print_nanny_client/apis/
devices_api.rs

1/*
2 * print-nanny-client
3 *
4 * Official API client library for print-nanny.com
5 *
6 * The version of the OpenAPI document: 0.0.0
7 * Contact: leigh@print-nanny.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`device_info_update_or_create`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeviceInfoUpdateOrCreateError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`devices_cameras_create`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DevicesCamerasCreateError {
29    DefaultResponse(crate::models::ErrorDetail),
30    UnknownValue(serde_json::Value),
31}
32
33/// struct for typed errors of method [`devices_cameras_list`]
34#[derive(Debug, Clone, Serialize, Deserialize)]
35#[serde(untagged)]
36pub enum DevicesCamerasListError {
37    DefaultResponse(crate::models::ErrorDetail),
38    UnknownValue(serde_json::Value),
39}
40
41/// struct for typed errors of method [`devices_cameras_partial_update`]
42#[derive(Debug, Clone, Serialize, Deserialize)]
43#[serde(untagged)]
44pub enum DevicesCamerasPartialUpdateError {
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`devices_cameras_retrieve`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum DevicesCamerasRetrieveError {
52    UnknownValue(serde_json::Value),
53}
54
55/// struct for typed errors of method [`devices_cameras_update`]
56#[derive(Debug, Clone, Serialize, Deserialize)]
57#[serde(untagged)]
58pub enum DevicesCamerasUpdateError {
59    DefaultResponse(crate::models::ErrorDetail),
60    UnknownValue(serde_json::Value),
61}
62
63/// struct for typed errors of method [`devices_cloud_iot_devices_create`]
64#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum DevicesCloudIotDevicesCreateError {
67    DefaultResponse(crate::models::ErrorDetail),
68    UnknownValue(serde_json::Value),
69}
70
71/// struct for typed errors of method [`devices_cloud_iot_devices_list`]
72#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(untagged)]
74pub enum DevicesCloudIotDevicesListError {
75    DefaultResponse(crate::models::ErrorDetail),
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`devices_cloud_iot_devices_partial_update`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum DevicesCloudIotDevicesPartialUpdateError {
83    UnknownValue(serde_json::Value),
84}
85
86/// struct for typed errors of method [`devices_cloud_iot_devices_retrieve`]
87#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum DevicesCloudIotDevicesRetrieveError {
90    UnknownValue(serde_json::Value),
91}
92
93/// struct for typed errors of method [`devices_cloud_iot_devices_update`]
94#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(untagged)]
96pub enum DevicesCloudIotDevicesUpdateError {
97    DefaultResponse(crate::models::ErrorDetail),
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`devices_config_list`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum DevicesConfigListError {
105    DefaultResponse(crate::models::ErrorDetail),
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`devices_config_retrieve`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum DevicesConfigRetrieveError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`devices_create`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum DevicesCreateError {
120    DefaultResponse(crate::models::ErrorDetail),
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`devices_info_create`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum DevicesInfoCreateError {
128    DefaultResponse(crate::models::ErrorDetail),
129    UnknownValue(serde_json::Value),
130}
131
132/// struct for typed errors of method [`devices_info_list`]
133#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum DevicesInfoListError {
136    DefaultResponse(crate::models::ErrorDetail),
137    UnknownValue(serde_json::Value),
138}
139
140/// struct for typed errors of method [`devices_info_partial_update`]
141#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum DevicesInfoPartialUpdateError {
144    UnknownValue(serde_json::Value),
145}
146
147/// struct for typed errors of method [`devices_info_retrieve`]
148#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum DevicesInfoRetrieveError {
151    UnknownValue(serde_json::Value),
152}
153
154/// struct for typed errors of method [`devices_info_update`]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum DevicesInfoUpdateError {
158    DefaultResponse(crate::models::ErrorDetail),
159    UnknownValue(serde_json::Value),
160}
161
162/// struct for typed errors of method [`devices_license_retrieve`]
163#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum DevicesLicenseRetrieveError {
166    UnknownValue(serde_json::Value),
167}
168
169/// struct for typed errors of method [`devices_list`]
170#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum DevicesListError {
173    DefaultResponse(crate::models::ErrorDetail),
174    UnknownValue(serde_json::Value),
175}
176
177/// struct for typed errors of method [`devices_partial_update`]
178#[derive(Debug, Clone, Serialize, Deserialize)]
179#[serde(untagged)]
180pub enum DevicesPartialUpdateError {
181    UnknownValue(serde_json::Value),
182}
183
184/// struct for typed errors of method [`devices_printer_controllers_create`]
185#[derive(Debug, Clone, Serialize, Deserialize)]
186#[serde(untagged)]
187pub enum DevicesPrinterControllersCreateError {
188    DefaultResponse(crate::models::ErrorDetail),
189    UnknownValue(serde_json::Value),
190}
191
192/// struct for typed errors of method [`devices_printer_controllers_list`]
193#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum DevicesPrinterControllersListError {
196    DefaultResponse(crate::models::ErrorDetail),
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`devices_printer_controllers_partial_update`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum DevicesPrinterControllersPartialUpdateError {
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`devices_printer_controllers_retrieve`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum DevicesPrinterControllersRetrieveError {
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`devices_printer_controllers_update`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum DevicesPrinterControllersUpdateError {
218    DefaultResponse(crate::models::ErrorDetail),
219    UnknownValue(serde_json::Value),
220}
221
222/// struct for typed errors of method [`devices_retrieve`]
223#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum DevicesRetrieveError {
226    UnknownValue(serde_json::Value),
227}
228
229/// struct for typed errors of method [`devices_retrieve_hostname`]
230#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum DevicesRetrieveHostnameError {
233    DefaultResponse(crate::models::ErrorDetail),
234    UnknownValue(serde_json::Value),
235}
236
237/// struct for typed errors of method [`devices_state_list`]
238#[derive(Debug, Clone, Serialize, Deserialize)]
239#[serde(untagged)]
240pub enum DevicesStateListError {
241    DefaultResponse(crate::models::ErrorDetail),
242    UnknownValue(serde_json::Value),
243}
244
245/// struct for typed errors of method [`devices_state_retrieve`]
246#[derive(Debug, Clone, Serialize, Deserialize)]
247#[serde(untagged)]
248pub enum DevicesStateRetrieveError {
249    UnknownValue(serde_json::Value),
250}
251
252/// struct for typed errors of method [`devices_update`]
253#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum DevicesUpdateError {
256    DefaultResponse(crate::models::ErrorDetail),
257    UnknownValue(serde_json::Value),
258}
259
260
261pub async fn device_info_update_or_create(configuration: &configuration::Configuration, device_id: i32, device_info_request: crate::models::DeviceInfoRequest) -> Result<crate::models::DeviceInfo, Error<DeviceInfoUpdateOrCreateError>> {
262    let local_var_configuration = configuration;
263
264    let local_var_client = &local_var_configuration.client;
265
266    let local_var_uri_str = format!("{}/api/devices/{device_id}/info/update-or-create/", local_var_configuration.base_path, device_id=device_id);
267    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
268
269    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
270        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
271    }
272    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
273        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
274    };
275    local_var_req_builder = local_var_req_builder.json(&device_info_request);
276
277    let local_var_req = local_var_req_builder.build()?;
278    let local_var_resp = local_var_client.execute(local_var_req).await?;
279
280    let local_var_status = local_var_resp.status();
281    let local_var_content = local_var_resp.text().await?;
282
283    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
284        serde_json::from_str(&local_var_content).map_err(Error::from)
285    } else {
286        let local_var_entity: Option<DeviceInfoUpdateOrCreateError> = serde_json::from_str(&local_var_content).ok();
287        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
288        Err(Error::ResponseError(local_var_error))
289    }
290}
291
292pub async fn devices_cameras_create(configuration: &configuration::Configuration, device_id: i32, camera_request: crate::models::CameraRequest) -> Result<crate::models::Camera, Error<DevicesCamerasCreateError>> {
293    let local_var_configuration = configuration;
294
295    let local_var_client = &local_var_configuration.client;
296
297    let local_var_uri_str = format!("{}/api/devices/{device_id}/cameras/", local_var_configuration.base_path, device_id=device_id);
298    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
299
300    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
301        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
302    }
303    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
304        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
305    };
306    local_var_req_builder = local_var_req_builder.json(&camera_request);
307
308    let local_var_req = local_var_req_builder.build()?;
309    let local_var_resp = local_var_client.execute(local_var_req).await?;
310
311    let local_var_status = local_var_resp.status();
312    let local_var_content = local_var_resp.text().await?;
313
314    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
315        serde_json::from_str(&local_var_content).map_err(Error::from)
316    } else {
317        let local_var_entity: Option<DevicesCamerasCreateError> = serde_json::from_str(&local_var_content).ok();
318        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
319        Err(Error::ResponseError(local_var_error))
320    }
321}
322
323pub async fn devices_cameras_list(configuration: &configuration::Configuration, device_id: i32, page: Option<i32>) -> Result<crate::models::PaginatedCameraList, Error<DevicesCamerasListError>> {
324    let local_var_configuration = configuration;
325
326    let local_var_client = &local_var_configuration.client;
327
328    let local_var_uri_str = format!("{}/api/devices/{device_id}/cameras/", local_var_configuration.base_path, device_id=device_id);
329    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
330
331    if let Some(ref local_var_str) = page {
332        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
333    }
334    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
335        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
336    }
337    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
338        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
339    };
340
341    let local_var_req = local_var_req_builder.build()?;
342    let local_var_resp = local_var_client.execute(local_var_req).await?;
343
344    let local_var_status = local_var_resp.status();
345    let local_var_content = local_var_resp.text().await?;
346
347    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
348        serde_json::from_str(&local_var_content).map_err(Error::from)
349    } else {
350        let local_var_entity: Option<DevicesCamerasListError> = serde_json::from_str(&local_var_content).ok();
351        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
352        Err(Error::ResponseError(local_var_error))
353    }
354}
355
356pub async fn devices_cameras_partial_update(configuration: &configuration::Configuration, device_id: i32, id: i32, patched_camera_request: Option<crate::models::PatchedCameraRequest>) -> Result<crate::models::Camera, Error<DevicesCamerasPartialUpdateError>> {
357    let local_var_configuration = configuration;
358
359    let local_var_client = &local_var_configuration.client;
360
361    let local_var_uri_str = format!("{}/api/devices/{device_id}/cameras/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
362    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
363
364    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
365        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
366    }
367    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
368        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
369    };
370    local_var_req_builder = local_var_req_builder.json(&patched_camera_request);
371
372    let local_var_req = local_var_req_builder.build()?;
373    let local_var_resp = local_var_client.execute(local_var_req).await?;
374
375    let local_var_status = local_var_resp.status();
376    let local_var_content = local_var_resp.text().await?;
377
378    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
379        serde_json::from_str(&local_var_content).map_err(Error::from)
380    } else {
381        let local_var_entity: Option<DevicesCamerasPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
382        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
383        Err(Error::ResponseError(local_var_error))
384    }
385}
386
387pub async fn devices_cameras_retrieve(configuration: &configuration::Configuration, device_id: i32, id: i32) -> Result<crate::models::Camera, Error<DevicesCamerasRetrieveError>> {
388    let local_var_configuration = configuration;
389
390    let local_var_client = &local_var_configuration.client;
391
392    let local_var_uri_str = format!("{}/api/devices/{device_id}/cameras/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
393    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
394
395    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
396        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
397    }
398    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
399        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
400    };
401
402    let local_var_req = local_var_req_builder.build()?;
403    let local_var_resp = local_var_client.execute(local_var_req).await?;
404
405    let local_var_status = local_var_resp.status();
406    let local_var_content = local_var_resp.text().await?;
407
408    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
409        serde_json::from_str(&local_var_content).map_err(Error::from)
410    } else {
411        let local_var_entity: Option<DevicesCamerasRetrieveError> = serde_json::from_str(&local_var_content).ok();
412        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
413        Err(Error::ResponseError(local_var_error))
414    }
415}
416
417pub async fn devices_cameras_update(configuration: &configuration::Configuration, device_id: i32, id: i32, camera_request: crate::models::CameraRequest) -> Result<crate::models::Camera, Error<DevicesCamerasUpdateError>> {
418    let local_var_configuration = configuration;
419
420    let local_var_client = &local_var_configuration.client;
421
422    let local_var_uri_str = format!("{}/api/devices/{device_id}/cameras/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
423    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
424
425    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
426        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
427    }
428    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
429        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
430    };
431    local_var_req_builder = local_var_req_builder.json(&camera_request);
432
433    let local_var_req = local_var_req_builder.build()?;
434    let local_var_resp = local_var_client.execute(local_var_req).await?;
435
436    let local_var_status = local_var_resp.status();
437    let local_var_content = local_var_resp.text().await?;
438
439    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
440        serde_json::from_str(&local_var_content).map_err(Error::from)
441    } else {
442        let local_var_entity: Option<DevicesCamerasUpdateError> = serde_json::from_str(&local_var_content).ok();
443        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
444        Err(Error::ResponseError(local_var_error))
445    }
446}
447
448pub async fn devices_cloud_iot_devices_create(configuration: &configuration::Configuration, device_id: i32, cloudiot_device_request: crate::models::CloudiotDeviceRequest) -> Result<crate::models::CloudiotDevice, Error<DevicesCloudIotDevicesCreateError>> {
449    let local_var_configuration = configuration;
450
451    let local_var_client = &local_var_configuration.client;
452
453    let local_var_uri_str = format!("{}/api/devices/{device_id}/cloud-iot-devices/", local_var_configuration.base_path, device_id=device_id);
454    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
455
456    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
457        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
458    }
459    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
460        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
461    };
462    local_var_req_builder = local_var_req_builder.json(&cloudiot_device_request);
463
464    let local_var_req = local_var_req_builder.build()?;
465    let local_var_resp = local_var_client.execute(local_var_req).await?;
466
467    let local_var_status = local_var_resp.status();
468    let local_var_content = local_var_resp.text().await?;
469
470    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
471        serde_json::from_str(&local_var_content).map_err(Error::from)
472    } else {
473        let local_var_entity: Option<DevicesCloudIotDevicesCreateError> = serde_json::from_str(&local_var_content).ok();
474        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
475        Err(Error::ResponseError(local_var_error))
476    }
477}
478
479pub async fn devices_cloud_iot_devices_list(configuration: &configuration::Configuration, device_id: i32, page: Option<i32>) -> Result<crate::models::PaginatedCloudiotDeviceList, Error<DevicesCloudIotDevicesListError>> {
480    let local_var_configuration = configuration;
481
482    let local_var_client = &local_var_configuration.client;
483
484    let local_var_uri_str = format!("{}/api/devices/{device_id}/cloud-iot-devices/", local_var_configuration.base_path, device_id=device_id);
485    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
486
487    if let Some(ref local_var_str) = page {
488        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
489    }
490    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
491        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
492    }
493    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
494        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
495    };
496
497    let local_var_req = local_var_req_builder.build()?;
498    let local_var_resp = local_var_client.execute(local_var_req).await?;
499
500    let local_var_status = local_var_resp.status();
501    let local_var_content = local_var_resp.text().await?;
502
503    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
504        serde_json::from_str(&local_var_content).map_err(Error::from)
505    } else {
506        let local_var_entity: Option<DevicesCloudIotDevicesListError> = serde_json::from_str(&local_var_content).ok();
507        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
508        Err(Error::ResponseError(local_var_error))
509    }
510}
511
512pub async fn devices_cloud_iot_devices_partial_update(configuration: &configuration::Configuration, device_id: i32, id: &str, patched_cloudiot_device_request: Option<crate::models::PatchedCloudiotDeviceRequest>) -> Result<crate::models::CloudiotDevice, Error<DevicesCloudIotDevicesPartialUpdateError>> {
513    let local_var_configuration = configuration;
514
515    let local_var_client = &local_var_configuration.client;
516
517    let local_var_uri_str = format!("{}/api/devices/{device_id}/cloud-iot-devices/{id}/", local_var_configuration.base_path, device_id=device_id, id=crate::apis::urlencode(id));
518    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
519
520    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
521        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
522    }
523    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
524        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
525    };
526    local_var_req_builder = local_var_req_builder.json(&patched_cloudiot_device_request);
527
528    let local_var_req = local_var_req_builder.build()?;
529    let local_var_resp = local_var_client.execute(local_var_req).await?;
530
531    let local_var_status = local_var_resp.status();
532    let local_var_content = local_var_resp.text().await?;
533
534    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
535        serde_json::from_str(&local_var_content).map_err(Error::from)
536    } else {
537        let local_var_entity: Option<DevicesCloudIotDevicesPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
538        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
539        Err(Error::ResponseError(local_var_error))
540    }
541}
542
543pub async fn devices_cloud_iot_devices_retrieve(configuration: &configuration::Configuration, device_id: i32, id: &str) -> Result<crate::models::CloudiotDevice, Error<DevicesCloudIotDevicesRetrieveError>> {
544    let local_var_configuration = configuration;
545
546    let local_var_client = &local_var_configuration.client;
547
548    let local_var_uri_str = format!("{}/api/devices/{device_id}/cloud-iot-devices/{id}/", local_var_configuration.base_path, device_id=device_id, id=crate::apis::urlencode(id));
549    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
550
551    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
552        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
553    }
554    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
555        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
556    };
557
558    let local_var_req = local_var_req_builder.build()?;
559    let local_var_resp = local_var_client.execute(local_var_req).await?;
560
561    let local_var_status = local_var_resp.status();
562    let local_var_content = local_var_resp.text().await?;
563
564    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
565        serde_json::from_str(&local_var_content).map_err(Error::from)
566    } else {
567        let local_var_entity: Option<DevicesCloudIotDevicesRetrieveError> = serde_json::from_str(&local_var_content).ok();
568        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
569        Err(Error::ResponseError(local_var_error))
570    }
571}
572
573pub async fn devices_cloud_iot_devices_update(configuration: &configuration::Configuration, device_id: i32, id: &str, cloudiot_device_request: crate::models::CloudiotDeviceRequest) -> Result<crate::models::CloudiotDevice, Error<DevicesCloudIotDevicesUpdateError>> {
574    let local_var_configuration = configuration;
575
576    let local_var_client = &local_var_configuration.client;
577
578    let local_var_uri_str = format!("{}/api/devices/{device_id}/cloud-iot-devices/{id}/", local_var_configuration.base_path, device_id=device_id, id=crate::apis::urlencode(id));
579    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
580
581    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
582        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
583    }
584    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
585        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
586    };
587    local_var_req_builder = local_var_req_builder.json(&cloudiot_device_request);
588
589    let local_var_req = local_var_req_builder.build()?;
590    let local_var_resp = local_var_client.execute(local_var_req).await?;
591
592    let local_var_status = local_var_resp.status();
593    let local_var_content = local_var_resp.text().await?;
594
595    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
596        serde_json::from_str(&local_var_content).map_err(Error::from)
597    } else {
598        let local_var_entity: Option<DevicesCloudIotDevicesUpdateError> = serde_json::from_str(&local_var_content).ok();
599        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
600        Err(Error::ResponseError(local_var_error))
601    }
602}
603
604pub async fn devices_config_list(configuration: &configuration::Configuration, device_id: i32, page: Option<i32>) -> Result<crate::models::PaginatedDeviceConfigList, Error<DevicesConfigListError>> {
605    let local_var_configuration = configuration;
606
607    let local_var_client = &local_var_configuration.client;
608
609    let local_var_uri_str = format!("{}/api/devices/{device_id}/config/", local_var_configuration.base_path, device_id=device_id);
610    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
611
612    if let Some(ref local_var_str) = page {
613        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
614    }
615    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
616        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
617    }
618    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
619        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
620    };
621
622    let local_var_req = local_var_req_builder.build()?;
623    let local_var_resp = local_var_client.execute(local_var_req).await?;
624
625    let local_var_status = local_var_resp.status();
626    let local_var_content = local_var_resp.text().await?;
627
628    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
629        serde_json::from_str(&local_var_content).map_err(Error::from)
630    } else {
631        let local_var_entity: Option<DevicesConfigListError> = serde_json::from_str(&local_var_content).ok();
632        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
633        Err(Error::ResponseError(local_var_error))
634    }
635}
636
637pub async fn devices_config_retrieve(configuration: &configuration::Configuration, device_id: i32, id: i32) -> Result<crate::models::DeviceConfig, Error<DevicesConfigRetrieveError>> {
638    let local_var_configuration = configuration;
639
640    let local_var_client = &local_var_configuration.client;
641
642    let local_var_uri_str = format!("{}/api/devices/{device_id}/config/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
643    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
644
645    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
646        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
647    }
648    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
649        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
650    };
651
652    let local_var_req = local_var_req_builder.build()?;
653    let local_var_resp = local_var_client.execute(local_var_req).await?;
654
655    let local_var_status = local_var_resp.status();
656    let local_var_content = local_var_resp.text().await?;
657
658    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
659        serde_json::from_str(&local_var_content).map_err(Error::from)
660    } else {
661        let local_var_entity: Option<DevicesConfigRetrieveError> = serde_json::from_str(&local_var_content).ok();
662        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
663        Err(Error::ResponseError(local_var_error))
664    }
665}
666
667/// All-in-one Print Nanny installation via print-nanny-main-<platform>-<cpu>.img
668pub async fn devices_create(configuration: &configuration::Configuration, device_request: Option<crate::models::DeviceRequest>) -> Result<crate::models::Device, Error<DevicesCreateError>> {
669    let local_var_configuration = configuration;
670
671    let local_var_client = &local_var_configuration.client;
672
673    let local_var_uri_str = format!("{}/api/devices/", local_var_configuration.base_path);
674    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
675
676    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
677        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
678    }
679    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
680        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
681    };
682    local_var_req_builder = local_var_req_builder.json(&device_request);
683
684    let local_var_req = local_var_req_builder.build()?;
685    let local_var_resp = local_var_client.execute(local_var_req).await?;
686
687    let local_var_status = local_var_resp.status();
688    let local_var_content = local_var_resp.text().await?;
689
690    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
691        serde_json::from_str(&local_var_content).map_err(Error::from)
692    } else {
693        let local_var_entity: Option<DevicesCreateError> = serde_json::from_str(&local_var_content).ok();
694        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
695        Err(Error::ResponseError(local_var_error))
696    }
697}
698
699pub async fn devices_info_create(configuration: &configuration::Configuration, device_id: i32, device_info_request: crate::models::DeviceInfoRequest) -> Result<crate::models::DeviceInfo, Error<DevicesInfoCreateError>> {
700    let local_var_configuration = configuration;
701
702    let local_var_client = &local_var_configuration.client;
703
704    let local_var_uri_str = format!("{}/api/devices/{device_id}/info/", local_var_configuration.base_path, device_id=device_id);
705    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
706
707    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
708        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
709    }
710    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
711        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
712    };
713    local_var_req_builder = local_var_req_builder.json(&device_info_request);
714
715    let local_var_req = local_var_req_builder.build()?;
716    let local_var_resp = local_var_client.execute(local_var_req).await?;
717
718    let local_var_status = local_var_resp.status();
719    let local_var_content = local_var_resp.text().await?;
720
721    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
722        serde_json::from_str(&local_var_content).map_err(Error::from)
723    } else {
724        let local_var_entity: Option<DevicesInfoCreateError> = serde_json::from_str(&local_var_content).ok();
725        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
726        Err(Error::ResponseError(local_var_error))
727    }
728}
729
730pub async fn devices_info_list(configuration: &configuration::Configuration, device_id: i32, page: Option<i32>) -> Result<crate::models::PaginatedDeviceInfoList, Error<DevicesInfoListError>> {
731    let local_var_configuration = configuration;
732
733    let local_var_client = &local_var_configuration.client;
734
735    let local_var_uri_str = format!("{}/api/devices/{device_id}/info/", local_var_configuration.base_path, device_id=device_id);
736    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
737
738    if let Some(ref local_var_str) = page {
739        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
740    }
741    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
742        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
743    }
744    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
745        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
746    };
747
748    let local_var_req = local_var_req_builder.build()?;
749    let local_var_resp = local_var_client.execute(local_var_req).await?;
750
751    let local_var_status = local_var_resp.status();
752    let local_var_content = local_var_resp.text().await?;
753
754    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
755        serde_json::from_str(&local_var_content).map_err(Error::from)
756    } else {
757        let local_var_entity: Option<DevicesInfoListError> = serde_json::from_str(&local_var_content).ok();
758        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
759        Err(Error::ResponseError(local_var_error))
760    }
761}
762
763pub async fn devices_info_partial_update(configuration: &configuration::Configuration, device_id: i32, id: i32, patched_device_info_request: Option<crate::models::PatchedDeviceInfoRequest>) -> Result<crate::models::DeviceInfo, Error<DevicesInfoPartialUpdateError>> {
764    let local_var_configuration = configuration;
765
766    let local_var_client = &local_var_configuration.client;
767
768    let local_var_uri_str = format!("{}/api/devices/{device_id}/info/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
769    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
770
771    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
772        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
773    }
774    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
775        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
776    };
777    local_var_req_builder = local_var_req_builder.json(&patched_device_info_request);
778
779    let local_var_req = local_var_req_builder.build()?;
780    let local_var_resp = local_var_client.execute(local_var_req).await?;
781
782    let local_var_status = local_var_resp.status();
783    let local_var_content = local_var_resp.text().await?;
784
785    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
786        serde_json::from_str(&local_var_content).map_err(Error::from)
787    } else {
788        let local_var_entity: Option<DevicesInfoPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
789        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
790        Err(Error::ResponseError(local_var_error))
791    }
792}
793
794pub async fn devices_info_retrieve(configuration: &configuration::Configuration, device_id: i32, id: i32) -> Result<crate::models::DeviceInfo, Error<DevicesInfoRetrieveError>> {
795    let local_var_configuration = configuration;
796
797    let local_var_client = &local_var_configuration.client;
798
799    let local_var_uri_str = format!("{}/api/devices/{device_id}/info/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
800    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
801
802    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
803        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
804    }
805    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
806        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
807    };
808
809    let local_var_req = local_var_req_builder.build()?;
810    let local_var_resp = local_var_client.execute(local_var_req).await?;
811
812    let local_var_status = local_var_resp.status();
813    let local_var_content = local_var_resp.text().await?;
814
815    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
816        serde_json::from_str(&local_var_content).map_err(Error::from)
817    } else {
818        let local_var_entity: Option<DevicesInfoRetrieveError> = serde_json::from_str(&local_var_content).ok();
819        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
820        Err(Error::ResponseError(local_var_error))
821    }
822}
823
824pub async fn devices_info_update(configuration: &configuration::Configuration, device_id: i32, id: i32, device_info_request: crate::models::DeviceInfoRequest) -> Result<crate::models::DeviceInfo, Error<DevicesInfoUpdateError>> {
825    let local_var_configuration = configuration;
826
827    let local_var_client = &local_var_configuration.client;
828
829    let local_var_uri_str = format!("{}/api/devices/{device_id}/info/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
830    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
831
832    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
833        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
834    }
835    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
836        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
837    };
838    local_var_req_builder = local_var_req_builder.json(&device_info_request);
839
840    let local_var_req = local_var_req_builder.build()?;
841    let local_var_resp = local_var_client.execute(local_var_req).await?;
842
843    let local_var_status = local_var_resp.status();
844    let local_var_content = local_var_resp.text().await?;
845
846    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
847        serde_json::from_str(&local_var_content).map_err(Error::from)
848    } else {
849        let local_var_entity: Option<DevicesInfoUpdateError> = serde_json::from_str(&local_var_content).ok();
850        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
851        Err(Error::ResponseError(local_var_error))
852    }
853}
854
855/// All-in-one Print Nanny installation via print-nanny-main-<platform>-<cpu>.img
856pub async fn devices_license_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::Device, Error<DevicesLicenseRetrieveError>> {
857    let local_var_configuration = configuration;
858
859    let local_var_client = &local_var_configuration.client;
860
861    let local_var_uri_str = format!("{}/api/devices/{id}/license/", local_var_configuration.base_path, id=id);
862    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
863
864    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
865        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
866    }
867    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
868        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
869    };
870
871    let local_var_req = local_var_req_builder.build()?;
872    let local_var_resp = local_var_client.execute(local_var_req).await?;
873
874    let local_var_status = local_var_resp.status();
875    let local_var_content = local_var_resp.text().await?;
876
877    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
878        serde_json::from_str(&local_var_content).map_err(Error::from)
879    } else {
880        let local_var_entity: Option<DevicesLicenseRetrieveError> = serde_json::from_str(&local_var_content).ok();
881        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
882        Err(Error::ResponseError(local_var_error))
883    }
884}
885
886/// All-in-one Print Nanny installation via print-nanny-main-<platform>-<cpu>.img
887pub async fn devices_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedDeviceList, Error<DevicesListError>> {
888    let local_var_configuration = configuration;
889
890    let local_var_client = &local_var_configuration.client;
891
892    let local_var_uri_str = format!("{}/api/devices/", local_var_configuration.base_path);
893    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
894
895    if let Some(ref local_var_str) = page {
896        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
897    }
898    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
899        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
900    }
901    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
902        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
903    };
904
905    let local_var_req = local_var_req_builder.build()?;
906    let local_var_resp = local_var_client.execute(local_var_req).await?;
907
908    let local_var_status = local_var_resp.status();
909    let local_var_content = local_var_resp.text().await?;
910
911    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
912        serde_json::from_str(&local_var_content).map_err(Error::from)
913    } else {
914        let local_var_entity: Option<DevicesListError> = serde_json::from_str(&local_var_content).ok();
915        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
916        Err(Error::ResponseError(local_var_error))
917    }
918}
919
920/// All-in-one Print Nanny installation via print-nanny-main-<platform>-<cpu>.img
921pub async fn devices_partial_update(configuration: &configuration::Configuration, id: i32, patched_device_request: Option<crate::models::PatchedDeviceRequest>) -> Result<crate::models::Device, Error<DevicesPartialUpdateError>> {
922    let local_var_configuration = configuration;
923
924    let local_var_client = &local_var_configuration.client;
925
926    let local_var_uri_str = format!("{}/api/devices/{id}/", local_var_configuration.base_path, id=id);
927    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
928
929    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
930        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
931    }
932    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
933        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
934    };
935    local_var_req_builder = local_var_req_builder.json(&patched_device_request);
936
937    let local_var_req = local_var_req_builder.build()?;
938    let local_var_resp = local_var_client.execute(local_var_req).await?;
939
940    let local_var_status = local_var_resp.status();
941    let local_var_content = local_var_resp.text().await?;
942
943    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
944        serde_json::from_str(&local_var_content).map_err(Error::from)
945    } else {
946        let local_var_entity: Option<DevicesPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
947        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
948        Err(Error::ResponseError(local_var_error))
949    }
950}
951
952pub async fn devices_printer_controllers_create(configuration: &configuration::Configuration, device_id: i32, device_request: Option<crate::models::DeviceRequest>) -> Result<crate::models::PrinterController, Error<DevicesPrinterControllersCreateError>> {
953    let local_var_configuration = configuration;
954
955    let local_var_client = &local_var_configuration.client;
956
957    let local_var_uri_str = format!("{}/api/devices/{device_id}/printer-controllers/", local_var_configuration.base_path, device_id=device_id);
958    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
959
960    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
961        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
962    }
963    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
964        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
965    };
966    local_var_req_builder = local_var_req_builder.json(&device_request);
967
968    let local_var_req = local_var_req_builder.build()?;
969    let local_var_resp = local_var_client.execute(local_var_req).await?;
970
971    let local_var_status = local_var_resp.status();
972    let local_var_content = local_var_resp.text().await?;
973
974    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
975        serde_json::from_str(&local_var_content).map_err(Error::from)
976    } else {
977        let local_var_entity: Option<DevicesPrinterControllersCreateError> = serde_json::from_str(&local_var_content).ok();
978        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
979        Err(Error::ResponseError(local_var_error))
980    }
981}
982
983pub async fn devices_printer_controllers_list(configuration: &configuration::Configuration, device_id: i32, page: Option<i32>) -> Result<crate::models::PaginatedPrinterControllerList, Error<DevicesPrinterControllersListError>> {
984    let local_var_configuration = configuration;
985
986    let local_var_client = &local_var_configuration.client;
987
988    let local_var_uri_str = format!("{}/api/devices/{device_id}/printer-controllers/", local_var_configuration.base_path, device_id=device_id);
989    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
990
991    if let Some(ref local_var_str) = page {
992        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
993    }
994    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
995        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
996    }
997    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
998        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
999    };
1000
1001    let local_var_req = local_var_req_builder.build()?;
1002    let local_var_resp = local_var_client.execute(local_var_req).await?;
1003
1004    let local_var_status = local_var_resp.status();
1005    let local_var_content = local_var_resp.text().await?;
1006
1007    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1008        serde_json::from_str(&local_var_content).map_err(Error::from)
1009    } else {
1010        let local_var_entity: Option<DevicesPrinterControllersListError> = serde_json::from_str(&local_var_content).ok();
1011        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1012        Err(Error::ResponseError(local_var_error))
1013    }
1014}
1015
1016pub async fn devices_printer_controllers_partial_update(configuration: &configuration::Configuration, device_id: i32, id: i32, patched_printer_controller_request: Option<crate::models::PatchedPrinterControllerRequest>) -> Result<crate::models::PrinterController, Error<DevicesPrinterControllersPartialUpdateError>> {
1017    let local_var_configuration = configuration;
1018
1019    let local_var_client = &local_var_configuration.client;
1020
1021    let local_var_uri_str = format!("{}/api/devices/{device_id}/printer-controllers/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
1022    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1023
1024    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1025        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1026    }
1027    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1028        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1029    };
1030    local_var_req_builder = local_var_req_builder.json(&patched_printer_controller_request);
1031
1032    let local_var_req = local_var_req_builder.build()?;
1033    let local_var_resp = local_var_client.execute(local_var_req).await?;
1034
1035    let local_var_status = local_var_resp.status();
1036    let local_var_content = local_var_resp.text().await?;
1037
1038    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1039        serde_json::from_str(&local_var_content).map_err(Error::from)
1040    } else {
1041        let local_var_entity: Option<DevicesPrinterControllersPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1042        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1043        Err(Error::ResponseError(local_var_error))
1044    }
1045}
1046
1047pub async fn devices_printer_controllers_retrieve(configuration: &configuration::Configuration, device_id: i32, id: i32) -> Result<crate::models::PrinterController, Error<DevicesPrinterControllersRetrieveError>> {
1048    let local_var_configuration = configuration;
1049
1050    let local_var_client = &local_var_configuration.client;
1051
1052    let local_var_uri_str = format!("{}/api/devices/{device_id}/printer-controllers/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
1053    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1054
1055    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1056        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1057    }
1058    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1059        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1060    };
1061
1062    let local_var_req = local_var_req_builder.build()?;
1063    let local_var_resp = local_var_client.execute(local_var_req).await?;
1064
1065    let local_var_status = local_var_resp.status();
1066    let local_var_content = local_var_resp.text().await?;
1067
1068    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1069        serde_json::from_str(&local_var_content).map_err(Error::from)
1070    } else {
1071        let local_var_entity: Option<DevicesPrinterControllersRetrieveError> = serde_json::from_str(&local_var_content).ok();
1072        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1073        Err(Error::ResponseError(local_var_error))
1074    }
1075}
1076
1077pub async fn devices_printer_controllers_update(configuration: &configuration::Configuration, device_id: i32, id: i32, device_request: Option<crate::models::DeviceRequest>) -> Result<crate::models::PrinterController, Error<DevicesPrinterControllersUpdateError>> {
1078    let local_var_configuration = configuration;
1079
1080    let local_var_client = &local_var_configuration.client;
1081
1082    let local_var_uri_str = format!("{}/api/devices/{device_id}/printer-controllers/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
1083    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1084
1085    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1086        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1087    }
1088    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1089        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1090    };
1091    local_var_req_builder = local_var_req_builder.json(&device_request);
1092
1093    let local_var_req = local_var_req_builder.build()?;
1094    let local_var_resp = local_var_client.execute(local_var_req).await?;
1095
1096    let local_var_status = local_var_resp.status();
1097    let local_var_content = local_var_resp.text().await?;
1098
1099    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1100        serde_json::from_str(&local_var_content).map_err(Error::from)
1101    } else {
1102        let local_var_entity: Option<DevicesPrinterControllersUpdateError> = serde_json::from_str(&local_var_content).ok();
1103        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1104        Err(Error::ResponseError(local_var_error))
1105    }
1106}
1107
1108/// All-in-one Print Nanny installation via print-nanny-main-<platform>-<cpu>.img
1109pub async fn devices_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::Device, Error<DevicesRetrieveError>> {
1110    let local_var_configuration = configuration;
1111
1112    let local_var_client = &local_var_configuration.client;
1113
1114    let local_var_uri_str = format!("{}/api/devices/{id}/", local_var_configuration.base_path, id=id);
1115    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1116
1117    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1118        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1119    }
1120    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1121        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1122    };
1123
1124    let local_var_req = local_var_req_builder.build()?;
1125    let local_var_resp = local_var_client.execute(local_var_req).await?;
1126
1127    let local_var_status = local_var_resp.status();
1128    let local_var_content = local_var_resp.text().await?;
1129
1130    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1131        serde_json::from_str(&local_var_content).map_err(Error::from)
1132    } else {
1133        let local_var_entity: Option<DevicesRetrieveError> = serde_json::from_str(&local_var_content).ok();
1134        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1135        Err(Error::ResponseError(local_var_error))
1136    }
1137}
1138
1139pub async fn devices_retrieve_hostname(configuration: &configuration::Configuration, hostname: &str) -> Result<crate::models::Device, Error<DevicesRetrieveHostnameError>> {
1140    let local_var_configuration = configuration;
1141
1142    let local_var_client = &local_var_configuration.client;
1143
1144    let local_var_uri_str = format!("{}/api/devices/{hostname}", local_var_configuration.base_path, hostname=crate::apis::urlencode(hostname));
1145    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1146
1147    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1148        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1149    }
1150    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1151        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1152    };
1153
1154    let local_var_req = local_var_req_builder.build()?;
1155    let local_var_resp = local_var_client.execute(local_var_req).await?;
1156
1157    let local_var_status = local_var_resp.status();
1158    let local_var_content = local_var_resp.text().await?;
1159
1160    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1161        serde_json::from_str(&local_var_content).map_err(Error::from)
1162    } else {
1163        let local_var_entity: Option<DevicesRetrieveHostnameError> = serde_json::from_str(&local_var_content).ok();
1164        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1165        Err(Error::ResponseError(local_var_error))
1166    }
1167}
1168
1169pub async fn devices_state_list(configuration: &configuration::Configuration, device_id: i32, page: Option<i32>) -> Result<crate::models::PaginatedDeviceStateList, Error<DevicesStateListError>> {
1170    let local_var_configuration = configuration;
1171
1172    let local_var_client = &local_var_configuration.client;
1173
1174    let local_var_uri_str = format!("{}/api/devices/{device_id}/state/", local_var_configuration.base_path, device_id=device_id);
1175    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1176
1177    if let Some(ref local_var_str) = page {
1178        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1179    }
1180    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1181        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1182    }
1183    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1184        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1185    };
1186
1187    let local_var_req = local_var_req_builder.build()?;
1188    let local_var_resp = local_var_client.execute(local_var_req).await?;
1189
1190    let local_var_status = local_var_resp.status();
1191    let local_var_content = local_var_resp.text().await?;
1192
1193    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1194        serde_json::from_str(&local_var_content).map_err(Error::from)
1195    } else {
1196        let local_var_entity: Option<DevicesStateListError> = serde_json::from_str(&local_var_content).ok();
1197        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1198        Err(Error::ResponseError(local_var_error))
1199    }
1200}
1201
1202pub async fn devices_state_retrieve(configuration: &configuration::Configuration, device_id: i32, id: i32) -> Result<crate::models::DeviceState, Error<DevicesStateRetrieveError>> {
1203    let local_var_configuration = configuration;
1204
1205    let local_var_client = &local_var_configuration.client;
1206
1207    let local_var_uri_str = format!("{}/api/devices/{device_id}/state/{id}/", local_var_configuration.base_path, device_id=device_id, id=id);
1208    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1209
1210    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1211        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1212    }
1213    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1214        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1215    };
1216
1217    let local_var_req = local_var_req_builder.build()?;
1218    let local_var_resp = local_var_client.execute(local_var_req).await?;
1219
1220    let local_var_status = local_var_resp.status();
1221    let local_var_content = local_var_resp.text().await?;
1222
1223    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1224        serde_json::from_str(&local_var_content).map_err(Error::from)
1225    } else {
1226        let local_var_entity: Option<DevicesStateRetrieveError> = serde_json::from_str(&local_var_content).ok();
1227        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1228        Err(Error::ResponseError(local_var_error))
1229    }
1230}
1231
1232/// All-in-one Print Nanny installation via print-nanny-main-<platform>-<cpu>.img
1233pub async fn devices_update(configuration: &configuration::Configuration, id: i32, device_request: Option<crate::models::DeviceRequest>) -> Result<crate::models::Device, Error<DevicesUpdateError>> {
1234    let local_var_configuration = configuration;
1235
1236    let local_var_client = &local_var_configuration.client;
1237
1238    let local_var_uri_str = format!("{}/api/devices/{id}/", local_var_configuration.base_path, id=id);
1239    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1240
1241    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1242        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1243    }
1244    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1245        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1246    };
1247    local_var_req_builder = local_var_req_builder.json(&device_request);
1248
1249    let local_var_req = local_var_req_builder.build()?;
1250    let local_var_resp = local_var_client.execute(local_var_req).await?;
1251
1252    let local_var_status = local_var_resp.status();
1253    let local_var_content = local_var_resp.text().await?;
1254
1255    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1256        serde_json::from_str(&local_var_content).map_err(Error::from)
1257    } else {
1258        let local_var_entity: Option<DevicesUpdateError> = serde_json::from_str(&local_var_content).ok();
1259        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1260        Err(Error::ResponseError(local_var_error))
1261    }
1262}
1263