use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct RadarGetAiBotsTimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetAiBotsTimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetAiBotsTimeseriesGroupAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
content_type:
Result<::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupContentTypeItem>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
crawl_purpose:
Result<::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupCrawlPurposeItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAiBotsTimeseriesGroupFormat, String>,
industry: Result<::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupIndustryItem>, String>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
normalization: Result<types::RadarGetAiBotsTimeseriesGroupNormalization, String>,
user_agent:
Result<::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupUserAgentItem>, String>,
vertical: Result<::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupVerticalItem>, String>,
}
impl<'a> RadarGetAiBotsTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
content_type: Err("content_type was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
crawl_purpose: Err("crawl_purpose was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
industry: Err("industry was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
normalization: Err("normalization was not initialized".to_string()),
user_agent: Err("user_agent was not initialized".to_string()),
vertical: Err("vertical was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiBotsTimeseriesGroupDimension>,
{
self.dimension = value.try_into().map_err(|_| {
"conversion to `RadarGetAiBotsTimeseriesGroupDimension` for dimension failed"
.to_string()
});
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiBotsTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetAiBotsTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn content_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupContentTypeItem>,
>,
{
self . content_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiBotsTimeseriesGroupContentTypeItem >` for content_type failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn crawl_purpose<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupCrawlPurposeItem>,
>,
{
self . crawl_purpose = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiBotsTimeseriesGroupCrawlPurposeItem >` for crawl_purpose failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiBotsTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiBotsTimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetAiBotsTimeseriesGroupFormat` for format failed".to_string()
});
self
}
pub fn industry<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupIndustryItem>,
>,
{
self . industry = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiBotsTimeseriesGroupIndustryItem >` for industry failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn normalization<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiBotsTimeseriesGroupNormalization>,
{
self . normalization = value . try_into () . map_err (| _ | "conversion to `RadarGetAiBotsTimeseriesGroupNormalization` for normalization failed" . to_string ()) ;
self
}
pub fn user_agent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupUserAgentItem>,
>,
{
self . user_agent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiBotsTimeseriesGroupUserAgentItem >` for user_agent failed" . to_string ()) ;
self
}
pub fn vertical<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupVerticalItem>,
>,
{
self . vertical = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiBotsTimeseriesGroupVerticalItem >` for vertical failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
asn,
content_type,
continent,
crawl_purpose,
date_end,
date_range,
date_start,
format,
industry,
limit_per_group,
location,
name,
normalization,
user_agent,
vertical,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let content_type = content_type.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let crawl_purpose = crawl_purpose.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let industry = industry.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let normalization = normalization.map_err(Error::InvalidRequest)?;
let user_agent = user_agent.map_err(Error::InvalidRequest)?;
let vertical = vertical.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/ai/bots/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new(
"contentType",
&content_type,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new(
"crawlPurpose",
&crawl_purpose,
))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("industry", &industry))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"normalization",
&normalization,
))
.query(&progenitor_client::QueryParam::new(
"userAgent",
&user_agent,
))
.query(&progenitor_client::QueryParam::new("vertical", &vertical))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_ai_bots_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAiBotsTimeseriesGroupByUserAgent<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetAiBotsTimeseriesGroupByUserAgentAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupByUserAgentDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAiBotsTimeseriesGroupByUserAgentFormat, String>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetAiBotsTimeseriesGroupByUserAgent<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiBotsTimeseriesGroupByUserAgentAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetAiBotsTimeseriesGroupByUserAgentAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiBotsTimeseriesGroupByUserAgentDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiBotsTimeseriesGroupByUserAgentDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiBotsTimeseriesGroupByUserAgentFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetAiBotsTimeseriesGroupByUserAgentFormat` for format failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
asn,
continent,
date_end,
date_range,
date_start,
format,
limit_per_group,
location,
name,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/ai/bots/timeseries_groups/user_agent",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_ai_bots_timeseries_group_by_user_agent",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAiInferenceTimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetAiInferenceTimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetAiInferenceTimeseriesGroupAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetAiInferenceTimeseriesGroupDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAiInferenceTimeseriesGroupFormat, String>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
normalization: Result<types::RadarGetAiInferenceTimeseriesGroupNormalization, String>,
}
impl<'a> RadarGetAiInferenceTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
normalization: Err("normalization was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupDimension>,
{
self . dimension = value . try_into () . map_err (| _ | "conversion to `RadarGetAiInferenceTimeseriesGroupDimension` for dimension failed" . to_string ()) ;
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetAiInferenceTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiInferenceTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiInferenceTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetAiInferenceTimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn normalization<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupNormalization>,
{
self . normalization = value . try_into () . map_err (| _ | "conversion to `RadarGetAiInferenceTimeseriesGroupNormalization` for normalization failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
asn,
continent,
date_end,
date_range,
date_start,
format,
limit_per_group,
location,
name,
normalization,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let normalization = normalization.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/ai/inference/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"normalization",
&normalization,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_ai_inference_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAiInferenceTimeseriesGroupByModel<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetAiInferenceTimeseriesGroupByModelAggInterval, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAiInferenceTimeseriesGroupByModelDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAiInferenceTimeseriesGroupByModelFormat, String>,
limit_per_group: Result<i64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetAiInferenceTimeseriesGroupByModel<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupByModelAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetAiInferenceTimeseriesGroupByModelAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiInferenceTimeseriesGroupByModelDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiInferenceTimeseriesGroupByModelDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupByModelFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetAiInferenceTimeseriesGroupByModelFormat` for format failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
date_end,
date_range,
date_start,
format,
limit_per_group,
name,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/ai/inference/timeseries_groups/model",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_ai_inference_timeseries_group_by_model",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAiInferenceTimeseriesGroupByTask<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetAiInferenceTimeseriesGroupByTaskAggInterval, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAiInferenceTimeseriesGroupByTaskDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAiInferenceTimeseriesGroupByTaskFormat, String>,
limit_per_group: Result<i64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetAiInferenceTimeseriesGroupByTask<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupByTaskAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetAiInferenceTimeseriesGroupByTaskAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAiInferenceTimeseriesGroupByTaskDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAiInferenceTimeseriesGroupByTaskDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAiInferenceTimeseriesGroupByTaskFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetAiInferenceTimeseriesGroupByTaskFormat` for format failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
date_end,
date_range,
date_start,
format,
limit_per_group,
name,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/ai/inference/timeseries_groups/task",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_ai_inference_timeseries_group_by_task",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetDnsAs112TimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetDnsAs112TimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetDnsAs112TimeseriesGroupAggInterval, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetDnsAs112TimeseriesGroupDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetDnsAs112TimeseriesGroupFormat, String>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
protocol:
Result<::std::vec::Vec<types::RadarGetDnsAs112TimeseriesGroupProtocolItem>, String>,
query_type: Result<
::std::vec::Vec<
::std::option::Option<types::RadarGetDnsAs112TimeseriesGroupQueryTypeItem>,
>,
String,
>,
response_code:
Result<::std::vec::Vec<types::RadarGetDnsAs112TimeseriesGroupResponseCodeItem>, String>,
}
impl<'a> RadarGetDnsAs112TimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
protocol: Err("protocol was not initialized".to_string()),
query_type: Err("query_type was not initialized".to_string()),
response_code: Err("response_code was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsAs112TimeseriesGroupDimension>,
{
self.dimension = value.try_into().map_err(|_| {
"conversion to `RadarGetDnsAs112TimeseriesGroupDimension` for dimension failed"
.to_string()
});
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsAs112TimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetDnsAs112TimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsAs112TimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsAs112TimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsAs112TimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetDnsAs112TimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsAs112TimeseriesGroupProtocolItem>,
>,
{
self . protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsAs112TimeseriesGroupProtocolItem >` for protocol failed" . to_string ()) ;
self
}
pub fn query_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<
::std::option::Option<types::RadarGetDnsAs112TimeseriesGroupQueryTypeItem>,
>,
>,
{
self . query_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: option :: Option < RadarGetDnsAs112TimeseriesGroupQueryTypeItem > >` for query_type failed" . to_string ()) ;
self
}
pub fn response_code<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsAs112TimeseriesGroupResponseCodeItem>,
>,
{
self . response_code = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsAs112TimeseriesGroupResponseCodeItem >` for response_code failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
continent,
date_end,
date_range,
date_start,
format,
limit_per_group,
location,
name,
protocol,
query_type,
response_code,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let protocol = protocol.map_err(Error::InvalidRequest)?;
let query_type = query_type.map_err(Error::InvalidRequest)?;
let response_code = response_code.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/as112/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("protocol", &protocol))
.query(&progenitor_client::QueryParam::new(
"queryType",
&query_type,
))
.query(&progenitor_client::QueryParam::new(
"responseCode",
&response_code,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_dns_as112_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetDnsAs112TopLocationsByDnssec<'a> {
client: &'a crate::Client,
dnssec: Result<types::RadarGetDnsAs112TopLocationsByDnssecDnssec, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetDnsAs112TopLocationsByDnssecDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetDnsAs112TopLocationsByDnssecFormat, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetDnsAs112TopLocationsByDnssec<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dnssec: Err("dnssec was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn dnssec<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsAs112TopLocationsByDnssecDnssec>,
{
self.dnssec = value.try_into().map_err(|_| {
"conversion to `RadarGetDnsAs112TopLocationsByDnssecDnssec` for dnssec failed"
.to_string()
});
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsAs112TopLocationsByDnssecDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsAs112TopLocationsByDnssecDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsAs112TopLocationsByDnssecFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetDnsAs112TopLocationsByDnssecFormat` for format failed"
.to_string()
});
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dnssec,
continent,
date_end,
date_range,
date_start,
format,
limit,
location,
name,
} = self;
let dnssec = dnssec.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/as112/top/locations/dnssec/{}",
client.baseurl,
encode_path(&dnssec.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_dns_as112_top_locations_by_dnssec",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetDnsAs112TopLocationsByIpVersion<'a> {
client: &'a crate::Client,
ip_version: Result<types::RadarGetDnsAs112TopLocationsByIpVersionIpVersion, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetDnsAs112TopLocationsByIpVersionDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetDnsAs112TopLocationsByIpVersionFormat, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetDnsAs112TopLocationsByIpVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
ip_version: Err("ip_version was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsAs112TopLocationsByIpVersionIpVersion>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `RadarGetDnsAs112TopLocationsByIpVersionIpVersion` for ip_version failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsAs112TopLocationsByIpVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsAs112TopLocationsByIpVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsAs112TopLocationsByIpVersionFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetDnsAs112TopLocationsByIpVersionFormat` for format failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
ip_version,
continent,
date_end,
date_range,
date_start,
format,
limit,
location,
name,
} = self;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/as112/top/locations/ip_version/{}",
client.baseurl,
encode_path(&ip_version.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_dns_as112_top_locations_by_ip_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAttacksLayer3TimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetAttacksLayer3TimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetAttacksLayer3TimeseriesGroupAggInterval, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TimeseriesGroupDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
direction: Result<types::RadarGetAttacksLayer3TimeseriesGroupDirection, String>,
format: Result<types::RadarGetAttacksLayer3TimeseriesGroupFormat, String>,
ip_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TimeseriesGroupIpVersionItem>,
String,
>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
normalization: Result<types::RadarGetAttacksLayer3TimeseriesGroupNormalization, String>,
protocol: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TimeseriesGroupProtocolItem>,
String,
>,
}
impl<'a> RadarGetAttacksLayer3TimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
direction: Err("direction was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
normalization: Err("normalization was not initialized".to_string()),
protocol: Err("protocol was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer3TimeseriesGroupDimension>,
{
self . dimension = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer3TimeseriesGroupDimension` for dimension failed" . to_string ()) ;
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer3TimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer3TimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn direction<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer3TimeseriesGroupDirection>,
{
self . direction = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer3TimeseriesGroupDirection` for direction failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer3TimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetAttacksLayer3TimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TimeseriesGroupIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TimeseriesGroupIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn normalization<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer3TimeseriesGroupNormalization>,
{
self . normalization = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer3TimeseriesGroupNormalization` for normalization failed" . to_string ()) ;
self
}
pub fn protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TimeseriesGroupProtocolItem>,
>,
{
self . protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TimeseriesGroupProtocolItem >` for protocol failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
continent,
date_end,
date_range,
date_start,
direction,
format,
ip_version,
limit_per_group,
location,
name,
normalization,
protocol,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let direction = direction.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let normalization = normalization.map_err(Error::InvalidRequest)?;
let protocol = protocol.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/attacks/layer3/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("direction", &direction))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"normalization",
&normalization,
))
.query(&progenitor_client::QueryParam::new("protocol", &protocol))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_attacks_layer3_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAttacksLayer3TopOriginLocations<'a> {
client: &'a crate::Client,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TopOriginLocationsDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAttacksLayer3TopOriginLocationsFormat, String>,
ip_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TopOriginLocationsIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
protocol: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TopOriginLocationsProtocolItem>,
String,
>,
}
impl<'a> RadarGetAttacksLayer3TopOriginLocations<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
protocol: Err("protocol was not initialized".to_string()),
}
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TopOriginLocationsDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TopOriginLocationsDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer3TopOriginLocationsFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer3TopOriginLocationsFormat` for format failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TopOriginLocationsIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TopOriginLocationsIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TopOriginLocationsProtocolItem>,
>,
{
self . protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TopOriginLocationsProtocolItem >` for protocol failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
continent,
date_end,
date_range,
date_start,
format,
ip_version,
limit,
location,
name,
protocol,
} = self;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let protocol = protocol.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/attacks/layer3/top/locations/origin",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("protocol", &protocol))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_attacks_layer3_top_origin_locations",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAttacksLayer3TopTargetLocations<'a> {
client: &'a crate::Client,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TopTargetLocationsDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAttacksLayer3TopTargetLocationsFormat, String>,
ip_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TopTargetLocationsIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
protocol: Result<
::std::vec::Vec<types::RadarGetAttacksLayer3TopTargetLocationsProtocolItem>,
String,
>,
}
impl<'a> RadarGetAttacksLayer3TopTargetLocations<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
protocol: Err("protocol was not initialized".to_string()),
}
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TopTargetLocationsDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TopTargetLocationsDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer3TopTargetLocationsFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer3TopTargetLocationsFormat` for format failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TopTargetLocationsIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TopTargetLocationsIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer3TopTargetLocationsProtocolItem>,
>,
{
self . protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer3TopTargetLocationsProtocolItem >` for protocol failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
continent,
date_end,
date_range,
date_start,
format,
ip_version,
limit,
location,
name,
protocol,
} = self;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let protocol = protocol.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/attacks/layer3/top/locations/target",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("protocol", &protocol))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_attacks_layer3_top_target_locations",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAttacksLayer7SummaryByHttpVersion<'a> {
client: &'a crate::Client,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7SummaryByHttpVersionDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAttacksLayer7SummaryByHttpVersionFormat, String>,
http_method: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7SummaryByHttpVersionHttpMethodItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7SummaryByHttpVersionIpVersionItem>,
String,
>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
mitigation_product: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7SummaryByHttpVersionMitigationProductItem>,
String,
>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetAttacksLayer7SummaryByHttpVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
http_method: Err("http_method was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
mitigation_product: Err("mitigation_product was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7SummaryByHttpVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7SummaryByHttpVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer7SummaryByHttpVersionFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer7SummaryByHttpVersionFormat` for format failed" . to_string ()) ;
self
}
pub fn http_method<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7SummaryByHttpVersionHttpMethodItem>,
>,
{
self . http_method = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7SummaryByHttpVersionHttpMethodItem >` for http_method failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7SummaryByHttpVersionIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7SummaryByHttpVersionIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn mitigation_product<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<
types::RadarGetAttacksLayer7SummaryByHttpVersionMitigationProductItem,
>,
>,
{
self . mitigation_product = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7SummaryByHttpVersionMitigationProductItem >` for mitigation_product failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
asn,
continent,
date_end,
date_range,
date_start,
format,
http_method,
ip_version,
location,
mitigation_product,
name,
} = self;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let http_method = http_method.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let mitigation_product = mitigation_product.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/attacks/layer7/summary/http_version",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"httpMethod",
&http_method,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new(
"mitigationProduct",
&mitigation_product,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_attacks_layer7_summary_by_http_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAttacksLayer7TimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetAttacksLayer7TimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetAttacksLayer7TimeseriesGroupAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAttacksLayer7TimeseriesGroupFormat, String>,
http_method: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupHttpMethodItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupIpVersionItem>,
String,
>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
mitigation_product: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupMitigationProductItem>,
String,
>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
normalization: Result<types::RadarGetAttacksLayer7TimeseriesGroupNormalization, String>,
}
impl<'a> RadarGetAttacksLayer7TimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
http_method: Err("http_method was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
mitigation_product: Err("mitigation_product was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
normalization: Err("normalization was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer7TimeseriesGroupDimension>,
{
self . dimension = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer7TimeseriesGroupDimension` for dimension failed" . to_string ()) ;
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer7TimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer7TimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer7TimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetAttacksLayer7TimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn http_method<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupHttpMethodItem>,
>,
{
self . http_method = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TimeseriesGroupHttpMethodItem >` for http_method failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TimeseriesGroupHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TimeseriesGroupIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn mitigation_product<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TimeseriesGroupMitigationProductItem>,
>,
{
self . mitigation_product = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TimeseriesGroupMitigationProductItem >` for mitigation_product failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn normalization<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer7TimeseriesGroupNormalization>,
{
self . normalization = value . try_into () . map_err (| _ | "conversion to `RadarGetAttacksLayer7TimeseriesGroupNormalization` for normalization failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
asn,
continent,
date_end,
date_range,
date_start,
format,
http_method,
http_version,
ip_version,
limit_per_group,
location,
mitigation_product,
name,
normalization,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let http_method = http_method.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let mitigation_product = mitigation_product.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let normalization = normalization.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/attacks/layer7/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"httpMethod",
&http_method,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new(
"mitigationProduct",
&mitigation_product,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"normalization",
&normalization,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_attacks_layer7_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAttacksLayer7TopOriginLocation<'a> {
client: &'a crate::Client,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAttacksLayer7TopOriginLocationFormat, String>,
http_method: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationHttpMethodItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
mitigation_product: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationMitigationProductItem>,
String,
>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetAttacksLayer7TopOriginLocation<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
http_method: Err("http_method was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
mitigation_product: Err("mitigation_product was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TopOriginLocationDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer7TopOriginLocationFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetAttacksLayer7TopOriginLocationFormat` for format failed"
.to_string()
});
self
}
pub fn http_method<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationHttpMethodItem>,
>,
{
self . http_method = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TopOriginLocationHttpMethodItem >` for http_method failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TopOriginLocationHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TopOriginLocationIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn mitigation_product<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TopOriginLocationMitigationProductItem>,
>,
{
self . mitigation_product = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TopOriginLocationMitigationProductItem >` for mitigation_product failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
asn,
continent,
date_end,
date_range,
date_start,
format,
http_method,
http_version,
ip_version,
limit,
mitigation_product,
name,
} = self;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let http_method = http_method.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let mitigation_product = mitigation_product.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/attacks/layer7/top/locations/origin",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"httpMethod",
&http_method,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new(
"mitigationProduct",
&mitigation_product,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_attacks_layer7_top_origin_location",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetAttacksLayer7TopTargetLocation<'a> {
client: &'a crate::Client,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TopTargetLocationDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetAttacksLayer7TopTargetLocationFormat, String>,
limit: Result<::std::num::NonZeroU64, String>,
mitigation_product: Result<
::std::vec::Vec<types::RadarGetAttacksLayer7TopTargetLocationMitigationProductItem>,
String,
>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetAttacksLayer7TopTargetLocation<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
mitigation_product: Err("mitigation_product was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TopTargetLocationDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TopTargetLocationDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetAttacksLayer7TopTargetLocationFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetAttacksLayer7TopTargetLocationFormat` for format failed"
.to_string()
});
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn mitigation_product<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetAttacksLayer7TopTargetLocationMitigationProductItem>,
>,
{
self . mitigation_product = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetAttacksLayer7TopTargetLocationMitigationProductItem >` for mitigation_product failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
continent,
date_end,
date_range,
date_start,
format,
limit,
mitigation_product,
name,
} = self;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let mitigation_product = mitigation_product.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/attacks/layer7/top/locations/target",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new(
"mitigationProduct",
&mitigation_product,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_attacks_layer7_top_target_location",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetCrawlersTimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetCrawlersTimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetCrawlersTimeseriesGroupAggInterval, String>,
bot_operator:
Result<::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupBotOperatorItem>, String>,
client_type:
Result<::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupClientTypeItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetCrawlersTimeseriesGroupFormat, String>,
industry:
Result<::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupIndustryItem>, String>,
limit_per_group: Result<i64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
vertical:
Result<::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupVerticalItem>, String>,
}
impl<'a> RadarGetCrawlersTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
bot_operator: Err("bot_operator was not initialized".to_string()),
client_type: Err("client_type was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
industry: Err("industry was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
vertical: Err("vertical was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetCrawlersTimeseriesGroupDimension>,
{
self.dimension = value.try_into().map_err(|_| {
"conversion to `RadarGetCrawlersTimeseriesGroupDimension` for dimension failed"
.to_string()
});
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetCrawlersTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetCrawlersTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn bot_operator<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupBotOperatorItem>,
>,
{
self . bot_operator = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetCrawlersTimeseriesGroupBotOperatorItem >` for bot_operator failed" . to_string ()) ;
self
}
pub fn client_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupClientTypeItem>,
>,
{
self . client_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetCrawlersTimeseriesGroupClientTypeItem >` for client_type failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetCrawlersTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetCrawlersTimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetCrawlersTimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn industry<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupIndustryItem>,
>,
{
self . industry = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetCrawlersTimeseriesGroupIndustryItem >` for industry failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn vertical<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetCrawlersTimeseriesGroupVerticalItem>,
>,
{
self . vertical = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetCrawlersTimeseriesGroupVerticalItem >` for vertical failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
bot_operator,
client_type,
date_end,
date_range,
date_start,
format,
industry,
limit_per_group,
name,
vertical,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let bot_operator = bot_operator.map_err(Error::InvalidRequest)?;
let client_type = client_type.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let industry = industry.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let vertical = vertical.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/bots/crawlers/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new(
"botOperator",
&bot_operator,
))
.query(&progenitor_client::QueryParam::new(
"clientType",
&client_type,
))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("industry", &industry))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("vertical", &vertical))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_crawlers_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetDnsTimeseriesGroupByResponseCode<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetDnsTimeseriesGroupByResponseCodeAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetDnsTimeseriesGroupByResponseCodeDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetDnsTimeseriesGroupByResponseCodeFormat, String>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
nodata: Result<::std::vec::Vec<bool>, String>,
protocol: Result<
::std::vec::Vec<types::RadarGetDnsTimeseriesGroupByResponseCodeProtocolItem>,
String,
>,
query_type: Result<
::std::vec::Vec<
::std::option::Option<types::RadarGetDnsTimeseriesGroupByResponseCodeQueryTypeItem>,
>,
String,
>,
tld:
Result<::std::vec::Vec<types::RadarGetDnsTimeseriesGroupByResponseCodeTldItem>, String>,
}
impl<'a> RadarGetDnsTimeseriesGroupByResponseCode<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
nodata: Err("nodata was not initialized".to_string()),
protocol: Err("protocol was not initialized".to_string()),
query_type: Err("query_type was not initialized".to_string()),
tld: Err("tld was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsTimeseriesGroupByResponseCodeAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetDnsTimeseriesGroupByResponseCodeAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsTimeseriesGroupByResponseCodeDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsTimeseriesGroupByResponseCodeDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetDnsTimeseriesGroupByResponseCodeFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetDnsTimeseriesGroupByResponseCodeFormat` for format failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn nodata<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<bool>>,
{
self.nodata = value.try_into().map_err(|_| {
"conversion to `:: std :: vec :: Vec < bool >` for nodata failed".to_string()
});
self
}
pub fn protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsTimeseriesGroupByResponseCodeProtocolItem>,
>,
{
self . protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsTimeseriesGroupByResponseCodeProtocolItem >` for protocol failed" . to_string ()) ;
self
}
pub fn query_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<
::std::option::Option<
types::RadarGetDnsTimeseriesGroupByResponseCodeQueryTypeItem,
>,
>,
>,
{
self . query_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: option :: Option < RadarGetDnsTimeseriesGroupByResponseCodeQueryTypeItem > >` for query_type failed" . to_string ()) ;
self
}
pub fn tld<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetDnsTimeseriesGroupByResponseCodeTldItem>,
>,
{
self . tld = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetDnsTimeseriesGroupByResponseCodeTldItem >` for tld failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
asn,
continent,
date_end,
date_range,
date_start,
format,
limit_per_group,
location,
name,
nodata,
protocol,
query_type,
tld,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let nodata = nodata.map_err(Error::InvalidRequest)?;
let protocol = protocol.map_err(Error::InvalidRequest)?;
let query_type = query_type.map_err(Error::InvalidRequest)?;
let tld = tld.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/dns/timeseries_groups/response_code",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("nodata", &nodata))
.query(&progenitor_client::QueryParam::new("protocol", &protocol))
.query(&progenitor_client::QueryParam::new(
"queryType",
&query_type,
))
.query(&progenitor_client::QueryParam::new("tld", &tld))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_dns_timeseries_group_by_response_code",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailRoutingTimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetEmailRoutingTimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetEmailRoutingTimeseriesGroupAggInterval, String>,
arc: Result<::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupArcItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupDkimItem>, String>,
dmarc: Result<::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupDmarcItem>, String>,
encrypted: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupEncryptedItem>,
String,
>,
format: Result<types::RadarGetEmailRoutingTimeseriesGroupFormat, String>,
ip_version: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupIpVersionItem>,
String,
>,
limit_per_group: Result<i64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf: Result<::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupSpfItem>, String>,
}
impl<'a> RadarGetEmailRoutingTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
encrypted: Err("encrypted was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupDimension>,
{
self . dimension = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupDimension` for dimension failed" . to_string ()) ;
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn encrypted<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupEncryptedItem>,
>,
{
self . encrypted = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupEncryptedItem >` for encrypted failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetEmailRoutingTimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupSpfItem >` for spf failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
arc,
date_end,
date_range,
date_start,
dkim,
dmarc,
encrypted,
format,
ip_version,
limit_per_group,
name,
spf,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let encrypted = encrypted.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/routing/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("encrypted", &encrypted))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_routing_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailRoutingTimeseriesGroupByArc<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetEmailRoutingTimeseriesGroupByArcAggInterval, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcDkimItem>,
String,
>,
dmarc: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcDmarcItem>,
String,
>,
encrypted: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcEncryptedItem>,
String,
>,
format: Result<types::RadarGetEmailRoutingTimeseriesGroupByArcFormat, String>,
ip_version: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcIpVersionItem>,
String,
>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf:
Result<::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcSpfItem>, String>,
}
impl<'a> RadarGetEmailRoutingTimeseriesGroupByArc<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
encrypted: Err("encrypted was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupByArcAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupByArcAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByArcDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByArcDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByArcDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn encrypted<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcEncryptedItem>,
>,
{
self . encrypted = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByArcEncryptedItem >` for encrypted failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupByArcFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupByArcFormat` for format failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByArcIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByArcSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByArcSpfItem >` for spf failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
date_end,
date_range,
date_start,
dkim,
dmarc,
encrypted,
format,
ip_version,
name,
spf,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let encrypted = encrypted.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/routing/timeseries_groups/arc",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("encrypted", &encrypted))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_routing_timeseries_group_by_arc",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailRoutingTimeseriesGroupByDkim<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetEmailRoutingTimeseriesGroupByDkimAggInterval, String>,
arc: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimArcItem>,
String,
>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dmarc: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimDmarcItem>,
String,
>,
encrypted: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimEncryptedItem>,
String,
>,
format: Result<types::RadarGetEmailRoutingTimeseriesGroupByDkimFormat, String>,
ip_version: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimIpVersionItem>,
String,
>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimSpfItem>,
String,
>,
}
impl<'a> RadarGetEmailRoutingTimeseriesGroupByDkim<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
encrypted: Err("encrypted was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupByDkimAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupByDkimAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByDkimArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByDkimDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByDkimDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn encrypted<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimEncryptedItem>,
>,
{
self . encrypted = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByDkimEncryptedItem >` for encrypted failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupByDkimFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupByDkimFormat` for format failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByDkimIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupByDkimSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupByDkimSpfItem >` for spf failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
arc,
date_end,
date_range,
date_start,
dmarc,
encrypted,
format,
ip_version,
name,
spf,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let encrypted = encrypted.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/routing/timeseries_groups/dkim",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("encrypted", &encrypted))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_routing_timeseries_group_by_dkim",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailRoutingTimeseriesGroupBySpf<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetEmailRoutingTimeseriesGroupBySpfAggInterval, String>,
arc:
Result<::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfArcItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfDkimItem>,
String,
>,
dmarc: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfDmarcItem>,
String,
>,
encrypted: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfEncryptedItem>,
String,
>,
format: Result<types::RadarGetEmailRoutingTimeseriesGroupBySpfFormat, String>,
ip_version: Result<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfIpVersionItem>,
String,
>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetEmailRoutingTimeseriesGroupBySpf<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
encrypted: Err("encrypted was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupBySpfAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupBySpfAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupBySpfArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupBySpfDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupBySpfDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupBySpfDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn encrypted<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfEncryptedItem>,
>,
{
self . encrypted = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupBySpfEncryptedItem >` for encrypted failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailRoutingTimeseriesGroupBySpfFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailRoutingTimeseriesGroupBySpfFormat` for format failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailRoutingTimeseriesGroupBySpfIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailRoutingTimeseriesGroupBySpfIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
arc,
date_end,
date_range,
date_start,
dkim,
dmarc,
encrypted,
format,
ip_version,
name,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let encrypted = encrypted.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/routing/timeseries_groups/spf",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("encrypted", &encrypted))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_routing_timeseries_group_by_spf",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailSecurityTimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetEmailSecurityTimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetEmailSecurityTimeseriesGroupAggInterval, String>,
arc: Result<::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupArcItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupDkimItem>, String>,
dmarc:
Result<::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupDmarcItem>, String>,
format: Result<types::RadarGetEmailSecurityTimeseriesGroupFormat, String>,
limit_per_group: Result<i64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf: Result<::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupSpfItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetEmailSecurityTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTimeseriesGroupDimension>,
{
self . dimension = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTimeseriesGroupDimension` for dimension failed" . to_string ()) ;
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetEmailSecurityTimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupSpfItem >` for spf failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
arc,
date_end,
date_range,
date_start,
dkim,
dmarc,
format,
limit_per_group,
name,
spf,
tls_version,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/security/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_security_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailSecurityTimeseriesGroupByArc<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetEmailSecurityTimeseriesGroupByArcAggInterval, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcDkimItem>,
String,
>,
dmarc: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcDmarcItem>,
String,
>,
format: Result<types::RadarGetEmailSecurityTimeseriesGroupByArcFormat, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcSpfItem>,
String,
>,
tls_version: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetEmailSecurityTimeseriesGroupByArc<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTimeseriesGroupByArcAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTimeseriesGroupByArcAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupByArcDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupByArcDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupByArcDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTimeseriesGroupByArcFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTimeseriesGroupByArcFormat` for format failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupByArcSpfItem >` for spf failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupByArcTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupByArcTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
date_end,
date_range,
date_start,
dkim,
dmarc,
format,
name,
spf,
tls_version,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/security/timeseries_groups/arc",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_security_timeseries_group_by_arc",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailSecurityTimeseriesGroupBySpf<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetEmailSecurityTimeseriesGroupBySpfAggInterval, String>,
arc: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfArcItem>,
String,
>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfDkimItem>,
String,
>,
dmarc: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfDmarcItem>,
String,
>,
format: Result<types::RadarGetEmailSecurityTimeseriesGroupBySpfFormat, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetEmailSecurityTimeseriesGroupBySpf<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTimeseriesGroupBySpfAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTimeseriesGroupBySpfAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupBySpfArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupBySpfDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupBySpfDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupBySpfDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTimeseriesGroupBySpfFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTimeseriesGroupBySpfFormat` for format failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTimeseriesGroupBySpfTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTimeseriesGroupBySpfTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
arc,
date_end,
date_range,
date_start,
dkim,
dmarc,
format,
name,
tls_version,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/security/timeseries_groups/spf",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_security_timeseries_group_by_spf",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailSecurityTopTldsByMalicious<'a> {
client: &'a crate::Client,
malicious: Result<types::RadarGetEmailSecurityTopTldsByMaliciousMalicious, String>,
arc: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousArcItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim:
Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousDkimItem>, String>,
dmarc: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousDmarcItem>,
String,
>,
format: Result<types::RadarGetEmailSecurityTopTldsByMaliciousFormat, String>,
limit: Result<::std::num::NonZeroU64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousSpfItem>, String>,
tld_category: Result<types::RadarGetEmailSecurityTopTldsByMaliciousTldCategory, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetEmailSecurityTopTldsByMalicious<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
malicious: Err("malicious was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
tld_category: Err("tld_category was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn malicious<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsByMaliciousMalicious>,
{
self . malicious = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTopTldsByMaliciousMalicious` for malicious failed" . to_string ()) ;
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsByMaliciousArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsByMaliciousDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsByMaliciousDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsByMaliciousDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsByMaliciousFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTopTldsByMaliciousFormat` for format failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsByMaliciousSpfItem >` for spf failed" . to_string ()) ;
self
}
pub fn tld_category<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsByMaliciousTldCategory>,
{
self . tld_category = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTopTldsByMaliciousTldCategory` for tld_category failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsByMaliciousTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsByMaliciousTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
malicious,
arc,
date_end,
date_range,
date_start,
dkim,
dmarc,
format,
limit,
name,
spf,
tld_category,
tls_version,
} = self;
let malicious = malicious.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let tld_category = tld_category.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/security/top/tlds/malicious/{}",
client.baseurl,
encode_path(&malicious.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.query(&progenitor_client::QueryParam::new(
"tldCategory",
&tld_category,
))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_security_top_tlds_by_malicious",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailSecurityTopTldsBySpam<'a> {
client: &'a crate::Client,
spam: Result<types::RadarGetEmailSecurityTopTldsBySpamSpam, String>,
arc: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamArcItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamDkimItem>, String>,
dmarc: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamDmarcItem>, String>,
format: Result<types::RadarGetEmailSecurityTopTldsBySpamFormat, String>,
limit: Result<::std::num::NonZeroU64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamSpfItem>, String>,
tld_category: Result<types::RadarGetEmailSecurityTopTldsBySpamTldCategory, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetEmailSecurityTopTldsBySpam<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
spam: Err("spam was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
tld_category: Err("tld_category was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn spam<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsBySpamSpam>,
{
self.spam = value.try_into().map_err(|_| {
"conversion to `RadarGetEmailSecurityTopTldsBySpamSpam` for spam failed".to_string()
});
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpamArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpamDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpamDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpamDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsBySpamFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetEmailSecurityTopTldsBySpamFormat` for format failed"
.to_string()
});
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpamSpfItem >` for spf failed" . to_string ()) ;
self
}
pub fn tld_category<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsBySpamTldCategory>,
{
self . tld_category = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTopTldsBySpamTldCategory` for tld_category failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpamTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpamTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
spam,
arc,
date_end,
date_range,
date_start,
dkim,
dmarc,
format,
limit,
name,
spf,
tld_category,
tls_version,
} = self;
let spam = spam.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let tld_category = tld_category.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/security/top/tlds/spam/{}",
client.baseurl,
encode_path(&spam.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.query(&progenitor_client::QueryParam::new(
"tldCategory",
&tld_category,
))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_security_top_tlds_by_spam",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetEmailSecurityTopTldsBySpoof<'a> {
client: &'a crate::Client,
spoof: Result<types::RadarGetEmailSecurityTopTldsBySpoofSpoof, String>,
arc: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofArcItem>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
dkim: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofDkimItem>, String>,
dmarc: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofDmarcItem>, String>,
format: Result<types::RadarGetEmailSecurityTopTldsBySpoofFormat, String>,
limit: Result<::std::num::NonZeroU64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
spf: Result<::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofSpfItem>, String>,
tld_category: Result<types::RadarGetEmailSecurityTopTldsBySpoofTldCategory, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetEmailSecurityTopTldsBySpoof<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
spoof: Err("spoof was not initialized".to_string()),
arc: Err("arc was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
dkim: Err("dkim was not initialized".to_string()),
dmarc: Err("dmarc was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
spf: Err("spf was not initialized".to_string()),
tld_category: Err("tld_category was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn spoof<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsBySpoofSpoof>,
{
self.spoof = value.try_into().map_err(|_| {
"conversion to `RadarGetEmailSecurityTopTldsBySpoofSpoof` for spoof failed"
.to_string()
});
self
}
pub fn arc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofArcItem>,
>,
{
self . arc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpoofArcItem >` for arc failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpoofDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn dkim<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofDkimItem>,
>,
{
self . dkim = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpoofDkimItem >` for dkim failed" . to_string ()) ;
self
}
pub fn dmarc<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofDmarcItem>,
>,
{
self . dmarc = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpoofDmarcItem >` for dmarc failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsBySpoofFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetEmailSecurityTopTldsBySpoofFormat` for format failed"
.to_string()
});
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn spf<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofSpfItem>,
>,
{
self . spf = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpoofSpfItem >` for spf failed" . to_string ()) ;
self
}
pub fn tld_category<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetEmailSecurityTopTldsBySpoofTldCategory>,
{
self . tld_category = value . try_into () . map_err (| _ | "conversion to `RadarGetEmailSecurityTopTldsBySpoofTldCategory` for tld_category failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetEmailSecurityTopTldsBySpoofTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetEmailSecurityTopTldsBySpoofTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
spoof,
arc,
date_end,
date_range,
date_start,
dkim,
dmarc,
format,
limit,
name,
spf,
tld_category,
tls_version,
} = self;
let spoof = spoof.map_err(Error::InvalidRequest)?;
let arc = arc.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let dkim = dkim.map_err(Error::InvalidRequest)?;
let dmarc = dmarc.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let spf = spf.map_err(Error::InvalidRequest)?;
let tld_category = tld_category.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/email/security/top/tlds/spoof/{}",
client.baseurl,
encode_path(&spoof.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("arc", &arc))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("dkim", &dkim))
.query(&progenitor_client::QueryParam::new("dmarc", &dmarc))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("spf", &spf))
.query(&progenitor_client::QueryParam::new(
"tldCategory",
&tld_category,
))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_email_security_top_tlds_by_spoof",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTimeseriesGroupByHttpProtocol<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetHttpTimeseriesGroupByHttpProtocolAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolBotClassItem>,
String,
>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTimeseriesGroupByHttpProtocolFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolIpVersionItem>,
String,
>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTimeseriesGroupByHttpProtocol<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTimeseriesGroupByHttpProtocolAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTimeseriesGroupByHttpProtocolAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTimeseriesGroupByHttpProtocolFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTimeseriesGroupByHttpProtocolFormat` for format failed" . to_string ()) ;
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpProtocolTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpProtocolTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_version,
ip_version,
location,
name,
os,
tls_version,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/timeseries_groups/http_protocol",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_timeseries_group_by_http_protocol",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTimeseriesGroupByHttpVersion<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetHttpTimeseriesGroupByHttpVersionAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionBotClassItem>,
String,
>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTimeseriesGroupByHttpVersionFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionHttpProtocolItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionIpVersionItem>,
String,
>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTimeseriesGroupByHttpVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTimeseriesGroupByHttpVersionAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTimeseriesGroupByHttpVersionAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTimeseriesGroupByHttpVersionFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTimeseriesGroupByHttpVersionFormat` for format failed" . to_string ()) ;
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByHttpVersionTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByHttpVersionTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
ip_version,
location,
name,
os,
tls_version,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/timeseries_groups/http_version",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_timeseries_group_by_http_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTimeseriesGroupByPostQuantum<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetHttpTimeseriesGroupByPostQuantumAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumBotClassItem>,
String,
>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTimeseriesGroupByPostQuantumFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumHttpProtocolItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumIpVersionItem>,
String,
>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTimeseriesGroupByPostQuantum<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTimeseriesGroupByPostQuantumAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTimeseriesGroupByPostQuantumAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTimeseriesGroupByPostQuantumFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTimeseriesGroupByPostQuantumFormat` for format failed" . to_string ()) ;
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTimeseriesGroupByPostQuantumTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTimeseriesGroupByPostQuantumTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
ip_version,
location,
name,
os,
tls_version,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/timeseries_groups/post_quantum",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_timeseries_group_by_post_quantum",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopAsesByBotClass<'a> {
client: &'a crate::Client,
bot_class: Result<types::RadarGetHttpTopAsesByBotClassBotClass, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
browser_family:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassBrowserFamilyItem>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassDeviceTypeItem>, String>,
format: Result<types::RadarGetHttpTopAsesByBotClassFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassHttpProtocolItem>, String>,
http_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassHttpVersionItem>, String>,
ip_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassIpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassOsItem>, String>,
tls_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassTlsVersionItem>, String>,
}
impl<'a> RadarGetHttpTopAsesByBotClass<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
bot_class: Err("bot_class was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByBotClassBotClass>,
{
self.bot_class = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByBotClassBotClass` for bot_class failed"
.to_string()
});
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByBotClassFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByBotClassFormat` for format failed".to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassOsItem>>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBotClassTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBotClassTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
bot_class,
asn,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/ases/bot_class/{}",
client.baseurl,
encode_path(&bot_class.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_ases_by_bot_class",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopAsesByBrowserFamily<'a> {
client: &'a crate::Client,
browser_family: Result<types::RadarGetHttpTopAsesByBrowserFamilyBrowserFamily, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyBotClassItem>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTopAsesByBrowserFamilyFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyHttpProtocolItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyHttpVersionItem>,
String,
>,
ip_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyIpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTopAsesByBrowserFamily<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
browser_family: Err("browser_family was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByBrowserFamilyBrowserFamily>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopAsesByBrowserFamilyBrowserFamily` for browser_family failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByBrowserFamilyFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByBrowserFamilyFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByBrowserFamilyTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByBrowserFamilyTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
browser_family,
asn,
bot_class,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/ases/browser_family/{}",
client.baseurl,
encode_path(&browser_family.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_ases_by_browser_family",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopAsesByDeviceType<'a> {
client: &'a crate::Client,
device_type: Result<types::RadarGetHttpTopAsesByDeviceTypeDeviceType, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeBotClassItem>, String>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetHttpTopAsesByDeviceTypeFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeHttpProtocolItem>, String>,
http_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeHttpVersionItem>, String>,
ip_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeIpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeOsItem>, String>,
tls_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeTlsVersionItem>, String>,
}
impl<'a> RadarGetHttpTopAsesByDeviceType<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
device_type: Err("device_type was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByDeviceTypeDeviceType>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopAsesByDeviceTypeDeviceType` for device_type failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByDeviceTypeFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByDeviceTypeFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeOsItem>>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByDeviceTypeTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByDeviceTypeTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
device_type,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/ases/device_type/{}",
client.baseurl,
encode_path(&device_type.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_ases_by_device_type",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopAsesByHttpProtocol<'a> {
client: &'a crate::Client,
http_protocol: Result<types::RadarGetHttpTopAsesByHttpProtocolHttpProtocol, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolBotClassItem>, String>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolDeviceTypeItem>, String>,
format: Result<types::RadarGetHttpTopAsesByHttpProtocolFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolHttpVersionItem>,
String,
>,
ip_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolIpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolOsItem>, String>,
tls_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolTlsVersionItem>, String>,
}
impl<'a> RadarGetHttpTopAsesByHttpProtocol<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
http_protocol: Err("http_protocol was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByHttpProtocolHttpProtocol>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopAsesByHttpProtocolHttpProtocol` for http_protocol failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByHttpProtocolFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByHttpProtocolFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpProtocolTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpProtocolTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
http_protocol,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/ases/http_protocol/{}",
client.baseurl,
encode_path(&http_protocol.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_ases_by_http_protocol",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopAsesByHttpVersion<'a> {
client: &'a crate::Client,
http_version: Result<types::RadarGetHttpTopAsesByHttpVersionHttpVersion, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionBotClassItem>, String>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionDeviceTypeItem>, String>,
format: Result<types::RadarGetHttpTopAsesByHttpVersionFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionHttpProtocolItem>,
String,
>,
ip_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionIpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionOsItem>, String>,
tls_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionTlsVersionItem>, String>,
}
impl<'a> RadarGetHttpTopAsesByHttpVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
http_version: Err("http_version was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByHttpVersionHttpVersion>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopAsesByHttpVersionHttpVersion` for http_version failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByHttpVersionFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByHttpVersionFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByHttpVersionTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByHttpVersionTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
http_version,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/ases/http_version/{}",
client.baseurl,
encode_path(&http_version.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_ases_by_http_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopAsesByIpVersion<'a> {
client: &'a crate::Client,
ip_version: Result<types::RadarGetHttpTopAsesByIpVersionIpVersion, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionBotClassItem>, String>,
browser_family:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionBrowserFamilyItem>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionDeviceTypeItem>, String>,
format: Result<types::RadarGetHttpTopAsesByIpVersionFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionHttpProtocolItem>, String>,
http_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionHttpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionOsItem>, String>,
tls_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionTlsVersionItem>, String>,
}
impl<'a> RadarGetHttpTopAsesByIpVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
ip_version: Err("ip_version was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByIpVersionIpVersion>,
{
self.ip_version = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByIpVersionIpVersion` for ip_version failed"
.to_string()
});
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByIpVersionFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByIpVersionFormat` for format failed".to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionOsItem>>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByIpVersionTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByIpVersionTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
ip_version,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
limit,
location,
name,
os,
tls_version,
} = self;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/ases/ip_version/{}",
client.baseurl,
encode_path(&ip_version.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_ases_by_ip_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopAsesByTlsVersion<'a> {
client: &'a crate::Client,
tls_version: Result<types::RadarGetHttpTopAsesByTlsVersionTlsVersion, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionBotClassItem>, String>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionDeviceTypeItem>, String>,
format: Result<types::RadarGetHttpTopAsesByTlsVersionFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionHttpProtocolItem>, String>,
http_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionHttpVersionItem>, String>,
ip_version:
Result<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionIpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionOsItem>, String>,
}
impl<'a> RadarGetHttpTopAsesByTlsVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
tls_version: Err("tls_version was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
}
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByTlsVersionTlsVersion>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopAsesByTlsVersionTlsVersion` for tls_version failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopAsesByTlsVersionFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopAsesByTlsVersionFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::RadarGetHttpTopAsesByTlsVersionOsItem>>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopAsesByTlsVersionOsItem >` for os failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
tls_version,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
} = self;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/ases/tls_version/{}",
client.baseurl,
encode_path(&tls_version.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_ases_by_tls_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopLocationsByBotClass<'a> {
client: &'a crate::Client,
bot_class: Result<types::RadarGetHttpTopLocationsByBotClassBotClass, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTopLocationsByBotClassFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassHttpProtocolItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassHttpVersionItem>,
String,
>,
ip_version:
Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassIpVersionItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTopLocationsByBotClass<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
bot_class: Err("bot_class was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByBotClassBotClass>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByBotClassBotClass` for bot_class failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByBotClassFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopLocationsByBotClassFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBotClassTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBotClassTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
bot_class,
asn,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/locations/bot_class/{}",
client.baseurl,
encode_path(&bot_class.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_locations_by_bot_class",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopLocationsByBrowserFamily<'a> {
client: &'a crate::Client,
browser_family: Result<types::RadarGetHttpTopLocationsByBrowserFamilyBrowserFamily, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyBotClassItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTopLocationsByBrowserFamilyFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyHttpProtocolItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTopLocationsByBrowserFamily<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
browser_family: Err("browser_family was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByBrowserFamilyBrowserFamily>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByBrowserFamilyBrowserFamily` for browser_family failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByBrowserFamilyFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByBrowserFamilyFormat` for format failed" . to_string ()) ;
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByBrowserFamilyTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByBrowserFamilyTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
browser_family,
asn,
bot_class,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/locations/browser_family/{}",
client.baseurl,
encode_path(&browser_family.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_locations_by_browser_family",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopLocationsByDeviceType<'a> {
client: &'a crate::Client,
device_type: Result<types::RadarGetHttpTopLocationsByDeviceTypeDeviceType, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeBotClassItem>,
String,
>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetHttpTopLocationsByDeviceTypeFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeHttpProtocolItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTopLocationsByDeviceType<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
device_type: Err("device_type was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByDeviceTypeDeviceType>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByDeviceTypeDeviceType` for device_type failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByDeviceTypeFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopLocationsByDeviceTypeFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByDeviceTypeTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByDeviceTypeTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
device_type,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/locations/device_type/{}",
client.baseurl,
encode_path(&device_type.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_locations_by_device_type",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopLocationsByHttpProtocol<'a> {
client: &'a crate::Client,
http_protocol: Result<types::RadarGetHttpTopLocationsByHttpProtocolHttpProtocol, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolBotClassItem>,
String,
>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTopLocationsByHttpProtocolFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTopLocationsByHttpProtocol<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
http_protocol: Err("http_protocol was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByHttpProtocolHttpProtocol>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByHttpProtocolHttpProtocol` for http_protocol failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByHttpProtocolFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopLocationsByHttpProtocolFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpProtocolTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpProtocolTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
http_protocol,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_version,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/locations/http_protocol/{}",
client.baseurl,
encode_path(&http_protocol.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_locations_by_http_protocol",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopLocationsByHttpVersion<'a> {
client: &'a crate::Client,
http_version: Result<types::RadarGetHttpTopLocationsByHttpVersionHttpVersion, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionBotClassItem>,
String,
>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTopLocationsByHttpVersionFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionHttpProtocolItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTopLocationsByHttpVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
http_version: Err("http_version was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByHttpVersionHttpVersion>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByHttpVersionHttpVersion` for http_version failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByHttpVersionFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopLocationsByHttpVersionFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByHttpVersionTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByHttpVersionTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
http_version,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
ip_version,
limit,
location,
name,
os,
tls_version,
} = self;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/locations/http_version/{}",
client.baseurl,
encode_path(&http_version.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_locations_by_http_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopLocationsByIpVersion<'a> {
client: &'a crate::Client,
ip_version: Result<types::RadarGetHttpTopLocationsByIpVersionIpVersion, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class:
Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionBotClassItem>, String>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTopLocationsByIpVersionFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionHttpProtocolItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionHttpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionOsItem>, String>,
tls_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionTlsVersionItem>,
String,
>,
}
impl<'a> RadarGetHttpTopLocationsByIpVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
ip_version: Err("ip_version was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
tls_version: Err("tls_version was not initialized".to_string()),
}
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByIpVersionIpVersion>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByIpVersionIpVersion` for ip_version failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByIpVersionFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopLocationsByIpVersionFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionOsItem >` for os failed" . to_string ()) ;
self
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByIpVersionTlsVersionItem>,
>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByIpVersionTlsVersionItem >` for tls_version failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
ip_version,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
limit,
location,
name,
os,
tls_version,
} = self;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/locations/ip_version/{}",
client.baseurl,
encode_path(&ip_version.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.query(&progenitor_client::QueryParam::new(
"tlsVersion",
&tls_version,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_locations_by_ip_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetHttpTopLocationsByTlsVersion<'a> {
client: &'a crate::Client,
tls_version: Result<types::RadarGetHttpTopLocationsByTlsVersionTlsVersion, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionBotClassItem>,
String,
>,
browser_family: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionBrowserFamilyItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
device_type: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionDeviceTypeItem>,
String,
>,
format: Result<types::RadarGetHttpTopLocationsByTlsVersionFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
http_protocol: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionHttpProtocolItem>,
String,
>,
http_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionHttpVersionItem>,
String,
>,
ip_version: Result<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionIpVersionItem>,
String,
>,
limit: Result<::std::num::NonZeroU64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
os: Result<::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionOsItem>, String>,
}
impl<'a> RadarGetHttpTopLocationsByTlsVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
tls_version: Err("tls_version was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
browser_family: Err("browser_family was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
device_type: Err("device_type was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
http_protocol: Err("http_protocol was not initialized".to_string()),
http_version: Err("http_version was not initialized".to_string()),
ip_version: Err("ip_version was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
os: Err("os was not initialized".to_string()),
}
}
pub fn tls_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByTlsVersionTlsVersion>,
{
self . tls_version = value . try_into () . map_err (| _ | "conversion to `RadarGetHttpTopLocationsByTlsVersionTlsVersion` for tls_version failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn browser_family<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionBrowserFamilyItem>,
>,
{
self . browser_family = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionBrowserFamilyItem >` for browser_family failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn device_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionDeviceTypeItem>,
>,
{
self . device_type = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionDeviceTypeItem >` for device_type failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetHttpTopLocationsByTlsVersionFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetHttpTopLocationsByTlsVersionFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn http_protocol<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionHttpProtocolItem>,
>,
{
self . http_protocol = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionHttpProtocolItem >` for http_protocol failed" . to_string ()) ;
self
}
pub fn http_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionHttpVersionItem>,
>,
{
self . http_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionHttpVersionItem >` for http_version failed" . to_string ()) ;
self
}
pub fn ip_version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionIpVersionItem>,
>,
{
self . ip_version = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionIpVersionItem >` for ip_version failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn os<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetHttpTopLocationsByTlsVersionOsItem>,
>,
{
self . os = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetHttpTopLocationsByTlsVersionOsItem >` for os failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
tls_version,
asn,
bot_class,
browser_family,
continent,
date_end,
date_range,
date_start,
device_type,
format,
geo_id,
http_protocol,
http_version,
ip_version,
limit,
location,
name,
os,
} = self;
let tls_version = tls_version.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let browser_family = browser_family.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let device_type = device_type.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let http_protocol = http_protocol.map_err(Error::InvalidRequest)?;
let http_version = http_version.map_err(Error::InvalidRequest)?;
let ip_version = ip_version.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let os = os.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/http/top/locations/tls_version/{}",
client.baseurl,
encode_path(&tls_version.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"browserFamily",
&browser_family,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new(
"deviceType",
&device_type,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"httpProtocol",
&http_protocol,
))
.query(&progenitor_client::QueryParam::new(
"httpVersion",
&http_version,
))
.query(&progenitor_client::QueryParam::new(
"ipVersion",
&ip_version,
))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("os", &os))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_http_top_locations_by_tls_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetLeakedCredentialChecksSummary<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetLeakedCredentialChecksSummaryDimension, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
bot_class: Result<
::std::vec::Vec<types::RadarGetLeakedCredentialChecksSummaryBotClassItem>,
String,
>,
compromised: Result<
::std::vec::Vec<types::RadarGetLeakedCredentialChecksSummaryCompromisedItem>,
String,
>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetLeakedCredentialChecksSummaryDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetLeakedCredentialChecksSummaryFormat, String>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetLeakedCredentialChecksSummary<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
bot_class: Err("bot_class was not initialized".to_string()),
compromised: Err("compromised was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetLeakedCredentialChecksSummaryDimension>,
{
self . dimension = value . try_into () . map_err (| _ | "conversion to `RadarGetLeakedCredentialChecksSummaryDimension` for dimension failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn bot_class<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetLeakedCredentialChecksSummaryBotClassItem>,
>,
{
self . bot_class = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetLeakedCredentialChecksSummaryBotClassItem >` for bot_class failed" . to_string ()) ;
self
}
pub fn compromised<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetLeakedCredentialChecksSummaryCompromisedItem>,
>,
{
self . compromised = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetLeakedCredentialChecksSummaryCompromisedItem >` for compromised failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetLeakedCredentialChecksSummaryDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetLeakedCredentialChecksSummaryDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetLeakedCredentialChecksSummaryFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetLeakedCredentialChecksSummaryFormat` for format failed"
.to_string()
});
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
asn,
bot_class,
compromised,
continent,
date_end,
date_range,
date_start,
format,
limit_per_group,
location,
name,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let bot_class = bot_class.map_err(Error::InvalidRequest)?;
let compromised = compromised.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/leaked_credential_checks/summary/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("botClass", &bot_class))
.query(&progenitor_client::QueryParam::new(
"compromised",
&compromised,
))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_leaked_credential_checks_summary",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetNetflowsTimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetNetflowsTimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetNetflowsTimeseriesGroupAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetNetflowsTimeseriesGroupDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetNetflowsTimeseriesGroupFormat, String>,
geo_id: Result<::std::vec::Vec<::std::string::String>, String>,
limit_per_group: Result<i64, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
normalization: Result<types::RadarGetNetflowsTimeseriesGroupNormalization, String>,
product: Result<::std::vec::Vec<types::RadarGetNetflowsTimeseriesGroupProductItem>, String>,
}
impl<'a> RadarGetNetflowsTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
geo_id: Err("geo_id was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
normalization: Err("normalization was not initialized".to_string()),
product: Err("product was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetNetflowsTimeseriesGroupDimension>,
{
self.dimension = value.try_into().map_err(|_| {
"conversion to `RadarGetNetflowsTimeseriesGroupDimension` for dimension failed"
.to_string()
});
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetNetflowsTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetNetflowsTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetNetflowsTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetNetflowsTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetNetflowsTimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetNetflowsTimeseriesGroupFormat` for format failed"
.to_string()
});
self
}
pub fn geo_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . geo_id = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for geo_id failed" . to_string ()) ;
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn normalization<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetNetflowsTimeseriesGroupNormalization>,
{
self . normalization = value . try_into () . map_err (| _ | "conversion to `RadarGetNetflowsTimeseriesGroupNormalization` for normalization failed" . to_string ()) ;
self
}
pub fn product<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetNetflowsTimeseriesGroupProductItem>,
>,
{
self . product = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetNetflowsTimeseriesGroupProductItem >` for product failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
asn,
continent,
date_end,
date_range,
date_start,
format,
geo_id,
limit_per_group,
location,
name,
normalization,
product,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let geo_id = geo_id.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let normalization = normalization.map_err(Error::InvalidRequest)?;
let product = product.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/netflows/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("geoId", &geo_id))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"normalization",
&normalization,
))
.query(&progenitor_client::QueryParam::new("product", &product))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_netflows_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetOriginsTimeseriesGroup<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetOriginsTimeseriesGroupDimension, String>,
agg_interval: Result<types::RadarGetOriginsTimeseriesGroupAggInterval, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetOriginsTimeseriesGroupDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetOriginsTimeseriesGroupFormat, String>,
limit_per_group: Result<i64, String>,
metric: Result<types::RadarGetOriginsTimeseriesGroupMetric, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
normalization: Result<types::RadarGetOriginsTimeseriesGroupNormalization, String>,
origin: Result<::std::vec::Vec<types::RadarGetOriginsTimeseriesGroupOriginItem>, String>,
region: Result<::std::vec::Vec<types::RadarGetOriginsTimeseriesGroupRegionItem>, String>,
}
impl<'a> RadarGetOriginsTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
agg_interval: Err("agg_interval was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit_per_group: Err("limit_per_group was not initialized".to_string()),
metric: Err("metric was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
normalization: Err("normalization was not initialized".to_string()),
origin: Err("origin was not initialized".to_string()),
region: Err("region was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginsTimeseriesGroupDimension>,
{
self.dimension = value.try_into().map_err(|_| {
"conversion to `RadarGetOriginsTimeseriesGroupDimension` for dimension failed"
.to_string()
});
self
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginsTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetOriginsTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetOriginsTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetOriginsTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginsTimeseriesGroupFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetOriginsTimeseriesGroupFormat` for format failed".to_string()
});
self
}
pub fn limit_per_group<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit_per_group = value
.try_into()
.map_err(|_| "conversion to `i64` for limit_per_group failed".to_string());
self
}
pub fn metric<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginsTimeseriesGroupMetric>,
{
self.metric = value.try_into().map_err(|_| {
"conversion to `RadarGetOriginsTimeseriesGroupMetric` for metric failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn normalization<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginsTimeseriesGroupNormalization>,
{
self . normalization = value . try_into () . map_err (| _ | "conversion to `RadarGetOriginsTimeseriesGroupNormalization` for normalization failed" . to_string ()) ;
self
}
pub fn origin<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetOriginsTimeseriesGroupOriginItem>,
>,
{
self . origin = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetOriginsTimeseriesGroupOriginItem >` for origin failed" . to_string ()) ;
self
}
pub fn region<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetOriginsTimeseriesGroupRegionItem>,
>,
{
self . region = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetOriginsTimeseriesGroupRegionItem >` for region failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
agg_interval,
date_end,
date_range,
date_start,
format,
limit_per_group,
metric,
name,
normalization,
origin,
region,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit_per_group = limit_per_group.map_err(Error::InvalidRequest)?;
let metric = metric.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let normalization = normalization.map_err(Error::InvalidRequest)?;
let origin = origin.map_err(Error::InvalidRequest)?;
let region = region.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/origins/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new(
"limitPerGroup",
&limit_per_group,
))
.query(&progenitor_client::QueryParam::new("metric", &metric))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"normalization",
&normalization,
))
.query(&progenitor_client::QueryParam::new("origin", &origin))
.query(&progenitor_client::QueryParam::new("region", ®ion))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_origins_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetOriginPostQuantumSummary<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetOriginPostQuantumSummaryDimension, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range:
Result<::std::vec::Vec<types::RadarGetOriginPostQuantumSummaryDateRangeItem>, String>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetOriginPostQuantumSummaryFormat, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetOriginPostQuantumSummary<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginPostQuantumSummaryDimension>,
{
self.dimension = value.try_into().map_err(|_| {
"conversion to `RadarGetOriginPostQuantumSummaryDimension` for dimension failed"
.to_string()
});
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetOriginPostQuantumSummaryDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetOriginPostQuantumSummaryDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginPostQuantumSummaryFormat>,
{
self.format = value.try_into().map_err(|_| {
"conversion to `RadarGetOriginPostQuantumSummaryFormat` for format failed"
.to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
date_end,
date_range,
date_start,
format,
name,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/post_quantum/origin/summary/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_origin_post_quantum_summary",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetOriginPostQuantumTimeseriesGroups<'a> {
client: &'a crate::Client,
dimension: Result<types::RadarGetOriginPostQuantumTimeseriesGroupsDimension, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetOriginPostQuantumTimeseriesGroupsDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetOriginPostQuantumTimeseriesGroupsFormat, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetOriginPostQuantumTimeseriesGroups<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
dimension: Err("dimension was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn dimension<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginPostQuantumTimeseriesGroupsDimension>,
{
self . dimension = value . try_into () . map_err (| _ | "conversion to `RadarGetOriginPostQuantumTimeseriesGroupsDimension` for dimension failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetOriginPostQuantumTimeseriesGroupsDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetOriginPostQuantumTimeseriesGroupsDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetOriginPostQuantumTimeseriesGroupsFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetOriginPostQuantumTimeseriesGroupsFormat` for format failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
dimension,
date_end,
date_range,
date_start,
format,
name,
} = self;
let dimension = dimension.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/post_quantum/origin/timeseries_groups/{}",
client.baseurl,
encode_path(&dimension.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_origin_post_quantum_timeseries_groups",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetRankingInternetServicesCategories<'a> {
client: &'a crate::Client,
date: Result<::std::vec::Vec<::chrono::naive::NaiveDate>, String>,
format: Result<types::RadarGetRankingInternetServicesCategoriesFormat, String>,
limit: Result<i64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetRankingInternetServicesCategories<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
date: Err("date was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn date<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::naive::NaiveDate>>,
{
self . date = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: naive :: NaiveDate >` for date failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetRankingInternetServicesCategoriesFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetRankingInternetServicesCategoriesFormat` for format failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.limit = value
.try_into()
.map_err(|_| "conversion to `i64` for limit failed".to_string());
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
date,
format,
limit,
name,
} = self;
let date = date.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/ranking/internet_services/categories",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("date", &date))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_ranking_internet_services_categories",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetRankingInternetServicesTimeseries<'a> {
client: &'a crate::Client,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetRankingInternetServicesTimeseriesDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetRankingInternetServicesTimeseriesFormat, String>,
limit: Result<::std::num::NonZeroU64, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
service_category: Result<
::std::vec::Vec<types::RadarGetRankingInternetServicesTimeseriesServiceCategoryItem>,
String,
>,
}
impl<'a> RadarGetRankingInternetServicesTimeseries<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
service_category: Err("service_category was not initialized".to_string()),
}
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetRankingInternetServicesTimeseriesDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetRankingInternetServicesTimeseriesDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetRankingInternetServicesTimeseriesFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetRankingInternetServicesTimeseriesFormat` for format failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub fn service_category<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<
types::RadarGetRankingInternetServicesTimeseriesServiceCategoryItem,
>,
>,
{
self . service_category = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetRankingInternetServicesTimeseriesServiceCategoryItem >` for service_category failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
date_end,
date_range,
date_start,
format,
limit,
name,
service_category,
} = self;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let service_category = service_category.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/ranking/internet_services/timeseries_groups",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new(
"serviceCategory",
&service_category,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_ranking_internet_services_timeseries",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct RadarGetTcpResetsTimeoutsTimeseriesGroup<'a> {
client: &'a crate::Client,
agg_interval: Result<types::RadarGetTcpResetsTimeoutsTimeseriesGroupAggInterval, String>,
asn: Result<::std::vec::Vec<::std::string::String>, String>,
continent: Result<::std::vec::Vec<::std::string::String>, String>,
date_end: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
date_range: Result<
::std::vec::Vec<types::RadarGetTcpResetsTimeoutsTimeseriesGroupDateRangeItem>,
String,
>,
date_start: Result<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>, String>,
format: Result<types::RadarGetTcpResetsTimeoutsTimeseriesGroupFormat, String>,
location: Result<::std::vec::Vec<::std::string::String>, String>,
name: Result<::std::vec::Vec<::std::string::String>, String>,
}
impl<'a> RadarGetTcpResetsTimeoutsTimeseriesGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
agg_interval: Err("agg_interval was not initialized".to_string()),
asn: Err("asn was not initialized".to_string()),
continent: Err("continent was not initialized".to_string()),
date_end: Err("date_end was not initialized".to_string()),
date_range: Err("date_range was not initialized".to_string()),
date_start: Err("date_start was not initialized".to_string()),
format: Err("format was not initialized".to_string()),
location: Err("location was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn agg_interval<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetTcpResetsTimeoutsTimeseriesGroupAggInterval>,
{
self . agg_interval = value . try_into () . map_err (| _ | "conversion to `RadarGetTcpResetsTimeoutsTimeseriesGroupAggInterval` for agg_interval failed" . to_string ()) ;
self
}
pub fn asn<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . asn = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for asn failed" . to_string ()) ;
self
}
pub fn continent<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . continent = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for continent failed" . to_string ()) ;
self
}
pub fn date_end<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_end = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_end failed" . to_string ()) ;
self
}
pub fn date_range<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<
::std::vec::Vec<types::RadarGetTcpResetsTimeoutsTimeseriesGroupDateRangeItem>,
>,
{
self . date_range = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < RadarGetTcpResetsTimeoutsTimeseriesGroupDateRangeItem >` for date_range failed" . to_string ()) ;
self
}
pub fn date_start<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::chrono::DateTime<::chrono::offset::Utc>>>,
{
self . date_start = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: chrono :: DateTime < :: chrono :: offset :: Utc > >` for date_start failed" . to_string ()) ;
self
}
pub fn format<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RadarGetTcpResetsTimeoutsTimeseriesGroupFormat>,
{
self . format = value . try_into () . map_err (| _ | "conversion to `RadarGetTcpResetsTimeoutsTimeseriesGroupFormat` for format failed" . to_string ()) ;
self
}
pub fn location<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . location = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for location failed" . to_string ()) ;
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
{
self . name = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for name failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
agg_interval,
asn,
continent,
date_end,
date_range,
date_start,
format,
location,
name,
} = self;
let agg_interval = agg_interval.map_err(Error::InvalidRequest)?;
let asn = asn.map_err(Error::InvalidRequest)?;
let continent = continent.map_err(Error::InvalidRequest)?;
let date_end = date_end.map_err(Error::InvalidRequest)?;
let date_range = date_range.map_err(Error::InvalidRequest)?;
let date_start = date_start.map_err(Error::InvalidRequest)?;
let format = format.map_err(Error::InvalidRequest)?;
let location = location.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/radar/tcp_resets_timeouts/timeseries_groups",
client.baseurl,
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new(
"aggInterval",
&agg_interval,
))
.query(&progenitor_client::QueryParam::new("asn", &asn))
.query(&progenitor_client::QueryParam::new("continent", &continent))
.query(&progenitor_client::QueryParam::new("dateEnd", &date_end))
.query(&progenitor_client::QueryParam::new(
"dateRange",
&date_range,
))
.query(&progenitor_client::QueryParam::new(
"dateStart",
&date_start,
))
.query(&progenitor_client::QueryParam::new("format", &format))
.query(&progenitor_client::QueryParam::new("location", &location))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "radar_get_tcp_resets_timeouts_timeseries_group",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}