gitbundle_sdk/apis/
admin_api.rs

1/*
2 * GitBundle API
3 *
4 * GitBundle API documentation.
5 *
6 * The version of the OpenAPI document: 3.0.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17/// struct for typed errors of method [`delete_group`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum DeleteGroupError {
21    Status400(models::JsonErrorResponseNull),
22    Status401(models::JsonErrorResponseNull),
23    Status403(models::JsonErrorResponseNull),
24    Status404(models::JsonErrorResponseNull),
25    Status409(models::JsonErrorResponseNull),
26    Status429(models::JsonErrorResponseNull),
27    Status500(models::JsonErrorResponseNull),
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`delete_runner`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum DeleteRunnerError {
35    Status400(models::JsonErrorResponseNull),
36    Status401(models::JsonErrorResponseNull),
37    Status403(models::JsonErrorResponseNull),
38    Status404(models::JsonErrorResponseNull),
39    Status409(models::JsonErrorResponseNull),
40    Status429(models::JsonErrorResponseNull),
41    Status500(models::JsonErrorResponseNull),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`delete_user`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum DeleteUserError {
49    Status400(models::JsonErrorResponseNull),
50    Status401(models::JsonErrorResponseNull),
51    Status403(models::JsonErrorResponseNull),
52    Status404(models::JsonErrorResponseNull),
53    Status409(models::JsonErrorResponseNull),
54    Status429(models::JsonErrorResponseNull),
55    Status500(models::JsonErrorResponseNull),
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`delete_variable`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum DeleteVariableError {
63    Status400(models::JsonErrorResponseNull),
64    Status401(models::JsonErrorResponseNull),
65    Status403(models::JsonErrorResponseNull),
66    Status404(models::JsonErrorResponseNull),
67    Status409(models::JsonErrorResponseNull),
68    Status429(models::JsonErrorResponseNull),
69    Status500(models::JsonErrorResponseNull),
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`get_groups`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum GetGroupsError {
77    Status400(models::JsonErrorResponseNull),
78    Status401(models::JsonErrorResponseNull),
79    Status403(models::JsonErrorResponseNull),
80    Status404(models::JsonErrorResponseNull),
81    Status409(models::JsonErrorResponseNull),
82    Status429(models::JsonErrorResponseNull),
83    Status500(models::JsonErrorResponseNull),
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`get_reseted_runner_register_token`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum GetResetedRunnerRegisterTokenError {
91    Status400(models::JsonErrorResponseNull),
92    Status401(models::JsonErrorResponseNull),
93    Status403(models::JsonErrorResponseNull),
94    Status404(models::JsonErrorResponseNull),
95    Status409(models::JsonErrorResponseNull),
96    Status429(models::JsonErrorResponseNull),
97    Status500(models::JsonErrorResponseNull),
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`get_runner`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum GetRunnerError {
105    Status400(models::JsonErrorResponseNull),
106    Status401(models::JsonErrorResponseNull),
107    Status403(models::JsonErrorResponseNull),
108    Status404(models::JsonErrorResponseNull),
109    Status409(models::JsonErrorResponseNull),
110    Status429(models::JsonErrorResponseNull),
111    Status500(models::JsonErrorResponseNull),
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`get_runner_register_token`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetRunnerRegisterTokenError {
119    Status400(models::JsonErrorResponseNull),
120    Status401(models::JsonErrorResponseNull),
121    Status403(models::JsonErrorResponseNull),
122    Status404(models::JsonErrorResponseNull),
123    Status409(models::JsonErrorResponseNull),
124    Status429(models::JsonErrorResponseNull),
125    Status500(models::JsonErrorResponseNull),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`get_runners`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum GetRunnersError {
133    Status400(models::JsonErrorResponseNull),
134    Status401(models::JsonErrorResponseNull),
135    Status403(models::JsonErrorResponseNull),
136    Status404(models::JsonErrorResponseNull),
137    Status409(models::JsonErrorResponseNull),
138    Status429(models::JsonErrorResponseNull),
139    Status500(models::JsonErrorResponseNull),
140    UnknownValue(serde_json::Value),
141}
142
143/// struct for typed errors of method [`get_stats`]
144#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum GetStatsError {
147    Status400(models::JsonErrorResponseNull),
148    Status401(models::JsonErrorResponseNull),
149    Status403(models::JsonErrorResponseNull),
150    Status404(models::JsonErrorResponseNull),
151    Status409(models::JsonErrorResponseNull),
152    Status429(models::JsonErrorResponseNull),
153    Status500(models::JsonErrorResponseNull),
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`get_user`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum GetUserError {
161    Status400(models::JsonErrorResponseNull),
162    Status401(models::JsonErrorResponseNull),
163    Status403(models::JsonErrorResponseNull),
164    Status404(models::JsonErrorResponseNull),
165    Status409(models::JsonErrorResponseNull),
166    Status429(models::JsonErrorResponseNull),
167    Status500(models::JsonErrorResponseNull),
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`get_users`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum GetUsersError {
175    Status400(models::JsonErrorResponseNull),
176    Status401(models::JsonErrorResponseNull),
177    Status403(models::JsonErrorResponseNull),
178    Status404(models::JsonErrorResponseNull),
179    Status409(models::JsonErrorResponseNull),
180    Status429(models::JsonErrorResponseNull),
181    Status500(models::JsonErrorResponseNull),
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`get_variable`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum GetVariableError {
189    Status400(models::JsonErrorResponseNull),
190    Status401(models::JsonErrorResponseNull),
191    Status403(models::JsonErrorResponseNull),
192    Status404(models::JsonErrorResponseNull),
193    Status409(models::JsonErrorResponseNull),
194    Status429(models::JsonErrorResponseNull),
195    Status500(models::JsonErrorResponseNull),
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`get_variables`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum GetVariablesError {
203    Status400(models::JsonErrorResponseNull),
204    Status401(models::JsonErrorResponseNull),
205    Status403(models::JsonErrorResponseNull),
206    Status404(models::JsonErrorResponseNull),
207    Status409(models::JsonErrorResponseNull),
208    Status429(models::JsonErrorResponseNull),
209    Status500(models::JsonErrorResponseNull),
210    UnknownValue(serde_json::Value),
211}
212
213/// struct for typed errors of method [`patch_runner`]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum PatchRunnerError {
217    Status400(models::JsonErrorResponseNull),
218    Status401(models::JsonErrorResponseNull),
219    Status403(models::JsonErrorResponseNull),
220    Status404(models::JsonErrorResponseNull),
221    Status409(models::JsonErrorResponseNull),
222    Status429(models::JsonErrorResponseNull),
223    Status500(models::JsonErrorResponseNull),
224    UnknownValue(serde_json::Value),
225}
226
227/// struct for typed errors of method [`patch_user`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum PatchUserError {
231    Status400(models::JsonErrorResponseNull),
232    Status401(models::JsonErrorResponseNull),
233    Status403(models::JsonErrorResponseNull),
234    Status404(models::JsonErrorResponseNull),
235    Status409(models::JsonErrorResponseNull),
236    Status429(models::JsonErrorResponseNull),
237    Status500(models::JsonErrorResponseNull),
238    UnknownValue(serde_json::Value),
239}
240
241/// struct for typed errors of method [`patch_user_admin`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum PatchUserAdminError {
245    Status400(models::JsonErrorResponseNull),
246    Status401(models::JsonErrorResponseNull),
247    Status403(models::JsonErrorResponseNull),
248    Status404(models::JsonErrorResponseNull),
249    Status409(models::JsonErrorResponseNull),
250    Status429(models::JsonErrorResponseNull),
251    Status500(models::JsonErrorResponseNull),
252    UnknownValue(serde_json::Value),
253}
254
255/// struct for typed errors of method [`patch_variable`]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum PatchVariableError {
259    Status400(models::JsonErrorResponseNull),
260    Status401(models::JsonErrorResponseNull),
261    Status403(models::JsonErrorResponseNull),
262    Status404(models::JsonErrorResponseNull),
263    Status409(models::JsonErrorResponseNull),
264    Status429(models::JsonErrorResponseNull),
265    Status500(models::JsonErrorResponseNull),
266    UnknownValue(serde_json::Value),
267}
268
269/// struct for typed errors of method [`post_user`]
270#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum PostUserError {
273    Status400(models::JsonErrorResponseNull),
274    Status401(models::JsonErrorResponseNull),
275    Status403(models::JsonErrorResponseNull),
276    Status404(models::JsonErrorResponseNull),
277    Status409(models::JsonErrorResponseNull),
278    Status429(models::JsonErrorResponseNull),
279    Status500(models::JsonErrorResponseNull),
280    UnknownValue(serde_json::Value),
281}
282
283/// struct for typed errors of method [`post_variable`]
284#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum PostVariableError {
287    Status400(models::JsonErrorResponseNull),
288    Status401(models::JsonErrorResponseNull),
289    Status403(models::JsonErrorResponseNull),
290    Status404(models::JsonErrorResponseNull),
291    Status409(models::JsonErrorResponseNull),
292    Status429(models::JsonErrorResponseNull),
293    Status500(models::JsonErrorResponseNull),
294    UnknownValue(serde_json::Value),
295}
296
297pub async fn delete_group(
298    configuration: &configuration::Configuration,
299    group_ref: &str,
300) -> Result<(), Error<DeleteGroupError>> {
301    // add a prefix to parameters to efficiently prevent name collisions
302    let p_path_group_ref = group_ref;
303
304    let uri_str = format!(
305        "{}/admin/groups/{group_ref}",
306        configuration.base_path,
307        group_ref = crate::apis::urlencode(p_path_group_ref)
308    );
309    let mut req_builder = configuration
310        .client
311        .request(reqwest::Method::DELETE, &uri_str);
312
313    if let Some(ref apikey) = configuration.api_key {
314        let key = apikey.key.clone();
315        let value = match apikey.prefix {
316            Some(ref prefix) => format!("{} {}", prefix, key),
317            None => key,
318        };
319        req_builder = req_builder.query(&[("access_token", value)]);
320    }
321    if let Some(ref user_agent) = configuration.user_agent {
322        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
323    }
324    if let Some(ref auth_conf) = configuration.basic_auth {
325        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
326    };
327    if let Some(ref token) = configuration.bearer_access_token {
328        req_builder = req_builder.bearer_auth(token.to_owned());
329    };
330
331    let req = req_builder.build()?;
332    let resp = configuration.client.execute(req).await?;
333
334    let status = resp.status();
335
336    if !status.is_client_error() && !status.is_server_error() {
337        Ok(())
338    } else {
339        let content = resp.text().await?;
340        let entity: Option<DeleteGroupError> = serde_json::from_str(&content).ok();
341        Err(Error::ResponseError(ResponseContent {
342            status,
343            content,
344            entity,
345        }))
346    }
347}
348
349pub async fn delete_runner(
350    configuration: &configuration::Configuration,
351    runner_uuid: &str,
352) -> Result<(), Error<DeleteRunnerError>> {
353    // add a prefix to parameters to efficiently prevent name collisions
354    let p_path_runner_uuid = runner_uuid;
355
356    let uri_str = format!(
357        "{}/admin/runners/{runner_uuid}",
358        configuration.base_path,
359        runner_uuid = crate::apis::urlencode(p_path_runner_uuid)
360    );
361    let mut req_builder = configuration
362        .client
363        .request(reqwest::Method::DELETE, &uri_str);
364
365    if let Some(ref apikey) = configuration.api_key {
366        let key = apikey.key.clone();
367        let value = match apikey.prefix {
368            Some(ref prefix) => format!("{} {}", prefix, key),
369            None => key,
370        };
371        req_builder = req_builder.query(&[("access_token", value)]);
372    }
373    if let Some(ref user_agent) = configuration.user_agent {
374        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
375    }
376    if let Some(ref auth_conf) = configuration.basic_auth {
377        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
378    };
379    if let Some(ref token) = configuration.bearer_access_token {
380        req_builder = req_builder.bearer_auth(token.to_owned());
381    };
382
383    let req = req_builder.build()?;
384    let resp = configuration.client.execute(req).await?;
385
386    let status = resp.status();
387
388    if !status.is_client_error() && !status.is_server_error() {
389        Ok(())
390    } else {
391        let content = resp.text().await?;
392        let entity: Option<DeleteRunnerError> = serde_json::from_str(&content).ok();
393        Err(Error::ResponseError(ResponseContent {
394            status,
395            content,
396            entity,
397        }))
398    }
399}
400
401pub async fn delete_user(
402    configuration: &configuration::Configuration,
403    user_identifier: &str,
404) -> Result<(), Error<DeleteUserError>> {
405    // add a prefix to parameters to efficiently prevent name collisions
406    let p_path_user_identifier = user_identifier;
407
408    let uri_str = format!(
409        "{}/admin/users/{user_identifier}",
410        configuration.base_path,
411        user_identifier = crate::apis::urlencode(p_path_user_identifier)
412    );
413    let mut req_builder = configuration
414        .client
415        .request(reqwest::Method::DELETE, &uri_str);
416
417    if let Some(ref apikey) = configuration.api_key {
418        let key = apikey.key.clone();
419        let value = match apikey.prefix {
420            Some(ref prefix) => format!("{} {}", prefix, key),
421            None => key,
422        };
423        req_builder = req_builder.query(&[("access_token", value)]);
424    }
425    if let Some(ref user_agent) = configuration.user_agent {
426        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
427    }
428    if let Some(ref auth_conf) = configuration.basic_auth {
429        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
430    };
431    if let Some(ref token) = configuration.bearer_access_token {
432        req_builder = req_builder.bearer_auth(token.to_owned());
433    };
434
435    let req = req_builder.build()?;
436    let resp = configuration.client.execute(req).await?;
437
438    let status = resp.status();
439
440    if !status.is_client_error() && !status.is_server_error() {
441        Ok(())
442    } else {
443        let content = resp.text().await?;
444        let entity: Option<DeleteUserError> = serde_json::from_str(&content).ok();
445        Err(Error::ResponseError(ResponseContent {
446            status,
447            content,
448            entity,
449        }))
450    }
451}
452
453pub async fn delete_variable(
454    configuration: &configuration::Configuration,
455    variable_identifier: &str,
456) -> Result<(), Error<DeleteVariableError>> {
457    // add a prefix to parameters to efficiently prevent name collisions
458    let p_path_variable_identifier = variable_identifier;
459
460    let uri_str = format!(
461        "{}/admin/variables/{variable_identifier}",
462        configuration.base_path,
463        variable_identifier = crate::apis::urlencode(p_path_variable_identifier)
464    );
465    let mut req_builder = configuration
466        .client
467        .request(reqwest::Method::DELETE, &uri_str);
468
469    if let Some(ref apikey) = configuration.api_key {
470        let key = apikey.key.clone();
471        let value = match apikey.prefix {
472            Some(ref prefix) => format!("{} {}", prefix, key),
473            None => key,
474        };
475        req_builder = req_builder.query(&[("access_token", value)]);
476    }
477    if let Some(ref user_agent) = configuration.user_agent {
478        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
479    }
480    if let Some(ref auth_conf) = configuration.basic_auth {
481        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
482    };
483    if let Some(ref token) = configuration.bearer_access_token {
484        req_builder = req_builder.bearer_auth(token.to_owned());
485    };
486
487    let req = req_builder.build()?;
488    let resp = configuration.client.execute(req).await?;
489
490    let status = resp.status();
491
492    if !status.is_client_error() && !status.is_server_error() {
493        Ok(())
494    } else {
495        let content = resp.text().await?;
496        let entity: Option<DeleteVariableError> = serde_json::from_str(&content).ok();
497        Err(Error::ResponseError(ResponseContent {
498            status,
499            content,
500            entity,
501        }))
502    }
503}
504
505pub async fn get_groups(
506    configuration: &configuration::Configuration,
507    page: Option<i64>,
508    size: Option<i64>,
509    query: Option<&str>,
510    sort: Option<models::GroupSort>,
511    order: Option<models::OrderOption>,
512) -> Result<Vec<models::GroupModel>, Error<GetGroupsError>> {
513    // add a prefix to parameters to efficiently prevent name collisions
514    let p_query_page = page;
515    let p_query_size = size;
516    let p_query_query = query;
517    let p_query_sort = sort;
518    let p_query_order = order;
519
520    let uri_str = format!("{}/admin/groups", configuration.base_path);
521    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
522
523    if let Some(ref param_value) = p_query_page {
524        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
525    }
526    if let Some(ref param_value) = p_query_size {
527        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
528    }
529    if let Some(ref param_value) = p_query_query {
530        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
531    }
532    if let Some(ref param_value) = p_query_sort {
533        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
534    }
535    if let Some(ref param_value) = p_query_order {
536        req_builder = req_builder.query(&[("order", &param_value.to_string())]);
537    }
538    if let Some(ref apikey) = configuration.api_key {
539        let key = apikey.key.clone();
540        let value = match apikey.prefix {
541            Some(ref prefix) => format!("{} {}", prefix, key),
542            None => key,
543        };
544        req_builder = req_builder.query(&[("access_token", value)]);
545    }
546    if let Some(ref user_agent) = configuration.user_agent {
547        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
548    }
549    if let Some(ref auth_conf) = configuration.basic_auth {
550        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
551    };
552    if let Some(ref token) = configuration.bearer_access_token {
553        req_builder = req_builder.bearer_auth(token.to_owned());
554    };
555
556    let req = req_builder.build()?;
557    let resp = configuration.client.execute(req).await?;
558
559    let status = resp.status();
560    let content_type = resp
561        .headers()
562        .get("content-type")
563        .and_then(|v| v.to_str().ok())
564        .unwrap_or("application/octet-stream");
565    let content_type = super::ContentType::from(content_type);
566
567    if !status.is_client_error() && !status.is_server_error() {
568        let content = resp.text().await?;
569        match content_type {
570            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
571            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::GroupModel&gt;`"))),
572            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::GroupModel&gt;`")))),
573        }
574    } else {
575        let content = resp.text().await?;
576        let entity: Option<GetGroupsError> = serde_json::from_str(&content).ok();
577        Err(Error::ResponseError(ResponseContent {
578            status,
579            content,
580            entity,
581        }))
582    }
583}
584
585pub async fn get_reseted_runner_register_token(
586    configuration: &configuration::Configuration,
587) -> Result<models::RegisterTokenModel, Error<GetResetedRunnerRegisterTokenError>> {
588    let uri_str = format!(
589        "{}/admin/runners/register_token/reseted",
590        configuration.base_path
591    );
592    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
593
594    if let Some(ref apikey) = configuration.api_key {
595        let key = apikey.key.clone();
596        let value = match apikey.prefix {
597            Some(ref prefix) => format!("{} {}", prefix, key),
598            None => key,
599        };
600        req_builder = req_builder.query(&[("access_token", value)]);
601    }
602    if let Some(ref user_agent) = configuration.user_agent {
603        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
604    }
605    if let Some(ref auth_conf) = configuration.basic_auth {
606        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
607    };
608    if let Some(ref token) = configuration.bearer_access_token {
609        req_builder = req_builder.bearer_auth(token.to_owned());
610    };
611
612    let req = req_builder.build()?;
613    let resp = configuration.client.execute(req).await?;
614
615    let status = resp.status();
616    let content_type = resp
617        .headers()
618        .get("content-type")
619        .and_then(|v| v.to_str().ok())
620        .unwrap_or("application/octet-stream");
621    let content_type = super::ContentType::from(content_type);
622
623    if !status.is_client_error() && !status.is_server_error() {
624        let content = resp.text().await?;
625        match content_type {
626            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
627            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RegisterTokenModel`"))),
628            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RegisterTokenModel`")))),
629        }
630    } else {
631        let content = resp.text().await?;
632        let entity: Option<GetResetedRunnerRegisterTokenError> =
633            serde_json::from_str(&content).ok();
634        Err(Error::ResponseError(ResponseContent {
635            status,
636            content,
637            entity,
638        }))
639    }
640}
641
642pub async fn get_runner(
643    configuration: &configuration::Configuration,
644    runner_uuid: &str,
645) -> Result<models::RunnerModel, Error<GetRunnerError>> {
646    // add a prefix to parameters to efficiently prevent name collisions
647    let p_path_runner_uuid = runner_uuid;
648
649    let uri_str = format!(
650        "{}/admin/runners/{runner_uuid}",
651        configuration.base_path,
652        runner_uuid = crate::apis::urlencode(p_path_runner_uuid)
653    );
654    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
655
656    if let Some(ref apikey) = configuration.api_key {
657        let key = apikey.key.clone();
658        let value = match apikey.prefix {
659            Some(ref prefix) => format!("{} {}", prefix, key),
660            None => key,
661        };
662        req_builder = req_builder.query(&[("access_token", value)]);
663    }
664    if let Some(ref user_agent) = configuration.user_agent {
665        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
666    }
667    if let Some(ref auth_conf) = configuration.basic_auth {
668        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
669    };
670    if let Some(ref token) = configuration.bearer_access_token {
671        req_builder = req_builder.bearer_auth(token.to_owned());
672    };
673
674    let req = req_builder.build()?;
675    let resp = configuration.client.execute(req).await?;
676
677    let status = resp.status();
678    let content_type = resp
679        .headers()
680        .get("content-type")
681        .and_then(|v| v.to_str().ok())
682        .unwrap_or("application/octet-stream");
683    let content_type = super::ContentType::from(content_type);
684
685    if !status.is_client_error() && !status.is_server_error() {
686        let content = resp.text().await?;
687        match content_type {
688            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
689            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunnerModel`"))),
690            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RunnerModel`")))),
691        }
692    } else {
693        let content = resp.text().await?;
694        let entity: Option<GetRunnerError> = serde_json::from_str(&content).ok();
695        Err(Error::ResponseError(ResponseContent {
696            status,
697            content,
698            entity,
699        }))
700    }
701}
702
703pub async fn get_runner_register_token(
704    configuration: &configuration::Configuration,
705) -> Result<models::RegisterTokenModel, Error<GetRunnerRegisterTokenError>> {
706    let uri_str = format!("{}/admin/runners/register_token", configuration.base_path);
707    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
708
709    if let Some(ref apikey) = configuration.api_key {
710        let key = apikey.key.clone();
711        let value = match apikey.prefix {
712            Some(ref prefix) => format!("{} {}", prefix, key),
713            None => key,
714        };
715        req_builder = req_builder.query(&[("access_token", value)]);
716    }
717    if let Some(ref user_agent) = configuration.user_agent {
718        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
719    }
720    if let Some(ref auth_conf) = configuration.basic_auth {
721        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
722    };
723    if let Some(ref token) = configuration.bearer_access_token {
724        req_builder = req_builder.bearer_auth(token.to_owned());
725    };
726
727    let req = req_builder.build()?;
728    let resp = configuration.client.execute(req).await?;
729
730    let status = resp.status();
731    let content_type = resp
732        .headers()
733        .get("content-type")
734        .and_then(|v| v.to_str().ok())
735        .unwrap_or("application/octet-stream");
736    let content_type = super::ContentType::from(content_type);
737
738    if !status.is_client_error() && !status.is_server_error() {
739        let content = resp.text().await?;
740        match content_type {
741            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
742            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RegisterTokenModel`"))),
743            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RegisterTokenModel`")))),
744        }
745    } else {
746        let content = resp.text().await?;
747        let entity: Option<GetRunnerRegisterTokenError> = serde_json::from_str(&content).ok();
748        Err(Error::ResponseError(ResponseContent {
749            status,
750            content,
751            entity,
752        }))
753    }
754}
755
756pub async fn get_runners(
757    configuration: &configuration::Configuration,
758    page: Option<i64>,
759    size: Option<i64>,
760    query: Option<&str>,
761) -> Result<Vec<models::RunnerCreator>, Error<GetRunnersError>> {
762    // add a prefix to parameters to efficiently prevent name collisions
763    let p_query_page = page;
764    let p_query_size = size;
765    let p_query_query = query;
766
767    let uri_str = format!("{}/admin/runners", configuration.base_path);
768    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
769
770    if let Some(ref param_value) = p_query_page {
771        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
772    }
773    if let Some(ref param_value) = p_query_size {
774        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
775    }
776    if let Some(ref param_value) = p_query_query {
777        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
778    }
779    if let Some(ref apikey) = configuration.api_key {
780        let key = apikey.key.clone();
781        let value = match apikey.prefix {
782            Some(ref prefix) => format!("{} {}", prefix, key),
783            None => key,
784        };
785        req_builder = req_builder.query(&[("access_token", value)]);
786    }
787    if let Some(ref user_agent) = configuration.user_agent {
788        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
789    }
790    if let Some(ref auth_conf) = configuration.basic_auth {
791        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
792    };
793    if let Some(ref token) = configuration.bearer_access_token {
794        req_builder = req_builder.bearer_auth(token.to_owned());
795    };
796
797    let req = req_builder.build()?;
798    let resp = configuration.client.execute(req).await?;
799
800    let status = resp.status();
801    let content_type = resp
802        .headers()
803        .get("content-type")
804        .and_then(|v| v.to_str().ok())
805        .unwrap_or("application/octet-stream");
806    let content_type = super::ContentType::from(content_type);
807
808    if !status.is_client_error() && !status.is_server_error() {
809        let content = resp.text().await?;
810        match content_type {
811            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
812            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::RunnerCreator&gt;`"))),
813            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::RunnerCreator&gt;`")))),
814        }
815    } else {
816        let content = resp.text().await?;
817        let entity: Option<GetRunnersError> = serde_json::from_str(&content).ok();
818        Err(Error::ResponseError(ResponseContent {
819            status,
820            content,
821            entity,
822        }))
823    }
824}
825
826pub async fn get_stats(
827    configuration: &configuration::Configuration,
828) -> Result<models::AdminStats, Error<GetStatsError>> {
829    let uri_str = format!("{}/admin/stats", configuration.base_path);
830    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
831
832    if let Some(ref apikey) = configuration.api_key {
833        let key = apikey.key.clone();
834        let value = match apikey.prefix {
835            Some(ref prefix) => format!("{} {}", prefix, key),
836            None => key,
837        };
838        req_builder = req_builder.query(&[("access_token", value)]);
839    }
840    if let Some(ref user_agent) = configuration.user_agent {
841        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
842    }
843    if let Some(ref auth_conf) = configuration.basic_auth {
844        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
845    };
846    if let Some(ref token) = configuration.bearer_access_token {
847        req_builder = req_builder.bearer_auth(token.to_owned());
848    };
849
850    let req = req_builder.build()?;
851    let resp = configuration.client.execute(req).await?;
852
853    let status = resp.status();
854    let content_type = resp
855        .headers()
856        .get("content-type")
857        .and_then(|v| v.to_str().ok())
858        .unwrap_or("application/octet-stream");
859    let content_type = super::ContentType::from(content_type);
860
861    if !status.is_client_error() && !status.is_server_error() {
862        let content = resp.text().await?;
863        match content_type {
864            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
865            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AdminStats`"))),
866            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AdminStats`")))),
867        }
868    } else {
869        let content = resp.text().await?;
870        let entity: Option<GetStatsError> = serde_json::from_str(&content).ok();
871        Err(Error::ResponseError(ResponseContent {
872            status,
873            content,
874            entity,
875        }))
876    }
877}
878
879pub async fn get_user(
880    configuration: &configuration::Configuration,
881    user_identifier: &str,
882) -> Result<models::UserModel, Error<GetUserError>> {
883    // add a prefix to parameters to efficiently prevent name collisions
884    let p_path_user_identifier = user_identifier;
885
886    let uri_str = format!(
887        "{}/admin/users/{user_identifier}",
888        configuration.base_path,
889        user_identifier = crate::apis::urlencode(p_path_user_identifier)
890    );
891    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
892
893    if let Some(ref apikey) = configuration.api_key {
894        let key = apikey.key.clone();
895        let value = match apikey.prefix {
896            Some(ref prefix) => format!("{} {}", prefix, key),
897            None => key,
898        };
899        req_builder = req_builder.query(&[("access_token", value)]);
900    }
901    if let Some(ref user_agent) = configuration.user_agent {
902        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
903    }
904    if let Some(ref auth_conf) = configuration.basic_auth {
905        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
906    };
907    if let Some(ref token) = configuration.bearer_access_token {
908        req_builder = req_builder.bearer_auth(token.to_owned());
909    };
910
911    let req = req_builder.build()?;
912    let resp = configuration.client.execute(req).await?;
913
914    let status = resp.status();
915    let content_type = resp
916        .headers()
917        .get("content-type")
918        .and_then(|v| v.to_str().ok())
919        .unwrap_or("application/octet-stream");
920    let content_type = super::ContentType::from(content_type);
921
922    if !status.is_client_error() && !status.is_server_error() {
923        let content = resp.text().await?;
924        match content_type {
925            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
926            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserModel`"))),
927            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UserModel`")))),
928        }
929    } else {
930        let content = resp.text().await?;
931        let entity: Option<GetUserError> = serde_json::from_str(&content).ok();
932        Err(Error::ResponseError(ResponseContent {
933            status,
934            content,
935            entity,
936        }))
937    }
938}
939
940pub async fn get_users(
941    configuration: &configuration::Configuration,
942    page: Option<i64>,
943    size: Option<i64>,
944    query: Option<&str>,
945    order: Option<models::OrderOption>,
946    sort: Option<models::UserSort>,
947) -> Result<Vec<models::UserModel>, Error<GetUsersError>> {
948    // add a prefix to parameters to efficiently prevent name collisions
949    let p_query_page = page;
950    let p_query_size = size;
951    let p_query_query = query;
952    let p_query_order = order;
953    let p_query_sort = sort;
954
955    let uri_str = format!("{}/admin/users", configuration.base_path);
956    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
957
958    if let Some(ref param_value) = p_query_page {
959        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
960    }
961    if let Some(ref param_value) = p_query_size {
962        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
963    }
964    if let Some(ref param_value) = p_query_query {
965        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
966    }
967    if let Some(ref param_value) = p_query_order {
968        req_builder = req_builder.query(&[("order", &param_value.to_string())]);
969    }
970    if let Some(ref param_value) = p_query_sort {
971        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
972    }
973    if let Some(ref apikey) = configuration.api_key {
974        let key = apikey.key.clone();
975        let value = match apikey.prefix {
976            Some(ref prefix) => format!("{} {}", prefix, key),
977            None => key,
978        };
979        req_builder = req_builder.query(&[("access_token", value)]);
980    }
981    if let Some(ref user_agent) = configuration.user_agent {
982        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
983    }
984    if let Some(ref auth_conf) = configuration.basic_auth {
985        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
986    };
987    if let Some(ref token) = configuration.bearer_access_token {
988        req_builder = req_builder.bearer_auth(token.to_owned());
989    };
990
991    let req = req_builder.build()?;
992    let resp = configuration.client.execute(req).await?;
993
994    let status = resp.status();
995    let content_type = resp
996        .headers()
997        .get("content-type")
998        .and_then(|v| v.to_str().ok())
999        .unwrap_or("application/octet-stream");
1000    let content_type = super::ContentType::from(content_type);
1001
1002    if !status.is_client_error() && !status.is_server_error() {
1003        let content = resp.text().await?;
1004        match content_type {
1005            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1006            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UserModel&gt;`"))),
1007            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UserModel&gt;`")))),
1008        }
1009    } else {
1010        let content = resp.text().await?;
1011        let entity: Option<GetUsersError> = serde_json::from_str(&content).ok();
1012        Err(Error::ResponseError(ResponseContent {
1013            status,
1014            content,
1015            entity,
1016        }))
1017    }
1018}
1019
1020pub async fn get_variable(
1021    configuration: &configuration::Configuration,
1022    variable_identifier: &str,
1023) -> Result<models::VariableModel, Error<GetVariableError>> {
1024    // add a prefix to parameters to efficiently prevent name collisions
1025    let p_path_variable_identifier = variable_identifier;
1026
1027    let uri_str = format!(
1028        "{}/admin/variables/{variable_identifier}",
1029        configuration.base_path,
1030        variable_identifier = crate::apis::urlencode(p_path_variable_identifier)
1031    );
1032    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1033
1034    if let Some(ref apikey) = configuration.api_key {
1035        let key = apikey.key.clone();
1036        let value = match apikey.prefix {
1037            Some(ref prefix) => format!("{} {}", prefix, key),
1038            None => key,
1039        };
1040        req_builder = req_builder.query(&[("access_token", value)]);
1041    }
1042    if let Some(ref user_agent) = configuration.user_agent {
1043        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1044    }
1045    if let Some(ref auth_conf) = configuration.basic_auth {
1046        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1047    };
1048    if let Some(ref token) = configuration.bearer_access_token {
1049        req_builder = req_builder.bearer_auth(token.to_owned());
1050    };
1051
1052    let req = req_builder.build()?;
1053    let resp = configuration.client.execute(req).await?;
1054
1055    let status = resp.status();
1056    let content_type = resp
1057        .headers()
1058        .get("content-type")
1059        .and_then(|v| v.to_str().ok())
1060        .unwrap_or("application/octet-stream");
1061    let content_type = super::ContentType::from(content_type);
1062
1063    if !status.is_client_error() && !status.is_server_error() {
1064        let content = resp.text().await?;
1065        match content_type {
1066            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1067            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VariableModel`"))),
1068            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VariableModel`")))),
1069        }
1070    } else {
1071        let content = resp.text().await?;
1072        let entity: Option<GetVariableError> = serde_json::from_str(&content).ok();
1073        Err(Error::ResponseError(ResponseContent {
1074            status,
1075            content,
1076            entity,
1077        }))
1078    }
1079}
1080
1081pub async fn get_variables(
1082    configuration: &configuration::Configuration,
1083    page: Option<i64>,
1084    size: Option<i64>,
1085    query: Option<&str>,
1086    types: Option<Vec<models::VariableType>>,
1087    sort: Option<models::VariableSort>,
1088    order: Option<models::OrderOption>,
1089) -> Result<Vec<models::VariableGroup>, Error<GetVariablesError>> {
1090    // add a prefix to parameters to efficiently prevent name collisions
1091    let p_query_page = page;
1092    let p_query_size = size;
1093    let p_query_query = query;
1094    let p_query_types = types;
1095    let p_query_sort = sort;
1096    let p_query_order = order;
1097
1098    let uri_str = format!("{}/admin/variables", configuration.base_path);
1099    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1100
1101    if let Some(ref param_value) = p_query_page {
1102        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1103    }
1104    if let Some(ref param_value) = p_query_size {
1105        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
1106    }
1107    if let Some(ref param_value) = p_query_query {
1108        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
1109    }
1110    if let Some(ref param_value) = p_query_types {
1111        req_builder = match "multi" {
1112            "multi" => req_builder.query(
1113                &param_value
1114                    .iter()
1115                    .map(|p| ("types".to_owned(), p.to_string()))
1116                    .collect::<Vec<(std::string::String, std::string::String)>>(),
1117            ),
1118            _ => req_builder.query(&[(
1119                "types",
1120                &param_value
1121                    .iter()
1122                    .map(|p| p.to_string())
1123                    .collect::<Vec<String>>()
1124                    .join(",")
1125                    .to_string(),
1126            )]),
1127        };
1128    }
1129    if let Some(ref param_value) = p_query_sort {
1130        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
1131    }
1132    if let Some(ref param_value) = p_query_order {
1133        req_builder = req_builder.query(&[("order", &param_value.to_string())]);
1134    }
1135    if let Some(ref apikey) = configuration.api_key {
1136        let key = apikey.key.clone();
1137        let value = match apikey.prefix {
1138            Some(ref prefix) => format!("{} {}", prefix, key),
1139            None => key,
1140        };
1141        req_builder = req_builder.query(&[("access_token", value)]);
1142    }
1143    if let Some(ref user_agent) = configuration.user_agent {
1144        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1145    }
1146    if let Some(ref auth_conf) = configuration.basic_auth {
1147        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1148    };
1149    if let Some(ref token) = configuration.bearer_access_token {
1150        req_builder = req_builder.bearer_auth(token.to_owned());
1151    };
1152
1153    let req = req_builder.build()?;
1154    let resp = configuration.client.execute(req).await?;
1155
1156    let status = resp.status();
1157    let content_type = resp
1158        .headers()
1159        .get("content-type")
1160        .and_then(|v| v.to_str().ok())
1161        .unwrap_or("application/octet-stream");
1162    let content_type = super::ContentType::from(content_type);
1163
1164    if !status.is_client_error() && !status.is_server_error() {
1165        let content = resp.text().await?;
1166        match content_type {
1167            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1168            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::VariableGroup&gt;`"))),
1169            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::VariableGroup&gt;`")))),
1170        }
1171    } else {
1172        let content = resp.text().await?;
1173        let entity: Option<GetVariablesError> = serde_json::from_str(&content).ok();
1174        Err(Error::ResponseError(ResponseContent {
1175            status,
1176            content,
1177            entity,
1178        }))
1179    }
1180}
1181
1182pub async fn patch_runner(
1183    configuration: &configuration::Configuration,
1184    runner_uuid: &str,
1185    runner_patch_input: models::RunnerPatchInput,
1186) -> Result<models::RunnerModel, Error<PatchRunnerError>> {
1187    // add a prefix to parameters to efficiently prevent name collisions
1188    let p_path_runner_uuid = runner_uuid;
1189    let p_body_runner_patch_input = runner_patch_input;
1190
1191    let uri_str = format!(
1192        "{}/admin/runners/{runner_uuid}",
1193        configuration.base_path,
1194        runner_uuid = crate::apis::urlencode(p_path_runner_uuid)
1195    );
1196    let mut req_builder = configuration
1197        .client
1198        .request(reqwest::Method::PATCH, &uri_str);
1199
1200    if let Some(ref apikey) = configuration.api_key {
1201        let key = apikey.key.clone();
1202        let value = match apikey.prefix {
1203            Some(ref prefix) => format!("{} {}", prefix, key),
1204            None => key,
1205        };
1206        req_builder = req_builder.query(&[("access_token", value)]);
1207    }
1208    if let Some(ref user_agent) = configuration.user_agent {
1209        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1210    }
1211    if let Some(ref auth_conf) = configuration.basic_auth {
1212        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1213    };
1214    if let Some(ref token) = configuration.bearer_access_token {
1215        req_builder = req_builder.bearer_auth(token.to_owned());
1216    };
1217    req_builder = req_builder.json(&p_body_runner_patch_input);
1218
1219    let req = req_builder.build()?;
1220    let resp = configuration.client.execute(req).await?;
1221
1222    let status = resp.status();
1223    let content_type = resp
1224        .headers()
1225        .get("content-type")
1226        .and_then(|v| v.to_str().ok())
1227        .unwrap_or("application/octet-stream");
1228    let content_type = super::ContentType::from(content_type);
1229
1230    if !status.is_client_error() && !status.is_server_error() {
1231        let content = resp.text().await?;
1232        match content_type {
1233            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1234            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunnerModel`"))),
1235            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RunnerModel`")))),
1236        }
1237    } else {
1238        let content = resp.text().await?;
1239        let entity: Option<PatchRunnerError> = serde_json::from_str(&content).ok();
1240        Err(Error::ResponseError(ResponseContent {
1241            status,
1242            content,
1243            entity,
1244        }))
1245    }
1246}
1247
1248pub async fn patch_user(
1249    configuration: &configuration::Configuration,
1250    user_identifier: &str,
1251    user_patch_input: models::UserPatchInput,
1252) -> Result<models::UserModel, Error<PatchUserError>> {
1253    // add a prefix to parameters to efficiently prevent name collisions
1254    let p_path_user_identifier = user_identifier;
1255    let p_body_user_patch_input = user_patch_input;
1256
1257    let uri_str = format!(
1258        "{}/admin/users/{user_identifier}",
1259        configuration.base_path,
1260        user_identifier = crate::apis::urlencode(p_path_user_identifier)
1261    );
1262    let mut req_builder = configuration
1263        .client
1264        .request(reqwest::Method::PATCH, &uri_str);
1265
1266    if let Some(ref apikey) = configuration.api_key {
1267        let key = apikey.key.clone();
1268        let value = match apikey.prefix {
1269            Some(ref prefix) => format!("{} {}", prefix, key),
1270            None => key,
1271        };
1272        req_builder = req_builder.query(&[("access_token", value)]);
1273    }
1274    if let Some(ref user_agent) = configuration.user_agent {
1275        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1276    }
1277    if let Some(ref auth_conf) = configuration.basic_auth {
1278        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1279    };
1280    if let Some(ref token) = configuration.bearer_access_token {
1281        req_builder = req_builder.bearer_auth(token.to_owned());
1282    };
1283    req_builder = req_builder.json(&p_body_user_patch_input);
1284
1285    let req = req_builder.build()?;
1286    let resp = configuration.client.execute(req).await?;
1287
1288    let status = resp.status();
1289    let content_type = resp
1290        .headers()
1291        .get("content-type")
1292        .and_then(|v| v.to_str().ok())
1293        .unwrap_or("application/octet-stream");
1294    let content_type = super::ContentType::from(content_type);
1295
1296    if !status.is_client_error() && !status.is_server_error() {
1297        let content = resp.text().await?;
1298        match content_type {
1299            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1300            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserModel`"))),
1301            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UserModel`")))),
1302        }
1303    } else {
1304        let content = resp.text().await?;
1305        let entity: Option<PatchUserError> = serde_json::from_str(&content).ok();
1306        Err(Error::ResponseError(ResponseContent {
1307            status,
1308            content,
1309            entity,
1310        }))
1311    }
1312}
1313
1314pub async fn patch_user_admin(
1315    configuration: &configuration::Configuration,
1316    user_identifier: &str,
1317    admin_patch_input: models::AdminPatchInput,
1318) -> Result<models::UserModel, Error<PatchUserAdminError>> {
1319    // add a prefix to parameters to efficiently prevent name collisions
1320    let p_path_user_identifier = user_identifier;
1321    let p_body_admin_patch_input = admin_patch_input;
1322
1323    let uri_str = format!(
1324        "{}/admin/users/{user_identifier}/admin",
1325        configuration.base_path,
1326        user_identifier = crate::apis::urlencode(p_path_user_identifier)
1327    );
1328    let mut req_builder = configuration
1329        .client
1330        .request(reqwest::Method::PATCH, &uri_str);
1331
1332    if let Some(ref apikey) = configuration.api_key {
1333        let key = apikey.key.clone();
1334        let value = match apikey.prefix {
1335            Some(ref prefix) => format!("{} {}", prefix, key),
1336            None => key,
1337        };
1338        req_builder = req_builder.query(&[("access_token", value)]);
1339    }
1340    if let Some(ref user_agent) = configuration.user_agent {
1341        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1342    }
1343    if let Some(ref auth_conf) = configuration.basic_auth {
1344        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1345    };
1346    if let Some(ref token) = configuration.bearer_access_token {
1347        req_builder = req_builder.bearer_auth(token.to_owned());
1348    };
1349    req_builder = req_builder.json(&p_body_admin_patch_input);
1350
1351    let req = req_builder.build()?;
1352    let resp = configuration.client.execute(req).await?;
1353
1354    let status = resp.status();
1355    let content_type = resp
1356        .headers()
1357        .get("content-type")
1358        .and_then(|v| v.to_str().ok())
1359        .unwrap_or("application/octet-stream");
1360    let content_type = super::ContentType::from(content_type);
1361
1362    if !status.is_client_error() && !status.is_server_error() {
1363        let content = resp.text().await?;
1364        match content_type {
1365            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1366            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserModel`"))),
1367            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UserModel`")))),
1368        }
1369    } else {
1370        let content = resp.text().await?;
1371        let entity: Option<PatchUserAdminError> = serde_json::from_str(&content).ok();
1372        Err(Error::ResponseError(ResponseContent {
1373            status,
1374            content,
1375            entity,
1376        }))
1377    }
1378}
1379
1380pub async fn patch_variable(
1381    configuration: &configuration::Configuration,
1382    variable_identifier: &str,
1383    variable_patch_input: models::VariablePatchInput,
1384) -> Result<models::VariableModel, Error<PatchVariableError>> {
1385    // add a prefix to parameters to efficiently prevent name collisions
1386    let p_path_variable_identifier = variable_identifier;
1387    let p_body_variable_patch_input = variable_patch_input;
1388
1389    let uri_str = format!(
1390        "{}/admin/variables/{variable_identifier}",
1391        configuration.base_path,
1392        variable_identifier = crate::apis::urlencode(p_path_variable_identifier)
1393    );
1394    let mut req_builder = configuration
1395        .client
1396        .request(reqwest::Method::PATCH, &uri_str);
1397
1398    if let Some(ref apikey) = configuration.api_key {
1399        let key = apikey.key.clone();
1400        let value = match apikey.prefix {
1401            Some(ref prefix) => format!("{} {}", prefix, key),
1402            None => key,
1403        };
1404        req_builder = req_builder.query(&[("access_token", value)]);
1405    }
1406    if let Some(ref user_agent) = configuration.user_agent {
1407        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1408    }
1409    if let Some(ref auth_conf) = configuration.basic_auth {
1410        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1411    };
1412    if let Some(ref token) = configuration.bearer_access_token {
1413        req_builder = req_builder.bearer_auth(token.to_owned());
1414    };
1415    req_builder = req_builder.json(&p_body_variable_patch_input);
1416
1417    let req = req_builder.build()?;
1418    let resp = configuration.client.execute(req).await?;
1419
1420    let status = resp.status();
1421    let content_type = resp
1422        .headers()
1423        .get("content-type")
1424        .and_then(|v| v.to_str().ok())
1425        .unwrap_or("application/octet-stream");
1426    let content_type = super::ContentType::from(content_type);
1427
1428    if !status.is_client_error() && !status.is_server_error() {
1429        let content = resp.text().await?;
1430        match content_type {
1431            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1432            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VariableModel`"))),
1433            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VariableModel`")))),
1434        }
1435    } else {
1436        let content = resp.text().await?;
1437        let entity: Option<PatchVariableError> = serde_json::from_str(&content).ok();
1438        Err(Error::ResponseError(ResponseContent {
1439            status,
1440            content,
1441            entity,
1442        }))
1443    }
1444}
1445
1446pub async fn post_user(
1447    configuration: &configuration::Configuration,
1448    user_create_input: models::UserCreateInput,
1449) -> Result<models::UserModel, Error<PostUserError>> {
1450    // add a prefix to parameters to efficiently prevent name collisions
1451    let p_body_user_create_input = user_create_input;
1452
1453    let uri_str = format!("{}/admin/users", configuration.base_path);
1454    let mut req_builder = configuration
1455        .client
1456        .request(reqwest::Method::POST, &uri_str);
1457
1458    if let Some(ref apikey) = configuration.api_key {
1459        let key = apikey.key.clone();
1460        let value = match apikey.prefix {
1461            Some(ref prefix) => format!("{} {}", prefix, key),
1462            None => key,
1463        };
1464        req_builder = req_builder.query(&[("access_token", value)]);
1465    }
1466    if let Some(ref user_agent) = configuration.user_agent {
1467        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1468    }
1469    if let Some(ref auth_conf) = configuration.basic_auth {
1470        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1471    };
1472    if let Some(ref token) = configuration.bearer_access_token {
1473        req_builder = req_builder.bearer_auth(token.to_owned());
1474    };
1475    req_builder = req_builder.json(&p_body_user_create_input);
1476
1477    let req = req_builder.build()?;
1478    let resp = configuration.client.execute(req).await?;
1479
1480    let status = resp.status();
1481    let content_type = resp
1482        .headers()
1483        .get("content-type")
1484        .and_then(|v| v.to_str().ok())
1485        .unwrap_or("application/octet-stream");
1486    let content_type = super::ContentType::from(content_type);
1487
1488    if !status.is_client_error() && !status.is_server_error() {
1489        let content = resp.text().await?;
1490        match content_type {
1491            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1492            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserModel`"))),
1493            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UserModel`")))),
1494        }
1495    } else {
1496        let content = resp.text().await?;
1497        let entity: Option<PostUserError> = serde_json::from_str(&content).ok();
1498        Err(Error::ResponseError(ResponseContent {
1499            status,
1500            content,
1501            entity,
1502        }))
1503    }
1504}
1505
1506pub async fn post_variable(
1507    configuration: &configuration::Configuration,
1508    variable_create_input: models::VariableCreateInput,
1509) -> Result<models::VariableModel, Error<PostVariableError>> {
1510    // add a prefix to parameters to efficiently prevent name collisions
1511    let p_body_variable_create_input = variable_create_input;
1512
1513    let uri_str = format!("{}/admin/variables", configuration.base_path);
1514    let mut req_builder = configuration
1515        .client
1516        .request(reqwest::Method::POST, &uri_str);
1517
1518    if let Some(ref apikey) = configuration.api_key {
1519        let key = apikey.key.clone();
1520        let value = match apikey.prefix {
1521            Some(ref prefix) => format!("{} {}", prefix, key),
1522            None => key,
1523        };
1524        req_builder = req_builder.query(&[("access_token", value)]);
1525    }
1526    if let Some(ref user_agent) = configuration.user_agent {
1527        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1528    }
1529    if let Some(ref auth_conf) = configuration.basic_auth {
1530        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1531    };
1532    if let Some(ref token) = configuration.bearer_access_token {
1533        req_builder = req_builder.bearer_auth(token.to_owned());
1534    };
1535    req_builder = req_builder.json(&p_body_variable_create_input);
1536
1537    let req = req_builder.build()?;
1538    let resp = configuration.client.execute(req).await?;
1539
1540    let status = resp.status();
1541    let content_type = resp
1542        .headers()
1543        .get("content-type")
1544        .and_then(|v| v.to_str().ok())
1545        .unwrap_or("application/octet-stream");
1546    let content_type = super::ContentType::from(content_type);
1547
1548    if !status.is_client_error() && !status.is_server_error() {
1549        let content = resp.text().await?;
1550        match content_type {
1551            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1552            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VariableModel`"))),
1553            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VariableModel`")))),
1554        }
1555    } else {
1556        let content = resp.text().await?;
1557        let entity: Option<PostVariableError> = serde_json::from_str(&content).ok();
1558        Err(Error::ResponseError(ResponseContent {
1559            status,
1560            content,
1561            entity,
1562        }))
1563    }
1564}