print_nanny_client/apis/
remote_control_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 [`commands_list`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CommandsListError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`commands_partial_update`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CommandsPartialUpdateError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`commands_retrieve`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CommandsRetrieveError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`commands_update`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CommandsUpdateError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`gcode_files_create`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GcodeFilesCreateError {
50    Status400(crate::models::GcodeFile),
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`gcode_files_list`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum GcodeFilesListError {
58    UnknownValue(serde_json::Value),
59}
60
61/// struct for typed errors of method [`gcode_files_partial_update`]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum GcodeFilesPartialUpdateError {
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`gcode_files_retrieve`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum GcodeFilesRetrieveError {
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`gcode_files_update`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GcodeFilesUpdateError {
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`gcode_files_update_or_create`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GcodeFilesUpdateOrCreateError {
86    Status400(crate::models::GcodeFile),
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`octoprint_devices_create`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum OctoprintDevicesCreateError {
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`octoprint_devices_list`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum OctoprintDevicesListError {
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`octoprint_devices_partial_update`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum OctoprintDevicesPartialUpdateError {
108    UnknownValue(serde_json::Value),
109}
110
111/// struct for typed errors of method [`octoprint_devices_retrieve`]
112#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum OctoprintDevicesRetrieveError {
115    UnknownValue(serde_json::Value),
116}
117
118/// struct for typed errors of method [`octoprint_devices_update`]
119#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum OctoprintDevicesUpdateError {
122    UnknownValue(serde_json::Value),
123}
124
125/// struct for typed errors of method [`octoprint_devices_update_or_create`]
126#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum OctoprintDevicesUpdateOrCreateError {
129    Status400(crate::models::OctoPrintDevice),
130    UnknownValue(serde_json::Value),
131}
132
133/// struct for typed errors of method [`print_session_partial_update`]
134#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum PrintSessionPartialUpdateError {
137    Status400(crate::models::PrintSession),
138    UnknownValue(serde_json::Value),
139}
140
141/// struct for typed errors of method [`print_session_update`]
142#[derive(Debug, Clone, Serialize, Deserialize)]
143#[serde(untagged)]
144pub enum PrintSessionUpdateError {
145    Status400(crate::models::PrintSession),
146    UnknownValue(serde_json::Value),
147}
148
149/// struct for typed errors of method [`print_sessions_create`]
150#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum PrintSessionsCreateError {
153    Status400(crate::models::PrintSession),
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`print_sessions_list`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum PrintSessionsListError {
161    UnknownValue(serde_json::Value),
162}
163
164/// struct for typed errors of method [`print_sessions_retrieve`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum PrintSessionsRetrieveError {
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`printer_profiles_create`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum PrinterProfilesCreateError {
175    Status400(crate::models::PrintSession),
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`printer_profiles_list`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum PrinterProfilesListError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`printer_profiles_partial_update`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum PrinterProfilesPartialUpdateError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`printer_profiles_retrieve`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum PrinterProfilesRetrieveError {
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`printer_profiles_update`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum PrinterProfilesUpdateError {
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`printer_profiles_update_or_create`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum PrinterProfilesUpdateOrCreateError {
211    UnknownValue(serde_json::Value),
212}
213
214
215pub async fn commands_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedRemoteControlCommandList, Error<CommandsListError>> {
216    let local_var_configuration = configuration;
217
218    let local_var_client = &local_var_configuration.client;
219
220    let local_var_uri_str = format!("{}/api/commands/", local_var_configuration.base_path);
221    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
222
223    if let Some(ref local_var_str) = page {
224        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
225    }
226    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
227        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
228    }
229    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
230        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
231    };
232
233    let local_var_req = local_var_req_builder.build()?;
234    let local_var_resp = local_var_client.execute(local_var_req).await?;
235
236    let local_var_status = local_var_resp.status();
237    let local_var_content = local_var_resp.text().await?;
238
239    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
240        serde_json::from_str(&local_var_content).map_err(Error::from)
241    } else {
242        let local_var_entity: Option<CommandsListError> = serde_json::from_str(&local_var_content).ok();
243        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
244        Err(Error::ResponseError(local_var_error))
245    }
246}
247
248pub async fn commands_partial_update(configuration: &configuration::Configuration, id: i32, patched_remote_control_command_request: Option<crate::models::PatchedRemoteControlCommandRequest>) -> Result<crate::models::RemoteControlCommand, Error<CommandsPartialUpdateError>> {
249    let local_var_configuration = configuration;
250
251    let local_var_client = &local_var_configuration.client;
252
253    let local_var_uri_str = format!("{}/api/commands/{id}/", local_var_configuration.base_path, id=id);
254    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
255
256    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
257        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
258    }
259    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
260        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
261    };
262    local_var_req_builder = local_var_req_builder.json(&patched_remote_control_command_request);
263
264    let local_var_req = local_var_req_builder.build()?;
265    let local_var_resp = local_var_client.execute(local_var_req).await?;
266
267    let local_var_status = local_var_resp.status();
268    let local_var_content = local_var_resp.text().await?;
269
270    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
271        serde_json::from_str(&local_var_content).map_err(Error::from)
272    } else {
273        let local_var_entity: Option<CommandsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
274        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
275        Err(Error::ResponseError(local_var_error))
276    }
277}
278
279pub async fn commands_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::RemoteControlCommand, Error<CommandsRetrieveError>> {
280    let local_var_configuration = configuration;
281
282    let local_var_client = &local_var_configuration.client;
283
284    let local_var_uri_str = format!("{}/api/commands/{id}/", local_var_configuration.base_path, id=id);
285    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
286
287    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
288        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
289    }
290    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
291        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
292    };
293
294    let local_var_req = local_var_req_builder.build()?;
295    let local_var_resp = local_var_client.execute(local_var_req).await?;
296
297    let local_var_status = local_var_resp.status();
298    let local_var_content = local_var_resp.text().await?;
299
300    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
301        serde_json::from_str(&local_var_content).map_err(Error::from)
302    } else {
303        let local_var_entity: Option<CommandsRetrieveError> = serde_json::from_str(&local_var_content).ok();
304        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
305        Err(Error::ResponseError(local_var_error))
306    }
307}
308
309pub async fn commands_update(configuration: &configuration::Configuration, id: i32, remote_control_command_request: crate::models::RemoteControlCommandRequest) -> Result<crate::models::RemoteControlCommand, Error<CommandsUpdateError>> {
310    let local_var_configuration = configuration;
311
312    let local_var_client = &local_var_configuration.client;
313
314    let local_var_uri_str = format!("{}/api/commands/{id}/", local_var_configuration.base_path, id=id);
315    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
316
317    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
318        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
319    }
320    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
321        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
322    };
323    local_var_req_builder = local_var_req_builder.json(&remote_control_command_request);
324
325    let local_var_req = local_var_req_builder.build()?;
326    let local_var_resp = local_var_client.execute(local_var_req).await?;
327
328    let local_var_status = local_var_resp.status();
329    let local_var_content = local_var_resp.text().await?;
330
331    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
332        serde_json::from_str(&local_var_content).map_err(Error::from)
333    } else {
334        let local_var_entity: Option<CommandsUpdateError> = serde_json::from_str(&local_var_content).ok();
335        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
336        Err(Error::ResponseError(local_var_error))
337    }
338}
339
340pub async fn gcode_files_create(configuration: &configuration::Configuration, name: &str, file: std::path::PathBuf, file_hash: &str, octoprint_device: &str) -> Result<crate::models::GcodeFile, Error<GcodeFilesCreateError>> {
341    let local_var_configuration = configuration;
342
343    let local_var_client = &local_var_configuration.client;
344
345    let local_var_uri_str = format!("{}/api/gcode-files/", local_var_configuration.base_path);
346    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
347
348    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
349        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
350    }
351    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
352        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
353    };
354    let mut local_var_form = reqwest::multipart::Form::new();
355    local_var_form = local_var_form.text("name", name.to_string());
356    // TODO: support file upload for 'file' parameter
357    local_var_form = local_var_form.text("file_hash", file_hash.to_string());
358    local_var_form = local_var_form.text("octoprint_device", octoprint_device.to_string());
359    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
360
361    let local_var_req = local_var_req_builder.build()?;
362    let local_var_resp = local_var_client.execute(local_var_req).await?;
363
364    let local_var_status = local_var_resp.status();
365    let local_var_content = local_var_resp.text().await?;
366
367    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
368        serde_json::from_str(&local_var_content).map_err(Error::from)
369    } else {
370        let local_var_entity: Option<GcodeFilesCreateError> = serde_json::from_str(&local_var_content).ok();
371        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
372        Err(Error::ResponseError(local_var_error))
373    }
374}
375
376pub async fn gcode_files_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedGcodeFileList, Error<GcodeFilesListError>> {
377    let local_var_configuration = configuration;
378
379    let local_var_client = &local_var_configuration.client;
380
381    let local_var_uri_str = format!("{}/api/gcode-files/", local_var_configuration.base_path);
382    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
383
384    if let Some(ref local_var_str) = page {
385        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
386    }
387    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
388        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
389    }
390    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
391        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
392    };
393
394    let local_var_req = local_var_req_builder.build()?;
395    let local_var_resp = local_var_client.execute(local_var_req).await?;
396
397    let local_var_status = local_var_resp.status();
398    let local_var_content = local_var_resp.text().await?;
399
400    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
401        serde_json::from_str(&local_var_content).map_err(Error::from)
402    } else {
403        let local_var_entity: Option<GcodeFilesListError> = serde_json::from_str(&local_var_content).ok();
404        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
405        Err(Error::ResponseError(local_var_error))
406    }
407}
408
409pub async fn gcode_files_partial_update(configuration: &configuration::Configuration, id: &str, name: Option<&str>, file: Option<std::path::PathBuf>, file_hash: Option<&str>, octoprint_device: Option<&str>) -> Result<crate::models::GcodeFile, Error<GcodeFilesPartialUpdateError>> {
410    let local_var_configuration = configuration;
411
412    let local_var_client = &local_var_configuration.client;
413
414    let local_var_uri_str = format!("{}/api/gcode-files/{id}/", local_var_configuration.base_path, id=crate::apis::urlencode(id));
415    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
416
417    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
418        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
419    }
420    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
421        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
422    };
423    let mut local_var_form = reqwest::multipart::Form::new();
424    if let Some(local_var_param_value) = name {
425        local_var_form = local_var_form.text("name", local_var_param_value.to_string());
426    }
427    // TODO: support file upload for 'file' parameter
428    if let Some(local_var_param_value) = file_hash {
429        local_var_form = local_var_form.text("file_hash", local_var_param_value.to_string());
430    }
431    if let Some(local_var_param_value) = octoprint_device {
432        local_var_form = local_var_form.text("octoprint_device", local_var_param_value.to_string());
433    }
434    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
435
436    let local_var_req = local_var_req_builder.build()?;
437    let local_var_resp = local_var_client.execute(local_var_req).await?;
438
439    let local_var_status = local_var_resp.status();
440    let local_var_content = local_var_resp.text().await?;
441
442    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
443        serde_json::from_str(&local_var_content).map_err(Error::from)
444    } else {
445        let local_var_entity: Option<GcodeFilesPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
446        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
447        Err(Error::ResponseError(local_var_error))
448    }
449}
450
451pub async fn gcode_files_retrieve(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::GcodeFile, Error<GcodeFilesRetrieveError>> {
452    let local_var_configuration = configuration;
453
454    let local_var_client = &local_var_configuration.client;
455
456    let local_var_uri_str = format!("{}/api/gcode-files/{id}/", local_var_configuration.base_path, id=crate::apis::urlencode(id));
457    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
458
459    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
460        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
461    }
462    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
463        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
464    };
465
466    let local_var_req = local_var_req_builder.build()?;
467    let local_var_resp = local_var_client.execute(local_var_req).await?;
468
469    let local_var_status = local_var_resp.status();
470    let local_var_content = local_var_resp.text().await?;
471
472    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
473        serde_json::from_str(&local_var_content).map_err(Error::from)
474    } else {
475        let local_var_entity: Option<GcodeFilesRetrieveError> = serde_json::from_str(&local_var_content).ok();
476        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
477        Err(Error::ResponseError(local_var_error))
478    }
479}
480
481pub async fn gcode_files_update(configuration: &configuration::Configuration, id: &str, name: &str, file: std::path::PathBuf, file_hash: &str, octoprint_device: &str) -> Result<crate::models::GcodeFile, Error<GcodeFilesUpdateError>> {
482    let local_var_configuration = configuration;
483
484    let local_var_client = &local_var_configuration.client;
485
486    let local_var_uri_str = format!("{}/api/gcode-files/{id}/", local_var_configuration.base_path, id=crate::apis::urlencode(id));
487    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
488
489    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
490        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
491    }
492    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
493        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
494    };
495    let mut local_var_form = reqwest::multipart::Form::new();
496    local_var_form = local_var_form.text("name", name.to_string());
497    // TODO: support file upload for 'file' parameter
498    local_var_form = local_var_form.text("file_hash", file_hash.to_string());
499    local_var_form = local_var_form.text("octoprint_device", octoprint_device.to_string());
500    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
501
502    let local_var_req = local_var_req_builder.build()?;
503    let local_var_resp = local_var_client.execute(local_var_req).await?;
504
505    let local_var_status = local_var_resp.status();
506    let local_var_content = local_var_resp.text().await?;
507
508    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
509        serde_json::from_str(&local_var_content).map_err(Error::from)
510    } else {
511        let local_var_entity: Option<GcodeFilesUpdateError> = serde_json::from_str(&local_var_content).ok();
512        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
513        Err(Error::ResponseError(local_var_error))
514    }
515}
516
517pub async fn gcode_files_update_or_create(configuration: &configuration::Configuration, name: &str, file: std::path::PathBuf, file_hash: &str, octoprint_device: &str) -> Result<crate::models::GcodeFile, Error<GcodeFilesUpdateOrCreateError>> {
518    let local_var_configuration = configuration;
519
520    let local_var_client = &local_var_configuration.client;
521
522    let local_var_uri_str = format!("{}/api/gcode-files/update-or-create/", local_var_configuration.base_path);
523    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
524
525    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
526        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
527    }
528    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
529        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
530    };
531    let mut local_var_form = reqwest::multipart::Form::new();
532    local_var_form = local_var_form.text("name", name.to_string());
533    // TODO: support file upload for 'file' parameter
534    local_var_form = local_var_form.text("file_hash", file_hash.to_string());
535    local_var_form = local_var_form.text("octoprint_device", octoprint_device.to_string());
536    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
537
538    let local_var_req = local_var_req_builder.build()?;
539    let local_var_resp = local_var_client.execute(local_var_req).await?;
540
541    let local_var_status = local_var_resp.status();
542    let local_var_content = local_var_resp.text().await?;
543
544    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
545        serde_json::from_str(&local_var_content).map_err(Error::from)
546    } else {
547        let local_var_entity: Option<GcodeFilesUpdateOrCreateError> = serde_json::from_str(&local_var_content).ok();
548        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
549        Err(Error::ResponseError(local_var_error))
550    }
551}
552
553pub async fn octoprint_devices_create(configuration: &configuration::Configuration, octo_print_device_request: crate::models::OctoPrintDeviceRequest) -> Result<crate::models::OctoPrintDevice, Error<OctoprintDevicesCreateError>> {
554    let local_var_configuration = configuration;
555
556    let local_var_client = &local_var_configuration.client;
557
558    let local_var_uri_str = format!("{}/api/octoprint-devices/", local_var_configuration.base_path);
559    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
560
561    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
562        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
563    }
564    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
565        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
566    };
567    local_var_req_builder = local_var_req_builder.json(&octo_print_device_request);
568
569    let local_var_req = local_var_req_builder.build()?;
570    let local_var_resp = local_var_client.execute(local_var_req).await?;
571
572    let local_var_status = local_var_resp.status();
573    let local_var_content = local_var_resp.text().await?;
574
575    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
576        serde_json::from_str(&local_var_content).map_err(Error::from)
577    } else {
578        let local_var_entity: Option<OctoprintDevicesCreateError> = serde_json::from_str(&local_var_content).ok();
579        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
580        Err(Error::ResponseError(local_var_error))
581    }
582}
583
584pub async fn octoprint_devices_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedOctoPrintDeviceList, Error<OctoprintDevicesListError>> {
585    let local_var_configuration = configuration;
586
587    let local_var_client = &local_var_configuration.client;
588
589    let local_var_uri_str = format!("{}/api/octoprint-devices/", local_var_configuration.base_path);
590    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
591
592    if let Some(ref local_var_str) = page {
593        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
594    }
595    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
596        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
597    }
598    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
599        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
600    };
601
602    let local_var_req = local_var_req_builder.build()?;
603    let local_var_resp = local_var_client.execute(local_var_req).await?;
604
605    let local_var_status = local_var_resp.status();
606    let local_var_content = local_var_resp.text().await?;
607
608    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
609        serde_json::from_str(&local_var_content).map_err(Error::from)
610    } else {
611        let local_var_entity: Option<OctoprintDevicesListError> = serde_json::from_str(&local_var_content).ok();
612        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
613        Err(Error::ResponseError(local_var_error))
614    }
615}
616
617pub async fn octoprint_devices_partial_update(configuration: &configuration::Configuration, id: i32, patched_octo_print_device_request: Option<crate::models::PatchedOctoPrintDeviceRequest>) -> Result<crate::models::OctoPrintDevice, Error<OctoprintDevicesPartialUpdateError>> {
618    let local_var_configuration = configuration;
619
620    let local_var_client = &local_var_configuration.client;
621
622    let local_var_uri_str = format!("{}/api/octoprint-devices/{id}/", local_var_configuration.base_path, id=id);
623    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
624
625    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
626        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
627    }
628    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
629        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
630    };
631    local_var_req_builder = local_var_req_builder.json(&patched_octo_print_device_request);
632
633    let local_var_req = local_var_req_builder.build()?;
634    let local_var_resp = local_var_client.execute(local_var_req).await?;
635
636    let local_var_status = local_var_resp.status();
637    let local_var_content = local_var_resp.text().await?;
638
639    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
640        serde_json::from_str(&local_var_content).map_err(Error::from)
641    } else {
642        let local_var_entity: Option<OctoprintDevicesPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
643        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
644        Err(Error::ResponseError(local_var_error))
645    }
646}
647
648pub async fn octoprint_devices_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::OctoPrintDevice, Error<OctoprintDevicesRetrieveError>> {
649    let local_var_configuration = configuration;
650
651    let local_var_client = &local_var_configuration.client;
652
653    let local_var_uri_str = format!("{}/api/octoprint-devices/{id}/", local_var_configuration.base_path, id=id);
654    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
655
656    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
657        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
658    }
659    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
660        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
661    };
662
663    let local_var_req = local_var_req_builder.build()?;
664    let local_var_resp = local_var_client.execute(local_var_req).await?;
665
666    let local_var_status = local_var_resp.status();
667    let local_var_content = local_var_resp.text().await?;
668
669    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
670        serde_json::from_str(&local_var_content).map_err(Error::from)
671    } else {
672        let local_var_entity: Option<OctoprintDevicesRetrieveError> = serde_json::from_str(&local_var_content).ok();
673        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
674        Err(Error::ResponseError(local_var_error))
675    }
676}
677
678pub async fn octoprint_devices_update(configuration: &configuration::Configuration, id: i32, octo_print_device_request: crate::models::OctoPrintDeviceRequest) -> Result<crate::models::OctoPrintDevice, Error<OctoprintDevicesUpdateError>> {
679    let local_var_configuration = configuration;
680
681    let local_var_client = &local_var_configuration.client;
682
683    let local_var_uri_str = format!("{}/api/octoprint-devices/{id}/", local_var_configuration.base_path, id=id);
684    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
685
686    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
687        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
688    }
689    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
690        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
691    };
692    local_var_req_builder = local_var_req_builder.json(&octo_print_device_request);
693
694    let local_var_req = local_var_req_builder.build()?;
695    let local_var_resp = local_var_client.execute(local_var_req).await?;
696
697    let local_var_status = local_var_resp.status();
698    let local_var_content = local_var_resp.text().await?;
699
700    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
701        serde_json::from_str(&local_var_content).map_err(Error::from)
702    } else {
703        let local_var_entity: Option<OctoprintDevicesUpdateError> = serde_json::from_str(&local_var_content).ok();
704        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
705        Err(Error::ResponseError(local_var_error))
706    }
707}
708
709pub async fn octoprint_devices_update_or_create(configuration: &configuration::Configuration, octo_print_device_request: crate::models::OctoPrintDeviceRequest) -> Result<crate::models::OctoPrintDevice, Error<OctoprintDevicesUpdateOrCreateError>> {
710    let local_var_configuration = configuration;
711
712    let local_var_client = &local_var_configuration.client;
713
714    let local_var_uri_str = format!("{}/api/octoprint-devices/update-or-create/", local_var_configuration.base_path);
715    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
716
717    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
718        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
719    }
720    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
721        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
722    };
723    local_var_req_builder = local_var_req_builder.json(&octo_print_device_request);
724
725    let local_var_req = local_var_req_builder.build()?;
726    let local_var_resp = local_var_client.execute(local_var_req).await?;
727
728    let local_var_status = local_var_resp.status();
729    let local_var_content = local_var_resp.text().await?;
730
731    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
732        serde_json::from_str(&local_var_content).map_err(Error::from)
733    } else {
734        let local_var_entity: Option<OctoprintDevicesUpdateOrCreateError> = serde_json::from_str(&local_var_content).ok();
735        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
736        Err(Error::ResponseError(local_var_error))
737    }
738}
739
740pub async fn print_session_partial_update(configuration: &configuration::Configuration, session: &str, patched_print_session_request: Option<crate::models::PatchedPrintSessionRequest>) -> Result<crate::models::PrintSession, Error<PrintSessionPartialUpdateError>> {
741    let local_var_configuration = configuration;
742
743    let local_var_client = &local_var_configuration.client;
744
745    let local_var_uri_str = format!("{}/api/print-sessions/{session}/", local_var_configuration.base_path, session=crate::apis::urlencode(session));
746    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
747
748    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
749        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
750    }
751    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
752        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
753    };
754    local_var_req_builder = local_var_req_builder.json(&patched_print_session_request);
755
756    let local_var_req = local_var_req_builder.build()?;
757    let local_var_resp = local_var_client.execute(local_var_req).await?;
758
759    let local_var_status = local_var_resp.status();
760    let local_var_content = local_var_resp.text().await?;
761
762    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
763        serde_json::from_str(&local_var_content).map_err(Error::from)
764    } else {
765        let local_var_entity: Option<PrintSessionPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
766        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
767        Err(Error::ResponseError(local_var_error))
768    }
769}
770
771pub async fn print_session_update(configuration: &configuration::Configuration, session: &str, print_session_request: crate::models::PrintSessionRequest) -> Result<crate::models::PrintSession, Error<PrintSessionUpdateError>> {
772    let local_var_configuration = configuration;
773
774    let local_var_client = &local_var_configuration.client;
775
776    let local_var_uri_str = format!("{}/api/print-sessions/{session}/", local_var_configuration.base_path, session=crate::apis::urlencode(session));
777    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
778
779    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
780        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
781    }
782    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
783        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
784    };
785    local_var_req_builder = local_var_req_builder.json(&print_session_request);
786
787    let local_var_req = local_var_req_builder.build()?;
788    let local_var_resp = local_var_client.execute(local_var_req).await?;
789
790    let local_var_status = local_var_resp.status();
791    let local_var_content = local_var_resp.text().await?;
792
793    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
794        serde_json::from_str(&local_var_content).map_err(Error::from)
795    } else {
796        let local_var_entity: Option<PrintSessionUpdateError> = serde_json::from_str(&local_var_content).ok();
797        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
798        Err(Error::ResponseError(local_var_error))
799    }
800}
801
802pub async fn print_sessions_create(configuration: &configuration::Configuration, print_session_request: crate::models::PrintSessionRequest) -> Result<crate::models::PrintSession, Error<PrintSessionsCreateError>> {
803    let local_var_configuration = configuration;
804
805    let local_var_client = &local_var_configuration.client;
806
807    let local_var_uri_str = format!("{}/api/print-sessions/", local_var_configuration.base_path);
808    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
809
810    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
811        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
812    }
813    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
814        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
815    };
816    local_var_req_builder = local_var_req_builder.json(&print_session_request);
817
818    let local_var_req = local_var_req_builder.build()?;
819    let local_var_resp = local_var_client.execute(local_var_req).await?;
820
821    let local_var_status = local_var_resp.status();
822    let local_var_content = local_var_resp.text().await?;
823
824    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
825        serde_json::from_str(&local_var_content).map_err(Error::from)
826    } else {
827        let local_var_entity: Option<PrintSessionsCreateError> = serde_json::from_str(&local_var_content).ok();
828        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
829        Err(Error::ResponseError(local_var_error))
830    }
831}
832
833pub async fn print_sessions_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedPrintSessionList, Error<PrintSessionsListError>> {
834    let local_var_configuration = configuration;
835
836    let local_var_client = &local_var_configuration.client;
837
838    let local_var_uri_str = format!("{}/api/print-sessions/", local_var_configuration.base_path);
839    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
840
841    if let Some(ref local_var_str) = page {
842        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
843    }
844    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
845        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
846    }
847    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
848        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
849    };
850
851    let local_var_req = local_var_req_builder.build()?;
852    let local_var_resp = local_var_client.execute(local_var_req).await?;
853
854    let local_var_status = local_var_resp.status();
855    let local_var_content = local_var_resp.text().await?;
856
857    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
858        serde_json::from_str(&local_var_content).map_err(Error::from)
859    } else {
860        let local_var_entity: Option<PrintSessionsListError> = serde_json::from_str(&local_var_content).ok();
861        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
862        Err(Error::ResponseError(local_var_error))
863    }
864}
865
866pub async fn print_sessions_retrieve(configuration: &configuration::Configuration, session: &str) -> Result<crate::models::PrintSession, Error<PrintSessionsRetrieveError>> {
867    let local_var_configuration = configuration;
868
869    let local_var_client = &local_var_configuration.client;
870
871    let local_var_uri_str = format!("{}/api/print-sessions/{session}/", local_var_configuration.base_path, session=crate::apis::urlencode(session));
872    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
873
874    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
875        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
876    }
877    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
878        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
879    };
880
881    let local_var_req = local_var_req_builder.build()?;
882    let local_var_resp = local_var_client.execute(local_var_req).await?;
883
884    let local_var_status = local_var_resp.status();
885    let local_var_content = local_var_resp.text().await?;
886
887    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
888        serde_json::from_str(&local_var_content).map_err(Error::from)
889    } else {
890        let local_var_entity: Option<PrintSessionsRetrieveError> = serde_json::from_str(&local_var_content).ok();
891        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
892        Err(Error::ResponseError(local_var_error))
893    }
894}
895
896pub async fn printer_profiles_create(configuration: &configuration::Configuration, printer_profile_request: crate::models::PrinterProfileRequest) -> Result<crate::models::PrintSession, Error<PrinterProfilesCreateError>> {
897    let local_var_configuration = configuration;
898
899    let local_var_client = &local_var_configuration.client;
900
901    let local_var_uri_str = format!("{}/api/printer-profiles/", local_var_configuration.base_path);
902    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
903
904    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
905        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
906    }
907    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
908        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
909    };
910    local_var_req_builder = local_var_req_builder.json(&printer_profile_request);
911
912    let local_var_req = local_var_req_builder.build()?;
913    let local_var_resp = local_var_client.execute(local_var_req).await?;
914
915    let local_var_status = local_var_resp.status();
916    let local_var_content = local_var_resp.text().await?;
917
918    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
919        serde_json::from_str(&local_var_content).map_err(Error::from)
920    } else {
921        let local_var_entity: Option<PrinterProfilesCreateError> = serde_json::from_str(&local_var_content).ok();
922        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
923        Err(Error::ResponseError(local_var_error))
924    }
925}
926
927pub async fn printer_profiles_list(configuration: &configuration::Configuration, name: Option<&str>, page: Option<i32>, user: Option<i32>) -> Result<crate::models::PaginatedPrinterProfileList, Error<PrinterProfilesListError>> {
928    let local_var_configuration = configuration;
929
930    let local_var_client = &local_var_configuration.client;
931
932    let local_var_uri_str = format!("{}/api/printer-profiles/", local_var_configuration.base_path);
933    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
934
935    if let Some(ref local_var_str) = name {
936        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
937    }
938    if let Some(ref local_var_str) = page {
939        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
940    }
941    if let Some(ref local_var_str) = user {
942        local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
943    }
944    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
945        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
946    }
947    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
948        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
949    };
950
951    let local_var_req = local_var_req_builder.build()?;
952    let local_var_resp = local_var_client.execute(local_var_req).await?;
953
954    let local_var_status = local_var_resp.status();
955    let local_var_content = local_var_resp.text().await?;
956
957    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
958        serde_json::from_str(&local_var_content).map_err(Error::from)
959    } else {
960        let local_var_entity: Option<PrinterProfilesListError> = serde_json::from_str(&local_var_content).ok();
961        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
962        Err(Error::ResponseError(local_var_error))
963    }
964}
965
966pub async fn printer_profiles_partial_update(configuration: &configuration::Configuration, id: i32, patched_printer_profile_request: Option<crate::models::PatchedPrinterProfileRequest>) -> Result<crate::models::PrinterProfile, Error<PrinterProfilesPartialUpdateError>> {
967    let local_var_configuration = configuration;
968
969    let local_var_client = &local_var_configuration.client;
970
971    let local_var_uri_str = format!("{}/api/printer-profiles/{id}/", local_var_configuration.base_path, id=id);
972    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
973
974    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
975        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
976    }
977    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
978        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
979    };
980    local_var_req_builder = local_var_req_builder.json(&patched_printer_profile_request);
981
982    let local_var_req = local_var_req_builder.build()?;
983    let local_var_resp = local_var_client.execute(local_var_req).await?;
984
985    let local_var_status = local_var_resp.status();
986    let local_var_content = local_var_resp.text().await?;
987
988    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
989        serde_json::from_str(&local_var_content).map_err(Error::from)
990    } else {
991        let local_var_entity: Option<PrinterProfilesPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
992        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
993        Err(Error::ResponseError(local_var_error))
994    }
995}
996
997pub async fn printer_profiles_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::PrinterProfile, Error<PrinterProfilesRetrieveError>> {
998    let local_var_configuration = configuration;
999
1000    let local_var_client = &local_var_configuration.client;
1001
1002    let local_var_uri_str = format!("{}/api/printer-profiles/{id}/", local_var_configuration.base_path, id=id);
1003    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1004
1005    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1006        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1007    }
1008    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1009        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1010    };
1011
1012    let local_var_req = local_var_req_builder.build()?;
1013    let local_var_resp = local_var_client.execute(local_var_req).await?;
1014
1015    let local_var_status = local_var_resp.status();
1016    let local_var_content = local_var_resp.text().await?;
1017
1018    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1019        serde_json::from_str(&local_var_content).map_err(Error::from)
1020    } else {
1021        let local_var_entity: Option<PrinterProfilesRetrieveError> = serde_json::from_str(&local_var_content).ok();
1022        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1023        Err(Error::ResponseError(local_var_error))
1024    }
1025}
1026
1027pub async fn printer_profiles_update(configuration: &configuration::Configuration, id: i32, printer_profile_request: crate::models::PrinterProfileRequest) -> Result<crate::models::PrinterProfile, Error<PrinterProfilesUpdateError>> {
1028    let local_var_configuration = configuration;
1029
1030    let local_var_client = &local_var_configuration.client;
1031
1032    let local_var_uri_str = format!("{}/api/printer-profiles/{id}/", local_var_configuration.base_path, id=id);
1033    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1034
1035    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1036        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1037    }
1038    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1039        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1040    };
1041    local_var_req_builder = local_var_req_builder.json(&printer_profile_request);
1042
1043    let local_var_req = local_var_req_builder.build()?;
1044    let local_var_resp = local_var_client.execute(local_var_req).await?;
1045
1046    let local_var_status = local_var_resp.status();
1047    let local_var_content = local_var_resp.text().await?;
1048
1049    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1050        serde_json::from_str(&local_var_content).map_err(Error::from)
1051    } else {
1052        let local_var_entity: Option<PrinterProfilesUpdateError> = serde_json::from_str(&local_var_content).ok();
1053        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1054        Err(Error::ResponseError(local_var_error))
1055    }
1056}
1057
1058pub async fn printer_profiles_update_or_create(configuration: &configuration::Configuration, printer_profile_request: crate::models::PrinterProfileRequest) -> Result<crate::models::PrinterProfile, Error<PrinterProfilesUpdateOrCreateError>> {
1059    let local_var_configuration = configuration;
1060
1061    let local_var_client = &local_var_configuration.client;
1062
1063    let local_var_uri_str = format!("{}/api/printer-profiles/update-or-create/", local_var_configuration.base_path);
1064    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1065
1066    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1067        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1068    }
1069    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1070        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1071    };
1072    local_var_req_builder = local_var_req_builder.json(&printer_profile_request);
1073
1074    let local_var_req = local_var_req_builder.build()?;
1075    let local_var_resp = local_var_client.execute(local_var_req).await?;
1076
1077    let local_var_status = local_var_resp.status();
1078    let local_var_content = local_var_resp.text().await?;
1079
1080    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1081        serde_json::from_str(&local_var_content).map_err(Error::from)
1082    } else {
1083        let local_var_entity: Option<PrinterProfilesUpdateOrCreateError> = serde_json::from_str(&local_var_content).ok();
1084        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1085        Err(Error::ResponseError(local_var_error))
1086    }
1087}
1088