Skip to main content

geoengine_api_client/apis/
user_api.rs

1/*
2 * Geo Engine API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * Contact: dev@geoengine.de
7 * Generated by: https://openapi-generator.tech
8 */
9
10
11use reqwest;
12use serde::{Deserialize, Serialize, de::Error as _};
13use crate::{apis::ResponseContent, models};
14use super::{Error, configuration, ContentType};
15
16
17/// struct for typed errors of method [`add_role_handler`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum AddRoleHandlerError {
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`assign_role_handler`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum AssignRoleHandlerError {
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`computation_quota_handler`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum ComputationQuotaHandlerError {
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`computations_quota_handler`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum ComputationsQuotaHandlerError {
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`data_usage_handler`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum DataUsageHandlerError {
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`data_usage_summary_handler`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum DataUsageSummaryHandlerError {
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`get_role_by_name_handler`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum GetRoleByNameHandlerError {
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`get_role_descriptions`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetRoleDescriptionsError {
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`get_user_quota_handler`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum GetUserQuotaHandlerError {
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`quota_handler`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum QuotaHandlerError {
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`remove_role_handler`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum RemoveRoleHandlerError {
91    UnknownValue(serde_json::Value),
92}
93
94/// struct for typed errors of method [`revoke_role_handler`]
95#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum RevokeRoleHandlerError {
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`update_user_quota_handler`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum UpdateUserQuotaHandlerError {
105    UnknownValue(serde_json::Value),
106}
107
108
109pub async fn add_role_handler(configuration: &configuration::Configuration, add_role: models::AddRole) -> Result<models::IdResponse, Error<AddRoleHandlerError>> {
110    // add a prefix to parameters to efficiently prevent name collisions
111    let p_body_add_role = add_role;
112
113    let uri_str = format!("{}/roles", configuration.base_path);
114    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
115
116    if let Some(ref user_agent) = configuration.user_agent {
117        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
118    }
119    if let Some(ref token) = configuration.bearer_access_token {
120        req_builder = req_builder.bearer_auth(token.to_owned());
121    };
122    req_builder = req_builder.json(&p_body_add_role);
123
124    let req = req_builder.build()?;
125    let resp = configuration.client.execute(req).await?;
126
127    let status = resp.status();
128    let content_type = resp
129        .headers()
130        .get("content-type")
131        .and_then(|v| v.to_str().ok())
132        .unwrap_or("application/octet-stream");
133    let content_type = super::ContentType::from(content_type);
134
135    if !status.is_client_error() && !status.is_server_error() {
136        let content = resp.text().await?;
137        match content_type {
138            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
139            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IdResponse`"))),
140            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IdResponse`")))),
141        }
142    } else {
143        let content = resp.text().await?;
144        let entity: Option<AddRoleHandlerError> = serde_json::from_str(&content).ok();
145        Err(Error::ResponseError(ResponseContent { status, content, entity }))
146    }
147}
148
149pub async fn assign_role_handler(configuration: &configuration::Configuration, user: &str, role: &str) -> Result<(), Error<AssignRoleHandlerError>> {
150    // add a prefix to parameters to efficiently prevent name collisions
151    let p_path_user = user;
152    let p_path_role = role;
153
154    let uri_str = format!("{}/users/{user}/roles/{role}", configuration.base_path, user=crate::apis::urlencode(p_path_user), role=crate::apis::urlencode(p_path_role));
155    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
156
157    if let Some(ref user_agent) = configuration.user_agent {
158        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
159    }
160    if let Some(ref token) = configuration.bearer_access_token {
161        req_builder = req_builder.bearer_auth(token.to_owned());
162    };
163
164    let req = req_builder.build()?;
165    let resp = configuration.client.execute(req).await?;
166
167    let status = resp.status();
168
169    if !status.is_client_error() && !status.is_server_error() {
170        Ok(())
171    } else {
172        let content = resp.text().await?;
173        let entity: Option<AssignRoleHandlerError> = serde_json::from_str(&content).ok();
174        Err(Error::ResponseError(ResponseContent { status, content, entity }))
175    }
176}
177
178pub async fn computation_quota_handler(configuration: &configuration::Configuration, computation: &str) -> Result<Vec<models::OperatorQuota>, Error<ComputationQuotaHandlerError>> {
179    // add a prefix to parameters to efficiently prevent name collisions
180    let p_path_computation = computation;
181
182    let uri_str = format!("{}/quota/computations/{computation}", configuration.base_path, computation=crate::apis::urlencode(p_path_computation));
183    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
184
185    if let Some(ref user_agent) = configuration.user_agent {
186        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
187    }
188    if let Some(ref token) = configuration.bearer_access_token {
189        req_builder = req_builder.bearer_auth(token.to_owned());
190    };
191
192    let req = req_builder.build()?;
193    let resp = configuration.client.execute(req).await?;
194
195    let status = resp.status();
196    let content_type = resp
197        .headers()
198        .get("content-type")
199        .and_then(|v| v.to_str().ok())
200        .unwrap_or("application/octet-stream");
201    let content_type = super::ContentType::from(content_type);
202
203    if !status.is_client_error() && !status.is_server_error() {
204        let content = resp.text().await?;
205        match content_type {
206            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
207            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::OperatorQuota&gt;`"))),
208            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::OperatorQuota&gt;`")))),
209        }
210    } else {
211        let content = resp.text().await?;
212        let entity: Option<ComputationQuotaHandlerError> = serde_json::from_str(&content).ok();
213        Err(Error::ResponseError(ResponseContent { status, content, entity }))
214    }
215}
216
217pub async fn computations_quota_handler(configuration: &configuration::Configuration, offset: i32, limit: i32) -> Result<Vec<models::ComputationQuota>, Error<ComputationsQuotaHandlerError>> {
218    // add a prefix to parameters to efficiently prevent name collisions
219    let p_query_offset = offset;
220    let p_query_limit = limit;
221
222    let uri_str = format!("{}/quota/computations", configuration.base_path);
223    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
224
225    req_builder = req_builder.query(&[("offset", &p_query_offset.to_string())]);
226    req_builder = req_builder.query(&[("limit", &p_query_limit.to_string())]);
227    if let Some(ref user_agent) = configuration.user_agent {
228        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
229    }
230    if let Some(ref token) = configuration.bearer_access_token {
231        req_builder = req_builder.bearer_auth(token.to_owned());
232    };
233
234    let req = req_builder.build()?;
235    let resp = configuration.client.execute(req).await?;
236
237    let status = resp.status();
238    let content_type = resp
239        .headers()
240        .get("content-type")
241        .and_then(|v| v.to_str().ok())
242        .unwrap_or("application/octet-stream");
243    let content_type = super::ContentType::from(content_type);
244
245    if !status.is_client_error() && !status.is_server_error() {
246        let content = resp.text().await?;
247        match content_type {
248            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
249            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::ComputationQuota&gt;`"))),
250            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::ComputationQuota&gt;`")))),
251        }
252    } else {
253        let content = resp.text().await?;
254        let entity: Option<ComputationsQuotaHandlerError> = serde_json::from_str(&content).ok();
255        Err(Error::ResponseError(ResponseContent { status, content, entity }))
256    }
257}
258
259pub async fn data_usage_handler(configuration: &configuration::Configuration, offset: i64, limit: i64) -> Result<Vec<models::DataUsage>, Error<DataUsageHandlerError>> {
260    // add a prefix to parameters to efficiently prevent name collisions
261    let p_query_offset = offset;
262    let p_query_limit = limit;
263
264    let uri_str = format!("{}/quota/dataUsage", configuration.base_path);
265    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
266
267    req_builder = req_builder.query(&[("offset", &p_query_offset.to_string())]);
268    req_builder = req_builder.query(&[("limit", &p_query_limit.to_string())]);
269    if let Some(ref user_agent) = configuration.user_agent {
270        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
271    }
272    if let Some(ref token) = configuration.bearer_access_token {
273        req_builder = req_builder.bearer_auth(token.to_owned());
274    };
275
276    let req = req_builder.build()?;
277    let resp = configuration.client.execute(req).await?;
278
279    let status = resp.status();
280    let content_type = resp
281        .headers()
282        .get("content-type")
283        .and_then(|v| v.to_str().ok())
284        .unwrap_or("application/octet-stream");
285    let content_type = super::ContentType::from(content_type);
286
287    if !status.is_client_error() && !status.is_server_error() {
288        let content = resp.text().await?;
289        match content_type {
290            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
291            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::DataUsage&gt;`"))),
292            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::DataUsage&gt;`")))),
293        }
294    } else {
295        let content = resp.text().await?;
296        let entity: Option<DataUsageHandlerError> = serde_json::from_str(&content).ok();
297        Err(Error::ResponseError(ResponseContent { status, content, entity }))
298    }
299}
300
301pub async fn data_usage_summary_handler(configuration: &configuration::Configuration, granularity: models::UsageSummaryGranularity, offset: i64, limit: i64, dataset: Option<&str>) -> Result<Vec<models::DataUsageSummary>, Error<DataUsageSummaryHandlerError>> {
302    // add a prefix to parameters to efficiently prevent name collisions
303    let p_query_granularity = granularity;
304    let p_query_offset = offset;
305    let p_query_limit = limit;
306    let p_query_dataset = dataset;
307
308    let uri_str = format!("{}/quota/dataUsage/summary", configuration.base_path);
309    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
310
311    req_builder = req_builder.query(&[("granularity", &p_query_granularity.to_string())]);
312    req_builder = req_builder.query(&[("offset", &p_query_offset.to_string())]);
313    req_builder = req_builder.query(&[("limit", &p_query_limit.to_string())]);
314    if let Some(ref param_value) = p_query_dataset {
315        req_builder = req_builder.query(&[("dataset", &param_value.to_string())]);
316    }
317    if let Some(ref user_agent) = configuration.user_agent {
318        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
319    }
320    if let Some(ref token) = configuration.bearer_access_token {
321        req_builder = req_builder.bearer_auth(token.to_owned());
322    };
323
324    let req = req_builder.build()?;
325    let resp = configuration.client.execute(req).await?;
326
327    let status = resp.status();
328    let content_type = resp
329        .headers()
330        .get("content-type")
331        .and_then(|v| v.to_str().ok())
332        .unwrap_or("application/octet-stream");
333    let content_type = super::ContentType::from(content_type);
334
335    if !status.is_client_error() && !status.is_server_error() {
336        let content = resp.text().await?;
337        match content_type {
338            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
339            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::DataUsageSummary&gt;`"))),
340            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::DataUsageSummary&gt;`")))),
341        }
342    } else {
343        let content = resp.text().await?;
344        let entity: Option<DataUsageSummaryHandlerError> = serde_json::from_str(&content).ok();
345        Err(Error::ResponseError(ResponseContent { status, content, entity }))
346    }
347}
348
349pub async fn get_role_by_name_handler(configuration: &configuration::Configuration, name: &str) -> Result<models::IdResponse, Error<GetRoleByNameHandlerError>> {
350    // add a prefix to parameters to efficiently prevent name collisions
351    let p_path_name = name;
352
353    let uri_str = format!("{}/roles/byName/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
354    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
355
356    if let Some(ref user_agent) = configuration.user_agent {
357        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
358    }
359    if let Some(ref token) = configuration.bearer_access_token {
360        req_builder = req_builder.bearer_auth(token.to_owned());
361    };
362
363    let req = req_builder.build()?;
364    let resp = configuration.client.execute(req).await?;
365
366    let status = resp.status();
367    let content_type = resp
368        .headers()
369        .get("content-type")
370        .and_then(|v| v.to_str().ok())
371        .unwrap_or("application/octet-stream");
372    let content_type = super::ContentType::from(content_type);
373
374    if !status.is_client_error() && !status.is_server_error() {
375        let content = resp.text().await?;
376        match content_type {
377            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
378            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IdResponse`"))),
379            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IdResponse`")))),
380        }
381    } else {
382        let content = resp.text().await?;
383        let entity: Option<GetRoleByNameHandlerError> = serde_json::from_str(&content).ok();
384        Err(Error::ResponseError(ResponseContent { status, content, entity }))
385    }
386}
387
388pub async fn get_role_descriptions(configuration: &configuration::Configuration, ) -> Result<Vec<models::RoleDescription>, Error<GetRoleDescriptionsError>> {
389
390    let uri_str = format!("{}/user/roles/descriptions", configuration.base_path);
391    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
392
393    if let Some(ref user_agent) = configuration.user_agent {
394        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
395    }
396    if let Some(ref token) = configuration.bearer_access_token {
397        req_builder = req_builder.bearer_auth(token.to_owned());
398    };
399
400    let req = req_builder.build()?;
401    let resp = configuration.client.execute(req).await?;
402
403    let status = resp.status();
404    let content_type = resp
405        .headers()
406        .get("content-type")
407        .and_then(|v| v.to_str().ok())
408        .unwrap_or("application/octet-stream");
409    let content_type = super::ContentType::from(content_type);
410
411    if !status.is_client_error() && !status.is_server_error() {
412        let content = resp.text().await?;
413        match content_type {
414            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
415            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::RoleDescription&gt;`"))),
416            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::RoleDescription&gt;`")))),
417        }
418    } else {
419        let content = resp.text().await?;
420        let entity: Option<GetRoleDescriptionsError> = serde_json::from_str(&content).ok();
421        Err(Error::ResponseError(ResponseContent { status, content, entity }))
422    }
423}
424
425pub async fn get_user_quota_handler(configuration: &configuration::Configuration, user: &str) -> Result<models::Quota, Error<GetUserQuotaHandlerError>> {
426    // add a prefix to parameters to efficiently prevent name collisions
427    let p_path_user = user;
428
429    let uri_str = format!("{}/quotas/{user}", configuration.base_path, user=crate::apis::urlencode(p_path_user));
430    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
431
432    if let Some(ref user_agent) = configuration.user_agent {
433        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
434    }
435    if let Some(ref token) = configuration.bearer_access_token {
436        req_builder = req_builder.bearer_auth(token.to_owned());
437    };
438
439    let req = req_builder.build()?;
440    let resp = configuration.client.execute(req).await?;
441
442    let status = resp.status();
443    let content_type = resp
444        .headers()
445        .get("content-type")
446        .and_then(|v| v.to_str().ok())
447        .unwrap_or("application/octet-stream");
448    let content_type = super::ContentType::from(content_type);
449
450    if !status.is_client_error() && !status.is_server_error() {
451        let content = resp.text().await?;
452        match content_type {
453            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
454            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Quota`"))),
455            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Quota`")))),
456        }
457    } else {
458        let content = resp.text().await?;
459        let entity: Option<GetUserQuotaHandlerError> = serde_json::from_str(&content).ok();
460        Err(Error::ResponseError(ResponseContent { status, content, entity }))
461    }
462}
463
464pub async fn quota_handler(configuration: &configuration::Configuration, ) -> Result<models::Quota, Error<QuotaHandlerError>> {
465
466    let uri_str = format!("{}/quota", configuration.base_path);
467    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
468
469    if let Some(ref user_agent) = configuration.user_agent {
470        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
471    }
472    if let Some(ref token) = configuration.bearer_access_token {
473        req_builder = req_builder.bearer_auth(token.to_owned());
474    };
475
476    let req = req_builder.build()?;
477    let resp = configuration.client.execute(req).await?;
478
479    let status = resp.status();
480    let content_type = resp
481        .headers()
482        .get("content-type")
483        .and_then(|v| v.to_str().ok())
484        .unwrap_or("application/octet-stream");
485    let content_type = super::ContentType::from(content_type);
486
487    if !status.is_client_error() && !status.is_server_error() {
488        let content = resp.text().await?;
489        match content_type {
490            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
491            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Quota`"))),
492            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Quota`")))),
493        }
494    } else {
495        let content = resp.text().await?;
496        let entity: Option<QuotaHandlerError> = serde_json::from_str(&content).ok();
497        Err(Error::ResponseError(ResponseContent { status, content, entity }))
498    }
499}
500
501pub async fn remove_role_handler(configuration: &configuration::Configuration, role: &str) -> Result<(), Error<RemoveRoleHandlerError>> {
502    // add a prefix to parameters to efficiently prevent name collisions
503    let p_path_role = role;
504
505    let uri_str = format!("{}/roles/{role}", configuration.base_path, role=crate::apis::urlencode(p_path_role));
506    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
507
508    if let Some(ref user_agent) = configuration.user_agent {
509        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
510    }
511    if let Some(ref token) = configuration.bearer_access_token {
512        req_builder = req_builder.bearer_auth(token.to_owned());
513    };
514
515    let req = req_builder.build()?;
516    let resp = configuration.client.execute(req).await?;
517
518    let status = resp.status();
519
520    if !status.is_client_error() && !status.is_server_error() {
521        Ok(())
522    } else {
523        let content = resp.text().await?;
524        let entity: Option<RemoveRoleHandlerError> = serde_json::from_str(&content).ok();
525        Err(Error::ResponseError(ResponseContent { status, content, entity }))
526    }
527}
528
529pub async fn revoke_role_handler(configuration: &configuration::Configuration, user: &str, role: &str) -> Result<(), Error<RevokeRoleHandlerError>> {
530    // add a prefix to parameters to efficiently prevent name collisions
531    let p_path_user = user;
532    let p_path_role = role;
533
534    let uri_str = format!("{}/users/{user}/roles/{role}", configuration.base_path, user=crate::apis::urlencode(p_path_user), role=crate::apis::urlencode(p_path_role));
535    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
536
537    if let Some(ref user_agent) = configuration.user_agent {
538        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
539    }
540    if let Some(ref token) = configuration.bearer_access_token {
541        req_builder = req_builder.bearer_auth(token.to_owned());
542    };
543
544    let req = req_builder.build()?;
545    let resp = configuration.client.execute(req).await?;
546
547    let status = resp.status();
548
549    if !status.is_client_error() && !status.is_server_error() {
550        Ok(())
551    } else {
552        let content = resp.text().await?;
553        let entity: Option<RevokeRoleHandlerError> = serde_json::from_str(&content).ok();
554        Err(Error::ResponseError(ResponseContent { status, content, entity }))
555    }
556}
557
558pub async fn update_user_quota_handler(configuration: &configuration::Configuration, user: &str, update_quota: models::UpdateQuota) -> Result<(), Error<UpdateUserQuotaHandlerError>> {
559    // add a prefix to parameters to efficiently prevent name collisions
560    let p_path_user = user;
561    let p_body_update_quota = update_quota;
562
563    let uri_str = format!("{}/quotas/{user}", configuration.base_path, user=crate::apis::urlencode(p_path_user));
564    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
565
566    if let Some(ref user_agent) = configuration.user_agent {
567        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
568    }
569    if let Some(ref token) = configuration.bearer_access_token {
570        req_builder = req_builder.bearer_auth(token.to_owned());
571    };
572    req_builder = req_builder.json(&p_body_update_quota);
573
574    let req = req_builder.build()?;
575    let resp = configuration.client.execute(req).await?;
576
577    let status = resp.status();
578
579    if !status.is_client_error() && !status.is_server_error() {
580        Ok(())
581    } else {
582        let content = resp.text().await?;
583        let entity: Option<UpdateUserQuotaHandlerError> = serde_json::from_str(&content).ok();
584        Err(Error::ResponseError(ResponseContent { status, content, entity }))
585    }
586}
587