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