print_nanny_api_client/apis/
ml_ops_api.rs1use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeviceCalibrationUpdateOrCreateError {
22 Status400(crate::models::DeviceCalibration),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum DeviceCalibrationsListError {
30 Status400(crate::models::DeviceCalibration),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum DeviceCalibrationsPartialUpdateError {
38 Status400(crate::models::DeviceCalibration),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum DeviceCalibrationsRetrieveError {
46 Status400(crate::models::DeviceCalibration),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum DeviceCalibrationsUpdateError {
54 Status400(crate::models::DeviceCalibration),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum ExperimentDeviceConfigsListError {
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum ExperimentDeviceConfigsRetrieveError {
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum ExperimentsListError {
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum ExperimentsRetrieveError {
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum ModelArtifactsListError {
90 UnknownValue(serde_json::Value),
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(untagged)]
96pub enum ModelArtifactsRetrieveError {
97 UnknownValue(serde_json::Value),
98}
99
100
101pub async fn device_calibration_update_or_create(configuration: &configuration::Configuration, device_calibration_request: crate::models::DeviceCalibrationRequest) -> Result<crate::models::DeviceCalibration, Error<DeviceCalibrationUpdateOrCreateError>> {
102 let local_var_configuration = configuration;
103
104 let local_var_client = &local_var_configuration.client;
105
106 let local_var_uri_str = format!("{}/api/device-calibrations/update-or-create/", local_var_configuration.base_path);
107 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
108
109 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
110 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
111 }
112 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
113 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
114 };
115 local_var_req_builder = local_var_req_builder.json(&device_calibration_request);
116
117 let local_var_req = local_var_req_builder.build()?;
118 let local_var_resp = local_var_client.execute(local_var_req).await?;
119
120 let local_var_status = local_var_resp.status();
121 let local_var_content = local_var_resp.text().await?;
122
123 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
124 serde_json::from_str(&local_var_content).map_err(Error::from)
125 } else {
126 let local_var_entity: Option<DeviceCalibrationUpdateOrCreateError> = serde_json::from_str(&local_var_content).ok();
127 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
128 Err(Error::ResponseError(local_var_error))
129 }
130}
131
132pub async fn device_calibrations_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedDeviceCalibrationList, Error<DeviceCalibrationsListError>> {
133 let local_var_configuration = configuration;
134
135 let local_var_client = &local_var_configuration.client;
136
137 let local_var_uri_str = format!("{}/api/device-calibrations/", local_var_configuration.base_path);
138 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
139
140 if let Some(ref local_var_str) = page {
141 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
142 }
143 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
144 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
145 }
146 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
147 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
148 };
149
150 let local_var_req = local_var_req_builder.build()?;
151 let local_var_resp = local_var_client.execute(local_var_req).await?;
152
153 let local_var_status = local_var_resp.status();
154 let local_var_content = local_var_resp.text().await?;
155
156 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
157 serde_json::from_str(&local_var_content).map_err(Error::from)
158 } else {
159 let local_var_entity: Option<DeviceCalibrationsListError> = serde_json::from_str(&local_var_content).ok();
160 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
161 Err(Error::ResponseError(local_var_error))
162 }
163}
164
165pub async fn device_calibrations_partial_update(configuration: &configuration::Configuration, id: i32, patched_device_calibration_request: Option<crate::models::PatchedDeviceCalibrationRequest>) -> Result<crate::models::DeviceCalibration, Error<DeviceCalibrationsPartialUpdateError>> {
166 let local_var_configuration = configuration;
167
168 let local_var_client = &local_var_configuration.client;
169
170 let local_var_uri_str = format!("{}/api/device-calibrations/{id}/", local_var_configuration.base_path, id=id);
171 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
172
173 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
174 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
175 }
176 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
177 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
178 };
179 local_var_req_builder = local_var_req_builder.json(&patched_device_calibration_request);
180
181 let local_var_req = local_var_req_builder.build()?;
182 let local_var_resp = local_var_client.execute(local_var_req).await?;
183
184 let local_var_status = local_var_resp.status();
185 let local_var_content = local_var_resp.text().await?;
186
187 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
188 serde_json::from_str(&local_var_content).map_err(Error::from)
189 } else {
190 let local_var_entity: Option<DeviceCalibrationsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
191 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
192 Err(Error::ResponseError(local_var_error))
193 }
194}
195
196pub async fn device_calibrations_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::DeviceCalibration, Error<DeviceCalibrationsRetrieveError>> {
197 let local_var_configuration = configuration;
198
199 let local_var_client = &local_var_configuration.client;
200
201 let local_var_uri_str = format!("{}/api/device-calibrations/{id}/", local_var_configuration.base_path, id=id);
202 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
203
204 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
205 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
206 }
207 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
208 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
209 };
210
211 let local_var_req = local_var_req_builder.build()?;
212 let local_var_resp = local_var_client.execute(local_var_req).await?;
213
214 let local_var_status = local_var_resp.status();
215 let local_var_content = local_var_resp.text().await?;
216
217 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
218 serde_json::from_str(&local_var_content).map_err(Error::from)
219 } else {
220 let local_var_entity: Option<DeviceCalibrationsRetrieveError> = serde_json::from_str(&local_var_content).ok();
221 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
222 Err(Error::ResponseError(local_var_error))
223 }
224}
225
226pub async fn device_calibrations_update(configuration: &configuration::Configuration, id: i32, device_calibration_request: crate::models::DeviceCalibrationRequest) -> Result<crate::models::DeviceCalibration, Error<DeviceCalibrationsUpdateError>> {
227 let local_var_configuration = configuration;
228
229 let local_var_client = &local_var_configuration.client;
230
231 let local_var_uri_str = format!("{}/api/device-calibrations/{id}/", local_var_configuration.base_path, id=id);
232 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
233
234 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
235 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
236 }
237 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
238 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
239 };
240 local_var_req_builder = local_var_req_builder.json(&device_calibration_request);
241
242 let local_var_req = local_var_req_builder.build()?;
243 let local_var_resp = local_var_client.execute(local_var_req).await?;
244
245 let local_var_status = local_var_resp.status();
246 let local_var_content = local_var_resp.text().await?;
247
248 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
249 serde_json::from_str(&local_var_content).map_err(Error::from)
250 } else {
251 let local_var_entity: Option<DeviceCalibrationsUpdateError> = serde_json::from_str(&local_var_content).ok();
252 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
253 Err(Error::ResponseError(local_var_error))
254 }
255}
256
257pub async fn experiment_device_configs_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedExperimentDeviceConfigList, Error<ExperimentDeviceConfigsListError>> {
258 let local_var_configuration = configuration;
259
260 let local_var_client = &local_var_configuration.client;
261
262 let local_var_uri_str = format!("{}/api/experiment-device-configs/", local_var_configuration.base_path);
263 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
264
265 if let Some(ref local_var_str) = page {
266 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
267 }
268 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
269 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
270 }
271 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
272 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
273 };
274
275 let local_var_req = local_var_req_builder.build()?;
276 let local_var_resp = local_var_client.execute(local_var_req).await?;
277
278 let local_var_status = local_var_resp.status();
279 let local_var_content = local_var_resp.text().await?;
280
281 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
282 serde_json::from_str(&local_var_content).map_err(Error::from)
283 } else {
284 let local_var_entity: Option<ExperimentDeviceConfigsListError> = serde_json::from_str(&local_var_content).ok();
285 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
286 Err(Error::ResponseError(local_var_error))
287 }
288}
289
290pub async fn experiment_device_configs_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::ExperimentDeviceConfig, Error<ExperimentDeviceConfigsRetrieveError>> {
291 let local_var_configuration = configuration;
292
293 let local_var_client = &local_var_configuration.client;
294
295 let local_var_uri_str = format!("{}/api/experiment-device-configs/{id}/", local_var_configuration.base_path, id=id);
296 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
297
298 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
299 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
300 }
301 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
302 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
303 };
304
305 let local_var_req = local_var_req_builder.build()?;
306 let local_var_resp = local_var_client.execute(local_var_req).await?;
307
308 let local_var_status = local_var_resp.status();
309 let local_var_content = local_var_resp.text().await?;
310
311 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
312 serde_json::from_str(&local_var_content).map_err(Error::from)
313 } else {
314 let local_var_entity: Option<ExperimentDeviceConfigsRetrieveError> = serde_json::from_str(&local_var_content).ok();
315 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
316 Err(Error::ResponseError(local_var_error))
317 }
318}
319
320pub async fn experiments_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedExperimentList, Error<ExperimentsListError>> {
321 let local_var_configuration = configuration;
322
323 let local_var_client = &local_var_configuration.client;
324
325 let local_var_uri_str = format!("{}/api/experiments/", local_var_configuration.base_path);
326 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
327
328 if let Some(ref local_var_str) = page {
329 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
330 }
331 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
332 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
333 }
334 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
335 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
336 };
337
338 let local_var_req = local_var_req_builder.build()?;
339 let local_var_resp = local_var_client.execute(local_var_req).await?;
340
341 let local_var_status = local_var_resp.status();
342 let local_var_content = local_var_resp.text().await?;
343
344 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
345 serde_json::from_str(&local_var_content).map_err(Error::from)
346 } else {
347 let local_var_entity: Option<ExperimentsListError> = serde_json::from_str(&local_var_content).ok();
348 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
349 Err(Error::ResponseError(local_var_error))
350 }
351}
352
353pub async fn experiments_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::Experiment, Error<ExperimentsRetrieveError>> {
354 let local_var_configuration = configuration;
355
356 let local_var_client = &local_var_configuration.client;
357
358 let local_var_uri_str = format!("{}/api/experiments/{id}/", local_var_configuration.base_path, id=id);
359 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
360
361 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
362 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
363 }
364 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
365 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
366 };
367
368 let local_var_req = local_var_req_builder.build()?;
369 let local_var_resp = local_var_client.execute(local_var_req).await?;
370
371 let local_var_status = local_var_resp.status();
372 let local_var_content = local_var_resp.text().await?;
373
374 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
375 serde_json::from_str(&local_var_content).map_err(Error::from)
376 } else {
377 let local_var_entity: Option<ExperimentsRetrieveError> = serde_json::from_str(&local_var_content).ok();
378 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
379 Err(Error::ResponseError(local_var_error))
380 }
381}
382
383pub async fn model_artifacts_list(configuration: &configuration::Configuration, page: Option<i32>) -> Result<crate::models::PaginatedModelArtifactList, Error<ModelArtifactsListError>> {
384 let local_var_configuration = configuration;
385
386 let local_var_client = &local_var_configuration.client;
387
388 let local_var_uri_str = format!("{}/api/model-artifacts/", local_var_configuration.base_path);
389 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
390
391 if let Some(ref local_var_str) = page {
392 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
393 }
394 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
395 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
396 }
397 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
398 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
399 };
400
401 let local_var_req = local_var_req_builder.build()?;
402 let local_var_resp = local_var_client.execute(local_var_req).await?;
403
404 let local_var_status = local_var_resp.status();
405 let local_var_content = local_var_resp.text().await?;
406
407 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
408 serde_json::from_str(&local_var_content).map_err(Error::from)
409 } else {
410 let local_var_entity: Option<ModelArtifactsListError> = serde_json::from_str(&local_var_content).ok();
411 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
412 Err(Error::ResponseError(local_var_error))
413 }
414}
415
416pub async fn model_artifacts_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<crate::models::ModelArtifact, Error<ModelArtifactsRetrieveError>> {
417 let local_var_configuration = configuration;
418
419 let local_var_client = &local_var_configuration.client;
420
421 let local_var_uri_str = format!("{}/api/model-artifacts/{id}/", local_var_configuration.base_path, id=id);
422 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
423
424 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
425 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
426 }
427 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
428 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
429 };
430
431 let local_var_req = local_var_req_builder.build()?;
432 let local_var_resp = local_var_client.execute(local_var_req).await?;
433
434 let local_var_status = local_var_resp.status();
435 let local_var_content = local_var_resp.text().await?;
436
437 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
438 serde_json::from_str(&local_var_content).map_err(Error::from)
439 } else {
440 let local_var_entity: Option<ModelArtifactsRetrieveError> = serde_json::from_str(&local_var_content).ok();
441 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
442 Err(Error::ResponseError(local_var_error))
443 }
444}
445