use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_rum_insights::RUMInsightsAPI;
use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequest;
use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequestAttributes;
use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequestData;
use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequestType;
use datadog_api_client::datadogV2::model::AggregatedWaterfallPerformanceCriteria;
use datadog_api_client::datadogV2::model::AggregatedWaterfallPerformanceCriteriaMetric;
#[tokio::main]
async fn main() {
let body = AggregatedSignalsProblemsRequest::new(AggregatedSignalsProblemsRequestData::new(
AggregatedSignalsProblemsRequestAttributes::new(
"ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b".to_string(),
1762437564,
30,
1762523964,
"/account/login(/:type)".to_string(),
)
.criteria(
AggregatedWaterfallPerformanceCriteria::new(
AggregatedWaterfallPerformanceCriteriaMetric::LARGEST_CONTENTFUL_PAINT,
)
.max(5.0 as f64)
.min(2.5 as f64),
)
.detection_types(vec![
"high_script_evaluations".to_string(),
"uncompressed_resources".to_string(),
])
.filter("@session.type:user".to_string()),
AggregatedSignalsProblemsRequestType::AGGREGATED_SIGNALS_PROBLEMS,
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.QueryAggregatedSignalsProblems", true);
let api = RUMInsightsAPI::with_config(configuration);
let resp = api.query_aggregated_signals_problems(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}