use crate::Result;
use crate::UptrakitClient;
use crate::types_impl::autodiscovery::{
CreateSoftwareIgnoreRequest, SoftwareIgnoreResponse, TriggerDiscoveryResponse,
};
use crate::types_impl::batch_actions::{BatchActionRequest, BatchActionResponse};
use crate::types_impl::pagination::PaginatedResponse;
use crate::types_impl::software_items::SoftwareItemResponse;
use uuid::Uuid;
#[derive(serde::Serialize)]
pub struct ListIgnoresParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub page: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub per_page: Option<u64>,
}
impl UptrakitClient {
pub async fn approve_software_item(&self, id: &Uuid) -> Result<SoftwareItemResponse> {
self.post_empty(&crate::paths::software_items::approve(id))
.await
}
pub async fn discover_host(&self, host_id: &Uuid) -> Result<TriggerDiscoveryResponse> {
self.post_empty(&crate::paths::hosts::discover(host_id))
.await
}
pub async fn discover_plugin_config(&self, id: &Uuid) -> Result<TriggerDiscoveryResponse> {
self.post_empty(&crate::paths::plugin_configs::discover(id))
.await
}
pub async fn list_software_ignores(
&self,
params: &ListIgnoresParams,
) -> Result<PaginatedResponse<SoftwareIgnoreResponse>> {
self.get_with_query(crate::paths::autodiscovery::IGNORES, params)
.await
}
pub async fn create_software_ignore(
&self,
req: &CreateSoftwareIgnoreRequest,
) -> Result<SoftwareIgnoreResponse> {
self.post_json(crate::paths::autodiscovery::IGNORES, req)
.await
}
pub async fn delete_software_ignore(&self, id: &Uuid) -> Result<()> {
self.delete(&crate::paths::autodiscovery::ignore_by_id(id))
.await
}
pub async fn batch_software_ignores(
&self,
req: &BatchActionRequest,
) -> Result<BatchActionResponse> {
self.post_json(crate::paths::autodiscovery::BATCH, req)
.await
}
}