use crate::Result;
use crate::UptrakitClient;
use crate::types_impl::pagination::PaginatedResponse;
use crate::types_impl::update_batches::{
BatchUpdateResponse, HostBatchUpdateRequest, ItemBatchUpdateRequest, UpdateBatchDetailResponse,
UpdateBatchListQuery, UpdateBatchSummaryResponse,
};
use uuid::Uuid;
impl UptrakitClient {
pub async fn trigger_host_batch_update(
&self,
host_id: &Uuid,
req: &HostBatchUpdateRequest,
) -> Result<BatchUpdateResponse> {
self.post_json(
&crate::paths::update_batches::host_batch_update(host_id),
req,
)
.await
}
pub async fn trigger_item_batch_update(
&self,
item_id: &Uuid,
req: &ItemBatchUpdateRequest,
) -> Result<BatchUpdateResponse> {
self.post_json(
&crate::paths::update_batches::item_batch_update(item_id),
req,
)
.await
}
pub async fn list_update_batches(
&self,
query: &UpdateBatchListQuery,
) -> Result<PaginatedResponse<UpdateBatchSummaryResponse>> {
self.get_with_query(crate::paths::update_batches::BASE, query)
.await
}
pub async fn list_all_update_batches(
&self,
query: &UpdateBatchListQuery,
) -> Result<Vec<UpdateBatchSummaryResponse>> {
self.fetch_all_pages(crate::paths::update_batches::BASE, query)
.await
}
pub async fn get_update_batch(&self, id: &Uuid) -> Result<UpdateBatchDetailResponse> {
self.get(&crate::paths::update_batches::by_id(id)).await
}
pub fn batch_progress_stream_path(id: &Uuid) -> String {
crate::paths::update_batches::stream(id)
}
}