Skip to main content

gitea_client/apis/
admin_api.rs

1/*
2 * Gitea API
3 *
4 * This documentation describes the Gitea API.
5 *
6 * The version of the OpenAPI document: 1.25.2
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`admin_add_user_badges`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AdminAddUserBadgesError {
22    Status403(),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`admin_adopt_repository`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum AdminAdoptRepositoryError {
30    Status403(),
31    Status404(),
32    UnknownValue(serde_json::Value),
33}
34
35/// struct for typed errors of method [`admin_create_hook`]
36#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum AdminCreateHookError {
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`admin_create_org`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum AdminCreateOrgError {
46    Status403(),
47    Status422(),
48    UnknownValue(serde_json::Value),
49}
50
51/// struct for typed errors of method [`admin_create_public_key`]
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum AdminCreatePublicKeyError {
55    Status403(),
56    Status422(),
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`admin_create_repo`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum AdminCreateRepoError {
64    Status400(),
65    Status403(),
66    Status404(),
67    Status409(),
68    Status422(),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`admin_create_runner_registration_token`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum AdminCreateRunnerRegistrationTokenError {
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`admin_create_user`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum AdminCreateUserError {
83    Status400(),
84    Status403(),
85    Status422(),
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`admin_cron_list`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum AdminCronListError {
93    Status403(),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`admin_cron_run`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum AdminCronRunError {
101    Status404(),
102    UnknownValue(serde_json::Value),
103}
104
105/// struct for typed errors of method [`admin_delete_hook`]
106#[derive(Debug, Clone, Serialize, Deserialize)]
107#[serde(untagged)]
108pub enum AdminDeleteHookError {
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`admin_delete_unadopted_repository`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum AdminDeleteUnadoptedRepositoryError {
116    Status403(),
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`admin_delete_user`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum AdminDeleteUserError {
124    Status403(),
125    Status404(),
126    Status422(),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`admin_delete_user_badges`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum AdminDeleteUserBadgesError {
134    Status403(),
135    Status422(),
136    UnknownValue(serde_json::Value),
137}
138
139/// struct for typed errors of method [`admin_delete_user_public_key`]
140#[derive(Debug, Clone, Serialize, Deserialize)]
141#[serde(untagged)]
142pub enum AdminDeleteUserPublicKeyError {
143    Status403(),
144    Status404(),
145    UnknownValue(serde_json::Value),
146}
147
148/// struct for typed errors of method [`admin_edit_hook`]
149#[derive(Debug, Clone, Serialize, Deserialize)]
150#[serde(untagged)]
151pub enum AdminEditHookError {
152    UnknownValue(serde_json::Value),
153}
154
155/// struct for typed errors of method [`admin_edit_user`]
156#[derive(Debug, Clone, Serialize, Deserialize)]
157#[serde(untagged)]
158pub enum AdminEditUserError {
159    Status400(),
160    Status403(),
161    Status422(),
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`admin_get_all_emails`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum AdminGetAllEmailsError {
169    Status403(),
170    UnknownValue(serde_json::Value),
171}
172
173/// struct for typed errors of method [`admin_get_all_orgs`]
174#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum AdminGetAllOrgsError {
177    Status403(),
178    UnknownValue(serde_json::Value),
179}
180
181/// struct for typed errors of method [`admin_get_hook`]
182#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum AdminGetHookError {
185    UnknownValue(serde_json::Value),
186}
187
188/// struct for typed errors of method [`admin_get_runner_registration_token`]
189#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum AdminGetRunnerRegistrationTokenError {
192    UnknownValue(serde_json::Value),
193}
194
195/// struct for typed errors of method [`admin_list_hooks`]
196#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum AdminListHooksError {
199    UnknownValue(serde_json::Value),
200}
201
202/// struct for typed errors of method [`admin_list_user_badges`]
203#[derive(Debug, Clone, Serialize, Deserialize)]
204#[serde(untagged)]
205pub enum AdminListUserBadgesError {
206    Status404(),
207    UnknownValue(serde_json::Value),
208}
209
210/// struct for typed errors of method [`admin_rename_user`]
211#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum AdminRenameUserError {
214    Status403(),
215    Status422(),
216    UnknownValue(serde_json::Value),
217}
218
219/// struct for typed errors of method [`admin_search_emails`]
220#[derive(Debug, Clone, Serialize, Deserialize)]
221#[serde(untagged)]
222pub enum AdminSearchEmailsError {
223    Status403(),
224    UnknownValue(serde_json::Value),
225}
226
227/// struct for typed errors of method [`admin_search_users`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum AdminSearchUsersError {
231    Status403(),
232    UnknownValue(serde_json::Value),
233}
234
235/// struct for typed errors of method [`admin_unadopted_list`]
236#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum AdminUnadoptedListError {
239    Status403(),
240    UnknownValue(serde_json::Value),
241}
242
243/// struct for typed errors of method [`delete_admin_runner`]
244#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum DeleteAdminRunnerError {
247    Status400(),
248    Status404(),
249    UnknownValue(serde_json::Value),
250}
251
252/// struct for typed errors of method [`get_admin_runner`]
253#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum GetAdminRunnerError {
256    Status400(),
257    Status404(),
258    UnknownValue(serde_json::Value),
259}
260
261/// struct for typed errors of method [`get_admin_runners`]
262#[derive(Debug, Clone, Serialize, Deserialize)]
263#[serde(untagged)]
264pub enum GetAdminRunnersError {
265    Status400(),
266    Status404(),
267    UnknownValue(serde_json::Value),
268}
269
270/// struct for typed errors of method [`list_admin_workflow_jobs`]
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum ListAdminWorkflowJobsError {
274    Status400(),
275    Status404(),
276    UnknownValue(serde_json::Value),
277}
278
279/// struct for typed errors of method [`list_admin_workflow_runs`]
280#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum ListAdminWorkflowRunsError {
283    Status400(),
284    Status404(),
285    UnknownValue(serde_json::Value),
286}
287
288
289pub async fn admin_add_user_badges(configuration: &configuration::Configuration, username: &str, body: Option<models::UserBadgeOption>) -> Result<(), Error<AdminAddUserBadgesError>> {
290    // add a prefix to parameters to efficiently prevent name collisions
291    let p_path_username = username;
292    let p_body_body = body;
293
294    let uri_str = format!("{}/admin/users/{username}/badges", configuration.base_path, username=crate::apis::urlencode(p_path_username));
295    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
296
297    if let Some(ref apikey) = configuration.api_key {
298        let key = apikey.key.clone();
299        let value = match apikey.prefix {
300            Some(ref prefix) => format!("{} {}", prefix, key),
301            None => key,
302        };
303        req_builder = req_builder.query(&[("access_token", value)]);
304    }
305    if let Some(ref apikey) = configuration.api_key {
306        let key = apikey.key.clone();
307        let value = match apikey.prefix {
308            Some(ref prefix) => format!("{} {}", prefix, key),
309            None => key,
310        };
311        req_builder = req_builder.query(&[("sudo", value)]);
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(&[("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 apikey) = configuration.api_key {
325        let key = apikey.key.clone();
326        let value = match apikey.prefix {
327            Some(ref prefix) => format!("{} {}", prefix, key),
328            None => key,
329        };
330        req_builder = req_builder.header("X-GITEA-OTP", value);
331    };
332    if let Some(ref apikey) = configuration.api_key {
333        let key = apikey.key.clone();
334        let value = match apikey.prefix {
335            Some(ref prefix) => format!("{} {}", prefix, key),
336            None => key,
337        };
338        req_builder = req_builder.header("Authorization", value);
339    };
340    if let Some(ref apikey) = configuration.api_key {
341        let key = apikey.key.clone();
342        let value = match apikey.prefix {
343            Some(ref prefix) => format!("{} {}", prefix, key),
344            None => key,
345        };
346        req_builder = req_builder.header("Sudo", value);
347    };
348    if let Some(ref auth_conf) = configuration.basic_auth {
349        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
350    };
351    req_builder = req_builder.json(&p_body_body);
352
353    let req = req_builder.build()?;
354    let resp = configuration.client.execute(req).await?;
355
356    let status = resp.status();
357
358    if !status.is_client_error() && !status.is_server_error() {
359        Ok(())
360    } else {
361        let content = resp.text().await?;
362        let entity: Option<AdminAddUserBadgesError> = serde_json::from_str(&content).ok();
363        Err(Error::ResponseError(ResponseContent { status, content, entity }))
364    }
365}
366
367pub async fn admin_adopt_repository(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<AdminAdoptRepositoryError>> {
368    // add a prefix to parameters to efficiently prevent name collisions
369    let p_path_owner = owner;
370    let p_path_repo = repo;
371
372    let uri_str = format!("{}/admin/unadopted/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
373    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
374
375    if let Some(ref apikey) = configuration.api_key {
376        let key = apikey.key.clone();
377        let value = match apikey.prefix {
378            Some(ref prefix) => format!("{} {}", prefix, key),
379            None => key,
380        };
381        req_builder = req_builder.query(&[("access_token", value)]);
382    }
383    if let Some(ref apikey) = configuration.api_key {
384        let key = apikey.key.clone();
385        let value = match apikey.prefix {
386            Some(ref prefix) => format!("{} {}", prefix, key),
387            None => key,
388        };
389        req_builder = req_builder.query(&[("sudo", value)]);
390    }
391    if let Some(ref apikey) = configuration.api_key {
392        let key = apikey.key.clone();
393        let value = match apikey.prefix {
394            Some(ref prefix) => format!("{} {}", prefix, key),
395            None => key,
396        };
397        req_builder = req_builder.query(&[("token", value)]);
398    }
399    if let Some(ref user_agent) = configuration.user_agent {
400        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
401    }
402    if let Some(ref apikey) = configuration.api_key {
403        let key = apikey.key.clone();
404        let value = match apikey.prefix {
405            Some(ref prefix) => format!("{} {}", prefix, key),
406            None => key,
407        };
408        req_builder = req_builder.header("X-GITEA-OTP", value);
409    };
410    if let Some(ref apikey) = configuration.api_key {
411        let key = apikey.key.clone();
412        let value = match apikey.prefix {
413            Some(ref prefix) => format!("{} {}", prefix, key),
414            None => key,
415        };
416        req_builder = req_builder.header("Authorization", value);
417    };
418    if let Some(ref apikey) = configuration.api_key {
419        let key = apikey.key.clone();
420        let value = match apikey.prefix {
421            Some(ref prefix) => format!("{} {}", prefix, key),
422            None => key,
423        };
424        req_builder = req_builder.header("Sudo", value);
425    };
426    if let Some(ref auth_conf) = configuration.basic_auth {
427        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
428    };
429
430    let req = req_builder.build()?;
431    let resp = configuration.client.execute(req).await?;
432
433    let status = resp.status();
434
435    if !status.is_client_error() && !status.is_server_error() {
436        Ok(())
437    } else {
438        let content = resp.text().await?;
439        let entity: Option<AdminAdoptRepositoryError> = serde_json::from_str(&content).ok();
440        Err(Error::ResponseError(ResponseContent { status, content, entity }))
441    }
442}
443
444pub async fn admin_create_hook(configuration: &configuration::Configuration, body: models::CreateHookOption) -> Result<models::Hook, Error<AdminCreateHookError>> {
445    // add a prefix to parameters to efficiently prevent name collisions
446    let p_body_body = body;
447
448    let uri_str = format!("{}/admin/hooks", configuration.base_path);
449    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
450
451    if let Some(ref apikey) = configuration.api_key {
452        let key = apikey.key.clone();
453        let value = match apikey.prefix {
454            Some(ref prefix) => format!("{} {}", prefix, key),
455            None => key,
456        };
457        req_builder = req_builder.query(&[("access_token", value)]);
458    }
459    if let Some(ref apikey) = configuration.api_key {
460        let key = apikey.key.clone();
461        let value = match apikey.prefix {
462            Some(ref prefix) => format!("{} {}", prefix, key),
463            None => key,
464        };
465        req_builder = req_builder.query(&[("sudo", value)]);
466    }
467    if let Some(ref apikey) = configuration.api_key {
468        let key = apikey.key.clone();
469        let value = match apikey.prefix {
470            Some(ref prefix) => format!("{} {}", prefix, key),
471            None => key,
472        };
473        req_builder = req_builder.query(&[("token", value)]);
474    }
475    if let Some(ref user_agent) = configuration.user_agent {
476        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
477    }
478    if let Some(ref apikey) = configuration.api_key {
479        let key = apikey.key.clone();
480        let value = match apikey.prefix {
481            Some(ref prefix) => format!("{} {}", prefix, key),
482            None => key,
483        };
484        req_builder = req_builder.header("X-GITEA-OTP", value);
485    };
486    if let Some(ref apikey) = configuration.api_key {
487        let key = apikey.key.clone();
488        let value = match apikey.prefix {
489            Some(ref prefix) => format!("{} {}", prefix, key),
490            None => key,
491        };
492        req_builder = req_builder.header("Authorization", value);
493    };
494    if let Some(ref apikey) = configuration.api_key {
495        let key = apikey.key.clone();
496        let value = match apikey.prefix {
497            Some(ref prefix) => format!("{} {}", prefix, key),
498            None => key,
499        };
500        req_builder = req_builder.header("Sudo", value);
501    };
502    if let Some(ref auth_conf) = configuration.basic_auth {
503        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
504    };
505    req_builder = req_builder.json(&p_body_body);
506
507    let req = req_builder.build()?;
508    let resp = configuration.client.execute(req).await?;
509
510    let status = resp.status();
511    let content_type = resp
512        .headers()
513        .get("content-type")
514        .and_then(|v| v.to_str().ok())
515        .unwrap_or("application/octet-stream");
516    let content_type = super::ContentType::from(content_type);
517
518    if !status.is_client_error() && !status.is_server_error() {
519        let content = resp.text().await?;
520        match content_type {
521            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
522            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
523            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))),
524        }
525    } else {
526        let content = resp.text().await?;
527        let entity: Option<AdminCreateHookError> = serde_json::from_str(&content).ok();
528        Err(Error::ResponseError(ResponseContent { status, content, entity }))
529    }
530}
531
532pub async fn admin_create_org(configuration: &configuration::Configuration, username: &str, organization: models::CreateOrgOption) -> Result<models::Organization, Error<AdminCreateOrgError>> {
533    // add a prefix to parameters to efficiently prevent name collisions
534    let p_path_username = username;
535    let p_body_organization = organization;
536
537    let uri_str = format!("{}/admin/users/{username}/orgs", configuration.base_path, username=crate::apis::urlencode(p_path_username));
538    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
539
540    if let Some(ref apikey) = configuration.api_key {
541        let key = apikey.key.clone();
542        let value = match apikey.prefix {
543            Some(ref prefix) => format!("{} {}", prefix, key),
544            None => key,
545        };
546        req_builder = req_builder.query(&[("access_token", value)]);
547    }
548    if let Some(ref apikey) = configuration.api_key {
549        let key = apikey.key.clone();
550        let value = match apikey.prefix {
551            Some(ref prefix) => format!("{} {}", prefix, key),
552            None => key,
553        };
554        req_builder = req_builder.query(&[("sudo", value)]);
555    }
556    if let Some(ref apikey) = configuration.api_key {
557        let key = apikey.key.clone();
558        let value = match apikey.prefix {
559            Some(ref prefix) => format!("{} {}", prefix, key),
560            None => key,
561        };
562        req_builder = req_builder.query(&[("token", value)]);
563    }
564    if let Some(ref user_agent) = configuration.user_agent {
565        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
566    }
567    if let Some(ref apikey) = configuration.api_key {
568        let key = apikey.key.clone();
569        let value = match apikey.prefix {
570            Some(ref prefix) => format!("{} {}", prefix, key),
571            None => key,
572        };
573        req_builder = req_builder.header("X-GITEA-OTP", value);
574    };
575    if let Some(ref apikey) = configuration.api_key {
576        let key = apikey.key.clone();
577        let value = match apikey.prefix {
578            Some(ref prefix) => format!("{} {}", prefix, key),
579            None => key,
580        };
581        req_builder = req_builder.header("Authorization", value);
582    };
583    if let Some(ref apikey) = configuration.api_key {
584        let key = apikey.key.clone();
585        let value = match apikey.prefix {
586            Some(ref prefix) => format!("{} {}", prefix, key),
587            None => key,
588        };
589        req_builder = req_builder.header("Sudo", value);
590    };
591    if let Some(ref auth_conf) = configuration.basic_auth {
592        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
593    };
594    req_builder = req_builder.json(&p_body_organization);
595
596    let req = req_builder.build()?;
597    let resp = configuration.client.execute(req).await?;
598
599    let status = resp.status();
600    let content_type = resp
601        .headers()
602        .get("content-type")
603        .and_then(|v| v.to_str().ok())
604        .unwrap_or("application/octet-stream");
605    let content_type = super::ContentType::from(content_type);
606
607    if !status.is_client_error() && !status.is_server_error() {
608        let content = resp.text().await?;
609        match content_type {
610            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
611            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
612            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Organization`")))),
613        }
614    } else {
615        let content = resp.text().await?;
616        let entity: Option<AdminCreateOrgError> = serde_json::from_str(&content).ok();
617        Err(Error::ResponseError(ResponseContent { status, content, entity }))
618    }
619}
620
621pub async fn admin_create_public_key(configuration: &configuration::Configuration, username: &str, key: Option<models::CreateKeyOption>) -> Result<models::PublicKey, Error<AdminCreatePublicKeyError>> {
622    // add a prefix to parameters to efficiently prevent name collisions
623    let p_path_username = username;
624    let p_body_key = key;
625
626    let uri_str = format!("{}/admin/users/{username}/keys", configuration.base_path, username=crate::apis::urlencode(p_path_username));
627    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
628
629    if let Some(ref apikey) = configuration.api_key {
630        let key = apikey.key.clone();
631        let value = match apikey.prefix {
632            Some(ref prefix) => format!("{} {}", prefix, key),
633            None => key,
634        };
635        req_builder = req_builder.query(&[("access_token", value)]);
636    }
637    if let Some(ref apikey) = configuration.api_key {
638        let key = apikey.key.clone();
639        let value = match apikey.prefix {
640            Some(ref prefix) => format!("{} {}", prefix, key),
641            None => key,
642        };
643        req_builder = req_builder.query(&[("sudo", value)]);
644    }
645    if let Some(ref apikey) = configuration.api_key {
646        let key = apikey.key.clone();
647        let value = match apikey.prefix {
648            Some(ref prefix) => format!("{} {}", prefix, key),
649            None => key,
650        };
651        req_builder = req_builder.query(&[("token", value)]);
652    }
653    if let Some(ref user_agent) = configuration.user_agent {
654        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
663    };
664    if let Some(ref apikey) = configuration.api_key {
665        let key = apikey.key.clone();
666        let value = match apikey.prefix {
667            Some(ref prefix) => format!("{} {}", prefix, key),
668            None => key,
669        };
670        req_builder = req_builder.header("Authorization", value);
671    };
672    if let Some(ref apikey) = configuration.api_key {
673        let key = apikey.key.clone();
674        let value = match apikey.prefix {
675            Some(ref prefix) => format!("{} {}", prefix, key),
676            None => key,
677        };
678        req_builder = req_builder.header("Sudo", value);
679    };
680    if let Some(ref auth_conf) = configuration.basic_auth {
681        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
682    };
683    req_builder = req_builder.json(&p_body_key);
684
685    let req = req_builder.build()?;
686    let resp = configuration.client.execute(req).await?;
687
688    let status = resp.status();
689    let content_type = resp
690        .headers()
691        .get("content-type")
692        .and_then(|v| v.to_str().ok())
693        .unwrap_or("application/octet-stream");
694    let content_type = super::ContentType::from(content_type);
695
696    if !status.is_client_error() && !status.is_server_error() {
697        let content = resp.text().await?;
698        match content_type {
699            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
700            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PublicKey`"))),
701            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PublicKey`")))),
702        }
703    } else {
704        let content = resp.text().await?;
705        let entity: Option<AdminCreatePublicKeyError> = serde_json::from_str(&content).ok();
706        Err(Error::ResponseError(ResponseContent { status, content, entity }))
707    }
708}
709
710pub async fn admin_create_repo(configuration: &configuration::Configuration, username: &str, repository: models::CreateRepoOption) -> Result<models::Repository, Error<AdminCreateRepoError>> {
711    // add a prefix to parameters to efficiently prevent name collisions
712    let p_path_username = username;
713    let p_body_repository = repository;
714
715    let uri_str = format!("{}/admin/users/{username}/repos", configuration.base_path, username=crate::apis::urlencode(p_path_username));
716    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
717
718    if let Some(ref apikey) = configuration.api_key {
719        let key = apikey.key.clone();
720        let value = match apikey.prefix {
721            Some(ref prefix) => format!("{} {}", prefix, key),
722            None => key,
723        };
724        req_builder = req_builder.query(&[("access_token", value)]);
725    }
726    if let Some(ref apikey) = configuration.api_key {
727        let key = apikey.key.clone();
728        let value = match apikey.prefix {
729            Some(ref prefix) => format!("{} {}", prefix, key),
730            None => key,
731        };
732        req_builder = req_builder.query(&[("sudo", value)]);
733    }
734    if let Some(ref apikey) = configuration.api_key {
735        let key = apikey.key.clone();
736        let value = match apikey.prefix {
737            Some(ref prefix) => format!("{} {}", prefix, key),
738            None => key,
739        };
740        req_builder = req_builder.query(&[("token", value)]);
741    }
742    if let Some(ref user_agent) = configuration.user_agent {
743        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
744    }
745    if let Some(ref apikey) = configuration.api_key {
746        let key = apikey.key.clone();
747        let value = match apikey.prefix {
748            Some(ref prefix) => format!("{} {}", prefix, key),
749            None => key,
750        };
751        req_builder = req_builder.header("X-GITEA-OTP", value);
752    };
753    if let Some(ref apikey) = configuration.api_key {
754        let key = apikey.key.clone();
755        let value = match apikey.prefix {
756            Some(ref prefix) => format!("{} {}", prefix, key),
757            None => key,
758        };
759        req_builder = req_builder.header("Authorization", value);
760    };
761    if let Some(ref apikey) = configuration.api_key {
762        let key = apikey.key.clone();
763        let value = match apikey.prefix {
764            Some(ref prefix) => format!("{} {}", prefix, key),
765            None => key,
766        };
767        req_builder = req_builder.header("Sudo", value);
768    };
769    if let Some(ref auth_conf) = configuration.basic_auth {
770        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
771    };
772    req_builder = req_builder.json(&p_body_repository);
773
774    let req = req_builder.build()?;
775    let resp = configuration.client.execute(req).await?;
776
777    let status = resp.status();
778    let content_type = resp
779        .headers()
780        .get("content-type")
781        .and_then(|v| v.to_str().ok())
782        .unwrap_or("application/octet-stream");
783    let content_type = super::ContentType::from(content_type);
784
785    if !status.is_client_error() && !status.is_server_error() {
786        let content = resp.text().await?;
787        match content_type {
788            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
789            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
790            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))),
791        }
792    } else {
793        let content = resp.text().await?;
794        let entity: Option<AdminCreateRepoError> = serde_json::from_str(&content).ok();
795        Err(Error::ResponseError(ResponseContent { status, content, entity }))
796    }
797}
798
799pub async fn admin_create_runner_registration_token(configuration: &configuration::Configuration, ) -> Result<(), Error<AdminCreateRunnerRegistrationTokenError>> {
800
801    let uri_str = format!("{}/admin/actions/runners/registration-token", configuration.base_path);
802    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
803
804    if let Some(ref apikey) = configuration.api_key {
805        let key = apikey.key.clone();
806        let value = match apikey.prefix {
807            Some(ref prefix) => format!("{} {}", prefix, key),
808            None => key,
809        };
810        req_builder = req_builder.query(&[("access_token", value)]);
811    }
812    if let Some(ref apikey) = configuration.api_key {
813        let key = apikey.key.clone();
814        let value = match apikey.prefix {
815            Some(ref prefix) => format!("{} {}", prefix, key),
816            None => key,
817        };
818        req_builder = req_builder.query(&[("sudo", value)]);
819    }
820    if let Some(ref apikey) = configuration.api_key {
821        let key = apikey.key.clone();
822        let value = match apikey.prefix {
823            Some(ref prefix) => format!("{} {}", prefix, key),
824            None => key,
825        };
826        req_builder = req_builder.query(&[("token", value)]);
827    }
828    if let Some(ref user_agent) = configuration.user_agent {
829        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
830    }
831    if let Some(ref apikey) = configuration.api_key {
832        let key = apikey.key.clone();
833        let value = match apikey.prefix {
834            Some(ref prefix) => format!("{} {}", prefix, key),
835            None => key,
836        };
837        req_builder = req_builder.header("X-GITEA-OTP", value);
838    };
839    if let Some(ref apikey) = configuration.api_key {
840        let key = apikey.key.clone();
841        let value = match apikey.prefix {
842            Some(ref prefix) => format!("{} {}", prefix, key),
843            None => key,
844        };
845        req_builder = req_builder.header("Authorization", value);
846    };
847    if let Some(ref apikey) = configuration.api_key {
848        let key = apikey.key.clone();
849        let value = match apikey.prefix {
850            Some(ref prefix) => format!("{} {}", prefix, key),
851            None => key,
852        };
853        req_builder = req_builder.header("Sudo", value);
854    };
855    if let Some(ref auth_conf) = configuration.basic_auth {
856        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
857    };
858
859    let req = req_builder.build()?;
860    let resp = configuration.client.execute(req).await?;
861
862    let status = resp.status();
863
864    if !status.is_client_error() && !status.is_server_error() {
865        Ok(())
866    } else {
867        let content = resp.text().await?;
868        let entity: Option<AdminCreateRunnerRegistrationTokenError> = serde_json::from_str(&content).ok();
869        Err(Error::ResponseError(ResponseContent { status, content, entity }))
870    }
871}
872
873pub async fn admin_create_user(configuration: &configuration::Configuration, body: Option<models::CreateUserOption>) -> Result<models::User, Error<AdminCreateUserError>> {
874    // add a prefix to parameters to efficiently prevent name collisions
875    let p_body_body = body;
876
877    let uri_str = format!("{}/admin/users", configuration.base_path);
878    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
879
880    if let Some(ref apikey) = configuration.api_key {
881        let key = apikey.key.clone();
882        let value = match apikey.prefix {
883            Some(ref prefix) => format!("{} {}", prefix, key),
884            None => key,
885        };
886        req_builder = req_builder.query(&[("access_token", value)]);
887    }
888    if let Some(ref apikey) = configuration.api_key {
889        let key = apikey.key.clone();
890        let value = match apikey.prefix {
891            Some(ref prefix) => format!("{} {}", prefix, key),
892            None => key,
893        };
894        req_builder = req_builder.query(&[("sudo", value)]);
895    }
896    if let Some(ref apikey) = configuration.api_key {
897        let key = apikey.key.clone();
898        let value = match apikey.prefix {
899            Some(ref prefix) => format!("{} {}", prefix, key),
900            None => key,
901        };
902        req_builder = req_builder.query(&[("token", value)]);
903    }
904    if let Some(ref user_agent) = configuration.user_agent {
905        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
914    };
915    if let Some(ref apikey) = configuration.api_key {
916        let key = apikey.key.clone();
917        let value = match apikey.prefix {
918            Some(ref prefix) => format!("{} {}", prefix, key),
919            None => key,
920        };
921        req_builder = req_builder.header("Authorization", value);
922    };
923    if let Some(ref apikey) = configuration.api_key {
924        let key = apikey.key.clone();
925        let value = match apikey.prefix {
926            Some(ref prefix) => format!("{} {}", prefix, key),
927            None => key,
928        };
929        req_builder = req_builder.header("Sudo", value);
930    };
931    if let Some(ref auth_conf) = configuration.basic_auth {
932        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
933    };
934    req_builder = req_builder.json(&p_body_body);
935
936    let req = req_builder.build()?;
937    let resp = configuration.client.execute(req).await?;
938
939    let status = resp.status();
940    let content_type = resp
941        .headers()
942        .get("content-type")
943        .and_then(|v| v.to_str().ok())
944        .unwrap_or("application/octet-stream");
945    let content_type = super::ContentType::from(content_type);
946
947    if !status.is_client_error() && !status.is_server_error() {
948        let content = resp.text().await?;
949        match content_type {
950            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
951            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))),
952            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))),
953        }
954    } else {
955        let content = resp.text().await?;
956        let entity: Option<AdminCreateUserError> = serde_json::from_str(&content).ok();
957        Err(Error::ResponseError(ResponseContent { status, content, entity }))
958    }
959}
960
961pub async fn admin_cron_list(configuration: &configuration::Configuration, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Cron>, Error<AdminCronListError>> {
962    // add a prefix to parameters to efficiently prevent name collisions
963    let p_query_page = page;
964    let p_query_limit = limit;
965
966    let uri_str = format!("{}/admin/cron", configuration.base_path);
967    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
968
969    if let Some(ref param_value) = p_query_page {
970        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
971    }
972    if let Some(ref param_value) = p_query_limit {
973        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
974    }
975    if let Some(ref apikey) = configuration.api_key {
976        let key = apikey.key.clone();
977        let value = match apikey.prefix {
978            Some(ref prefix) => format!("{} {}", prefix, key),
979            None => key,
980        };
981        req_builder = req_builder.query(&[("access_token", value)]);
982    }
983    if let Some(ref apikey) = configuration.api_key {
984        let key = apikey.key.clone();
985        let value = match apikey.prefix {
986            Some(ref prefix) => format!("{} {}", prefix, key),
987            None => key,
988        };
989        req_builder = req_builder.query(&[("sudo", value)]);
990    }
991    if let Some(ref apikey) = configuration.api_key {
992        let key = apikey.key.clone();
993        let value = match apikey.prefix {
994            Some(ref prefix) => format!("{} {}", prefix, key),
995            None => key,
996        };
997        req_builder = req_builder.query(&[("token", value)]);
998    }
999    if let Some(ref user_agent) = configuration.user_agent {
1000        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1001    }
1002    if let Some(ref apikey) = configuration.api_key {
1003        let key = apikey.key.clone();
1004        let value = match apikey.prefix {
1005            Some(ref prefix) => format!("{} {}", prefix, key),
1006            None => key,
1007        };
1008        req_builder = req_builder.header("X-GITEA-OTP", value);
1009    };
1010    if let Some(ref apikey) = configuration.api_key {
1011        let key = apikey.key.clone();
1012        let value = match apikey.prefix {
1013            Some(ref prefix) => format!("{} {}", prefix, key),
1014            None => key,
1015        };
1016        req_builder = req_builder.header("Authorization", value);
1017    };
1018    if let Some(ref apikey) = configuration.api_key {
1019        let key = apikey.key.clone();
1020        let value = match apikey.prefix {
1021            Some(ref prefix) => format!("{} {}", prefix, key),
1022            None => key,
1023        };
1024        req_builder = req_builder.header("Sudo", value);
1025    };
1026    if let Some(ref auth_conf) = configuration.basic_auth {
1027        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1028    };
1029
1030    let req = req_builder.build()?;
1031    let resp = configuration.client.execute(req).await?;
1032
1033    let status = resp.status();
1034    let content_type = resp
1035        .headers()
1036        .get("content-type")
1037        .and_then(|v| v.to_str().ok())
1038        .unwrap_or("application/octet-stream");
1039    let content_type = super::ContentType::from(content_type);
1040
1041    if !status.is_client_error() && !status.is_server_error() {
1042        let content = resp.text().await?;
1043        match content_type {
1044            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1045            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Cron&gt;`"))),
1046            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Cron&gt;`")))),
1047        }
1048    } else {
1049        let content = resp.text().await?;
1050        let entity: Option<AdminCronListError> = serde_json::from_str(&content).ok();
1051        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1052    }
1053}
1054
1055pub async fn admin_cron_run(configuration: &configuration::Configuration, task: &str) -> Result<(), Error<AdminCronRunError>> {
1056    // add a prefix to parameters to efficiently prevent name collisions
1057    let p_path_task = task;
1058
1059    let uri_str = format!("{}/admin/cron/{task}", configuration.base_path, task=crate::apis::urlencode(p_path_task));
1060    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1061
1062    if let Some(ref apikey) = configuration.api_key {
1063        let key = apikey.key.clone();
1064        let value = match apikey.prefix {
1065            Some(ref prefix) => format!("{} {}", prefix, key),
1066            None => key,
1067        };
1068        req_builder = req_builder.query(&[("access_token", value)]);
1069    }
1070    if let Some(ref apikey) = configuration.api_key {
1071        let key = apikey.key.clone();
1072        let value = match apikey.prefix {
1073            Some(ref prefix) => format!("{} {}", prefix, key),
1074            None => key,
1075        };
1076        req_builder = req_builder.query(&[("sudo", value)]);
1077    }
1078    if let Some(ref apikey) = configuration.api_key {
1079        let key = apikey.key.clone();
1080        let value = match apikey.prefix {
1081            Some(ref prefix) => format!("{} {}", prefix, key),
1082            None => key,
1083        };
1084        req_builder = req_builder.query(&[("token", value)]);
1085    }
1086    if let Some(ref user_agent) = configuration.user_agent {
1087        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1088    }
1089    if let Some(ref apikey) = configuration.api_key {
1090        let key = apikey.key.clone();
1091        let value = match apikey.prefix {
1092            Some(ref prefix) => format!("{} {}", prefix, key),
1093            None => key,
1094        };
1095        req_builder = req_builder.header("X-GITEA-OTP", value);
1096    };
1097    if let Some(ref apikey) = configuration.api_key {
1098        let key = apikey.key.clone();
1099        let value = match apikey.prefix {
1100            Some(ref prefix) => format!("{} {}", prefix, key),
1101            None => key,
1102        };
1103        req_builder = req_builder.header("Authorization", value);
1104    };
1105    if let Some(ref apikey) = configuration.api_key {
1106        let key = apikey.key.clone();
1107        let value = match apikey.prefix {
1108            Some(ref prefix) => format!("{} {}", prefix, key),
1109            None => key,
1110        };
1111        req_builder = req_builder.header("Sudo", value);
1112    };
1113    if let Some(ref auth_conf) = configuration.basic_auth {
1114        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1115    };
1116
1117    let req = req_builder.build()?;
1118    let resp = configuration.client.execute(req).await?;
1119
1120    let status = resp.status();
1121
1122    if !status.is_client_error() && !status.is_server_error() {
1123        Ok(())
1124    } else {
1125        let content = resp.text().await?;
1126        let entity: Option<AdminCronRunError> = serde_json::from_str(&content).ok();
1127        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1128    }
1129}
1130
1131pub async fn admin_delete_hook(configuration: &configuration::Configuration, id: i64) -> Result<(), Error<AdminDeleteHookError>> {
1132    // add a prefix to parameters to efficiently prevent name collisions
1133    let p_path_id = id;
1134
1135    let uri_str = format!("{}/admin/hooks/{id}", configuration.base_path, id=p_path_id);
1136    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1137
1138    if let Some(ref apikey) = configuration.api_key {
1139        let key = apikey.key.clone();
1140        let value = match apikey.prefix {
1141            Some(ref prefix) => format!("{} {}", prefix, key),
1142            None => key,
1143        };
1144        req_builder = req_builder.query(&[("access_token", value)]);
1145    }
1146    if let Some(ref apikey) = configuration.api_key {
1147        let key = apikey.key.clone();
1148        let value = match apikey.prefix {
1149            Some(ref prefix) => format!("{} {}", prefix, key),
1150            None => key,
1151        };
1152        req_builder = req_builder.query(&[("sudo", value)]);
1153    }
1154    if let Some(ref apikey) = configuration.api_key {
1155        let key = apikey.key.clone();
1156        let value = match apikey.prefix {
1157            Some(ref prefix) => format!("{} {}", prefix, key),
1158            None => key,
1159        };
1160        req_builder = req_builder.query(&[("token", value)]);
1161    }
1162    if let Some(ref user_agent) = configuration.user_agent {
1163        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1164    }
1165    if let Some(ref apikey) = configuration.api_key {
1166        let key = apikey.key.clone();
1167        let value = match apikey.prefix {
1168            Some(ref prefix) => format!("{} {}", prefix, key),
1169            None => key,
1170        };
1171        req_builder = req_builder.header("X-GITEA-OTP", value);
1172    };
1173    if let Some(ref apikey) = configuration.api_key {
1174        let key = apikey.key.clone();
1175        let value = match apikey.prefix {
1176            Some(ref prefix) => format!("{} {}", prefix, key),
1177            None => key,
1178        };
1179        req_builder = req_builder.header("Authorization", value);
1180    };
1181    if let Some(ref apikey) = configuration.api_key {
1182        let key = apikey.key.clone();
1183        let value = match apikey.prefix {
1184            Some(ref prefix) => format!("{} {}", prefix, key),
1185            None => key,
1186        };
1187        req_builder = req_builder.header("Sudo", value);
1188    };
1189    if let Some(ref auth_conf) = configuration.basic_auth {
1190        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1191    };
1192
1193    let req = req_builder.build()?;
1194    let resp = configuration.client.execute(req).await?;
1195
1196    let status = resp.status();
1197
1198    if !status.is_client_error() && !status.is_server_error() {
1199        Ok(())
1200    } else {
1201        let content = resp.text().await?;
1202        let entity: Option<AdminDeleteHookError> = serde_json::from_str(&content).ok();
1203        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1204    }
1205}
1206
1207pub async fn admin_delete_unadopted_repository(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<AdminDeleteUnadoptedRepositoryError>> {
1208    // add a prefix to parameters to efficiently prevent name collisions
1209    let p_path_owner = owner;
1210    let p_path_repo = repo;
1211
1212    let uri_str = format!("{}/admin/unadopted/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1213    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1214
1215    if let Some(ref apikey) = configuration.api_key {
1216        let key = apikey.key.clone();
1217        let value = match apikey.prefix {
1218            Some(ref prefix) => format!("{} {}", prefix, key),
1219            None => key,
1220        };
1221        req_builder = req_builder.query(&[("access_token", value)]);
1222    }
1223    if let Some(ref apikey) = configuration.api_key {
1224        let key = apikey.key.clone();
1225        let value = match apikey.prefix {
1226            Some(ref prefix) => format!("{} {}", prefix, key),
1227            None => key,
1228        };
1229        req_builder = req_builder.query(&[("sudo", value)]);
1230    }
1231    if let Some(ref apikey) = configuration.api_key {
1232        let key = apikey.key.clone();
1233        let value = match apikey.prefix {
1234            Some(ref prefix) => format!("{} {}", prefix, key),
1235            None => key,
1236        };
1237        req_builder = req_builder.query(&[("token", value)]);
1238    }
1239    if let Some(ref user_agent) = configuration.user_agent {
1240        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1241    }
1242    if let Some(ref apikey) = configuration.api_key {
1243        let key = apikey.key.clone();
1244        let value = match apikey.prefix {
1245            Some(ref prefix) => format!("{} {}", prefix, key),
1246            None => key,
1247        };
1248        req_builder = req_builder.header("X-GITEA-OTP", value);
1249    };
1250    if let Some(ref apikey) = configuration.api_key {
1251        let key = apikey.key.clone();
1252        let value = match apikey.prefix {
1253            Some(ref prefix) => format!("{} {}", prefix, key),
1254            None => key,
1255        };
1256        req_builder = req_builder.header("Authorization", value);
1257    };
1258    if let Some(ref apikey) = configuration.api_key {
1259        let key = apikey.key.clone();
1260        let value = match apikey.prefix {
1261            Some(ref prefix) => format!("{} {}", prefix, key),
1262            None => key,
1263        };
1264        req_builder = req_builder.header("Sudo", value);
1265    };
1266    if let Some(ref auth_conf) = configuration.basic_auth {
1267        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1268    };
1269
1270    let req = req_builder.build()?;
1271    let resp = configuration.client.execute(req).await?;
1272
1273    let status = resp.status();
1274
1275    if !status.is_client_error() && !status.is_server_error() {
1276        Ok(())
1277    } else {
1278        let content = resp.text().await?;
1279        let entity: Option<AdminDeleteUnadoptedRepositoryError> = serde_json::from_str(&content).ok();
1280        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1281    }
1282}
1283
1284pub async fn admin_delete_user(configuration: &configuration::Configuration, username: &str, purge: Option<bool>) -> Result<(), Error<AdminDeleteUserError>> {
1285    // add a prefix to parameters to efficiently prevent name collisions
1286    let p_path_username = username;
1287    let p_query_purge = purge;
1288
1289    let uri_str = format!("{}/admin/users/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username));
1290    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1291
1292    if let Some(ref param_value) = p_query_purge {
1293        req_builder = req_builder.query(&[("purge", &param_value.to_string())]);
1294    }
1295    if let Some(ref apikey) = configuration.api_key {
1296        let key = apikey.key.clone();
1297        let value = match apikey.prefix {
1298            Some(ref prefix) => format!("{} {}", prefix, key),
1299            None => key,
1300        };
1301        req_builder = req_builder.query(&[("access_token", value)]);
1302    }
1303    if let Some(ref apikey) = configuration.api_key {
1304        let key = apikey.key.clone();
1305        let value = match apikey.prefix {
1306            Some(ref prefix) => format!("{} {}", prefix, key),
1307            None => key,
1308        };
1309        req_builder = req_builder.query(&[("sudo", value)]);
1310    }
1311    if let Some(ref apikey) = configuration.api_key {
1312        let key = apikey.key.clone();
1313        let value = match apikey.prefix {
1314            Some(ref prefix) => format!("{} {}", prefix, key),
1315            None => key,
1316        };
1317        req_builder = req_builder.query(&[("token", value)]);
1318    }
1319    if let Some(ref user_agent) = configuration.user_agent {
1320        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1321    }
1322    if let Some(ref apikey) = configuration.api_key {
1323        let key = apikey.key.clone();
1324        let value = match apikey.prefix {
1325            Some(ref prefix) => format!("{} {}", prefix, key),
1326            None => key,
1327        };
1328        req_builder = req_builder.header("X-GITEA-OTP", value);
1329    };
1330    if let Some(ref apikey) = configuration.api_key {
1331        let key = apikey.key.clone();
1332        let value = match apikey.prefix {
1333            Some(ref prefix) => format!("{} {}", prefix, key),
1334            None => key,
1335        };
1336        req_builder = req_builder.header("Authorization", value);
1337    };
1338    if let Some(ref apikey) = configuration.api_key {
1339        let key = apikey.key.clone();
1340        let value = match apikey.prefix {
1341            Some(ref prefix) => format!("{} {}", prefix, key),
1342            None => key,
1343        };
1344        req_builder = req_builder.header("Sudo", value);
1345    };
1346    if let Some(ref auth_conf) = configuration.basic_auth {
1347        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1348    };
1349
1350    let req = req_builder.build()?;
1351    let resp = configuration.client.execute(req).await?;
1352
1353    let status = resp.status();
1354
1355    if !status.is_client_error() && !status.is_server_error() {
1356        Ok(())
1357    } else {
1358        let content = resp.text().await?;
1359        let entity: Option<AdminDeleteUserError> = serde_json::from_str(&content).ok();
1360        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1361    }
1362}
1363
1364pub async fn admin_delete_user_badges(configuration: &configuration::Configuration, username: &str, body: Option<models::UserBadgeOption>) -> Result<(), Error<AdminDeleteUserBadgesError>> {
1365    // add a prefix to parameters to efficiently prevent name collisions
1366    let p_path_username = username;
1367    let p_body_body = body;
1368
1369    let uri_str = format!("{}/admin/users/{username}/badges", configuration.base_path, username=crate::apis::urlencode(p_path_username));
1370    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1371
1372    if let Some(ref apikey) = configuration.api_key {
1373        let key = apikey.key.clone();
1374        let value = match apikey.prefix {
1375            Some(ref prefix) => format!("{} {}", prefix, key),
1376            None => key,
1377        };
1378        req_builder = req_builder.query(&[("access_token", value)]);
1379    }
1380    if let Some(ref apikey) = configuration.api_key {
1381        let key = apikey.key.clone();
1382        let value = match apikey.prefix {
1383            Some(ref prefix) => format!("{} {}", prefix, key),
1384            None => key,
1385        };
1386        req_builder = req_builder.query(&[("sudo", value)]);
1387    }
1388    if let Some(ref apikey) = configuration.api_key {
1389        let key = apikey.key.clone();
1390        let value = match apikey.prefix {
1391            Some(ref prefix) => format!("{} {}", prefix, key),
1392            None => key,
1393        };
1394        req_builder = req_builder.query(&[("token", value)]);
1395    }
1396    if let Some(ref user_agent) = configuration.user_agent {
1397        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1398    }
1399    if let Some(ref apikey) = configuration.api_key {
1400        let key = apikey.key.clone();
1401        let value = match apikey.prefix {
1402            Some(ref prefix) => format!("{} {}", prefix, key),
1403            None => key,
1404        };
1405        req_builder = req_builder.header("X-GITEA-OTP", value);
1406    };
1407    if let Some(ref apikey) = configuration.api_key {
1408        let key = apikey.key.clone();
1409        let value = match apikey.prefix {
1410            Some(ref prefix) => format!("{} {}", prefix, key),
1411            None => key,
1412        };
1413        req_builder = req_builder.header("Authorization", value);
1414    };
1415    if let Some(ref apikey) = configuration.api_key {
1416        let key = apikey.key.clone();
1417        let value = match apikey.prefix {
1418            Some(ref prefix) => format!("{} {}", prefix, key),
1419            None => key,
1420        };
1421        req_builder = req_builder.header("Sudo", value);
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    req_builder = req_builder.json(&p_body_body);
1427
1428    let req = req_builder.build()?;
1429    let resp = configuration.client.execute(req).await?;
1430
1431    let status = resp.status();
1432
1433    if !status.is_client_error() && !status.is_server_error() {
1434        Ok(())
1435    } else {
1436        let content = resp.text().await?;
1437        let entity: Option<AdminDeleteUserBadgesError> = serde_json::from_str(&content).ok();
1438        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1439    }
1440}
1441
1442pub async fn admin_delete_user_public_key(configuration: &configuration::Configuration, username: &str, id: i64) -> Result<(), Error<AdminDeleteUserPublicKeyError>> {
1443    // add a prefix to parameters to efficiently prevent name collisions
1444    let p_path_username = username;
1445    let p_path_id = id;
1446
1447    let uri_str = format!("{}/admin/users/{username}/keys/{id}", configuration.base_path, username=crate::apis::urlencode(p_path_username), id=p_path_id);
1448    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1449
1450    if let Some(ref apikey) = configuration.api_key {
1451        let key = apikey.key.clone();
1452        let value = match apikey.prefix {
1453            Some(ref prefix) => format!("{} {}", prefix, key),
1454            None => key,
1455        };
1456        req_builder = req_builder.query(&[("access_token", value)]);
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(&[("sudo", value)]);
1465    }
1466    if let Some(ref apikey) = configuration.api_key {
1467        let key = apikey.key.clone();
1468        let value = match apikey.prefix {
1469            Some(ref prefix) => format!("{} {}", prefix, key),
1470            None => key,
1471        };
1472        req_builder = req_builder.query(&[("token", value)]);
1473    }
1474    if let Some(ref user_agent) = configuration.user_agent {
1475        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1476    }
1477    if let Some(ref apikey) = configuration.api_key {
1478        let key = apikey.key.clone();
1479        let value = match apikey.prefix {
1480            Some(ref prefix) => format!("{} {}", prefix, key),
1481            None => key,
1482        };
1483        req_builder = req_builder.header("X-GITEA-OTP", value);
1484    };
1485    if let Some(ref apikey) = configuration.api_key {
1486        let key = apikey.key.clone();
1487        let value = match apikey.prefix {
1488            Some(ref prefix) => format!("{} {}", prefix, key),
1489            None => key,
1490        };
1491        req_builder = req_builder.header("Authorization", value);
1492    };
1493    if let Some(ref apikey) = configuration.api_key {
1494        let key = apikey.key.clone();
1495        let value = match apikey.prefix {
1496            Some(ref prefix) => format!("{} {}", prefix, key),
1497            None => key,
1498        };
1499        req_builder = req_builder.header("Sudo", value);
1500    };
1501    if let Some(ref auth_conf) = configuration.basic_auth {
1502        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1503    };
1504
1505    let req = req_builder.build()?;
1506    let resp = configuration.client.execute(req).await?;
1507
1508    let status = resp.status();
1509
1510    if !status.is_client_error() && !status.is_server_error() {
1511        Ok(())
1512    } else {
1513        let content = resp.text().await?;
1514        let entity: Option<AdminDeleteUserPublicKeyError> = serde_json::from_str(&content).ok();
1515        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1516    }
1517}
1518
1519pub async fn admin_edit_hook(configuration: &configuration::Configuration, id: i64, body: Option<models::EditHookOption>) -> Result<models::Hook, Error<AdminEditHookError>> {
1520    // add a prefix to parameters to efficiently prevent name collisions
1521    let p_path_id = id;
1522    let p_body_body = body;
1523
1524    let uri_str = format!("{}/admin/hooks/{id}", configuration.base_path, id=p_path_id);
1525    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1526
1527    if let Some(ref apikey) = configuration.api_key {
1528        let key = apikey.key.clone();
1529        let value = match apikey.prefix {
1530            Some(ref prefix) => format!("{} {}", prefix, key),
1531            None => key,
1532        };
1533        req_builder = req_builder.query(&[("access_token", value)]);
1534    }
1535    if let Some(ref apikey) = configuration.api_key {
1536        let key = apikey.key.clone();
1537        let value = match apikey.prefix {
1538            Some(ref prefix) => format!("{} {}", prefix, key),
1539            None => key,
1540        };
1541        req_builder = req_builder.query(&[("sudo", value)]);
1542    }
1543    if let Some(ref apikey) = configuration.api_key {
1544        let key = apikey.key.clone();
1545        let value = match apikey.prefix {
1546            Some(ref prefix) => format!("{} {}", prefix, key),
1547            None => key,
1548        };
1549        req_builder = req_builder.query(&[("token", value)]);
1550    }
1551    if let Some(ref user_agent) = configuration.user_agent {
1552        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1553    }
1554    if let Some(ref apikey) = configuration.api_key {
1555        let key = apikey.key.clone();
1556        let value = match apikey.prefix {
1557            Some(ref prefix) => format!("{} {}", prefix, key),
1558            None => key,
1559        };
1560        req_builder = req_builder.header("X-GITEA-OTP", value);
1561    };
1562    if let Some(ref apikey) = configuration.api_key {
1563        let key = apikey.key.clone();
1564        let value = match apikey.prefix {
1565            Some(ref prefix) => format!("{} {}", prefix, key),
1566            None => key,
1567        };
1568        req_builder = req_builder.header("Authorization", value);
1569    };
1570    if let Some(ref apikey) = configuration.api_key {
1571        let key = apikey.key.clone();
1572        let value = match apikey.prefix {
1573            Some(ref prefix) => format!("{} {}", prefix, key),
1574            None => key,
1575        };
1576        req_builder = req_builder.header("Sudo", value);
1577    };
1578    if let Some(ref auth_conf) = configuration.basic_auth {
1579        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1580    };
1581    req_builder = req_builder.json(&p_body_body);
1582
1583    let req = req_builder.build()?;
1584    let resp = configuration.client.execute(req).await?;
1585
1586    let status = resp.status();
1587    let content_type = resp
1588        .headers()
1589        .get("content-type")
1590        .and_then(|v| v.to_str().ok())
1591        .unwrap_or("application/octet-stream");
1592    let content_type = super::ContentType::from(content_type);
1593
1594    if !status.is_client_error() && !status.is_server_error() {
1595        let content = resp.text().await?;
1596        match content_type {
1597            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1598            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
1599            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))),
1600        }
1601    } else {
1602        let content = resp.text().await?;
1603        let entity: Option<AdminEditHookError> = serde_json::from_str(&content).ok();
1604        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1605    }
1606}
1607
1608pub async fn admin_edit_user(configuration: &configuration::Configuration, username: &str, body: Option<models::EditUserOption>) -> Result<models::User, Error<AdminEditUserError>> {
1609    // add a prefix to parameters to efficiently prevent name collisions
1610    let p_path_username = username;
1611    let p_body_body = body;
1612
1613    let uri_str = format!("{}/admin/users/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username));
1614    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1615
1616    if let Some(ref apikey) = configuration.api_key {
1617        let key = apikey.key.clone();
1618        let value = match apikey.prefix {
1619            Some(ref prefix) => format!("{} {}", prefix, key),
1620            None => key,
1621        };
1622        req_builder = req_builder.query(&[("access_token", value)]);
1623    }
1624    if let Some(ref apikey) = configuration.api_key {
1625        let key = apikey.key.clone();
1626        let value = match apikey.prefix {
1627            Some(ref prefix) => format!("{} {}", prefix, key),
1628            None => key,
1629        };
1630        req_builder = req_builder.query(&[("sudo", value)]);
1631    }
1632    if let Some(ref apikey) = configuration.api_key {
1633        let key = apikey.key.clone();
1634        let value = match apikey.prefix {
1635            Some(ref prefix) => format!("{} {}", prefix, key),
1636            None => key,
1637        };
1638        req_builder = req_builder.query(&[("token", value)]);
1639    }
1640    if let Some(ref user_agent) = configuration.user_agent {
1641        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1642    }
1643    if let Some(ref apikey) = configuration.api_key {
1644        let key = apikey.key.clone();
1645        let value = match apikey.prefix {
1646            Some(ref prefix) => format!("{} {}", prefix, key),
1647            None => key,
1648        };
1649        req_builder = req_builder.header("X-GITEA-OTP", value);
1650    };
1651    if let Some(ref apikey) = configuration.api_key {
1652        let key = apikey.key.clone();
1653        let value = match apikey.prefix {
1654            Some(ref prefix) => format!("{} {}", prefix, key),
1655            None => key,
1656        };
1657        req_builder = req_builder.header("Authorization", value);
1658    };
1659    if let Some(ref apikey) = configuration.api_key {
1660        let key = apikey.key.clone();
1661        let value = match apikey.prefix {
1662            Some(ref prefix) => format!("{} {}", prefix, key),
1663            None => key,
1664        };
1665        req_builder = req_builder.header("Sudo", value);
1666    };
1667    if let Some(ref auth_conf) = configuration.basic_auth {
1668        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1669    };
1670    req_builder = req_builder.json(&p_body_body);
1671
1672    let req = req_builder.build()?;
1673    let resp = configuration.client.execute(req).await?;
1674
1675    let status = resp.status();
1676    let content_type = resp
1677        .headers()
1678        .get("content-type")
1679        .and_then(|v| v.to_str().ok())
1680        .unwrap_or("application/octet-stream");
1681    let content_type = super::ContentType::from(content_type);
1682
1683    if !status.is_client_error() && !status.is_server_error() {
1684        let content = resp.text().await?;
1685        match content_type {
1686            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1687            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))),
1688            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))),
1689        }
1690    } else {
1691        let content = resp.text().await?;
1692        let entity: Option<AdminEditUserError> = serde_json::from_str(&content).ok();
1693        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1694    }
1695}
1696
1697pub async fn admin_get_all_emails(configuration: &configuration::Configuration, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Email>, Error<AdminGetAllEmailsError>> {
1698    // add a prefix to parameters to efficiently prevent name collisions
1699    let p_query_page = page;
1700    let p_query_limit = limit;
1701
1702    let uri_str = format!("{}/admin/emails", configuration.base_path);
1703    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1704
1705    if let Some(ref param_value) = p_query_page {
1706        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1707    }
1708    if let Some(ref param_value) = p_query_limit {
1709        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1710    }
1711    if let Some(ref apikey) = configuration.api_key {
1712        let key = apikey.key.clone();
1713        let value = match apikey.prefix {
1714            Some(ref prefix) => format!("{} {}", prefix, key),
1715            None => key,
1716        };
1717        req_builder = req_builder.query(&[("access_token", value)]);
1718    }
1719    if let Some(ref apikey) = configuration.api_key {
1720        let key = apikey.key.clone();
1721        let value = match apikey.prefix {
1722            Some(ref prefix) => format!("{} {}", prefix, key),
1723            None => key,
1724        };
1725        req_builder = req_builder.query(&[("sudo", value)]);
1726    }
1727    if let Some(ref apikey) = configuration.api_key {
1728        let key = apikey.key.clone();
1729        let value = match apikey.prefix {
1730            Some(ref prefix) => format!("{} {}", prefix, key),
1731            None => key,
1732        };
1733        req_builder = req_builder.query(&[("token", value)]);
1734    }
1735    if let Some(ref user_agent) = configuration.user_agent {
1736        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1737    }
1738    if let Some(ref apikey) = configuration.api_key {
1739        let key = apikey.key.clone();
1740        let value = match apikey.prefix {
1741            Some(ref prefix) => format!("{} {}", prefix, key),
1742            None => key,
1743        };
1744        req_builder = req_builder.header("X-GITEA-OTP", value);
1745    };
1746    if let Some(ref apikey) = configuration.api_key {
1747        let key = apikey.key.clone();
1748        let value = match apikey.prefix {
1749            Some(ref prefix) => format!("{} {}", prefix, key),
1750            None => key,
1751        };
1752        req_builder = req_builder.header("Authorization", value);
1753    };
1754    if let Some(ref apikey) = configuration.api_key {
1755        let key = apikey.key.clone();
1756        let value = match apikey.prefix {
1757            Some(ref prefix) => format!("{} {}", prefix, key),
1758            None => key,
1759        };
1760        req_builder = req_builder.header("Sudo", value);
1761    };
1762    if let Some(ref auth_conf) = configuration.basic_auth {
1763        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1764    };
1765
1766    let req = req_builder.build()?;
1767    let resp = configuration.client.execute(req).await?;
1768
1769    let status = resp.status();
1770    let content_type = resp
1771        .headers()
1772        .get("content-type")
1773        .and_then(|v| v.to_str().ok())
1774        .unwrap_or("application/octet-stream");
1775    let content_type = super::ContentType::from(content_type);
1776
1777    if !status.is_client_error() && !status.is_server_error() {
1778        let content = resp.text().await?;
1779        match content_type {
1780            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1781            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Email&gt;`"))),
1782            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Email&gt;`")))),
1783        }
1784    } else {
1785        let content = resp.text().await?;
1786        let entity: Option<AdminGetAllEmailsError> = serde_json::from_str(&content).ok();
1787        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1788    }
1789}
1790
1791pub async fn admin_get_all_orgs(configuration: &configuration::Configuration, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Organization>, Error<AdminGetAllOrgsError>> {
1792    // add a prefix to parameters to efficiently prevent name collisions
1793    let p_query_page = page;
1794    let p_query_limit = limit;
1795
1796    let uri_str = format!("{}/admin/orgs", configuration.base_path);
1797    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1798
1799    if let Some(ref param_value) = p_query_page {
1800        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1801    }
1802    if let Some(ref param_value) = p_query_limit {
1803        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1804    }
1805    if let Some(ref apikey) = configuration.api_key {
1806        let key = apikey.key.clone();
1807        let value = match apikey.prefix {
1808            Some(ref prefix) => format!("{} {}", prefix, key),
1809            None => key,
1810        };
1811        req_builder = req_builder.query(&[("access_token", value)]);
1812    }
1813    if let Some(ref apikey) = configuration.api_key {
1814        let key = apikey.key.clone();
1815        let value = match apikey.prefix {
1816            Some(ref prefix) => format!("{} {}", prefix, key),
1817            None => key,
1818        };
1819        req_builder = req_builder.query(&[("sudo", value)]);
1820    }
1821    if let Some(ref apikey) = configuration.api_key {
1822        let key = apikey.key.clone();
1823        let value = match apikey.prefix {
1824            Some(ref prefix) => format!("{} {}", prefix, key),
1825            None => key,
1826        };
1827        req_builder = req_builder.query(&[("token", value)]);
1828    }
1829    if let Some(ref user_agent) = configuration.user_agent {
1830        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1831    }
1832    if let Some(ref apikey) = configuration.api_key {
1833        let key = apikey.key.clone();
1834        let value = match apikey.prefix {
1835            Some(ref prefix) => format!("{} {}", prefix, key),
1836            None => key,
1837        };
1838        req_builder = req_builder.header("X-GITEA-OTP", value);
1839    };
1840    if let Some(ref apikey) = configuration.api_key {
1841        let key = apikey.key.clone();
1842        let value = match apikey.prefix {
1843            Some(ref prefix) => format!("{} {}", prefix, key),
1844            None => key,
1845        };
1846        req_builder = req_builder.header("Authorization", value);
1847    };
1848    if let Some(ref apikey) = configuration.api_key {
1849        let key = apikey.key.clone();
1850        let value = match apikey.prefix {
1851            Some(ref prefix) => format!("{} {}", prefix, key),
1852            None => key,
1853        };
1854        req_builder = req_builder.header("Sudo", value);
1855    };
1856    if let Some(ref auth_conf) = configuration.basic_auth {
1857        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1858    };
1859
1860    let req = req_builder.build()?;
1861    let resp = configuration.client.execute(req).await?;
1862
1863    let status = resp.status();
1864    let content_type = resp
1865        .headers()
1866        .get("content-type")
1867        .and_then(|v| v.to_str().ok())
1868        .unwrap_or("application/octet-stream");
1869    let content_type = super::ContentType::from(content_type);
1870
1871    if !status.is_client_error() && !status.is_server_error() {
1872        let content = resp.text().await?;
1873        match content_type {
1874            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1875            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Organization&gt;`"))),
1876            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Organization&gt;`")))),
1877        }
1878    } else {
1879        let content = resp.text().await?;
1880        let entity: Option<AdminGetAllOrgsError> = serde_json::from_str(&content).ok();
1881        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1882    }
1883}
1884
1885pub async fn admin_get_hook(configuration: &configuration::Configuration, id: i64) -> Result<models::Hook, Error<AdminGetHookError>> {
1886    // add a prefix to parameters to efficiently prevent name collisions
1887    let p_path_id = id;
1888
1889    let uri_str = format!("{}/admin/hooks/{id}", configuration.base_path, id=p_path_id);
1890    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1891
1892    if let Some(ref apikey) = configuration.api_key {
1893        let key = apikey.key.clone();
1894        let value = match apikey.prefix {
1895            Some(ref prefix) => format!("{} {}", prefix, key),
1896            None => key,
1897        };
1898        req_builder = req_builder.query(&[("access_token", value)]);
1899    }
1900    if let Some(ref apikey) = configuration.api_key {
1901        let key = apikey.key.clone();
1902        let value = match apikey.prefix {
1903            Some(ref prefix) => format!("{} {}", prefix, key),
1904            None => key,
1905        };
1906        req_builder = req_builder.query(&[("sudo", value)]);
1907    }
1908    if let Some(ref apikey) = configuration.api_key {
1909        let key = apikey.key.clone();
1910        let value = match apikey.prefix {
1911            Some(ref prefix) => format!("{} {}", prefix, key),
1912            None => key,
1913        };
1914        req_builder = req_builder.query(&[("token", value)]);
1915    }
1916    if let Some(ref user_agent) = configuration.user_agent {
1917        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1918    }
1919    if let Some(ref apikey) = configuration.api_key {
1920        let key = apikey.key.clone();
1921        let value = match apikey.prefix {
1922            Some(ref prefix) => format!("{} {}", prefix, key),
1923            None => key,
1924        };
1925        req_builder = req_builder.header("X-GITEA-OTP", value);
1926    };
1927    if let Some(ref apikey) = configuration.api_key {
1928        let key = apikey.key.clone();
1929        let value = match apikey.prefix {
1930            Some(ref prefix) => format!("{} {}", prefix, key),
1931            None => key,
1932        };
1933        req_builder = req_builder.header("Authorization", value);
1934    };
1935    if let Some(ref apikey) = configuration.api_key {
1936        let key = apikey.key.clone();
1937        let value = match apikey.prefix {
1938            Some(ref prefix) => format!("{} {}", prefix, key),
1939            None => key,
1940        };
1941        req_builder = req_builder.header("Sudo", value);
1942    };
1943    if let Some(ref auth_conf) = configuration.basic_auth {
1944        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1945    };
1946
1947    let req = req_builder.build()?;
1948    let resp = configuration.client.execute(req).await?;
1949
1950    let status = resp.status();
1951    let content_type = resp
1952        .headers()
1953        .get("content-type")
1954        .and_then(|v| v.to_str().ok())
1955        .unwrap_or("application/octet-stream");
1956    let content_type = super::ContentType::from(content_type);
1957
1958    if !status.is_client_error() && !status.is_server_error() {
1959        let content = resp.text().await?;
1960        match content_type {
1961            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1962            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
1963            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))),
1964        }
1965    } else {
1966        let content = resp.text().await?;
1967        let entity: Option<AdminGetHookError> = serde_json::from_str(&content).ok();
1968        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1969    }
1970}
1971
1972pub async fn admin_get_runner_registration_token(configuration: &configuration::Configuration, ) -> Result<(), Error<AdminGetRunnerRegistrationTokenError>> {
1973
1974    let uri_str = format!("{}/admin/runners/registration-token", configuration.base_path);
1975    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1976
1977    if let Some(ref apikey) = configuration.api_key {
1978        let key = apikey.key.clone();
1979        let value = match apikey.prefix {
1980            Some(ref prefix) => format!("{} {}", prefix, key),
1981            None => key,
1982        };
1983        req_builder = req_builder.query(&[("access_token", value)]);
1984    }
1985    if let Some(ref apikey) = configuration.api_key {
1986        let key = apikey.key.clone();
1987        let value = match apikey.prefix {
1988            Some(ref prefix) => format!("{} {}", prefix, key),
1989            None => key,
1990        };
1991        req_builder = req_builder.query(&[("sudo", value)]);
1992    }
1993    if let Some(ref apikey) = configuration.api_key {
1994        let key = apikey.key.clone();
1995        let value = match apikey.prefix {
1996            Some(ref prefix) => format!("{} {}", prefix, key),
1997            None => key,
1998        };
1999        req_builder = req_builder.query(&[("token", value)]);
2000    }
2001    if let Some(ref user_agent) = configuration.user_agent {
2002        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2003    }
2004    if let Some(ref apikey) = configuration.api_key {
2005        let key = apikey.key.clone();
2006        let value = match apikey.prefix {
2007            Some(ref prefix) => format!("{} {}", prefix, key),
2008            None => key,
2009        };
2010        req_builder = req_builder.header("X-GITEA-OTP", value);
2011    };
2012    if let Some(ref apikey) = configuration.api_key {
2013        let key = apikey.key.clone();
2014        let value = match apikey.prefix {
2015            Some(ref prefix) => format!("{} {}", prefix, key),
2016            None => key,
2017        };
2018        req_builder = req_builder.header("Authorization", value);
2019    };
2020    if let Some(ref apikey) = configuration.api_key {
2021        let key = apikey.key.clone();
2022        let value = match apikey.prefix {
2023            Some(ref prefix) => format!("{} {}", prefix, key),
2024            None => key,
2025        };
2026        req_builder = req_builder.header("Sudo", value);
2027    };
2028    if let Some(ref auth_conf) = configuration.basic_auth {
2029        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2030    };
2031
2032    let req = req_builder.build()?;
2033    let resp = configuration.client.execute(req).await?;
2034
2035    let status = resp.status();
2036
2037    if !status.is_client_error() && !status.is_server_error() {
2038        Ok(())
2039    } else {
2040        let content = resp.text().await?;
2041        let entity: Option<AdminGetRunnerRegistrationTokenError> = serde_json::from_str(&content).ok();
2042        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2043    }
2044}
2045
2046pub async fn admin_list_hooks(configuration: &configuration::Configuration, page: Option<i32>, limit: Option<i32>, r#type: Option<&str>) -> Result<Vec<models::Hook>, Error<AdminListHooksError>> {
2047    // add a prefix to parameters to efficiently prevent name collisions
2048    let p_query_page = page;
2049    let p_query_limit = limit;
2050    let p_query_type = r#type;
2051
2052    let uri_str = format!("{}/admin/hooks", configuration.base_path);
2053    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2054
2055    if let Some(ref param_value) = p_query_page {
2056        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2057    }
2058    if let Some(ref param_value) = p_query_limit {
2059        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2060    }
2061    if let Some(ref param_value) = p_query_type {
2062        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
2063    }
2064    if let Some(ref apikey) = configuration.api_key {
2065        let key = apikey.key.clone();
2066        let value = match apikey.prefix {
2067            Some(ref prefix) => format!("{} {}", prefix, key),
2068            None => key,
2069        };
2070        req_builder = req_builder.query(&[("access_token", value)]);
2071    }
2072    if let Some(ref apikey) = configuration.api_key {
2073        let key = apikey.key.clone();
2074        let value = match apikey.prefix {
2075            Some(ref prefix) => format!("{} {}", prefix, key),
2076            None => key,
2077        };
2078        req_builder = req_builder.query(&[("sudo", value)]);
2079    }
2080    if let Some(ref apikey) = configuration.api_key {
2081        let key = apikey.key.clone();
2082        let value = match apikey.prefix {
2083            Some(ref prefix) => format!("{} {}", prefix, key),
2084            None => key,
2085        };
2086        req_builder = req_builder.query(&[("token", value)]);
2087    }
2088    if let Some(ref user_agent) = configuration.user_agent {
2089        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2090    }
2091    if let Some(ref apikey) = configuration.api_key {
2092        let key = apikey.key.clone();
2093        let value = match apikey.prefix {
2094            Some(ref prefix) => format!("{} {}", prefix, key),
2095            None => key,
2096        };
2097        req_builder = req_builder.header("X-GITEA-OTP", value);
2098    };
2099    if let Some(ref apikey) = configuration.api_key {
2100        let key = apikey.key.clone();
2101        let value = match apikey.prefix {
2102            Some(ref prefix) => format!("{} {}", prefix, key),
2103            None => key,
2104        };
2105        req_builder = req_builder.header("Authorization", value);
2106    };
2107    if let Some(ref apikey) = configuration.api_key {
2108        let key = apikey.key.clone();
2109        let value = match apikey.prefix {
2110            Some(ref prefix) => format!("{} {}", prefix, key),
2111            None => key,
2112        };
2113        req_builder = req_builder.header("Sudo", value);
2114    };
2115    if let Some(ref auth_conf) = configuration.basic_auth {
2116        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2117    };
2118
2119    let req = req_builder.build()?;
2120    let resp = configuration.client.execute(req).await?;
2121
2122    let status = resp.status();
2123    let content_type = resp
2124        .headers()
2125        .get("content-type")
2126        .and_then(|v| v.to_str().ok())
2127        .unwrap_or("application/octet-stream");
2128    let content_type = super::ContentType::from(content_type);
2129
2130    if !status.is_client_error() && !status.is_server_error() {
2131        let content = resp.text().await?;
2132        match content_type {
2133            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2134            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Hook&gt;`"))),
2135            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Hook&gt;`")))),
2136        }
2137    } else {
2138        let content = resp.text().await?;
2139        let entity: Option<AdminListHooksError> = serde_json::from_str(&content).ok();
2140        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2141    }
2142}
2143
2144pub async fn admin_list_user_badges(configuration: &configuration::Configuration, username: &str) -> Result<Vec<models::Badge>, Error<AdminListUserBadgesError>> {
2145    // add a prefix to parameters to efficiently prevent name collisions
2146    let p_path_username = username;
2147
2148    let uri_str = format!("{}/admin/users/{username}/badges", configuration.base_path, username=crate::apis::urlencode(p_path_username));
2149    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2150
2151    if let Some(ref apikey) = configuration.api_key {
2152        let key = apikey.key.clone();
2153        let value = match apikey.prefix {
2154            Some(ref prefix) => format!("{} {}", prefix, key),
2155            None => key,
2156        };
2157        req_builder = req_builder.query(&[("access_token", value)]);
2158    }
2159    if let Some(ref apikey) = configuration.api_key {
2160        let key = apikey.key.clone();
2161        let value = match apikey.prefix {
2162            Some(ref prefix) => format!("{} {}", prefix, key),
2163            None => key,
2164        };
2165        req_builder = req_builder.query(&[("sudo", value)]);
2166    }
2167    if let Some(ref apikey) = configuration.api_key {
2168        let key = apikey.key.clone();
2169        let value = match apikey.prefix {
2170            Some(ref prefix) => format!("{} {}", prefix, key),
2171            None => key,
2172        };
2173        req_builder = req_builder.query(&[("token", value)]);
2174    }
2175    if let Some(ref user_agent) = configuration.user_agent {
2176        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2177    }
2178    if let Some(ref apikey) = configuration.api_key {
2179        let key = apikey.key.clone();
2180        let value = match apikey.prefix {
2181            Some(ref prefix) => format!("{} {}", prefix, key),
2182            None => key,
2183        };
2184        req_builder = req_builder.header("X-GITEA-OTP", value);
2185    };
2186    if let Some(ref apikey) = configuration.api_key {
2187        let key = apikey.key.clone();
2188        let value = match apikey.prefix {
2189            Some(ref prefix) => format!("{} {}", prefix, key),
2190            None => key,
2191        };
2192        req_builder = req_builder.header("Authorization", value);
2193    };
2194    if let Some(ref apikey) = configuration.api_key {
2195        let key = apikey.key.clone();
2196        let value = match apikey.prefix {
2197            Some(ref prefix) => format!("{} {}", prefix, key),
2198            None => key,
2199        };
2200        req_builder = req_builder.header("Sudo", value);
2201    };
2202    if let Some(ref auth_conf) = configuration.basic_auth {
2203        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2204    };
2205
2206    let req = req_builder.build()?;
2207    let resp = configuration.client.execute(req).await?;
2208
2209    let status = resp.status();
2210    let content_type = resp
2211        .headers()
2212        .get("content-type")
2213        .and_then(|v| v.to_str().ok())
2214        .unwrap_or("application/octet-stream");
2215    let content_type = super::ContentType::from(content_type);
2216
2217    if !status.is_client_error() && !status.is_server_error() {
2218        let content = resp.text().await?;
2219        match content_type {
2220            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2221            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Badge&gt;`"))),
2222            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Badge&gt;`")))),
2223        }
2224    } else {
2225        let content = resp.text().await?;
2226        let entity: Option<AdminListUserBadgesError> = serde_json::from_str(&content).ok();
2227        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2228    }
2229}
2230
2231pub async fn admin_rename_user(configuration: &configuration::Configuration, username: &str, body: models::RenameUserOption) -> Result<(), Error<AdminRenameUserError>> {
2232    // add a prefix to parameters to efficiently prevent name collisions
2233    let p_path_username = username;
2234    let p_body_body = body;
2235
2236    let uri_str = format!("{}/admin/users/{username}/rename", configuration.base_path, username=crate::apis::urlencode(p_path_username));
2237    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2238
2239    if let Some(ref apikey) = configuration.api_key {
2240        let key = apikey.key.clone();
2241        let value = match apikey.prefix {
2242            Some(ref prefix) => format!("{} {}", prefix, key),
2243            None => key,
2244        };
2245        req_builder = req_builder.query(&[("access_token", value)]);
2246    }
2247    if let Some(ref apikey) = configuration.api_key {
2248        let key = apikey.key.clone();
2249        let value = match apikey.prefix {
2250            Some(ref prefix) => format!("{} {}", prefix, key),
2251            None => key,
2252        };
2253        req_builder = req_builder.query(&[("sudo", value)]);
2254    }
2255    if let Some(ref apikey) = configuration.api_key {
2256        let key = apikey.key.clone();
2257        let value = match apikey.prefix {
2258            Some(ref prefix) => format!("{} {}", prefix, key),
2259            None => key,
2260        };
2261        req_builder = req_builder.query(&[("token", value)]);
2262    }
2263    if let Some(ref user_agent) = configuration.user_agent {
2264        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2265    }
2266    if let Some(ref apikey) = configuration.api_key {
2267        let key = apikey.key.clone();
2268        let value = match apikey.prefix {
2269            Some(ref prefix) => format!("{} {}", prefix, key),
2270            None => key,
2271        };
2272        req_builder = req_builder.header("X-GITEA-OTP", value);
2273    };
2274    if let Some(ref apikey) = configuration.api_key {
2275        let key = apikey.key.clone();
2276        let value = match apikey.prefix {
2277            Some(ref prefix) => format!("{} {}", prefix, key),
2278            None => key,
2279        };
2280        req_builder = req_builder.header("Authorization", value);
2281    };
2282    if let Some(ref apikey) = configuration.api_key {
2283        let key = apikey.key.clone();
2284        let value = match apikey.prefix {
2285            Some(ref prefix) => format!("{} {}", prefix, key),
2286            None => key,
2287        };
2288        req_builder = req_builder.header("Sudo", value);
2289    };
2290    if let Some(ref auth_conf) = configuration.basic_auth {
2291        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2292    };
2293    req_builder = req_builder.json(&p_body_body);
2294
2295    let req = req_builder.build()?;
2296    let resp = configuration.client.execute(req).await?;
2297
2298    let status = resp.status();
2299
2300    if !status.is_client_error() && !status.is_server_error() {
2301        Ok(())
2302    } else {
2303        let content = resp.text().await?;
2304        let entity: Option<AdminRenameUserError> = serde_json::from_str(&content).ok();
2305        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2306    }
2307}
2308
2309pub async fn admin_search_emails(configuration: &configuration::Configuration, q: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Email>, Error<AdminSearchEmailsError>> {
2310    // add a prefix to parameters to efficiently prevent name collisions
2311    let p_query_q = q;
2312    let p_query_page = page;
2313    let p_query_limit = limit;
2314
2315    let uri_str = format!("{}/admin/emails/search", configuration.base_path);
2316    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2317
2318    if let Some(ref param_value) = p_query_q {
2319        req_builder = req_builder.query(&[("q", &param_value.to_string())]);
2320    }
2321    if let Some(ref param_value) = p_query_page {
2322        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2323    }
2324    if let Some(ref param_value) = p_query_limit {
2325        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2326    }
2327    if let Some(ref apikey) = configuration.api_key {
2328        let key = apikey.key.clone();
2329        let value = match apikey.prefix {
2330            Some(ref prefix) => format!("{} {}", prefix, key),
2331            None => key,
2332        };
2333        req_builder = req_builder.query(&[("access_token", value)]);
2334    }
2335    if let Some(ref apikey) = configuration.api_key {
2336        let key = apikey.key.clone();
2337        let value = match apikey.prefix {
2338            Some(ref prefix) => format!("{} {}", prefix, key),
2339            None => key,
2340        };
2341        req_builder = req_builder.query(&[("sudo", value)]);
2342    }
2343    if let Some(ref apikey) = configuration.api_key {
2344        let key = apikey.key.clone();
2345        let value = match apikey.prefix {
2346            Some(ref prefix) => format!("{} {}", prefix, key),
2347            None => key,
2348        };
2349        req_builder = req_builder.query(&[("token", value)]);
2350    }
2351    if let Some(ref user_agent) = configuration.user_agent {
2352        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2353    }
2354    if let Some(ref apikey) = configuration.api_key {
2355        let key = apikey.key.clone();
2356        let value = match apikey.prefix {
2357            Some(ref prefix) => format!("{} {}", prefix, key),
2358            None => key,
2359        };
2360        req_builder = req_builder.header("X-GITEA-OTP", value);
2361    };
2362    if let Some(ref apikey) = configuration.api_key {
2363        let key = apikey.key.clone();
2364        let value = match apikey.prefix {
2365            Some(ref prefix) => format!("{} {}", prefix, key),
2366            None => key,
2367        };
2368        req_builder = req_builder.header("Authorization", value);
2369    };
2370    if let Some(ref apikey) = configuration.api_key {
2371        let key = apikey.key.clone();
2372        let value = match apikey.prefix {
2373            Some(ref prefix) => format!("{} {}", prefix, key),
2374            None => key,
2375        };
2376        req_builder = req_builder.header("Sudo", value);
2377    };
2378    if let Some(ref auth_conf) = configuration.basic_auth {
2379        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2380    };
2381
2382    let req = req_builder.build()?;
2383    let resp = configuration.client.execute(req).await?;
2384
2385    let status = resp.status();
2386    let content_type = resp
2387        .headers()
2388        .get("content-type")
2389        .and_then(|v| v.to_str().ok())
2390        .unwrap_or("application/octet-stream");
2391    let content_type = super::ContentType::from(content_type);
2392
2393    if !status.is_client_error() && !status.is_server_error() {
2394        let content = resp.text().await?;
2395        match content_type {
2396            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2397            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Email&gt;`"))),
2398            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Email&gt;`")))),
2399        }
2400    } else {
2401        let content = resp.text().await?;
2402        let entity: Option<AdminSearchEmailsError> = serde_json::from_str(&content).ok();
2403        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2404    }
2405}
2406
2407pub async fn admin_search_users(configuration: &configuration::Configuration, source_id: Option<i64>, login_name: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<AdminSearchUsersError>> {
2408    // add a prefix to parameters to efficiently prevent name collisions
2409    let p_query_source_id = source_id;
2410    let p_query_login_name = login_name;
2411    let p_query_page = page;
2412    let p_query_limit = limit;
2413
2414    let uri_str = format!("{}/admin/users", configuration.base_path);
2415    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2416
2417    if let Some(ref param_value) = p_query_source_id {
2418        req_builder = req_builder.query(&[("source_id", &param_value.to_string())]);
2419    }
2420    if let Some(ref param_value) = p_query_login_name {
2421        req_builder = req_builder.query(&[("login_name", &param_value.to_string())]);
2422    }
2423    if let Some(ref param_value) = p_query_page {
2424        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2425    }
2426    if let Some(ref param_value) = p_query_limit {
2427        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2428    }
2429    if let Some(ref apikey) = configuration.api_key {
2430        let key = apikey.key.clone();
2431        let value = match apikey.prefix {
2432            Some(ref prefix) => format!("{} {}", prefix, key),
2433            None => key,
2434        };
2435        req_builder = req_builder.query(&[("access_token", value)]);
2436    }
2437    if let Some(ref apikey) = configuration.api_key {
2438        let key = apikey.key.clone();
2439        let value = match apikey.prefix {
2440            Some(ref prefix) => format!("{} {}", prefix, key),
2441            None => key,
2442        };
2443        req_builder = req_builder.query(&[("sudo", value)]);
2444    }
2445    if let Some(ref apikey) = configuration.api_key {
2446        let key = apikey.key.clone();
2447        let value = match apikey.prefix {
2448            Some(ref prefix) => format!("{} {}", prefix, key),
2449            None => key,
2450        };
2451        req_builder = req_builder.query(&[("token", value)]);
2452    }
2453    if let Some(ref user_agent) = configuration.user_agent {
2454        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2455    }
2456    if let Some(ref apikey) = configuration.api_key {
2457        let key = apikey.key.clone();
2458        let value = match apikey.prefix {
2459            Some(ref prefix) => format!("{} {}", prefix, key),
2460            None => key,
2461        };
2462        req_builder = req_builder.header("X-GITEA-OTP", value);
2463    };
2464    if let Some(ref apikey) = configuration.api_key {
2465        let key = apikey.key.clone();
2466        let value = match apikey.prefix {
2467            Some(ref prefix) => format!("{} {}", prefix, key),
2468            None => key,
2469        };
2470        req_builder = req_builder.header("Authorization", value);
2471    };
2472    if let Some(ref apikey) = configuration.api_key {
2473        let key = apikey.key.clone();
2474        let value = match apikey.prefix {
2475            Some(ref prefix) => format!("{} {}", prefix, key),
2476            None => key,
2477        };
2478        req_builder = req_builder.header("Sudo", value);
2479    };
2480    if let Some(ref auth_conf) = configuration.basic_auth {
2481        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2482    };
2483
2484    let req = req_builder.build()?;
2485    let resp = configuration.client.execute(req).await?;
2486
2487    let status = resp.status();
2488    let content_type = resp
2489        .headers()
2490        .get("content-type")
2491        .and_then(|v| v.to_str().ok())
2492        .unwrap_or("application/octet-stream");
2493    let content_type = super::ContentType::from(content_type);
2494
2495    if !status.is_client_error() && !status.is_server_error() {
2496        let content = resp.text().await?;
2497        match content_type {
2498            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2499            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::User&gt;`"))),
2500            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::User&gt;`")))),
2501        }
2502    } else {
2503        let content = resp.text().await?;
2504        let entity: Option<AdminSearchUsersError> = serde_json::from_str(&content).ok();
2505        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2506    }
2507}
2508
2509pub async fn admin_unadopted_list(configuration: &configuration::Configuration, page: Option<i32>, limit: Option<i32>, pattern: Option<&str>) -> Result<Vec<String>, Error<AdminUnadoptedListError>> {
2510    // add a prefix to parameters to efficiently prevent name collisions
2511    let p_query_page = page;
2512    let p_query_limit = limit;
2513    let p_query_pattern = pattern;
2514
2515    let uri_str = format!("{}/admin/unadopted", configuration.base_path);
2516    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2517
2518    if let Some(ref param_value) = p_query_page {
2519        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2520    }
2521    if let Some(ref param_value) = p_query_limit {
2522        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2523    }
2524    if let Some(ref param_value) = p_query_pattern {
2525        req_builder = req_builder.query(&[("pattern", &param_value.to_string())]);
2526    }
2527    if let Some(ref apikey) = configuration.api_key {
2528        let key = apikey.key.clone();
2529        let value = match apikey.prefix {
2530            Some(ref prefix) => format!("{} {}", prefix, key),
2531            None => key,
2532        };
2533        req_builder = req_builder.query(&[("access_token", value)]);
2534    }
2535    if let Some(ref apikey) = configuration.api_key {
2536        let key = apikey.key.clone();
2537        let value = match apikey.prefix {
2538            Some(ref prefix) => format!("{} {}", prefix, key),
2539            None => key,
2540        };
2541        req_builder = req_builder.query(&[("sudo", value)]);
2542    }
2543    if let Some(ref apikey) = configuration.api_key {
2544        let key = apikey.key.clone();
2545        let value = match apikey.prefix {
2546            Some(ref prefix) => format!("{} {}", prefix, key),
2547            None => key,
2548        };
2549        req_builder = req_builder.query(&[("token", value)]);
2550    }
2551    if let Some(ref user_agent) = configuration.user_agent {
2552        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2553    }
2554    if let Some(ref apikey) = configuration.api_key {
2555        let key = apikey.key.clone();
2556        let value = match apikey.prefix {
2557            Some(ref prefix) => format!("{} {}", prefix, key),
2558            None => key,
2559        };
2560        req_builder = req_builder.header("X-GITEA-OTP", value);
2561    };
2562    if let Some(ref apikey) = configuration.api_key {
2563        let key = apikey.key.clone();
2564        let value = match apikey.prefix {
2565            Some(ref prefix) => format!("{} {}", prefix, key),
2566            None => key,
2567        };
2568        req_builder = req_builder.header("Authorization", value);
2569    };
2570    if let Some(ref apikey) = configuration.api_key {
2571        let key = apikey.key.clone();
2572        let value = match apikey.prefix {
2573            Some(ref prefix) => format!("{} {}", prefix, key),
2574            None => key,
2575        };
2576        req_builder = req_builder.header("Sudo", value);
2577    };
2578    if let Some(ref auth_conf) = configuration.basic_auth {
2579        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2580    };
2581
2582    let req = req_builder.build()?;
2583    let resp = configuration.client.execute(req).await?;
2584
2585    let status = resp.status();
2586    let content_type = resp
2587        .headers()
2588        .get("content-type")
2589        .and_then(|v| v.to_str().ok())
2590        .unwrap_or("application/octet-stream");
2591    let content_type = super::ContentType::from(content_type);
2592
2593    if !status.is_client_error() && !status.is_server_error() {
2594        let content = resp.text().await?;
2595        match content_type {
2596            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2597            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;String&gt;`"))),
2598            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;String&gt;`")))),
2599        }
2600    } else {
2601        let content = resp.text().await?;
2602        let entity: Option<AdminUnadoptedListError> = serde_json::from_str(&content).ok();
2603        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2604    }
2605}
2606
2607pub async fn delete_admin_runner(configuration: &configuration::Configuration, runner_id: &str) -> Result<(), Error<DeleteAdminRunnerError>> {
2608    // add a prefix to parameters to efficiently prevent name collisions
2609    let p_path_runner_id = runner_id;
2610
2611    let uri_str = format!("{}/admin/actions/runners/{runner_id}", configuration.base_path, runner_id=crate::apis::urlencode(p_path_runner_id));
2612    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2613
2614    if let Some(ref apikey) = configuration.api_key {
2615        let key = apikey.key.clone();
2616        let value = match apikey.prefix {
2617            Some(ref prefix) => format!("{} {}", prefix, key),
2618            None => key,
2619        };
2620        req_builder = req_builder.query(&[("access_token", value)]);
2621    }
2622    if let Some(ref apikey) = configuration.api_key {
2623        let key = apikey.key.clone();
2624        let value = match apikey.prefix {
2625            Some(ref prefix) => format!("{} {}", prefix, key),
2626            None => key,
2627        };
2628        req_builder = req_builder.query(&[("sudo", value)]);
2629    }
2630    if let Some(ref apikey) = configuration.api_key {
2631        let key = apikey.key.clone();
2632        let value = match apikey.prefix {
2633            Some(ref prefix) => format!("{} {}", prefix, key),
2634            None => key,
2635        };
2636        req_builder = req_builder.query(&[("token", value)]);
2637    }
2638    if let Some(ref user_agent) = configuration.user_agent {
2639        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2640    }
2641    if let Some(ref apikey) = configuration.api_key {
2642        let key = apikey.key.clone();
2643        let value = match apikey.prefix {
2644            Some(ref prefix) => format!("{} {}", prefix, key),
2645            None => key,
2646        };
2647        req_builder = req_builder.header("X-GITEA-OTP", value);
2648    };
2649    if let Some(ref apikey) = configuration.api_key {
2650        let key = apikey.key.clone();
2651        let value = match apikey.prefix {
2652            Some(ref prefix) => format!("{} {}", prefix, key),
2653            None => key,
2654        };
2655        req_builder = req_builder.header("Authorization", value);
2656    };
2657    if let Some(ref apikey) = configuration.api_key {
2658        let key = apikey.key.clone();
2659        let value = match apikey.prefix {
2660            Some(ref prefix) => format!("{} {}", prefix, key),
2661            None => key,
2662        };
2663        req_builder = req_builder.header("Sudo", value);
2664    };
2665    if let Some(ref auth_conf) = configuration.basic_auth {
2666        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2667    };
2668
2669    let req = req_builder.build()?;
2670    let resp = configuration.client.execute(req).await?;
2671
2672    let status = resp.status();
2673
2674    if !status.is_client_error() && !status.is_server_error() {
2675        Ok(())
2676    } else {
2677        let content = resp.text().await?;
2678        let entity: Option<DeleteAdminRunnerError> = serde_json::from_str(&content).ok();
2679        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2680    }
2681}
2682
2683pub async fn get_admin_runner(configuration: &configuration::Configuration, runner_id: &str) -> Result<(), Error<GetAdminRunnerError>> {
2684    // add a prefix to parameters to efficiently prevent name collisions
2685    let p_path_runner_id = runner_id;
2686
2687    let uri_str = format!("{}/admin/actions/runners/{runner_id}", configuration.base_path, runner_id=crate::apis::urlencode(p_path_runner_id));
2688    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2689
2690    if let Some(ref apikey) = configuration.api_key {
2691        let key = apikey.key.clone();
2692        let value = match apikey.prefix {
2693            Some(ref prefix) => format!("{} {}", prefix, key),
2694            None => key,
2695        };
2696        req_builder = req_builder.query(&[("access_token", value)]);
2697    }
2698    if let Some(ref apikey) = configuration.api_key {
2699        let key = apikey.key.clone();
2700        let value = match apikey.prefix {
2701            Some(ref prefix) => format!("{} {}", prefix, key),
2702            None => key,
2703        };
2704        req_builder = req_builder.query(&[("sudo", value)]);
2705    }
2706    if let Some(ref apikey) = configuration.api_key {
2707        let key = apikey.key.clone();
2708        let value = match apikey.prefix {
2709            Some(ref prefix) => format!("{} {}", prefix, key),
2710            None => key,
2711        };
2712        req_builder = req_builder.query(&[("token", value)]);
2713    }
2714    if let Some(ref user_agent) = configuration.user_agent {
2715        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2716    }
2717    if let Some(ref apikey) = configuration.api_key {
2718        let key = apikey.key.clone();
2719        let value = match apikey.prefix {
2720            Some(ref prefix) => format!("{} {}", prefix, key),
2721            None => key,
2722        };
2723        req_builder = req_builder.header("X-GITEA-OTP", value);
2724    };
2725    if let Some(ref apikey) = configuration.api_key {
2726        let key = apikey.key.clone();
2727        let value = match apikey.prefix {
2728            Some(ref prefix) => format!("{} {}", prefix, key),
2729            None => key,
2730        };
2731        req_builder = req_builder.header("Authorization", value);
2732    };
2733    if let Some(ref apikey) = configuration.api_key {
2734        let key = apikey.key.clone();
2735        let value = match apikey.prefix {
2736            Some(ref prefix) => format!("{} {}", prefix, key),
2737            None => key,
2738        };
2739        req_builder = req_builder.header("Sudo", value);
2740    };
2741    if let Some(ref auth_conf) = configuration.basic_auth {
2742        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2743    };
2744
2745    let req = req_builder.build()?;
2746    let resp = configuration.client.execute(req).await?;
2747
2748    let status = resp.status();
2749
2750    if !status.is_client_error() && !status.is_server_error() {
2751        Ok(())
2752    } else {
2753        let content = resp.text().await?;
2754        let entity: Option<GetAdminRunnerError> = serde_json::from_str(&content).ok();
2755        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2756    }
2757}
2758
2759pub async fn get_admin_runners(configuration: &configuration::Configuration, ) -> Result<(), Error<GetAdminRunnersError>> {
2760
2761    let uri_str = format!("{}/admin/actions/runners", configuration.base_path);
2762    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2763
2764    if let Some(ref apikey) = configuration.api_key {
2765        let key = apikey.key.clone();
2766        let value = match apikey.prefix {
2767            Some(ref prefix) => format!("{} {}", prefix, key),
2768            None => key,
2769        };
2770        req_builder = req_builder.query(&[("access_token", value)]);
2771    }
2772    if let Some(ref apikey) = configuration.api_key {
2773        let key = apikey.key.clone();
2774        let value = match apikey.prefix {
2775            Some(ref prefix) => format!("{} {}", prefix, key),
2776            None => key,
2777        };
2778        req_builder = req_builder.query(&[("sudo", value)]);
2779    }
2780    if let Some(ref apikey) = configuration.api_key {
2781        let key = apikey.key.clone();
2782        let value = match apikey.prefix {
2783            Some(ref prefix) => format!("{} {}", prefix, key),
2784            None => key,
2785        };
2786        req_builder = req_builder.query(&[("token", value)]);
2787    }
2788    if let Some(ref user_agent) = configuration.user_agent {
2789        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2790    }
2791    if let Some(ref apikey) = configuration.api_key {
2792        let key = apikey.key.clone();
2793        let value = match apikey.prefix {
2794            Some(ref prefix) => format!("{} {}", prefix, key),
2795            None => key,
2796        };
2797        req_builder = req_builder.header("X-GITEA-OTP", value);
2798    };
2799    if let Some(ref apikey) = configuration.api_key {
2800        let key = apikey.key.clone();
2801        let value = match apikey.prefix {
2802            Some(ref prefix) => format!("{} {}", prefix, key),
2803            None => key,
2804        };
2805        req_builder = req_builder.header("Authorization", value);
2806    };
2807    if let Some(ref apikey) = configuration.api_key {
2808        let key = apikey.key.clone();
2809        let value = match apikey.prefix {
2810            Some(ref prefix) => format!("{} {}", prefix, key),
2811            None => key,
2812        };
2813        req_builder = req_builder.header("Sudo", value);
2814    };
2815    if let Some(ref auth_conf) = configuration.basic_auth {
2816        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2817    };
2818
2819    let req = req_builder.build()?;
2820    let resp = configuration.client.execute(req).await?;
2821
2822    let status = resp.status();
2823
2824    if !status.is_client_error() && !status.is_server_error() {
2825        Ok(())
2826    } else {
2827        let content = resp.text().await?;
2828        let entity: Option<GetAdminRunnersError> = serde_json::from_str(&content).ok();
2829        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2830    }
2831}
2832
2833pub async fn list_admin_workflow_jobs(configuration: &configuration::Configuration, status: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<models::ActionWorkflowJobsResponse, Error<ListAdminWorkflowJobsError>> {
2834    // add a prefix to parameters to efficiently prevent name collisions
2835    let p_query_status = status;
2836    let p_query_page = page;
2837    let p_query_limit = limit;
2838
2839    let uri_str = format!("{}/admin/actions/jobs", configuration.base_path);
2840    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2841
2842    if let Some(ref param_value) = p_query_status {
2843        req_builder = req_builder.query(&[("status", &param_value.to_string())]);
2844    }
2845    if let Some(ref param_value) = p_query_page {
2846        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2847    }
2848    if let Some(ref param_value) = p_query_limit {
2849        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2850    }
2851    if let Some(ref apikey) = configuration.api_key {
2852        let key = apikey.key.clone();
2853        let value = match apikey.prefix {
2854            Some(ref prefix) => format!("{} {}", prefix, key),
2855            None => key,
2856        };
2857        req_builder = req_builder.query(&[("access_token", value)]);
2858    }
2859    if let Some(ref apikey) = configuration.api_key {
2860        let key = apikey.key.clone();
2861        let value = match apikey.prefix {
2862            Some(ref prefix) => format!("{} {}", prefix, key),
2863            None => key,
2864        };
2865        req_builder = req_builder.query(&[("sudo", value)]);
2866    }
2867    if let Some(ref apikey) = configuration.api_key {
2868        let key = apikey.key.clone();
2869        let value = match apikey.prefix {
2870            Some(ref prefix) => format!("{} {}", prefix, key),
2871            None => key,
2872        };
2873        req_builder = req_builder.query(&[("token", value)]);
2874    }
2875    if let Some(ref user_agent) = configuration.user_agent {
2876        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2877    }
2878    if let Some(ref apikey) = configuration.api_key {
2879        let key = apikey.key.clone();
2880        let value = match apikey.prefix {
2881            Some(ref prefix) => format!("{} {}", prefix, key),
2882            None => key,
2883        };
2884        req_builder = req_builder.header("X-GITEA-OTP", value);
2885    };
2886    if let Some(ref apikey) = configuration.api_key {
2887        let key = apikey.key.clone();
2888        let value = match apikey.prefix {
2889            Some(ref prefix) => format!("{} {}", prefix, key),
2890            None => key,
2891        };
2892        req_builder = req_builder.header("Authorization", value);
2893    };
2894    if let Some(ref apikey) = configuration.api_key {
2895        let key = apikey.key.clone();
2896        let value = match apikey.prefix {
2897            Some(ref prefix) => format!("{} {}", prefix, key),
2898            None => key,
2899        };
2900        req_builder = req_builder.header("Sudo", value);
2901    };
2902    if let Some(ref auth_conf) = configuration.basic_auth {
2903        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2904    };
2905
2906    let req = req_builder.build()?;
2907    let resp = configuration.client.execute(req).await?;
2908
2909    let status = resp.status();
2910    let content_type = resp
2911        .headers()
2912        .get("content-type")
2913        .and_then(|v| v.to_str().ok())
2914        .unwrap_or("application/octet-stream");
2915    let content_type = super::ContentType::from(content_type);
2916
2917    if !status.is_client_error() && !status.is_server_error() {
2918        let content = resp.text().await?;
2919        match content_type {
2920            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2921            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))),
2922            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`")))),
2923        }
2924    } else {
2925        let content = resp.text().await?;
2926        let entity: Option<ListAdminWorkflowJobsError> = serde_json::from_str(&content).ok();
2927        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2928    }
2929}
2930
2931pub async fn list_admin_workflow_runs(configuration: &configuration::Configuration, event: Option<&str>, branch: Option<&str>, status: Option<&str>, actor: Option<&str>, head_sha: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<models::ActionWorkflowRunsResponse, Error<ListAdminWorkflowRunsError>> {
2932    // add a prefix to parameters to efficiently prevent name collisions
2933    let p_query_event = event;
2934    let p_query_branch = branch;
2935    let p_query_status = status;
2936    let p_query_actor = actor;
2937    let p_query_head_sha = head_sha;
2938    let p_query_page = page;
2939    let p_query_limit = limit;
2940
2941    let uri_str = format!("{}/admin/actions/runs", configuration.base_path);
2942    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2943
2944    if let Some(ref param_value) = p_query_event {
2945        req_builder = req_builder.query(&[("event", &param_value.to_string())]);
2946    }
2947    if let Some(ref param_value) = p_query_branch {
2948        req_builder = req_builder.query(&[("branch", &param_value.to_string())]);
2949    }
2950    if let Some(ref param_value) = p_query_status {
2951        req_builder = req_builder.query(&[("status", &param_value.to_string())]);
2952    }
2953    if let Some(ref param_value) = p_query_actor {
2954        req_builder = req_builder.query(&[("actor", &param_value.to_string())]);
2955    }
2956    if let Some(ref param_value) = p_query_head_sha {
2957        req_builder = req_builder.query(&[("head_sha", &param_value.to_string())]);
2958    }
2959    if let Some(ref param_value) = p_query_page {
2960        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2961    }
2962    if let Some(ref param_value) = p_query_limit {
2963        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2964    }
2965    if let Some(ref apikey) = configuration.api_key {
2966        let key = apikey.key.clone();
2967        let value = match apikey.prefix {
2968            Some(ref prefix) => format!("{} {}", prefix, key),
2969            None => key,
2970        };
2971        req_builder = req_builder.query(&[("access_token", value)]);
2972    }
2973    if let Some(ref apikey) = configuration.api_key {
2974        let key = apikey.key.clone();
2975        let value = match apikey.prefix {
2976            Some(ref prefix) => format!("{} {}", prefix, key),
2977            None => key,
2978        };
2979        req_builder = req_builder.query(&[("sudo", value)]);
2980    }
2981    if let Some(ref apikey) = configuration.api_key {
2982        let key = apikey.key.clone();
2983        let value = match apikey.prefix {
2984            Some(ref prefix) => format!("{} {}", prefix, key),
2985            None => key,
2986        };
2987        req_builder = req_builder.query(&[("token", value)]);
2988    }
2989    if let Some(ref user_agent) = configuration.user_agent {
2990        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2991    }
2992    if let Some(ref apikey) = configuration.api_key {
2993        let key = apikey.key.clone();
2994        let value = match apikey.prefix {
2995            Some(ref prefix) => format!("{} {}", prefix, key),
2996            None => key,
2997        };
2998        req_builder = req_builder.header("X-GITEA-OTP", value);
2999    };
3000    if let Some(ref apikey) = configuration.api_key {
3001        let key = apikey.key.clone();
3002        let value = match apikey.prefix {
3003            Some(ref prefix) => format!("{} {}", prefix, key),
3004            None => key,
3005        };
3006        req_builder = req_builder.header("Authorization", value);
3007    };
3008    if let Some(ref apikey) = configuration.api_key {
3009        let key = apikey.key.clone();
3010        let value = match apikey.prefix {
3011            Some(ref prefix) => format!("{} {}", prefix, key),
3012            None => key,
3013        };
3014        req_builder = req_builder.header("Sudo", value);
3015    };
3016    if let Some(ref auth_conf) = configuration.basic_auth {
3017        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3018    };
3019
3020    let req = req_builder.build()?;
3021    let resp = configuration.client.execute(req).await?;
3022
3023    let status = resp.status();
3024    let content_type = resp
3025        .headers()
3026        .get("content-type")
3027        .and_then(|v| v.to_str().ok())
3028        .unwrap_or("application/octet-stream");
3029    let content_type = super::ContentType::from(content_type);
3030
3031    if !status.is_client_error() && !status.is_server_error() {
3032        let content = resp.text().await?;
3033        match content_type {
3034            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3035            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`"))),
3036            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`")))),
3037        }
3038    } else {
3039        let content = resp.text().await?;
3040        let entity: Option<ListAdminWorkflowRunsError> = serde_json::from_str(&content).ok();
3041        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3042    }
3043}
3044