uptrakit_openapi_client/
update_batches.rs1use crate::Result;
2use crate::UptrakitClient;
3use crate::types_impl::pagination::PaginatedResponse;
4use crate::types_impl::update_batches::{
5 BatchUpdateResponse, HostBatchUpdateRequest, ItemBatchUpdateRequest, UpdateBatchDetailResponse,
6 UpdateBatchListQuery, UpdateBatchSummaryResponse,
7};
8use uuid::Uuid;
9
10impl UptrakitClient {
11 pub async fn trigger_host_batch_update(
13 &self,
14 host_id: &Uuid,
15 req: &HostBatchUpdateRequest,
16 ) -> Result<BatchUpdateResponse> {
17 self.post_json(
18 &crate::paths::update_batches::host_batch_update(host_id),
19 req,
20 )
21 .await
22 }
23
24 pub async fn trigger_item_batch_update(
26 &self,
27 item_id: &Uuid,
28 req: &ItemBatchUpdateRequest,
29 ) -> Result<BatchUpdateResponse> {
30 self.post_json(
31 &crate::paths::update_batches::item_batch_update(item_id),
32 req,
33 )
34 .await
35 }
36
37 pub async fn list_update_batches(
39 &self,
40 query: &UpdateBatchListQuery,
41 ) -> Result<PaginatedResponse<UpdateBatchSummaryResponse>> {
42 self.get_with_query(crate::paths::update_batches::BASE, query)
43 .await
44 }
45
46 pub async fn list_all_update_batches(
48 &self,
49 query: &UpdateBatchListQuery,
50 ) -> Result<Vec<UpdateBatchSummaryResponse>> {
51 self.fetch_all_pages(crate::paths::update_batches::BASE, query)
52 .await
53 }
54
55 pub async fn get_update_batch(&self, id: &Uuid) -> Result<UpdateBatchDetailResponse> {
57 self.get(&crate::paths::update_batches::by_id(id)).await
58 }
59
60 pub fn batch_progress_stream_path(id: &Uuid) -> String {
65 crate::paths::update_batches::stream(id)
66 }
67}