gitbundle_sdk/apis/
admin_api.rs

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