1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateOrgRepoError {
22 Status400(),
23 Status403(),
24 Status404(),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum CreateOrgRepoDeprecatedError {
32 Status403(),
33 Status404(),
34 Status422(),
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum CreateOrgVariableError {
42 Status400(),
43 Status409(),
44 Status500(),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum DeleteOrgRunnerError {
52 Status400(),
53 Status404(),
54 UnknownValue(serde_json::Value),
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(untagged)]
60pub enum DeleteOrgSecretError {
61 Status400(),
62 Status404(),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum DeleteOrgVariableError {
70 Status400(),
71 Status404(),
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GetOrgRunnerError {
79 Status400(),
80 Status404(),
81 UnknownValue(serde_json::Value),
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum GetOrgRunnersError {
88 Status400(),
89 Status404(),
90 UnknownValue(serde_json::Value),
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(untagged)]
96pub enum GetOrgVariableError {
97 Status400(),
98 Status404(),
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetOrgVariablesListError {
106 Status400(),
107 Status404(),
108 UnknownValue(serde_json::Value),
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum GetOrgWorkflowJobsError {
115 Status400(),
116 Status404(),
117 UnknownValue(serde_json::Value),
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum GetOrgWorkflowRunsError {
124 Status400(),
125 Status404(),
126 UnknownValue(serde_json::Value),
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum OrgAddTeamMemberError {
133 Status403(),
134 Status404(),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum OrgAddTeamRepositoryError {
142 Status403(),
143 Status404(),
144 UnknownValue(serde_json::Value),
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum OrgConcealMemberError {
151 Status403(),
152 Status404(),
153 UnknownValue(serde_json::Value),
154}
155
156#[derive(Debug, Clone, Serialize, Deserialize)]
158#[serde(untagged)]
159pub enum OrgCreateError {
160 Status403(),
161 Status422(),
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum OrgCreateHookError {
169 Status404(),
170 UnknownValue(serde_json::Value),
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum OrgCreateLabelError {
177 Status404(),
178 Status422(),
179 UnknownValue(serde_json::Value),
180}
181
182#[derive(Debug, Clone, Serialize, Deserialize)]
184#[serde(untagged)]
185pub enum OrgCreateRunnerRegistrationTokenError {
186 UnknownValue(serde_json::Value),
187}
188
189#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum OrgCreateTeamError {
193 Status404(),
194 Status422(),
195 UnknownValue(serde_json::Value),
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum OrgDeleteError {
202 Status404(),
203 UnknownValue(serde_json::Value),
204}
205
206#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum OrgDeleteAvatarError {
210 Status404(),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum OrgDeleteHookError {
218 Status404(),
219 UnknownValue(serde_json::Value),
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum OrgDeleteLabelError {
226 Status404(),
227 UnknownValue(serde_json::Value),
228}
229
230#[derive(Debug, Clone, Serialize, Deserialize)]
232#[serde(untagged)]
233pub enum OrgDeleteMemberError {
234 Status404(),
235 UnknownValue(serde_json::Value),
236}
237
238#[derive(Debug, Clone, Serialize, Deserialize)]
240#[serde(untagged)]
241pub enum OrgDeleteTeamError {
242 Status404(),
243 UnknownValue(serde_json::Value),
244}
245
246#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum OrgEditError {
250 Status404(),
251 UnknownValue(serde_json::Value),
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize)]
256#[serde(untagged)]
257pub enum OrgEditHookError {
258 Status404(),
259 UnknownValue(serde_json::Value),
260}
261
262#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum OrgEditLabelError {
266 Status404(),
267 Status422(),
268 UnknownValue(serde_json::Value),
269}
270
271#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum OrgEditTeamError {
275 Status404(),
276 UnknownValue(serde_json::Value),
277}
278
279#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum OrgGetError {
283 Status404(),
284 UnknownValue(serde_json::Value),
285}
286
287#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum OrgGetAllError {
291 UnknownValue(serde_json::Value),
292}
293
294#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(untagged)]
297pub enum OrgGetHookError {
298 Status404(),
299 UnknownValue(serde_json::Value),
300}
301
302#[derive(Debug, Clone, Serialize, Deserialize)]
304#[serde(untagged)]
305pub enum OrgGetLabelError {
306 Status404(),
307 UnknownValue(serde_json::Value),
308}
309
310#[derive(Debug, Clone, Serialize, Deserialize)]
312#[serde(untagged)]
313pub enum OrgGetRunnerRegistrationTokenError {
314 UnknownValue(serde_json::Value),
315}
316
317#[derive(Debug, Clone, Serialize, Deserialize)]
319#[serde(untagged)]
320pub enum OrgGetTeamError {
321 Status404(),
322 UnknownValue(serde_json::Value),
323}
324
325#[derive(Debug, Clone, Serialize, Deserialize)]
327#[serde(untagged)]
328pub enum OrgGetUserPermissionsError {
329 Status403(),
330 Status404(),
331 UnknownValue(serde_json::Value),
332}
333
334#[derive(Debug, Clone, Serialize, Deserialize)]
336#[serde(untagged)]
337pub enum OrgIsMemberError {
338 Status404(),
339 UnknownValue(serde_json::Value),
340}
341
342#[derive(Debug, Clone, Serialize, Deserialize)]
344#[serde(untagged)]
345pub enum OrgIsPublicMemberError {
346 Status404(),
347 UnknownValue(serde_json::Value),
348}
349
350#[derive(Debug, Clone, Serialize, Deserialize)]
352#[serde(untagged)]
353pub enum OrgListActionsSecretsError {
354 Status404(),
355 UnknownValue(serde_json::Value),
356}
357
358#[derive(Debug, Clone, Serialize, Deserialize)]
360#[serde(untagged)]
361pub enum OrgListActivityFeedsError {
362 Status404(),
363 UnknownValue(serde_json::Value),
364}
365
366#[derive(Debug, Clone, Serialize, Deserialize)]
368#[serde(untagged)]
369pub enum OrgListCurrentUserOrgsError {
370 Status404(),
371 UnknownValue(serde_json::Value),
372}
373
374#[derive(Debug, Clone, Serialize, Deserialize)]
376#[serde(untagged)]
377pub enum OrgListHooksError {
378 Status404(),
379 UnknownValue(serde_json::Value),
380}
381
382#[derive(Debug, Clone, Serialize, Deserialize)]
384#[serde(untagged)]
385pub enum OrgListLabelsError {
386 Status404(),
387 UnknownValue(serde_json::Value),
388}
389
390#[derive(Debug, Clone, Serialize, Deserialize)]
392#[serde(untagged)]
393pub enum OrgListMembersError {
394 Status404(),
395 UnknownValue(serde_json::Value),
396}
397
398#[derive(Debug, Clone, Serialize, Deserialize)]
400#[serde(untagged)]
401pub enum OrgListPublicMembersError {
402 Status404(),
403 UnknownValue(serde_json::Value),
404}
405
406#[derive(Debug, Clone, Serialize, Deserialize)]
408#[serde(untagged)]
409pub enum OrgListReposError {
410 Status404(),
411 UnknownValue(serde_json::Value),
412}
413
414#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum OrgListTeamActivityFeedsError {
418 Status404(),
419 UnknownValue(serde_json::Value),
420}
421
422#[derive(Debug, Clone, Serialize, Deserialize)]
424#[serde(untagged)]
425pub enum OrgListTeamMemberError {
426 Status404(),
427 UnknownValue(serde_json::Value),
428}
429
430#[derive(Debug, Clone, Serialize, Deserialize)]
432#[serde(untagged)]
433pub enum OrgListTeamMembersError {
434 Status404(),
435 UnknownValue(serde_json::Value),
436}
437
438#[derive(Debug, Clone, Serialize, Deserialize)]
440#[serde(untagged)]
441pub enum OrgListTeamRepoError {
442 Status404(),
443 UnknownValue(serde_json::Value),
444}
445
446#[derive(Debug, Clone, Serialize, Deserialize)]
448#[serde(untagged)]
449pub enum OrgListTeamReposError {
450 Status404(),
451 UnknownValue(serde_json::Value),
452}
453
454#[derive(Debug, Clone, Serialize, Deserialize)]
456#[serde(untagged)]
457pub enum OrgListTeamsError {
458 Status404(),
459 UnknownValue(serde_json::Value),
460}
461
462#[derive(Debug, Clone, Serialize, Deserialize)]
464#[serde(untagged)]
465pub enum OrgListUserOrgsError {
466 Status404(),
467 UnknownValue(serde_json::Value),
468}
469
470#[derive(Debug, Clone, Serialize, Deserialize)]
472#[serde(untagged)]
473pub enum OrgPublicizeMemberError {
474 Status403(),
475 Status404(),
476 UnknownValue(serde_json::Value),
477}
478
479#[derive(Debug, Clone, Serialize, Deserialize)]
481#[serde(untagged)]
482pub enum OrgRemoveTeamMemberError {
483 Status404(),
484 UnknownValue(serde_json::Value),
485}
486
487#[derive(Debug, Clone, Serialize, Deserialize)]
489#[serde(untagged)]
490pub enum OrgRemoveTeamRepositoryError {
491 Status403(),
492 Status404(),
493 UnknownValue(serde_json::Value),
494}
495
496#[derive(Debug, Clone, Serialize, Deserialize)]
498#[serde(untagged)]
499pub enum OrgUpdateAvatarError {
500 Status404(),
501 UnknownValue(serde_json::Value),
502}
503
504#[derive(Debug, Clone, Serialize, Deserialize)]
506#[serde(untagged)]
507pub enum OrganizationBlockUserError {
508 Status404(),
509 Status422(),
510 UnknownValue(serde_json::Value),
511}
512
513#[derive(Debug, Clone, Serialize, Deserialize)]
515#[serde(untagged)]
516pub enum OrganizationCheckUserBlockError {
517 Status404(),
518 UnknownValue(serde_json::Value),
519}
520
521#[derive(Debug, Clone, Serialize, Deserialize)]
523#[serde(untagged)]
524pub enum OrganizationListBlocksError {
525 UnknownValue(serde_json::Value),
526}
527
528#[derive(Debug, Clone, Serialize, Deserialize)]
530#[serde(untagged)]
531pub enum OrganizationUnblockUserError {
532 Status404(),
533 Status422(),
534 UnknownValue(serde_json::Value),
535}
536
537#[derive(Debug, Clone, Serialize, Deserialize)]
539#[serde(untagged)]
540pub enum RenameOrgError {
541 Status403(),
542 Status422(),
543 UnknownValue(serde_json::Value),
544}
545
546#[derive(Debug, Clone, Serialize, Deserialize)]
548#[serde(untagged)]
549pub enum TeamSearchError {
550 Status404(),
551 UnknownValue(serde_json::Value),
552}
553
554#[derive(Debug, Clone, Serialize, Deserialize)]
556#[serde(untagged)]
557pub enum UpdateOrgSecretError {
558 Status400(),
559 Status404(),
560 UnknownValue(serde_json::Value),
561}
562
563#[derive(Debug, Clone, Serialize, Deserialize)]
565#[serde(untagged)]
566pub enum UpdateOrgVariableError {
567 Status400(),
568 Status404(),
569 UnknownValue(serde_json::Value),
570}
571
572
573pub async fn create_org_repo(configuration: &configuration::Configuration, org: &str, body: Option<models::CreateRepoOption>) -> Result<models::Repository, Error<CreateOrgRepoError>> {
574 let p_path_org = org;
576 let p_body_body = body;
577
578 let uri_str = format!("{}/orgs/{org}/repos", configuration.base_path, org=crate::apis::urlencode(p_path_org));
579 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
580
581 if let Some(ref apikey) = configuration.api_key {
582 let key = apikey.key.clone();
583 let value = match apikey.prefix {
584 Some(ref prefix) => format!("{} {}", prefix, key),
585 None => key,
586 };
587 req_builder = req_builder.query(&[("access_token", value)]);
588 }
589 if let Some(ref apikey) = configuration.api_key {
590 let key = apikey.key.clone();
591 let value = match apikey.prefix {
592 Some(ref prefix) => format!("{} {}", prefix, key),
593 None => key,
594 };
595 req_builder = req_builder.query(&[("sudo", value)]);
596 }
597 if let Some(ref apikey) = configuration.api_key {
598 let key = apikey.key.clone();
599 let value = match apikey.prefix {
600 Some(ref prefix) => format!("{} {}", prefix, key),
601 None => key,
602 };
603 req_builder = req_builder.query(&[("token", value)]);
604 }
605 if let Some(ref user_agent) = configuration.user_agent {
606 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
607 }
608 if let Some(ref apikey) = configuration.api_key {
609 let key = apikey.key.clone();
610 let value = match apikey.prefix {
611 Some(ref prefix) => format!("{} {}", prefix, key),
612 None => key,
613 };
614 req_builder = req_builder.header("X-GITEA-OTP", value);
615 };
616 if let Some(ref apikey) = configuration.api_key {
617 let key = apikey.key.clone();
618 let value = match apikey.prefix {
619 Some(ref prefix) => format!("{} {}", prefix, key),
620 None => key,
621 };
622 req_builder = req_builder.header("Authorization", value);
623 };
624 if let Some(ref apikey) = configuration.api_key {
625 let key = apikey.key.clone();
626 let value = match apikey.prefix {
627 Some(ref prefix) => format!("{} {}", prefix, key),
628 None => key,
629 };
630 req_builder = req_builder.header("Sudo", value);
631 };
632 if let Some(ref auth_conf) = configuration.basic_auth {
633 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
634 };
635 req_builder = req_builder.json(&p_body_body);
636
637 let req = req_builder.build()?;
638 let resp = configuration.client.execute(req).await?;
639
640 let status = resp.status();
641 let content_type = resp
642 .headers()
643 .get("content-type")
644 .and_then(|v| v.to_str().ok())
645 .unwrap_or("application/octet-stream");
646 let content_type = super::ContentType::from(content_type);
647
648 if !status.is_client_error() && !status.is_server_error() {
649 let content = resp.text().await?;
650 match content_type {
651 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
652 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
653 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`")))),
654 }
655 } else {
656 let content = resp.text().await?;
657 let entity: Option<CreateOrgRepoError> = serde_json::from_str(&content).ok();
658 Err(Error::ResponseError(ResponseContent { status, content, entity }))
659 }
660}
661
662#[deprecated]
663pub async fn create_org_repo_deprecated(configuration: &configuration::Configuration, org: &str, body: Option<models::CreateRepoOption>) -> Result<models::Repository, Error<CreateOrgRepoDeprecatedError>> {
664 let p_path_org = org;
666 let p_body_body = body;
667
668 let uri_str = format!("{}/org/{org}/repos", configuration.base_path, org=crate::apis::urlencode(p_path_org));
669 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
670
671 if let Some(ref apikey) = configuration.api_key {
672 let key = apikey.key.clone();
673 let value = match apikey.prefix {
674 Some(ref prefix) => format!("{} {}", prefix, key),
675 None => key,
676 };
677 req_builder = req_builder.query(&[("access_token", value)]);
678 }
679 if let Some(ref apikey) = configuration.api_key {
680 let key = apikey.key.clone();
681 let value = match apikey.prefix {
682 Some(ref prefix) => format!("{} {}", prefix, key),
683 None => key,
684 };
685 req_builder = req_builder.query(&[("sudo", value)]);
686 }
687 if let Some(ref apikey) = configuration.api_key {
688 let key = apikey.key.clone();
689 let value = match apikey.prefix {
690 Some(ref prefix) => format!("{} {}", prefix, key),
691 None => key,
692 };
693 req_builder = req_builder.query(&[("token", value)]);
694 }
695 if let Some(ref user_agent) = configuration.user_agent {
696 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
697 }
698 if let Some(ref apikey) = configuration.api_key {
699 let key = apikey.key.clone();
700 let value = match apikey.prefix {
701 Some(ref prefix) => format!("{} {}", prefix, key),
702 None => key,
703 };
704 req_builder = req_builder.header("X-GITEA-OTP", value);
705 };
706 if let Some(ref apikey) = configuration.api_key {
707 let key = apikey.key.clone();
708 let value = match apikey.prefix {
709 Some(ref prefix) => format!("{} {}", prefix, key),
710 None => key,
711 };
712 req_builder = req_builder.header("Authorization", value);
713 };
714 if let Some(ref apikey) = configuration.api_key {
715 let key = apikey.key.clone();
716 let value = match apikey.prefix {
717 Some(ref prefix) => format!("{} {}", prefix, key),
718 None => key,
719 };
720 req_builder = req_builder.header("Sudo", value);
721 };
722 if let Some(ref auth_conf) = configuration.basic_auth {
723 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
724 };
725 req_builder = req_builder.json(&p_body_body);
726
727 let req = req_builder.build()?;
728 let resp = configuration.client.execute(req).await?;
729
730 let status = resp.status();
731 let content_type = resp
732 .headers()
733 .get("content-type")
734 .and_then(|v| v.to_str().ok())
735 .unwrap_or("application/octet-stream");
736 let content_type = super::ContentType::from(content_type);
737
738 if !status.is_client_error() && !status.is_server_error() {
739 let content = resp.text().await?;
740 match content_type {
741 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
742 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
743 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`")))),
744 }
745 } else {
746 let content = resp.text().await?;
747 let entity: Option<CreateOrgRepoDeprecatedError> = serde_json::from_str(&content).ok();
748 Err(Error::ResponseError(ResponseContent { status, content, entity }))
749 }
750}
751
752pub async fn create_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str, body: Option<models::CreateVariableOption>) -> Result<(), Error<CreateOrgVariableError>> {
753 let p_path_org = org;
755 let p_path_variablename = variablename;
756 let p_body_body = body;
757
758 let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename));
759 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
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.query(&[("access_token", value)]);
768 }
769 if let Some(ref apikey) = configuration.api_key {
770 let key = apikey.key.clone();
771 let value = match apikey.prefix {
772 Some(ref prefix) => format!("{} {}", prefix, key),
773 None => key,
774 };
775 req_builder = req_builder.query(&[("sudo", value)]);
776 }
777 if let Some(ref apikey) = configuration.api_key {
778 let key = apikey.key.clone();
779 let value = match apikey.prefix {
780 Some(ref prefix) => format!("{} {}", prefix, key),
781 None => key,
782 };
783 req_builder = req_builder.query(&[("token", value)]);
784 }
785 if let Some(ref user_agent) = configuration.user_agent {
786 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
787 }
788 if let Some(ref apikey) = configuration.api_key {
789 let key = apikey.key.clone();
790 let value = match apikey.prefix {
791 Some(ref prefix) => format!("{} {}", prefix, key),
792 None => key,
793 };
794 req_builder = req_builder.header("X-GITEA-OTP", value);
795 };
796 if let Some(ref apikey) = configuration.api_key {
797 let key = apikey.key.clone();
798 let value = match apikey.prefix {
799 Some(ref prefix) => format!("{} {}", prefix, key),
800 None => key,
801 };
802 req_builder = req_builder.header("Authorization", value);
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.header("Sudo", value);
811 };
812 if let Some(ref auth_conf) = configuration.basic_auth {
813 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
814 };
815 req_builder = req_builder.json(&p_body_body);
816
817 let req = req_builder.build()?;
818 let resp = configuration.client.execute(req).await?;
819
820 let status = resp.status();
821
822 if !status.is_client_error() && !status.is_server_error() {
823 Ok(())
824 } else {
825 let content = resp.text().await?;
826 let entity: Option<CreateOrgVariableError> = serde_json::from_str(&content).ok();
827 Err(Error::ResponseError(ResponseContent { status, content, entity }))
828 }
829}
830
831pub async fn delete_org_runner(configuration: &configuration::Configuration, org: &str, runner_id: &str) -> Result<(), Error<DeleteOrgRunnerError>> {
832 let p_path_org = org;
834 let p_path_runner_id = runner_id;
835
836 let uri_str = format!("{}/orgs/{org}/actions/runners/{runner_id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), runner_id=crate::apis::urlencode(p_path_runner_id));
837 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
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.query(&[("access_token", 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.query(&[("sudo", value)]);
854 }
855 if let Some(ref apikey) = configuration.api_key {
856 let key = apikey.key.clone();
857 let value = match apikey.prefix {
858 Some(ref prefix) => format!("{} {}", prefix, key),
859 None => key,
860 };
861 req_builder = req_builder.query(&[("token", value)]);
862 }
863 if let Some(ref user_agent) = configuration.user_agent {
864 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
865 }
866 if let Some(ref apikey) = configuration.api_key {
867 let key = apikey.key.clone();
868 let value = match apikey.prefix {
869 Some(ref prefix) => format!("{} {}", prefix, key),
870 None => key,
871 };
872 req_builder = req_builder.header("X-GITEA-OTP", value);
873 };
874 if let Some(ref apikey) = configuration.api_key {
875 let key = apikey.key.clone();
876 let value = match apikey.prefix {
877 Some(ref prefix) => format!("{} {}", prefix, key),
878 None => key,
879 };
880 req_builder = req_builder.header("Authorization", value);
881 };
882 if let Some(ref apikey) = configuration.api_key {
883 let key = apikey.key.clone();
884 let value = match apikey.prefix {
885 Some(ref prefix) => format!("{} {}", prefix, key),
886 None => key,
887 };
888 req_builder = req_builder.header("Sudo", value);
889 };
890 if let Some(ref auth_conf) = configuration.basic_auth {
891 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
892 };
893
894 let req = req_builder.build()?;
895 let resp = configuration.client.execute(req).await?;
896
897 let status = resp.status();
898
899 if !status.is_client_error() && !status.is_server_error() {
900 Ok(())
901 } else {
902 let content = resp.text().await?;
903 let entity: Option<DeleteOrgRunnerError> = serde_json::from_str(&content).ok();
904 Err(Error::ResponseError(ResponseContent { status, content, entity }))
905 }
906}
907
908pub async fn delete_org_secret(configuration: &configuration::Configuration, org: &str, secretname: &str) -> Result<(), Error<DeleteOrgSecretError>> {
909 let p_path_org = org;
911 let p_path_secretname = secretname;
912
913 let uri_str = format!("{}/orgs/{org}/actions/secrets/{secretname}", configuration.base_path, org=crate::apis::urlencode(p_path_org), secretname=crate::apis::urlencode(p_path_secretname));
914 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
915
916 if let Some(ref apikey) = configuration.api_key {
917 let key = apikey.key.clone();
918 let value = match apikey.prefix {
919 Some(ref prefix) => format!("{} {}", prefix, key),
920 None => key,
921 };
922 req_builder = req_builder.query(&[("access_token", value)]);
923 }
924 if let Some(ref apikey) = configuration.api_key {
925 let key = apikey.key.clone();
926 let value = match apikey.prefix {
927 Some(ref prefix) => format!("{} {}", prefix, key),
928 None => key,
929 };
930 req_builder = req_builder.query(&[("sudo", value)]);
931 }
932 if let Some(ref apikey) = configuration.api_key {
933 let key = apikey.key.clone();
934 let value = match apikey.prefix {
935 Some(ref prefix) => format!("{} {}", prefix, key),
936 None => key,
937 };
938 req_builder = req_builder.query(&[("token", value)]);
939 }
940 if let Some(ref user_agent) = configuration.user_agent {
941 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
942 }
943 if let Some(ref apikey) = configuration.api_key {
944 let key = apikey.key.clone();
945 let value = match apikey.prefix {
946 Some(ref prefix) => format!("{} {}", prefix, key),
947 None => key,
948 };
949 req_builder = req_builder.header("X-GITEA-OTP", value);
950 };
951 if let Some(ref apikey) = configuration.api_key {
952 let key = apikey.key.clone();
953 let value = match apikey.prefix {
954 Some(ref prefix) => format!("{} {}", prefix, key),
955 None => key,
956 };
957 req_builder = req_builder.header("Authorization", value);
958 };
959 if let Some(ref apikey) = configuration.api_key {
960 let key = apikey.key.clone();
961 let value = match apikey.prefix {
962 Some(ref prefix) => format!("{} {}", prefix, key),
963 None => key,
964 };
965 req_builder = req_builder.header("Sudo", value);
966 };
967 if let Some(ref auth_conf) = configuration.basic_auth {
968 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
969 };
970
971 let req = req_builder.build()?;
972 let resp = configuration.client.execute(req).await?;
973
974 let status = resp.status();
975
976 if !status.is_client_error() && !status.is_server_error() {
977 Ok(())
978 } else {
979 let content = resp.text().await?;
980 let entity: Option<DeleteOrgSecretError> = serde_json::from_str(&content).ok();
981 Err(Error::ResponseError(ResponseContent { status, content, entity }))
982 }
983}
984
985pub async fn delete_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str) -> Result<models::ActionVariable, Error<DeleteOrgVariableError>> {
986 let p_path_org = org;
988 let p_path_variablename = variablename;
989
990 let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename));
991 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
992
993 if let Some(ref apikey) = configuration.api_key {
994 let key = apikey.key.clone();
995 let value = match apikey.prefix {
996 Some(ref prefix) => format!("{} {}", prefix, key),
997 None => key,
998 };
999 req_builder = req_builder.query(&[("access_token", value)]);
1000 }
1001 if let Some(ref apikey) = configuration.api_key {
1002 let key = apikey.key.clone();
1003 let value = match apikey.prefix {
1004 Some(ref prefix) => format!("{} {}", prefix, key),
1005 None => key,
1006 };
1007 req_builder = req_builder.query(&[("sudo", value)]);
1008 }
1009 if let Some(ref apikey) = configuration.api_key {
1010 let key = apikey.key.clone();
1011 let value = match apikey.prefix {
1012 Some(ref prefix) => format!("{} {}", prefix, key),
1013 None => key,
1014 };
1015 req_builder = req_builder.query(&[("token", value)]);
1016 }
1017 if let Some(ref user_agent) = configuration.user_agent {
1018 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1019 }
1020 if let Some(ref apikey) = configuration.api_key {
1021 let key = apikey.key.clone();
1022 let value = match apikey.prefix {
1023 Some(ref prefix) => format!("{} {}", prefix, key),
1024 None => key,
1025 };
1026 req_builder = req_builder.header("X-GITEA-OTP", value);
1027 };
1028 if let Some(ref apikey) = configuration.api_key {
1029 let key = apikey.key.clone();
1030 let value = match apikey.prefix {
1031 Some(ref prefix) => format!("{} {}", prefix, key),
1032 None => key,
1033 };
1034 req_builder = req_builder.header("Authorization", value);
1035 };
1036 if let Some(ref apikey) = configuration.api_key {
1037 let key = apikey.key.clone();
1038 let value = match apikey.prefix {
1039 Some(ref prefix) => format!("{} {}", prefix, key),
1040 None => key,
1041 };
1042 req_builder = req_builder.header("Sudo", value);
1043 };
1044 if let Some(ref auth_conf) = configuration.basic_auth {
1045 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1046 };
1047
1048 let req = req_builder.build()?;
1049 let resp = configuration.client.execute(req).await?;
1050
1051 let status = resp.status();
1052 let content_type = resp
1053 .headers()
1054 .get("content-type")
1055 .and_then(|v| v.to_str().ok())
1056 .unwrap_or("application/octet-stream");
1057 let content_type = super::ContentType::from(content_type);
1058
1059 if !status.is_client_error() && !status.is_server_error() {
1060 let content = resp.text().await?;
1061 match content_type {
1062 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1063 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))),
1064 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::ActionVariable`")))),
1065 }
1066 } else {
1067 let content = resp.text().await?;
1068 let entity: Option<DeleteOrgVariableError> = serde_json::from_str(&content).ok();
1069 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1070 }
1071}
1072
1073pub async fn get_org_runner(configuration: &configuration::Configuration, org: &str, runner_id: &str) -> Result<(), Error<GetOrgRunnerError>> {
1074 let p_path_org = org;
1076 let p_path_runner_id = runner_id;
1077
1078 let uri_str = format!("{}/orgs/{org}/actions/runners/{runner_id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), runner_id=crate::apis::urlencode(p_path_runner_id));
1079 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1080
1081 if let Some(ref apikey) = configuration.api_key {
1082 let key = apikey.key.clone();
1083 let value = match apikey.prefix {
1084 Some(ref prefix) => format!("{} {}", prefix, key),
1085 None => key,
1086 };
1087 req_builder = req_builder.query(&[("access_token", value)]);
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.query(&[("sudo", 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.query(&[("token", value)]);
1104 }
1105 if let Some(ref user_agent) = configuration.user_agent {
1106 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1107 }
1108 if let Some(ref apikey) = configuration.api_key {
1109 let key = apikey.key.clone();
1110 let value = match apikey.prefix {
1111 Some(ref prefix) => format!("{} {}", prefix, key),
1112 None => key,
1113 };
1114 req_builder = req_builder.header("X-GITEA-OTP", value);
1115 };
1116 if let Some(ref apikey) = configuration.api_key {
1117 let key = apikey.key.clone();
1118 let value = match apikey.prefix {
1119 Some(ref prefix) => format!("{} {}", prefix, key),
1120 None => key,
1121 };
1122 req_builder = req_builder.header("Authorization", value);
1123 };
1124 if let Some(ref apikey) = configuration.api_key {
1125 let key = apikey.key.clone();
1126 let value = match apikey.prefix {
1127 Some(ref prefix) => format!("{} {}", prefix, key),
1128 None => key,
1129 };
1130 req_builder = req_builder.header("Sudo", value);
1131 };
1132 if let Some(ref auth_conf) = configuration.basic_auth {
1133 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1134 };
1135
1136 let req = req_builder.build()?;
1137 let resp = configuration.client.execute(req).await?;
1138
1139 let status = resp.status();
1140
1141 if !status.is_client_error() && !status.is_server_error() {
1142 Ok(())
1143 } else {
1144 let content = resp.text().await?;
1145 let entity: Option<GetOrgRunnerError> = serde_json::from_str(&content).ok();
1146 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1147 }
1148}
1149
1150pub async fn get_org_runners(configuration: &configuration::Configuration, org: &str) -> Result<(), Error<GetOrgRunnersError>> {
1151 let p_path_org = org;
1153
1154 let uri_str = format!("{}/orgs/{org}/actions/runners", configuration.base_path, org=crate::apis::urlencode(p_path_org));
1155 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1156
1157 if let Some(ref apikey) = configuration.api_key {
1158 let key = apikey.key.clone();
1159 let value = match apikey.prefix {
1160 Some(ref prefix) => format!("{} {}", prefix, key),
1161 None => key,
1162 };
1163 req_builder = req_builder.query(&[("access_token", value)]);
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.query(&[("sudo", 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.query(&[("token", value)]);
1180 }
1181 if let Some(ref user_agent) = configuration.user_agent {
1182 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1183 }
1184 if let Some(ref apikey) = configuration.api_key {
1185 let key = apikey.key.clone();
1186 let value = match apikey.prefix {
1187 Some(ref prefix) => format!("{} {}", prefix, key),
1188 None => key,
1189 };
1190 req_builder = req_builder.header("X-GITEA-OTP", value);
1191 };
1192 if let Some(ref apikey) = configuration.api_key {
1193 let key = apikey.key.clone();
1194 let value = match apikey.prefix {
1195 Some(ref prefix) => format!("{} {}", prefix, key),
1196 None => key,
1197 };
1198 req_builder = req_builder.header("Authorization", value);
1199 };
1200 if let Some(ref apikey) = configuration.api_key {
1201 let key = apikey.key.clone();
1202 let value = match apikey.prefix {
1203 Some(ref prefix) => format!("{} {}", prefix, key),
1204 None => key,
1205 };
1206 req_builder = req_builder.header("Sudo", value);
1207 };
1208 if let Some(ref auth_conf) = configuration.basic_auth {
1209 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1210 };
1211
1212 let req = req_builder.build()?;
1213 let resp = configuration.client.execute(req).await?;
1214
1215 let status = resp.status();
1216
1217 if !status.is_client_error() && !status.is_server_error() {
1218 Ok(())
1219 } else {
1220 let content = resp.text().await?;
1221 let entity: Option<GetOrgRunnersError> = serde_json::from_str(&content).ok();
1222 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1223 }
1224}
1225
1226pub async fn get_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str) -> Result<models::ActionVariable, Error<GetOrgVariableError>> {
1227 let p_path_org = org;
1229 let p_path_variablename = variablename;
1230
1231 let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename));
1232 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1233
1234 if let Some(ref apikey) = configuration.api_key {
1235 let key = apikey.key.clone();
1236 let value = match apikey.prefix {
1237 Some(ref prefix) => format!("{} {}", prefix, key),
1238 None => key,
1239 };
1240 req_builder = req_builder.query(&[("access_token", value)]);
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.query(&[("sudo", 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.query(&[("token", value)]);
1257 }
1258 if let Some(ref user_agent) = configuration.user_agent {
1259 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1260 }
1261 if let Some(ref apikey) = configuration.api_key {
1262 let key = apikey.key.clone();
1263 let value = match apikey.prefix {
1264 Some(ref prefix) => format!("{} {}", prefix, key),
1265 None => key,
1266 };
1267 req_builder = req_builder.header("X-GITEA-OTP", value);
1268 };
1269 if let Some(ref apikey) = configuration.api_key {
1270 let key = apikey.key.clone();
1271 let value = match apikey.prefix {
1272 Some(ref prefix) => format!("{} {}", prefix, key),
1273 None => key,
1274 };
1275 req_builder = req_builder.header("Authorization", value);
1276 };
1277 if let Some(ref apikey) = configuration.api_key {
1278 let key = apikey.key.clone();
1279 let value = match apikey.prefix {
1280 Some(ref prefix) => format!("{} {}", prefix, key),
1281 None => key,
1282 };
1283 req_builder = req_builder.header("Sudo", value);
1284 };
1285 if let Some(ref auth_conf) = configuration.basic_auth {
1286 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1287 };
1288
1289 let req = req_builder.build()?;
1290 let resp = configuration.client.execute(req).await?;
1291
1292 let status = resp.status();
1293 let content_type = resp
1294 .headers()
1295 .get("content-type")
1296 .and_then(|v| v.to_str().ok())
1297 .unwrap_or("application/octet-stream");
1298 let content_type = super::ContentType::from(content_type);
1299
1300 if !status.is_client_error() && !status.is_server_error() {
1301 let content = resp.text().await?;
1302 match content_type {
1303 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1304 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))),
1305 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::ActionVariable`")))),
1306 }
1307 } else {
1308 let content = resp.text().await?;
1309 let entity: Option<GetOrgVariableError> = serde_json::from_str(&content).ok();
1310 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1311 }
1312}
1313
1314pub async fn get_org_variables_list(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::ActionVariable>, Error<GetOrgVariablesListError>> {
1315 let p_path_org = org;
1317 let p_query_page = page;
1318 let p_query_limit = limit;
1319
1320 let uri_str = format!("{}/orgs/{org}/actions/variables", configuration.base_path, org=crate::apis::urlencode(p_path_org));
1321 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1322
1323 if let Some(ref param_value) = p_query_page {
1324 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1325 }
1326 if let Some(ref param_value) = p_query_limit {
1327 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1328 }
1329 if let Some(ref apikey) = configuration.api_key {
1330 let key = apikey.key.clone();
1331 let value = match apikey.prefix {
1332 Some(ref prefix) => format!("{} {}", prefix, key),
1333 None => key,
1334 };
1335 req_builder = req_builder.query(&[("access_token", value)]);
1336 }
1337 if let Some(ref apikey) = configuration.api_key {
1338 let key = apikey.key.clone();
1339 let value = match apikey.prefix {
1340 Some(ref prefix) => format!("{} {}", prefix, key),
1341 None => key,
1342 };
1343 req_builder = req_builder.query(&[("sudo", value)]);
1344 }
1345 if let Some(ref apikey) = configuration.api_key {
1346 let key = apikey.key.clone();
1347 let value = match apikey.prefix {
1348 Some(ref prefix) => format!("{} {}", prefix, key),
1349 None => key,
1350 };
1351 req_builder = req_builder.query(&[("token", value)]);
1352 }
1353 if let Some(ref user_agent) = configuration.user_agent {
1354 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1355 }
1356 if let Some(ref apikey) = configuration.api_key {
1357 let key = apikey.key.clone();
1358 let value = match apikey.prefix {
1359 Some(ref prefix) => format!("{} {}", prefix, key),
1360 None => key,
1361 };
1362 req_builder = req_builder.header("X-GITEA-OTP", value);
1363 };
1364 if let Some(ref apikey) = configuration.api_key {
1365 let key = apikey.key.clone();
1366 let value = match apikey.prefix {
1367 Some(ref prefix) => format!("{} {}", prefix, key),
1368 None => key,
1369 };
1370 req_builder = req_builder.header("Authorization", value);
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.header("Sudo", value);
1379 };
1380 if let Some(ref auth_conf) = configuration.basic_auth {
1381 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1382 };
1383
1384 let req = req_builder.build()?;
1385 let resp = configuration.client.execute(req).await?;
1386
1387 let status = resp.status();
1388 let content_type = resp
1389 .headers()
1390 .get("content-type")
1391 .and_then(|v| v.to_str().ok())
1392 .unwrap_or("application/octet-stream");
1393 let content_type = super::ContentType::from(content_type);
1394
1395 if !status.is_client_error() && !status.is_server_error() {
1396 let content = resp.text().await?;
1397 match content_type {
1398 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1399 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ActionVariable>`"))),
1400 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<models::ActionVariable>`")))),
1401 }
1402 } else {
1403 let content = resp.text().await?;
1404 let entity: Option<GetOrgVariablesListError> = serde_json::from_str(&content).ok();
1405 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1406 }
1407}
1408
1409pub async fn get_org_workflow_jobs(configuration: &configuration::Configuration, org: &str, status: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<models::ActionWorkflowJobsResponse, Error<GetOrgWorkflowJobsError>> {
1410 let p_path_org = org;
1412 let p_query_status = status;
1413 let p_query_page = page;
1414 let p_query_limit = limit;
1415
1416 let uri_str = format!("{}/orgs/{org}/actions/jobs", configuration.base_path, org=crate::apis::urlencode(p_path_org));
1417 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1418
1419 if let Some(ref param_value) = p_query_status {
1420 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
1421 }
1422 if let Some(ref param_value) = p_query_page {
1423 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1424 }
1425 if let Some(ref param_value) = p_query_limit {
1426 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1427 }
1428 if let Some(ref apikey) = configuration.api_key {
1429 let key = apikey.key.clone();
1430 let value = match apikey.prefix {
1431 Some(ref prefix) => format!("{} {}", prefix, key),
1432 None => key,
1433 };
1434 req_builder = req_builder.query(&[("access_token", value)]);
1435 }
1436 if let Some(ref apikey) = configuration.api_key {
1437 let key = apikey.key.clone();
1438 let value = match apikey.prefix {
1439 Some(ref prefix) => format!("{} {}", prefix, key),
1440 None => key,
1441 };
1442 req_builder = req_builder.query(&[("sudo", value)]);
1443 }
1444 if let Some(ref apikey) = configuration.api_key {
1445 let key = apikey.key.clone();
1446 let value = match apikey.prefix {
1447 Some(ref prefix) => format!("{} {}", prefix, key),
1448 None => key,
1449 };
1450 req_builder = req_builder.query(&[("token", value)]);
1451 }
1452 if let Some(ref user_agent) = configuration.user_agent {
1453 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1454 }
1455 if let Some(ref apikey) = configuration.api_key {
1456 let key = apikey.key.clone();
1457 let value = match apikey.prefix {
1458 Some(ref prefix) => format!("{} {}", prefix, key),
1459 None => key,
1460 };
1461 req_builder = req_builder.header("X-GITEA-OTP", value);
1462 };
1463 if let Some(ref apikey) = configuration.api_key {
1464 let key = apikey.key.clone();
1465 let value = match apikey.prefix {
1466 Some(ref prefix) => format!("{} {}", prefix, key),
1467 None => key,
1468 };
1469 req_builder = req_builder.header("Authorization", value);
1470 };
1471 if let Some(ref apikey) = configuration.api_key {
1472 let key = apikey.key.clone();
1473 let value = match apikey.prefix {
1474 Some(ref prefix) => format!("{} {}", prefix, key),
1475 None => key,
1476 };
1477 req_builder = req_builder.header("Sudo", value);
1478 };
1479 if let Some(ref auth_conf) = configuration.basic_auth {
1480 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1481 };
1482
1483 let req = req_builder.build()?;
1484 let resp = configuration.client.execute(req).await?;
1485
1486 let status = resp.status();
1487 let content_type = resp
1488 .headers()
1489 .get("content-type")
1490 .and_then(|v| v.to_str().ok())
1491 .unwrap_or("application/octet-stream");
1492 let content_type = super::ContentType::from(content_type);
1493
1494 if !status.is_client_error() && !status.is_server_error() {
1495 let content = resp.text().await?;
1496 match content_type {
1497 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1498 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))),
1499 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`")))),
1500 }
1501 } else {
1502 let content = resp.text().await?;
1503 let entity: Option<GetOrgWorkflowJobsError> = serde_json::from_str(&content).ok();
1504 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1505 }
1506}
1507
1508pub async fn get_org_workflow_runs(configuration: &configuration::Configuration, org: &str, 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<GetOrgWorkflowRunsError>> {
1509 let p_path_org = org;
1511 let p_query_event = event;
1512 let p_query_branch = branch;
1513 let p_query_status = status;
1514 let p_query_actor = actor;
1515 let p_query_head_sha = head_sha;
1516 let p_query_page = page;
1517 let p_query_limit = limit;
1518
1519 let uri_str = format!("{}/orgs/{org}/actions/runs", configuration.base_path, org=crate::apis::urlencode(p_path_org));
1520 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1521
1522 if let Some(ref param_value) = p_query_event {
1523 req_builder = req_builder.query(&[("event", ¶m_value.to_string())]);
1524 }
1525 if let Some(ref param_value) = p_query_branch {
1526 req_builder = req_builder.query(&[("branch", ¶m_value.to_string())]);
1527 }
1528 if let Some(ref param_value) = p_query_status {
1529 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
1530 }
1531 if let Some(ref param_value) = p_query_actor {
1532 req_builder = req_builder.query(&[("actor", ¶m_value.to_string())]);
1533 }
1534 if let Some(ref param_value) = p_query_head_sha {
1535 req_builder = req_builder.query(&[("head_sha", ¶m_value.to_string())]);
1536 }
1537 if let Some(ref param_value) = p_query_page {
1538 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1539 }
1540 if let Some(ref param_value) = p_query_limit {
1541 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
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(&[("access_token", value)]);
1550 }
1551 if let Some(ref apikey) = configuration.api_key {
1552 let key = apikey.key.clone();
1553 let value = match apikey.prefix {
1554 Some(ref prefix) => format!("{} {}", prefix, key),
1555 None => key,
1556 };
1557 req_builder = req_builder.query(&[("sudo", value)]);
1558 }
1559 if let Some(ref apikey) = configuration.api_key {
1560 let key = apikey.key.clone();
1561 let value = match apikey.prefix {
1562 Some(ref prefix) => format!("{} {}", prefix, key),
1563 None => key,
1564 };
1565 req_builder = req_builder.query(&[("token", value)]);
1566 }
1567 if let Some(ref user_agent) = configuration.user_agent {
1568 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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("X-GITEA-OTP", value);
1577 };
1578 if let Some(ref apikey) = configuration.api_key {
1579 let key = apikey.key.clone();
1580 let value = match apikey.prefix {
1581 Some(ref prefix) => format!("{} {}", prefix, key),
1582 None => key,
1583 };
1584 req_builder = req_builder.header("Authorization", value);
1585 };
1586 if let Some(ref apikey) = configuration.api_key {
1587 let key = apikey.key.clone();
1588 let value = match apikey.prefix {
1589 Some(ref prefix) => format!("{} {}", prefix, key),
1590 None => key,
1591 };
1592 req_builder = req_builder.header("Sudo", value);
1593 };
1594 if let Some(ref auth_conf) = configuration.basic_auth {
1595 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1596 };
1597
1598 let req = req_builder.build()?;
1599 let resp = configuration.client.execute(req).await?;
1600
1601 let status = resp.status();
1602 let content_type = resp
1603 .headers()
1604 .get("content-type")
1605 .and_then(|v| v.to_str().ok())
1606 .unwrap_or("application/octet-stream");
1607 let content_type = super::ContentType::from(content_type);
1608
1609 if !status.is_client_error() && !status.is_server_error() {
1610 let content = resp.text().await?;
1611 match content_type {
1612 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1613 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`"))),
1614 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`")))),
1615 }
1616 } else {
1617 let content = resp.text().await?;
1618 let entity: Option<GetOrgWorkflowRunsError> = serde_json::from_str(&content).ok();
1619 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1620 }
1621}
1622
1623pub async fn org_add_team_member(configuration: &configuration::Configuration, id: i64, username: &str) -> Result<(), Error<OrgAddTeamMemberError>> {
1624 let p_path_id = id;
1626 let p_path_username = username;
1627
1628 let uri_str = format!("{}/teams/{id}/members/{username}", configuration.base_path, id=p_path_id, username=crate::apis::urlencode(p_path_username));
1629 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1630
1631 if let Some(ref apikey) = configuration.api_key {
1632 let key = apikey.key.clone();
1633 let value = match apikey.prefix {
1634 Some(ref prefix) => format!("{} {}", prefix, key),
1635 None => key,
1636 };
1637 req_builder = req_builder.query(&[("access_token", value)]);
1638 }
1639 if let Some(ref apikey) = configuration.api_key {
1640 let key = apikey.key.clone();
1641 let value = match apikey.prefix {
1642 Some(ref prefix) => format!("{} {}", prefix, key),
1643 None => key,
1644 };
1645 req_builder = req_builder.query(&[("sudo", value)]);
1646 }
1647 if let Some(ref apikey) = configuration.api_key {
1648 let key = apikey.key.clone();
1649 let value = match apikey.prefix {
1650 Some(ref prefix) => format!("{} {}", prefix, key),
1651 None => key,
1652 };
1653 req_builder = req_builder.query(&[("token", value)]);
1654 }
1655 if let Some(ref user_agent) = configuration.user_agent {
1656 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1657 }
1658 if let Some(ref apikey) = configuration.api_key {
1659 let key = apikey.key.clone();
1660 let value = match apikey.prefix {
1661 Some(ref prefix) => format!("{} {}", prefix, key),
1662 None => key,
1663 };
1664 req_builder = req_builder.header("X-GITEA-OTP", value);
1665 };
1666 if let Some(ref apikey) = configuration.api_key {
1667 let key = apikey.key.clone();
1668 let value = match apikey.prefix {
1669 Some(ref prefix) => format!("{} {}", prefix, key),
1670 None => key,
1671 };
1672 req_builder = req_builder.header("Authorization", value);
1673 };
1674 if let Some(ref apikey) = configuration.api_key {
1675 let key = apikey.key.clone();
1676 let value = match apikey.prefix {
1677 Some(ref prefix) => format!("{} {}", prefix, key),
1678 None => key,
1679 };
1680 req_builder = req_builder.header("Sudo", value);
1681 };
1682 if let Some(ref auth_conf) = configuration.basic_auth {
1683 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1684 };
1685
1686 let req = req_builder.build()?;
1687 let resp = configuration.client.execute(req).await?;
1688
1689 let status = resp.status();
1690
1691 if !status.is_client_error() && !status.is_server_error() {
1692 Ok(())
1693 } else {
1694 let content = resp.text().await?;
1695 let entity: Option<OrgAddTeamMemberError> = serde_json::from_str(&content).ok();
1696 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1697 }
1698}
1699
1700pub async fn org_add_team_repository(configuration: &configuration::Configuration, id: i64, org: &str, repo: &str) -> Result<(), Error<OrgAddTeamRepositoryError>> {
1701 let p_path_id = id;
1703 let p_path_org = org;
1704 let p_path_repo = repo;
1705
1706 let uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", configuration.base_path, id=p_path_id, org=crate::apis::urlencode(p_path_org), repo=crate::apis::urlencode(p_path_repo));
1707 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1708
1709 if let Some(ref apikey) = configuration.api_key {
1710 let key = apikey.key.clone();
1711 let value = match apikey.prefix {
1712 Some(ref prefix) => format!("{} {}", prefix, key),
1713 None => key,
1714 };
1715 req_builder = req_builder.query(&[("access_token", value)]);
1716 }
1717 if let Some(ref apikey) = configuration.api_key {
1718 let key = apikey.key.clone();
1719 let value = match apikey.prefix {
1720 Some(ref prefix) => format!("{} {}", prefix, key),
1721 None => key,
1722 };
1723 req_builder = req_builder.query(&[("sudo", value)]);
1724 }
1725 if let Some(ref apikey) = configuration.api_key {
1726 let key = apikey.key.clone();
1727 let value = match apikey.prefix {
1728 Some(ref prefix) => format!("{} {}", prefix, key),
1729 None => key,
1730 };
1731 req_builder = req_builder.query(&[("token", value)]);
1732 }
1733 if let Some(ref user_agent) = configuration.user_agent {
1734 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1735 }
1736 if let Some(ref apikey) = configuration.api_key {
1737 let key = apikey.key.clone();
1738 let value = match apikey.prefix {
1739 Some(ref prefix) => format!("{} {}", prefix, key),
1740 None => key,
1741 };
1742 req_builder = req_builder.header("X-GITEA-OTP", value);
1743 };
1744 if let Some(ref apikey) = configuration.api_key {
1745 let key = apikey.key.clone();
1746 let value = match apikey.prefix {
1747 Some(ref prefix) => format!("{} {}", prefix, key),
1748 None => key,
1749 };
1750 req_builder = req_builder.header("Authorization", value);
1751 };
1752 if let Some(ref apikey) = configuration.api_key {
1753 let key = apikey.key.clone();
1754 let value = match apikey.prefix {
1755 Some(ref prefix) => format!("{} {}", prefix, key),
1756 None => key,
1757 };
1758 req_builder = req_builder.header("Sudo", value);
1759 };
1760 if let Some(ref auth_conf) = configuration.basic_auth {
1761 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1762 };
1763
1764 let req = req_builder.build()?;
1765 let resp = configuration.client.execute(req).await?;
1766
1767 let status = resp.status();
1768
1769 if !status.is_client_error() && !status.is_server_error() {
1770 Ok(())
1771 } else {
1772 let content = resp.text().await?;
1773 let entity: Option<OrgAddTeamRepositoryError> = serde_json::from_str(&content).ok();
1774 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1775 }
1776}
1777
1778pub async fn org_conceal_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error<OrgConcealMemberError>> {
1779 let p_path_org = org;
1781 let p_path_username = username;
1782
1783 let uri_str = format!("{}/orgs/{org}/public_members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
1784 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1785
1786 if let Some(ref apikey) = configuration.api_key {
1787 let key = apikey.key.clone();
1788 let value = match apikey.prefix {
1789 Some(ref prefix) => format!("{} {}", prefix, key),
1790 None => key,
1791 };
1792 req_builder = req_builder.query(&[("access_token", value)]);
1793 }
1794 if let Some(ref apikey) = configuration.api_key {
1795 let key = apikey.key.clone();
1796 let value = match apikey.prefix {
1797 Some(ref prefix) => format!("{} {}", prefix, key),
1798 None => key,
1799 };
1800 req_builder = req_builder.query(&[("sudo", value)]);
1801 }
1802 if let Some(ref apikey) = configuration.api_key {
1803 let key = apikey.key.clone();
1804 let value = match apikey.prefix {
1805 Some(ref prefix) => format!("{} {}", prefix, key),
1806 None => key,
1807 };
1808 req_builder = req_builder.query(&[("token", value)]);
1809 }
1810 if let Some(ref user_agent) = configuration.user_agent {
1811 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", 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.header("Authorization", value);
1828 };
1829 if let Some(ref apikey) = configuration.api_key {
1830 let key = apikey.key.clone();
1831 let value = match apikey.prefix {
1832 Some(ref prefix) => format!("{} {}", prefix, key),
1833 None => key,
1834 };
1835 req_builder = req_builder.header("Sudo", value);
1836 };
1837 if let Some(ref auth_conf) = configuration.basic_auth {
1838 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1839 };
1840
1841 let req = req_builder.build()?;
1842 let resp = configuration.client.execute(req).await?;
1843
1844 let status = resp.status();
1845
1846 if !status.is_client_error() && !status.is_server_error() {
1847 Ok(())
1848 } else {
1849 let content = resp.text().await?;
1850 let entity: Option<OrgConcealMemberError> = serde_json::from_str(&content).ok();
1851 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1852 }
1853}
1854
1855pub async fn org_create(configuration: &configuration::Configuration, organization: models::CreateOrgOption) -> Result<models::Organization, Error<OrgCreateError>> {
1856 let p_body_organization = organization;
1858
1859 let uri_str = format!("{}/orgs", configuration.base_path);
1860 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1861
1862 if let Some(ref apikey) = configuration.api_key {
1863 let key = apikey.key.clone();
1864 let value = match apikey.prefix {
1865 Some(ref prefix) => format!("{} {}", prefix, key),
1866 None => key,
1867 };
1868 req_builder = req_builder.query(&[("access_token", value)]);
1869 }
1870 if let Some(ref apikey) = configuration.api_key {
1871 let key = apikey.key.clone();
1872 let value = match apikey.prefix {
1873 Some(ref prefix) => format!("{} {}", prefix, key),
1874 None => key,
1875 };
1876 req_builder = req_builder.query(&[("sudo", value)]);
1877 }
1878 if let Some(ref apikey) = configuration.api_key {
1879 let key = apikey.key.clone();
1880 let value = match apikey.prefix {
1881 Some(ref prefix) => format!("{} {}", prefix, key),
1882 None => key,
1883 };
1884 req_builder = req_builder.query(&[("token", value)]);
1885 }
1886 if let Some(ref user_agent) = configuration.user_agent {
1887 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1888 }
1889 if let Some(ref apikey) = configuration.api_key {
1890 let key = apikey.key.clone();
1891 let value = match apikey.prefix {
1892 Some(ref prefix) => format!("{} {}", prefix, key),
1893 None => key,
1894 };
1895 req_builder = req_builder.header("X-GITEA-OTP", value);
1896 };
1897 if let Some(ref apikey) = configuration.api_key {
1898 let key = apikey.key.clone();
1899 let value = match apikey.prefix {
1900 Some(ref prefix) => format!("{} {}", prefix, key),
1901 None => key,
1902 };
1903 req_builder = req_builder.header("Authorization", value);
1904 };
1905 if let Some(ref apikey) = configuration.api_key {
1906 let key = apikey.key.clone();
1907 let value = match apikey.prefix {
1908 Some(ref prefix) => format!("{} {}", prefix, key),
1909 None => key,
1910 };
1911 req_builder = req_builder.header("Sudo", value);
1912 };
1913 if let Some(ref auth_conf) = configuration.basic_auth {
1914 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1915 };
1916 req_builder = req_builder.json(&p_body_organization);
1917
1918 let req = req_builder.build()?;
1919 let resp = configuration.client.execute(req).await?;
1920
1921 let status = resp.status();
1922 let content_type = resp
1923 .headers()
1924 .get("content-type")
1925 .and_then(|v| v.to_str().ok())
1926 .unwrap_or("application/octet-stream");
1927 let content_type = super::ContentType::from(content_type);
1928
1929 if !status.is_client_error() && !status.is_server_error() {
1930 let content = resp.text().await?;
1931 match content_type {
1932 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1933 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
1934 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`")))),
1935 }
1936 } else {
1937 let content = resp.text().await?;
1938 let entity: Option<OrgCreateError> = serde_json::from_str(&content).ok();
1939 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1940 }
1941}
1942
1943pub async fn org_create_hook(configuration: &configuration::Configuration, org: &str, body: models::CreateHookOption) -> Result<models::Hook, Error<OrgCreateHookError>> {
1944 let p_path_org = org;
1946 let p_body_body = body;
1947
1948 let uri_str = format!("{}/orgs/{org}/hooks", configuration.base_path, org=crate::apis::urlencode(p_path_org));
1949 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1950
1951 if let Some(ref apikey) = configuration.api_key {
1952 let key = apikey.key.clone();
1953 let value = match apikey.prefix {
1954 Some(ref prefix) => format!("{} {}", prefix, key),
1955 None => key,
1956 };
1957 req_builder = req_builder.query(&[("access_token", value)]);
1958 }
1959 if let Some(ref apikey) = configuration.api_key {
1960 let key = apikey.key.clone();
1961 let value = match apikey.prefix {
1962 Some(ref prefix) => format!("{} {}", prefix, key),
1963 None => key,
1964 };
1965 req_builder = req_builder.query(&[("sudo", value)]);
1966 }
1967 if let Some(ref apikey) = configuration.api_key {
1968 let key = apikey.key.clone();
1969 let value = match apikey.prefix {
1970 Some(ref prefix) => format!("{} {}", prefix, key),
1971 None => key,
1972 };
1973 req_builder = req_builder.query(&[("token", value)]);
1974 }
1975 if let Some(ref user_agent) = configuration.user_agent {
1976 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1977 }
1978 if let Some(ref apikey) = configuration.api_key {
1979 let key = apikey.key.clone();
1980 let value = match apikey.prefix {
1981 Some(ref prefix) => format!("{} {}", prefix, key),
1982 None => key,
1983 };
1984 req_builder = req_builder.header("X-GITEA-OTP", value);
1985 };
1986 if let Some(ref apikey) = configuration.api_key {
1987 let key = apikey.key.clone();
1988 let value = match apikey.prefix {
1989 Some(ref prefix) => format!("{} {}", prefix, key),
1990 None => key,
1991 };
1992 req_builder = req_builder.header("Authorization", value);
1993 };
1994 if let Some(ref apikey) = configuration.api_key {
1995 let key = apikey.key.clone();
1996 let value = match apikey.prefix {
1997 Some(ref prefix) => format!("{} {}", prefix, key),
1998 None => key,
1999 };
2000 req_builder = req_builder.header("Sudo", value);
2001 };
2002 if let Some(ref auth_conf) = configuration.basic_auth {
2003 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2004 };
2005 req_builder = req_builder.json(&p_body_body);
2006
2007 let req = req_builder.build()?;
2008 let resp = configuration.client.execute(req).await?;
2009
2010 let status = resp.status();
2011 let content_type = resp
2012 .headers()
2013 .get("content-type")
2014 .and_then(|v| v.to_str().ok())
2015 .unwrap_or("application/octet-stream");
2016 let content_type = super::ContentType::from(content_type);
2017
2018 if !status.is_client_error() && !status.is_server_error() {
2019 let content = resp.text().await?;
2020 match content_type {
2021 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2022 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
2023 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`")))),
2024 }
2025 } else {
2026 let content = resp.text().await?;
2027 let entity: Option<OrgCreateHookError> = serde_json::from_str(&content).ok();
2028 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2029 }
2030}
2031
2032pub async fn org_create_label(configuration: &configuration::Configuration, org: &str, body: Option<models::CreateLabelOption>) -> Result<models::Label, Error<OrgCreateLabelError>> {
2033 let p_path_org = org;
2035 let p_body_body = body;
2036
2037 let uri_str = format!("{}/orgs/{org}/labels", configuration.base_path, org=crate::apis::urlencode(p_path_org));
2038 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2039
2040 if let Some(ref apikey) = configuration.api_key {
2041 let key = apikey.key.clone();
2042 let value = match apikey.prefix {
2043 Some(ref prefix) => format!("{} {}", prefix, key),
2044 None => key,
2045 };
2046 req_builder = req_builder.query(&[("access_token", value)]);
2047 }
2048 if let Some(ref apikey) = configuration.api_key {
2049 let key = apikey.key.clone();
2050 let value = match apikey.prefix {
2051 Some(ref prefix) => format!("{} {}", prefix, key),
2052 None => key,
2053 };
2054 req_builder = req_builder.query(&[("sudo", value)]);
2055 }
2056 if let Some(ref apikey) = configuration.api_key {
2057 let key = apikey.key.clone();
2058 let value = match apikey.prefix {
2059 Some(ref prefix) => format!("{} {}", prefix, key),
2060 None => key,
2061 };
2062 req_builder = req_builder.query(&[("token", value)]);
2063 }
2064 if let Some(ref user_agent) = configuration.user_agent {
2065 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2066 }
2067 if let Some(ref apikey) = configuration.api_key {
2068 let key = apikey.key.clone();
2069 let value = match apikey.prefix {
2070 Some(ref prefix) => format!("{} {}", prefix, key),
2071 None => key,
2072 };
2073 req_builder = req_builder.header("X-GITEA-OTP", value);
2074 };
2075 if let Some(ref apikey) = configuration.api_key {
2076 let key = apikey.key.clone();
2077 let value = match apikey.prefix {
2078 Some(ref prefix) => format!("{} {}", prefix, key),
2079 None => key,
2080 };
2081 req_builder = req_builder.header("Authorization", value);
2082 };
2083 if let Some(ref apikey) = configuration.api_key {
2084 let key = apikey.key.clone();
2085 let value = match apikey.prefix {
2086 Some(ref prefix) => format!("{} {}", prefix, key),
2087 None => key,
2088 };
2089 req_builder = req_builder.header("Sudo", value);
2090 };
2091 if let Some(ref auth_conf) = configuration.basic_auth {
2092 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2093 };
2094 req_builder = req_builder.json(&p_body_body);
2095
2096 let req = req_builder.build()?;
2097 let resp = configuration.client.execute(req).await?;
2098
2099 let status = resp.status();
2100 let content_type = resp
2101 .headers()
2102 .get("content-type")
2103 .and_then(|v| v.to_str().ok())
2104 .unwrap_or("application/octet-stream");
2105 let content_type = super::ContentType::from(content_type);
2106
2107 if !status.is_client_error() && !status.is_server_error() {
2108 let content = resp.text().await?;
2109 match content_type {
2110 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2111 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))),
2112 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::Label`")))),
2113 }
2114 } else {
2115 let content = resp.text().await?;
2116 let entity: Option<OrgCreateLabelError> = serde_json::from_str(&content).ok();
2117 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2118 }
2119}
2120
2121pub async fn org_create_runner_registration_token(configuration: &configuration::Configuration, org: &str) -> Result<(), Error<OrgCreateRunnerRegistrationTokenError>> {
2122 let p_path_org = org;
2124
2125 let uri_str = format!("{}/orgs/{org}/actions/runners/registration-token", configuration.base_path, org=crate::apis::urlencode(p_path_org));
2126 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2127
2128 if let Some(ref apikey) = configuration.api_key {
2129 let key = apikey.key.clone();
2130 let value = match apikey.prefix {
2131 Some(ref prefix) => format!("{} {}", prefix, key),
2132 None => key,
2133 };
2134 req_builder = req_builder.query(&[("access_token", value)]);
2135 }
2136 if let Some(ref apikey) = configuration.api_key {
2137 let key = apikey.key.clone();
2138 let value = match apikey.prefix {
2139 Some(ref prefix) => format!("{} {}", prefix, key),
2140 None => key,
2141 };
2142 req_builder = req_builder.query(&[("sudo", value)]);
2143 }
2144 if let Some(ref apikey) = configuration.api_key {
2145 let key = apikey.key.clone();
2146 let value = match apikey.prefix {
2147 Some(ref prefix) => format!("{} {}", prefix, key),
2148 None => key,
2149 };
2150 req_builder = req_builder.query(&[("token", value)]);
2151 }
2152 if let Some(ref user_agent) = configuration.user_agent {
2153 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2154 }
2155 if let Some(ref apikey) = configuration.api_key {
2156 let key = apikey.key.clone();
2157 let value = match apikey.prefix {
2158 Some(ref prefix) => format!("{} {}", prefix, key),
2159 None => key,
2160 };
2161 req_builder = req_builder.header("X-GITEA-OTP", value);
2162 };
2163 if let Some(ref apikey) = configuration.api_key {
2164 let key = apikey.key.clone();
2165 let value = match apikey.prefix {
2166 Some(ref prefix) => format!("{} {}", prefix, key),
2167 None => key,
2168 };
2169 req_builder = req_builder.header("Authorization", value);
2170 };
2171 if let Some(ref apikey) = configuration.api_key {
2172 let key = apikey.key.clone();
2173 let value = match apikey.prefix {
2174 Some(ref prefix) => format!("{} {}", prefix, key),
2175 None => key,
2176 };
2177 req_builder = req_builder.header("Sudo", value);
2178 };
2179 if let Some(ref auth_conf) = configuration.basic_auth {
2180 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2181 };
2182
2183 let req = req_builder.build()?;
2184 let resp = configuration.client.execute(req).await?;
2185
2186 let status = resp.status();
2187
2188 if !status.is_client_error() && !status.is_server_error() {
2189 Ok(())
2190 } else {
2191 let content = resp.text().await?;
2192 let entity: Option<OrgCreateRunnerRegistrationTokenError> = serde_json::from_str(&content).ok();
2193 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2194 }
2195}
2196
2197pub async fn org_create_team(configuration: &configuration::Configuration, org: &str, body: Option<models::CreateTeamOption>) -> Result<models::Team, Error<OrgCreateTeamError>> {
2198 let p_path_org = org;
2200 let p_body_body = body;
2201
2202 let uri_str = format!("{}/orgs/{org}/teams", configuration.base_path, org=crate::apis::urlencode(p_path_org));
2203 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2204
2205 if let Some(ref apikey) = configuration.api_key {
2206 let key = apikey.key.clone();
2207 let value = match apikey.prefix {
2208 Some(ref prefix) => format!("{} {}", prefix, key),
2209 None => key,
2210 };
2211 req_builder = req_builder.query(&[("access_token", value)]);
2212 }
2213 if let Some(ref apikey) = configuration.api_key {
2214 let key = apikey.key.clone();
2215 let value = match apikey.prefix {
2216 Some(ref prefix) => format!("{} {}", prefix, key),
2217 None => key,
2218 };
2219 req_builder = req_builder.query(&[("sudo", value)]);
2220 }
2221 if let Some(ref apikey) = configuration.api_key {
2222 let key = apikey.key.clone();
2223 let value = match apikey.prefix {
2224 Some(ref prefix) => format!("{} {}", prefix, key),
2225 None => key,
2226 };
2227 req_builder = req_builder.query(&[("token", value)]);
2228 }
2229 if let Some(ref user_agent) = configuration.user_agent {
2230 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2231 }
2232 if let Some(ref apikey) = configuration.api_key {
2233 let key = apikey.key.clone();
2234 let value = match apikey.prefix {
2235 Some(ref prefix) => format!("{} {}", prefix, key),
2236 None => key,
2237 };
2238 req_builder = req_builder.header("X-GITEA-OTP", value);
2239 };
2240 if let Some(ref apikey) = configuration.api_key {
2241 let key = apikey.key.clone();
2242 let value = match apikey.prefix {
2243 Some(ref prefix) => format!("{} {}", prefix, key),
2244 None => key,
2245 };
2246 req_builder = req_builder.header("Authorization", value);
2247 };
2248 if let Some(ref apikey) = configuration.api_key {
2249 let key = apikey.key.clone();
2250 let value = match apikey.prefix {
2251 Some(ref prefix) => format!("{} {}", prefix, key),
2252 None => key,
2253 };
2254 req_builder = req_builder.header("Sudo", value);
2255 };
2256 if let Some(ref auth_conf) = configuration.basic_auth {
2257 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2258 };
2259 req_builder = req_builder.json(&p_body_body);
2260
2261 let req = req_builder.build()?;
2262 let resp = configuration.client.execute(req).await?;
2263
2264 let status = resp.status();
2265 let content_type = resp
2266 .headers()
2267 .get("content-type")
2268 .and_then(|v| v.to_str().ok())
2269 .unwrap_or("application/octet-stream");
2270 let content_type = super::ContentType::from(content_type);
2271
2272 if !status.is_client_error() && !status.is_server_error() {
2273 let content = resp.text().await?;
2274 match content_type {
2275 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2276 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))),
2277 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::Team`")))),
2278 }
2279 } else {
2280 let content = resp.text().await?;
2281 let entity: Option<OrgCreateTeamError> = serde_json::from_str(&content).ok();
2282 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2283 }
2284}
2285
2286pub async fn org_delete(configuration: &configuration::Configuration, org: &str) -> Result<(), Error<OrgDeleteError>> {
2287 let p_path_org = org;
2289
2290 let uri_str = format!("{}/orgs/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org));
2291 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2292
2293 if let Some(ref apikey) = configuration.api_key {
2294 let key = apikey.key.clone();
2295 let value = match apikey.prefix {
2296 Some(ref prefix) => format!("{} {}", prefix, key),
2297 None => key,
2298 };
2299 req_builder = req_builder.query(&[("access_token", value)]);
2300 }
2301 if let Some(ref apikey) = configuration.api_key {
2302 let key = apikey.key.clone();
2303 let value = match apikey.prefix {
2304 Some(ref prefix) => format!("{} {}", prefix, key),
2305 None => key,
2306 };
2307 req_builder = req_builder.query(&[("sudo", value)]);
2308 }
2309 if let Some(ref apikey) = configuration.api_key {
2310 let key = apikey.key.clone();
2311 let value = match apikey.prefix {
2312 Some(ref prefix) => format!("{} {}", prefix, key),
2313 None => key,
2314 };
2315 req_builder = req_builder.query(&[("token", value)]);
2316 }
2317 if let Some(ref user_agent) = configuration.user_agent {
2318 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2319 }
2320 if let Some(ref apikey) = configuration.api_key {
2321 let key = apikey.key.clone();
2322 let value = match apikey.prefix {
2323 Some(ref prefix) => format!("{} {}", prefix, key),
2324 None => key,
2325 };
2326 req_builder = req_builder.header("X-GITEA-OTP", value);
2327 };
2328 if let Some(ref apikey) = configuration.api_key {
2329 let key = apikey.key.clone();
2330 let value = match apikey.prefix {
2331 Some(ref prefix) => format!("{} {}", prefix, key),
2332 None => key,
2333 };
2334 req_builder = req_builder.header("Authorization", value);
2335 };
2336 if let Some(ref apikey) = configuration.api_key {
2337 let key = apikey.key.clone();
2338 let value = match apikey.prefix {
2339 Some(ref prefix) => format!("{} {}", prefix, key),
2340 None => key,
2341 };
2342 req_builder = req_builder.header("Sudo", value);
2343 };
2344 if let Some(ref auth_conf) = configuration.basic_auth {
2345 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2346 };
2347
2348 let req = req_builder.build()?;
2349 let resp = configuration.client.execute(req).await?;
2350
2351 let status = resp.status();
2352
2353 if !status.is_client_error() && !status.is_server_error() {
2354 Ok(())
2355 } else {
2356 let content = resp.text().await?;
2357 let entity: Option<OrgDeleteError> = serde_json::from_str(&content).ok();
2358 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2359 }
2360}
2361
2362pub async fn org_delete_avatar(configuration: &configuration::Configuration, org: &str) -> Result<(), Error<OrgDeleteAvatarError>> {
2363 let p_path_org = org;
2365
2366 let uri_str = format!("{}/orgs/{org}/avatar", configuration.base_path, org=crate::apis::urlencode(p_path_org));
2367 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2368
2369 if let Some(ref apikey) = configuration.api_key {
2370 let key = apikey.key.clone();
2371 let value = match apikey.prefix {
2372 Some(ref prefix) => format!("{} {}", prefix, key),
2373 None => key,
2374 };
2375 req_builder = req_builder.query(&[("access_token", value)]);
2376 }
2377 if let Some(ref apikey) = configuration.api_key {
2378 let key = apikey.key.clone();
2379 let value = match apikey.prefix {
2380 Some(ref prefix) => format!("{} {}", prefix, key),
2381 None => key,
2382 };
2383 req_builder = req_builder.query(&[("sudo", value)]);
2384 }
2385 if let Some(ref apikey) = configuration.api_key {
2386 let key = apikey.key.clone();
2387 let value = match apikey.prefix {
2388 Some(ref prefix) => format!("{} {}", prefix, key),
2389 None => key,
2390 };
2391 req_builder = req_builder.query(&[("token", value)]);
2392 }
2393 if let Some(ref user_agent) = configuration.user_agent {
2394 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2395 }
2396 if let Some(ref apikey) = configuration.api_key {
2397 let key = apikey.key.clone();
2398 let value = match apikey.prefix {
2399 Some(ref prefix) => format!("{} {}", prefix, key),
2400 None => key,
2401 };
2402 req_builder = req_builder.header("X-GITEA-OTP", value);
2403 };
2404 if let Some(ref apikey) = configuration.api_key {
2405 let key = apikey.key.clone();
2406 let value = match apikey.prefix {
2407 Some(ref prefix) => format!("{} {}", prefix, key),
2408 None => key,
2409 };
2410 req_builder = req_builder.header("Authorization", value);
2411 };
2412 if let Some(ref apikey) = configuration.api_key {
2413 let key = apikey.key.clone();
2414 let value = match apikey.prefix {
2415 Some(ref prefix) => format!("{} {}", prefix, key),
2416 None => key,
2417 };
2418 req_builder = req_builder.header("Sudo", value);
2419 };
2420 if let Some(ref auth_conf) = configuration.basic_auth {
2421 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2422 };
2423
2424 let req = req_builder.build()?;
2425 let resp = configuration.client.execute(req).await?;
2426
2427 let status = resp.status();
2428
2429 if !status.is_client_error() && !status.is_server_error() {
2430 Ok(())
2431 } else {
2432 let content = resp.text().await?;
2433 let entity: Option<OrgDeleteAvatarError> = serde_json::from_str(&content).ok();
2434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2435 }
2436}
2437
2438pub async fn org_delete_hook(configuration: &configuration::Configuration, org: &str, id: i64) -> Result<(), Error<OrgDeleteHookError>> {
2439 let p_path_org = org;
2441 let p_path_id = id;
2442
2443 let uri_str = format!("{}/orgs/{org}/hooks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id);
2444 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2445
2446 if let Some(ref apikey) = configuration.api_key {
2447 let key = apikey.key.clone();
2448 let value = match apikey.prefix {
2449 Some(ref prefix) => format!("{} {}", prefix, key),
2450 None => key,
2451 };
2452 req_builder = req_builder.query(&[("access_token", value)]);
2453 }
2454 if let Some(ref apikey) = configuration.api_key {
2455 let key = apikey.key.clone();
2456 let value = match apikey.prefix {
2457 Some(ref prefix) => format!("{} {}", prefix, key),
2458 None => key,
2459 };
2460 req_builder = req_builder.query(&[("sudo", value)]);
2461 }
2462 if let Some(ref apikey) = configuration.api_key {
2463 let key = apikey.key.clone();
2464 let value = match apikey.prefix {
2465 Some(ref prefix) => format!("{} {}", prefix, key),
2466 None => key,
2467 };
2468 req_builder = req_builder.query(&[("token", value)]);
2469 }
2470 if let Some(ref user_agent) = configuration.user_agent {
2471 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2472 }
2473 if let Some(ref apikey) = configuration.api_key {
2474 let key = apikey.key.clone();
2475 let value = match apikey.prefix {
2476 Some(ref prefix) => format!("{} {}", prefix, key),
2477 None => key,
2478 };
2479 req_builder = req_builder.header("X-GITEA-OTP", value);
2480 };
2481 if let Some(ref apikey) = configuration.api_key {
2482 let key = apikey.key.clone();
2483 let value = match apikey.prefix {
2484 Some(ref prefix) => format!("{} {}", prefix, key),
2485 None => key,
2486 };
2487 req_builder = req_builder.header("Authorization", value);
2488 };
2489 if let Some(ref apikey) = configuration.api_key {
2490 let key = apikey.key.clone();
2491 let value = match apikey.prefix {
2492 Some(ref prefix) => format!("{} {}", prefix, key),
2493 None => key,
2494 };
2495 req_builder = req_builder.header("Sudo", value);
2496 };
2497 if let Some(ref auth_conf) = configuration.basic_auth {
2498 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2499 };
2500
2501 let req = req_builder.build()?;
2502 let resp = configuration.client.execute(req).await?;
2503
2504 let status = resp.status();
2505
2506 if !status.is_client_error() && !status.is_server_error() {
2507 Ok(())
2508 } else {
2509 let content = resp.text().await?;
2510 let entity: Option<OrgDeleteHookError> = serde_json::from_str(&content).ok();
2511 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2512 }
2513}
2514
2515pub async fn org_delete_label(configuration: &configuration::Configuration, org: &str, id: i64) -> Result<(), Error<OrgDeleteLabelError>> {
2516 let p_path_org = org;
2518 let p_path_id = id;
2519
2520 let uri_str = format!("{}/orgs/{org}/labels/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id);
2521 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2522
2523 if let Some(ref apikey) = configuration.api_key {
2524 let key = apikey.key.clone();
2525 let value = match apikey.prefix {
2526 Some(ref prefix) => format!("{} {}", prefix, key),
2527 None => key,
2528 };
2529 req_builder = req_builder.query(&[("access_token", value)]);
2530 }
2531 if let Some(ref apikey) = configuration.api_key {
2532 let key = apikey.key.clone();
2533 let value = match apikey.prefix {
2534 Some(ref prefix) => format!("{} {}", prefix, key),
2535 None => key,
2536 };
2537 req_builder = req_builder.query(&[("sudo", value)]);
2538 }
2539 if let Some(ref apikey) = configuration.api_key {
2540 let key = apikey.key.clone();
2541 let value = match apikey.prefix {
2542 Some(ref prefix) => format!("{} {}", prefix, key),
2543 None => key,
2544 };
2545 req_builder = req_builder.query(&[("token", value)]);
2546 }
2547 if let Some(ref user_agent) = configuration.user_agent {
2548 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2549 }
2550 if let Some(ref apikey) = configuration.api_key {
2551 let key = apikey.key.clone();
2552 let value = match apikey.prefix {
2553 Some(ref prefix) => format!("{} {}", prefix, key),
2554 None => key,
2555 };
2556 req_builder = req_builder.header("X-GITEA-OTP", value);
2557 };
2558 if let Some(ref apikey) = configuration.api_key {
2559 let key = apikey.key.clone();
2560 let value = match apikey.prefix {
2561 Some(ref prefix) => format!("{} {}", prefix, key),
2562 None => key,
2563 };
2564 req_builder = req_builder.header("Authorization", value);
2565 };
2566 if let Some(ref apikey) = configuration.api_key {
2567 let key = apikey.key.clone();
2568 let value = match apikey.prefix {
2569 Some(ref prefix) => format!("{} {}", prefix, key),
2570 None => key,
2571 };
2572 req_builder = req_builder.header("Sudo", value);
2573 };
2574 if let Some(ref auth_conf) = configuration.basic_auth {
2575 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2576 };
2577
2578 let req = req_builder.build()?;
2579 let resp = configuration.client.execute(req).await?;
2580
2581 let status = resp.status();
2582
2583 if !status.is_client_error() && !status.is_server_error() {
2584 Ok(())
2585 } else {
2586 let content = resp.text().await?;
2587 let entity: Option<OrgDeleteLabelError> = serde_json::from_str(&content).ok();
2588 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2589 }
2590}
2591
2592pub async fn org_delete_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error<OrgDeleteMemberError>> {
2593 let p_path_org = org;
2595 let p_path_username = username;
2596
2597 let uri_str = format!("{}/orgs/{org}/members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
2598 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2599
2600 if let Some(ref apikey) = configuration.api_key {
2601 let key = apikey.key.clone();
2602 let value = match apikey.prefix {
2603 Some(ref prefix) => format!("{} {}", prefix, key),
2604 None => key,
2605 };
2606 req_builder = req_builder.query(&[("access_token", value)]);
2607 }
2608 if let Some(ref apikey) = configuration.api_key {
2609 let key = apikey.key.clone();
2610 let value = match apikey.prefix {
2611 Some(ref prefix) => format!("{} {}", prefix, key),
2612 None => key,
2613 };
2614 req_builder = req_builder.query(&[("sudo", value)]);
2615 }
2616 if let Some(ref apikey) = configuration.api_key {
2617 let key = apikey.key.clone();
2618 let value = match apikey.prefix {
2619 Some(ref prefix) => format!("{} {}", prefix, key),
2620 None => key,
2621 };
2622 req_builder = req_builder.query(&[("token", value)]);
2623 }
2624 if let Some(ref user_agent) = configuration.user_agent {
2625 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2626 }
2627 if let Some(ref apikey) = configuration.api_key {
2628 let key = apikey.key.clone();
2629 let value = match apikey.prefix {
2630 Some(ref prefix) => format!("{} {}", prefix, key),
2631 None => key,
2632 };
2633 req_builder = req_builder.header("X-GITEA-OTP", value);
2634 };
2635 if let Some(ref apikey) = configuration.api_key {
2636 let key = apikey.key.clone();
2637 let value = match apikey.prefix {
2638 Some(ref prefix) => format!("{} {}", prefix, key),
2639 None => key,
2640 };
2641 req_builder = req_builder.header("Authorization", value);
2642 };
2643 if let Some(ref apikey) = configuration.api_key {
2644 let key = apikey.key.clone();
2645 let value = match apikey.prefix {
2646 Some(ref prefix) => format!("{} {}", prefix, key),
2647 None => key,
2648 };
2649 req_builder = req_builder.header("Sudo", value);
2650 };
2651 if let Some(ref auth_conf) = configuration.basic_auth {
2652 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2653 };
2654
2655 let req = req_builder.build()?;
2656 let resp = configuration.client.execute(req).await?;
2657
2658 let status = resp.status();
2659
2660 if !status.is_client_error() && !status.is_server_error() {
2661 Ok(())
2662 } else {
2663 let content = resp.text().await?;
2664 let entity: Option<OrgDeleteMemberError> = serde_json::from_str(&content).ok();
2665 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2666 }
2667}
2668
2669pub async fn org_delete_team(configuration: &configuration::Configuration, id: i64) -> Result<(), Error<OrgDeleteTeamError>> {
2670 let p_path_id = id;
2672
2673 let uri_str = format!("{}/teams/{id}", configuration.base_path, id=p_path_id);
2674 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2675
2676 if let Some(ref apikey) = configuration.api_key {
2677 let key = apikey.key.clone();
2678 let value = match apikey.prefix {
2679 Some(ref prefix) => format!("{} {}", prefix, key),
2680 None => key,
2681 };
2682 req_builder = req_builder.query(&[("access_token", value)]);
2683 }
2684 if let Some(ref apikey) = configuration.api_key {
2685 let key = apikey.key.clone();
2686 let value = match apikey.prefix {
2687 Some(ref prefix) => format!("{} {}", prefix, key),
2688 None => key,
2689 };
2690 req_builder = req_builder.query(&[("sudo", value)]);
2691 }
2692 if let Some(ref apikey) = configuration.api_key {
2693 let key = apikey.key.clone();
2694 let value = match apikey.prefix {
2695 Some(ref prefix) => format!("{} {}", prefix, key),
2696 None => key,
2697 };
2698 req_builder = req_builder.query(&[("token", value)]);
2699 }
2700 if let Some(ref user_agent) = configuration.user_agent {
2701 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2702 }
2703 if let Some(ref apikey) = configuration.api_key {
2704 let key = apikey.key.clone();
2705 let value = match apikey.prefix {
2706 Some(ref prefix) => format!("{} {}", prefix, key),
2707 None => key,
2708 };
2709 req_builder = req_builder.header("X-GITEA-OTP", value);
2710 };
2711 if let Some(ref apikey) = configuration.api_key {
2712 let key = apikey.key.clone();
2713 let value = match apikey.prefix {
2714 Some(ref prefix) => format!("{} {}", prefix, key),
2715 None => key,
2716 };
2717 req_builder = req_builder.header("Authorization", value);
2718 };
2719 if let Some(ref apikey) = configuration.api_key {
2720 let key = apikey.key.clone();
2721 let value = match apikey.prefix {
2722 Some(ref prefix) => format!("{} {}", prefix, key),
2723 None => key,
2724 };
2725 req_builder = req_builder.header("Sudo", value);
2726 };
2727 if let Some(ref auth_conf) = configuration.basic_auth {
2728 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2729 };
2730
2731 let req = req_builder.build()?;
2732 let resp = configuration.client.execute(req).await?;
2733
2734 let status = resp.status();
2735
2736 if !status.is_client_error() && !status.is_server_error() {
2737 Ok(())
2738 } else {
2739 let content = resp.text().await?;
2740 let entity: Option<OrgDeleteTeamError> = serde_json::from_str(&content).ok();
2741 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2742 }
2743}
2744
2745pub async fn org_edit(configuration: &configuration::Configuration, org: &str, body: models::EditOrgOption) -> Result<models::Organization, Error<OrgEditError>> {
2746 let p_path_org = org;
2748 let p_body_body = body;
2749
2750 let uri_str = format!("{}/orgs/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org));
2751 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2752
2753 if let Some(ref apikey) = configuration.api_key {
2754 let key = apikey.key.clone();
2755 let value = match apikey.prefix {
2756 Some(ref prefix) => format!("{} {}", prefix, key),
2757 None => key,
2758 };
2759 req_builder = req_builder.query(&[("access_token", value)]);
2760 }
2761 if let Some(ref apikey) = configuration.api_key {
2762 let key = apikey.key.clone();
2763 let value = match apikey.prefix {
2764 Some(ref prefix) => format!("{} {}", prefix, key),
2765 None => key,
2766 };
2767 req_builder = req_builder.query(&[("sudo", value)]);
2768 }
2769 if let Some(ref apikey) = configuration.api_key {
2770 let key = apikey.key.clone();
2771 let value = match apikey.prefix {
2772 Some(ref prefix) => format!("{} {}", prefix, key),
2773 None => key,
2774 };
2775 req_builder = req_builder.query(&[("token", value)]);
2776 }
2777 if let Some(ref user_agent) = configuration.user_agent {
2778 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
2787 };
2788 if let Some(ref apikey) = configuration.api_key {
2789 let key = apikey.key.clone();
2790 let value = match apikey.prefix {
2791 Some(ref prefix) => format!("{} {}", prefix, key),
2792 None => key,
2793 };
2794 req_builder = req_builder.header("Authorization", value);
2795 };
2796 if let Some(ref apikey) = configuration.api_key {
2797 let key = apikey.key.clone();
2798 let value = match apikey.prefix {
2799 Some(ref prefix) => format!("{} {}", prefix, key),
2800 None => key,
2801 };
2802 req_builder = req_builder.header("Sudo", value);
2803 };
2804 if let Some(ref auth_conf) = configuration.basic_auth {
2805 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2806 };
2807 req_builder = req_builder.json(&p_body_body);
2808
2809 let req = req_builder.build()?;
2810 let resp = configuration.client.execute(req).await?;
2811
2812 let status = resp.status();
2813 let content_type = resp
2814 .headers()
2815 .get("content-type")
2816 .and_then(|v| v.to_str().ok())
2817 .unwrap_or("application/octet-stream");
2818 let content_type = super::ContentType::from(content_type);
2819
2820 if !status.is_client_error() && !status.is_server_error() {
2821 let content = resp.text().await?;
2822 match content_type {
2823 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2824 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
2825 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`")))),
2826 }
2827 } else {
2828 let content = resp.text().await?;
2829 let entity: Option<OrgEditError> = serde_json::from_str(&content).ok();
2830 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2831 }
2832}
2833
2834pub async fn org_edit_hook(configuration: &configuration::Configuration, org: &str, id: i64, body: Option<models::EditHookOption>) -> Result<models::Hook, Error<OrgEditHookError>> {
2835 let p_path_org = org;
2837 let p_path_id = id;
2838 let p_body_body = body;
2839
2840 let uri_str = format!("{}/orgs/{org}/hooks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id);
2841 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2842
2843 if let Some(ref apikey) = configuration.api_key {
2844 let key = apikey.key.clone();
2845 let value = match apikey.prefix {
2846 Some(ref prefix) => format!("{} {}", prefix, key),
2847 None => key,
2848 };
2849 req_builder = req_builder.query(&[("access_token", value)]);
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(&[("sudo", 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(&[("token", value)]);
2866 }
2867 if let Some(ref user_agent) = configuration.user_agent {
2868 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2869 }
2870 if let Some(ref apikey) = configuration.api_key {
2871 let key = apikey.key.clone();
2872 let value = match apikey.prefix {
2873 Some(ref prefix) => format!("{} {}", prefix, key),
2874 None => key,
2875 };
2876 req_builder = req_builder.header("X-GITEA-OTP", value);
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("Authorization", 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("Sudo", value);
2893 };
2894 if let Some(ref auth_conf) = configuration.basic_auth {
2895 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2896 };
2897 req_builder = req_builder.json(&p_body_body);
2898
2899 let req = req_builder.build()?;
2900 let resp = configuration.client.execute(req).await?;
2901
2902 let status = resp.status();
2903 let content_type = resp
2904 .headers()
2905 .get("content-type")
2906 .and_then(|v| v.to_str().ok())
2907 .unwrap_or("application/octet-stream");
2908 let content_type = super::ContentType::from(content_type);
2909
2910 if !status.is_client_error() && !status.is_server_error() {
2911 let content = resp.text().await?;
2912 match content_type {
2913 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2914 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
2915 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`")))),
2916 }
2917 } else {
2918 let content = resp.text().await?;
2919 let entity: Option<OrgEditHookError> = serde_json::from_str(&content).ok();
2920 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2921 }
2922}
2923
2924pub async fn org_edit_label(configuration: &configuration::Configuration, org: &str, id: i64, body: Option<models::EditLabelOption>) -> Result<models::Label, Error<OrgEditLabelError>> {
2925 let p_path_org = org;
2927 let p_path_id = id;
2928 let p_body_body = body;
2929
2930 let uri_str = format!("{}/orgs/{org}/labels/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id);
2931 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2932
2933 if let Some(ref apikey) = configuration.api_key {
2934 let key = apikey.key.clone();
2935 let value = match apikey.prefix {
2936 Some(ref prefix) => format!("{} {}", prefix, key),
2937 None => key,
2938 };
2939 req_builder = req_builder.query(&[("access_token", value)]);
2940 }
2941 if let Some(ref apikey) = configuration.api_key {
2942 let key = apikey.key.clone();
2943 let value = match apikey.prefix {
2944 Some(ref prefix) => format!("{} {}", prefix, key),
2945 None => key,
2946 };
2947 req_builder = req_builder.query(&[("sudo", value)]);
2948 }
2949 if let Some(ref apikey) = configuration.api_key {
2950 let key = apikey.key.clone();
2951 let value = match apikey.prefix {
2952 Some(ref prefix) => format!("{} {}", prefix, key),
2953 None => key,
2954 };
2955 req_builder = req_builder.query(&[("token", value)]);
2956 }
2957 if let Some(ref user_agent) = configuration.user_agent {
2958 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2959 }
2960 if let Some(ref apikey) = configuration.api_key {
2961 let key = apikey.key.clone();
2962 let value = match apikey.prefix {
2963 Some(ref prefix) => format!("{} {}", prefix, key),
2964 None => key,
2965 };
2966 req_builder = req_builder.header("X-GITEA-OTP", value);
2967 };
2968 if let Some(ref apikey) = configuration.api_key {
2969 let key = apikey.key.clone();
2970 let value = match apikey.prefix {
2971 Some(ref prefix) => format!("{} {}", prefix, key),
2972 None => key,
2973 };
2974 req_builder = req_builder.header("Authorization", value);
2975 };
2976 if let Some(ref apikey) = configuration.api_key {
2977 let key = apikey.key.clone();
2978 let value = match apikey.prefix {
2979 Some(ref prefix) => format!("{} {}", prefix, key),
2980 None => key,
2981 };
2982 req_builder = req_builder.header("Sudo", value);
2983 };
2984 if let Some(ref auth_conf) = configuration.basic_auth {
2985 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2986 };
2987 req_builder = req_builder.json(&p_body_body);
2988
2989 let req = req_builder.build()?;
2990 let resp = configuration.client.execute(req).await?;
2991
2992 let status = resp.status();
2993 let content_type = resp
2994 .headers()
2995 .get("content-type")
2996 .and_then(|v| v.to_str().ok())
2997 .unwrap_or("application/octet-stream");
2998 let content_type = super::ContentType::from(content_type);
2999
3000 if !status.is_client_error() && !status.is_server_error() {
3001 let content = resp.text().await?;
3002 match content_type {
3003 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3004 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))),
3005 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::Label`")))),
3006 }
3007 } else {
3008 let content = resp.text().await?;
3009 let entity: Option<OrgEditLabelError> = serde_json::from_str(&content).ok();
3010 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3011 }
3012}
3013
3014pub async fn org_edit_team(configuration: &configuration::Configuration, id: i32, body: Option<models::EditTeamOption>) -> Result<models::Team, Error<OrgEditTeamError>> {
3015 let p_path_id = id;
3017 let p_body_body = body;
3018
3019 let uri_str = format!("{}/teams/{id}", configuration.base_path, id=p_path_id);
3020 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3021
3022 if let Some(ref apikey) = configuration.api_key {
3023 let key = apikey.key.clone();
3024 let value = match apikey.prefix {
3025 Some(ref prefix) => format!("{} {}", prefix, key),
3026 None => key,
3027 };
3028 req_builder = req_builder.query(&[("access_token", value)]);
3029 }
3030 if let Some(ref apikey) = configuration.api_key {
3031 let key = apikey.key.clone();
3032 let value = match apikey.prefix {
3033 Some(ref prefix) => format!("{} {}", prefix, key),
3034 None => key,
3035 };
3036 req_builder = req_builder.query(&[("sudo", value)]);
3037 }
3038 if let Some(ref apikey) = configuration.api_key {
3039 let key = apikey.key.clone();
3040 let value = match apikey.prefix {
3041 Some(ref prefix) => format!("{} {}", prefix, key),
3042 None => key,
3043 };
3044 req_builder = req_builder.query(&[("token", value)]);
3045 }
3046 if let Some(ref user_agent) = configuration.user_agent {
3047 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3048 }
3049 if let Some(ref apikey) = configuration.api_key {
3050 let key = apikey.key.clone();
3051 let value = match apikey.prefix {
3052 Some(ref prefix) => format!("{} {}", prefix, key),
3053 None => key,
3054 };
3055 req_builder = req_builder.header("X-GITEA-OTP", value);
3056 };
3057 if let Some(ref apikey) = configuration.api_key {
3058 let key = apikey.key.clone();
3059 let value = match apikey.prefix {
3060 Some(ref prefix) => format!("{} {}", prefix, key),
3061 None => key,
3062 };
3063 req_builder = req_builder.header("Authorization", value);
3064 };
3065 if let Some(ref apikey) = configuration.api_key {
3066 let key = apikey.key.clone();
3067 let value = match apikey.prefix {
3068 Some(ref prefix) => format!("{} {}", prefix, key),
3069 None => key,
3070 };
3071 req_builder = req_builder.header("Sudo", value);
3072 };
3073 if let Some(ref auth_conf) = configuration.basic_auth {
3074 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3075 };
3076 req_builder = req_builder.json(&p_body_body);
3077
3078 let req = req_builder.build()?;
3079 let resp = configuration.client.execute(req).await?;
3080
3081 let status = resp.status();
3082 let content_type = resp
3083 .headers()
3084 .get("content-type")
3085 .and_then(|v| v.to_str().ok())
3086 .unwrap_or("application/octet-stream");
3087 let content_type = super::ContentType::from(content_type);
3088
3089 if !status.is_client_error() && !status.is_server_error() {
3090 let content = resp.text().await?;
3091 match content_type {
3092 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3093 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))),
3094 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::Team`")))),
3095 }
3096 } else {
3097 let content = resp.text().await?;
3098 let entity: Option<OrgEditTeamError> = serde_json::from_str(&content).ok();
3099 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3100 }
3101}
3102
3103pub async fn org_get(configuration: &configuration::Configuration, org: &str) -> Result<models::Organization, Error<OrgGetError>> {
3104 let p_path_org = org;
3106
3107 let uri_str = format!("{}/orgs/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org));
3108 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3109
3110 if let Some(ref apikey) = configuration.api_key {
3111 let key = apikey.key.clone();
3112 let value = match apikey.prefix {
3113 Some(ref prefix) => format!("{} {}", prefix, key),
3114 None => key,
3115 };
3116 req_builder = req_builder.query(&[("access_token", value)]);
3117 }
3118 if let Some(ref apikey) = configuration.api_key {
3119 let key = apikey.key.clone();
3120 let value = match apikey.prefix {
3121 Some(ref prefix) => format!("{} {}", prefix, key),
3122 None => key,
3123 };
3124 req_builder = req_builder.query(&[("sudo", value)]);
3125 }
3126 if let Some(ref apikey) = configuration.api_key {
3127 let key = apikey.key.clone();
3128 let value = match apikey.prefix {
3129 Some(ref prefix) => format!("{} {}", prefix, key),
3130 None => key,
3131 };
3132 req_builder = req_builder.query(&[("token", value)]);
3133 }
3134 if let Some(ref user_agent) = configuration.user_agent {
3135 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3136 }
3137 if let Some(ref apikey) = configuration.api_key {
3138 let key = apikey.key.clone();
3139 let value = match apikey.prefix {
3140 Some(ref prefix) => format!("{} {}", prefix, key),
3141 None => key,
3142 };
3143 req_builder = req_builder.header("X-GITEA-OTP", value);
3144 };
3145 if let Some(ref apikey) = configuration.api_key {
3146 let key = apikey.key.clone();
3147 let value = match apikey.prefix {
3148 Some(ref prefix) => format!("{} {}", prefix, key),
3149 None => key,
3150 };
3151 req_builder = req_builder.header("Authorization", value);
3152 };
3153 if let Some(ref apikey) = configuration.api_key {
3154 let key = apikey.key.clone();
3155 let value = match apikey.prefix {
3156 Some(ref prefix) => format!("{} {}", prefix, key),
3157 None => key,
3158 };
3159 req_builder = req_builder.header("Sudo", value);
3160 };
3161 if let Some(ref auth_conf) = configuration.basic_auth {
3162 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3163 };
3164
3165 let req = req_builder.build()?;
3166 let resp = configuration.client.execute(req).await?;
3167
3168 let status = resp.status();
3169 let content_type = resp
3170 .headers()
3171 .get("content-type")
3172 .and_then(|v| v.to_str().ok())
3173 .unwrap_or("application/octet-stream");
3174 let content_type = super::ContentType::from(content_type);
3175
3176 if !status.is_client_error() && !status.is_server_error() {
3177 let content = resp.text().await?;
3178 match content_type {
3179 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3180 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
3181 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`")))),
3182 }
3183 } else {
3184 let content = resp.text().await?;
3185 let entity: Option<OrgGetError> = serde_json::from_str(&content).ok();
3186 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3187 }
3188}
3189
3190pub async fn org_get_all(configuration: &configuration::Configuration, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Organization>, Error<OrgGetAllError>> {
3191 let p_query_page = page;
3193 let p_query_limit = limit;
3194
3195 let uri_str = format!("{}/orgs", configuration.base_path);
3196 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3197
3198 if let Some(ref param_value) = p_query_page {
3199 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3200 }
3201 if let Some(ref param_value) = p_query_limit {
3202 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
3203 }
3204 if let Some(ref apikey) = configuration.api_key {
3205 let key = apikey.key.clone();
3206 let value = match apikey.prefix {
3207 Some(ref prefix) => format!("{} {}", prefix, key),
3208 None => key,
3209 };
3210 req_builder = req_builder.query(&[("access_token", value)]);
3211 }
3212 if let Some(ref apikey) = configuration.api_key {
3213 let key = apikey.key.clone();
3214 let value = match apikey.prefix {
3215 Some(ref prefix) => format!("{} {}", prefix, key),
3216 None => key,
3217 };
3218 req_builder = req_builder.query(&[("sudo", value)]);
3219 }
3220 if let Some(ref apikey) = configuration.api_key {
3221 let key = apikey.key.clone();
3222 let value = match apikey.prefix {
3223 Some(ref prefix) => format!("{} {}", prefix, key),
3224 None => key,
3225 };
3226 req_builder = req_builder.query(&[("token", value)]);
3227 }
3228 if let Some(ref user_agent) = configuration.user_agent {
3229 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3230 }
3231 if let Some(ref apikey) = configuration.api_key {
3232 let key = apikey.key.clone();
3233 let value = match apikey.prefix {
3234 Some(ref prefix) => format!("{} {}", prefix, key),
3235 None => key,
3236 };
3237 req_builder = req_builder.header("X-GITEA-OTP", value);
3238 };
3239 if let Some(ref apikey) = configuration.api_key {
3240 let key = apikey.key.clone();
3241 let value = match apikey.prefix {
3242 Some(ref prefix) => format!("{} {}", prefix, key),
3243 None => key,
3244 };
3245 req_builder = req_builder.header("Authorization", value);
3246 };
3247 if let Some(ref apikey) = configuration.api_key {
3248 let key = apikey.key.clone();
3249 let value = match apikey.prefix {
3250 Some(ref prefix) => format!("{} {}", prefix, key),
3251 None => key,
3252 };
3253 req_builder = req_builder.header("Sudo", value);
3254 };
3255 if let Some(ref auth_conf) = configuration.basic_auth {
3256 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3257 };
3258
3259 let req = req_builder.build()?;
3260 let resp = configuration.client.execute(req).await?;
3261
3262 let status = resp.status();
3263 let content_type = resp
3264 .headers()
3265 .get("content-type")
3266 .and_then(|v| v.to_str().ok())
3267 .unwrap_or("application/octet-stream");
3268 let content_type = super::ContentType::from(content_type);
3269
3270 if !status.is_client_error() && !status.is_server_error() {
3271 let content = resp.text().await?;
3272 match content_type {
3273 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3274 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Organization>`"))),
3275 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<models::Organization>`")))),
3276 }
3277 } else {
3278 let content = resp.text().await?;
3279 let entity: Option<OrgGetAllError> = serde_json::from_str(&content).ok();
3280 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3281 }
3282}
3283
3284pub async fn org_get_hook(configuration: &configuration::Configuration, org: &str, id: i64) -> Result<models::Hook, Error<OrgGetHookError>> {
3285 let p_path_org = org;
3287 let p_path_id = id;
3288
3289 let uri_str = format!("{}/orgs/{org}/hooks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id);
3290 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3291
3292 if let Some(ref apikey) = configuration.api_key {
3293 let key = apikey.key.clone();
3294 let value = match apikey.prefix {
3295 Some(ref prefix) => format!("{} {}", prefix, key),
3296 None => key,
3297 };
3298 req_builder = req_builder.query(&[("access_token", value)]);
3299 }
3300 if let Some(ref apikey) = configuration.api_key {
3301 let key = apikey.key.clone();
3302 let value = match apikey.prefix {
3303 Some(ref prefix) => format!("{} {}", prefix, key),
3304 None => key,
3305 };
3306 req_builder = req_builder.query(&[("sudo", value)]);
3307 }
3308 if let Some(ref apikey) = configuration.api_key {
3309 let key = apikey.key.clone();
3310 let value = match apikey.prefix {
3311 Some(ref prefix) => format!("{} {}", prefix, key),
3312 None => key,
3313 };
3314 req_builder = req_builder.query(&[("token", value)]);
3315 }
3316 if let Some(ref user_agent) = configuration.user_agent {
3317 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3318 }
3319 if let Some(ref apikey) = configuration.api_key {
3320 let key = apikey.key.clone();
3321 let value = match apikey.prefix {
3322 Some(ref prefix) => format!("{} {}", prefix, key),
3323 None => key,
3324 };
3325 req_builder = req_builder.header("X-GITEA-OTP", value);
3326 };
3327 if let Some(ref apikey) = configuration.api_key {
3328 let key = apikey.key.clone();
3329 let value = match apikey.prefix {
3330 Some(ref prefix) => format!("{} {}", prefix, key),
3331 None => key,
3332 };
3333 req_builder = req_builder.header("Authorization", value);
3334 };
3335 if let Some(ref apikey) = configuration.api_key {
3336 let key = apikey.key.clone();
3337 let value = match apikey.prefix {
3338 Some(ref prefix) => format!("{} {}", prefix, key),
3339 None => key,
3340 };
3341 req_builder = req_builder.header("Sudo", value);
3342 };
3343 if let Some(ref auth_conf) = configuration.basic_auth {
3344 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3345 };
3346
3347 let req = req_builder.build()?;
3348 let resp = configuration.client.execute(req).await?;
3349
3350 let status = resp.status();
3351 let content_type = resp
3352 .headers()
3353 .get("content-type")
3354 .and_then(|v| v.to_str().ok())
3355 .unwrap_or("application/octet-stream");
3356 let content_type = super::ContentType::from(content_type);
3357
3358 if !status.is_client_error() && !status.is_server_error() {
3359 let content = resp.text().await?;
3360 match content_type {
3361 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3362 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
3363 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`")))),
3364 }
3365 } else {
3366 let content = resp.text().await?;
3367 let entity: Option<OrgGetHookError> = serde_json::from_str(&content).ok();
3368 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3369 }
3370}
3371
3372pub async fn org_get_label(configuration: &configuration::Configuration, org: &str, id: i64) -> Result<models::Label, Error<OrgGetLabelError>> {
3373 let p_path_org = org;
3375 let p_path_id = id;
3376
3377 let uri_str = format!("{}/orgs/{org}/labels/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id);
3378 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3379
3380 if let Some(ref apikey) = configuration.api_key {
3381 let key = apikey.key.clone();
3382 let value = match apikey.prefix {
3383 Some(ref prefix) => format!("{} {}", prefix, key),
3384 None => key,
3385 };
3386 req_builder = req_builder.query(&[("access_token", value)]);
3387 }
3388 if let Some(ref apikey) = configuration.api_key {
3389 let key = apikey.key.clone();
3390 let value = match apikey.prefix {
3391 Some(ref prefix) => format!("{} {}", prefix, key),
3392 None => key,
3393 };
3394 req_builder = req_builder.query(&[("sudo", value)]);
3395 }
3396 if let Some(ref apikey) = configuration.api_key {
3397 let key = apikey.key.clone();
3398 let value = match apikey.prefix {
3399 Some(ref prefix) => format!("{} {}", prefix, key),
3400 None => key,
3401 };
3402 req_builder = req_builder.query(&[("token", value)]);
3403 }
3404 if let Some(ref user_agent) = configuration.user_agent {
3405 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3406 }
3407 if let Some(ref apikey) = configuration.api_key {
3408 let key = apikey.key.clone();
3409 let value = match apikey.prefix {
3410 Some(ref prefix) => format!("{} {}", prefix, key),
3411 None => key,
3412 };
3413 req_builder = req_builder.header("X-GITEA-OTP", value);
3414 };
3415 if let Some(ref apikey) = configuration.api_key {
3416 let key = apikey.key.clone();
3417 let value = match apikey.prefix {
3418 Some(ref prefix) => format!("{} {}", prefix, key),
3419 None => key,
3420 };
3421 req_builder = req_builder.header("Authorization", value);
3422 };
3423 if let Some(ref apikey) = configuration.api_key {
3424 let key = apikey.key.clone();
3425 let value = match apikey.prefix {
3426 Some(ref prefix) => format!("{} {}", prefix, key),
3427 None => key,
3428 };
3429 req_builder = req_builder.header("Sudo", value);
3430 };
3431 if let Some(ref auth_conf) = configuration.basic_auth {
3432 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3433 };
3434
3435 let req = req_builder.build()?;
3436 let resp = configuration.client.execute(req).await?;
3437
3438 let status = resp.status();
3439 let content_type = resp
3440 .headers()
3441 .get("content-type")
3442 .and_then(|v| v.to_str().ok())
3443 .unwrap_or("application/octet-stream");
3444 let content_type = super::ContentType::from(content_type);
3445
3446 if !status.is_client_error() && !status.is_server_error() {
3447 let content = resp.text().await?;
3448 match content_type {
3449 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3450 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))),
3451 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::Label`")))),
3452 }
3453 } else {
3454 let content = resp.text().await?;
3455 let entity: Option<OrgGetLabelError> = serde_json::from_str(&content).ok();
3456 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3457 }
3458}
3459
3460pub async fn org_get_runner_registration_token(configuration: &configuration::Configuration, org: &str) -> Result<(), Error<OrgGetRunnerRegistrationTokenError>> {
3461 let p_path_org = org;
3463
3464 let uri_str = format!("{}/orgs/{org}/actions/runners/registration-token", configuration.base_path, org=crate::apis::urlencode(p_path_org));
3465 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3466
3467 if let Some(ref apikey) = configuration.api_key {
3468 let key = apikey.key.clone();
3469 let value = match apikey.prefix {
3470 Some(ref prefix) => format!("{} {}", prefix, key),
3471 None => key,
3472 };
3473 req_builder = req_builder.query(&[("access_token", value)]);
3474 }
3475 if let Some(ref apikey) = configuration.api_key {
3476 let key = apikey.key.clone();
3477 let value = match apikey.prefix {
3478 Some(ref prefix) => format!("{} {}", prefix, key),
3479 None => key,
3480 };
3481 req_builder = req_builder.query(&[("sudo", value)]);
3482 }
3483 if let Some(ref apikey) = configuration.api_key {
3484 let key = apikey.key.clone();
3485 let value = match apikey.prefix {
3486 Some(ref prefix) => format!("{} {}", prefix, key),
3487 None => key,
3488 };
3489 req_builder = req_builder.query(&[("token", value)]);
3490 }
3491 if let Some(ref user_agent) = configuration.user_agent {
3492 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3493 }
3494 if let Some(ref apikey) = configuration.api_key {
3495 let key = apikey.key.clone();
3496 let value = match apikey.prefix {
3497 Some(ref prefix) => format!("{} {}", prefix, key),
3498 None => key,
3499 };
3500 req_builder = req_builder.header("X-GITEA-OTP", value);
3501 };
3502 if let Some(ref apikey) = configuration.api_key {
3503 let key = apikey.key.clone();
3504 let value = match apikey.prefix {
3505 Some(ref prefix) => format!("{} {}", prefix, key),
3506 None => key,
3507 };
3508 req_builder = req_builder.header("Authorization", value);
3509 };
3510 if let Some(ref apikey) = configuration.api_key {
3511 let key = apikey.key.clone();
3512 let value = match apikey.prefix {
3513 Some(ref prefix) => format!("{} {}", prefix, key),
3514 None => key,
3515 };
3516 req_builder = req_builder.header("Sudo", value);
3517 };
3518 if let Some(ref auth_conf) = configuration.basic_auth {
3519 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3520 };
3521
3522 let req = req_builder.build()?;
3523 let resp = configuration.client.execute(req).await?;
3524
3525 let status = resp.status();
3526
3527 if !status.is_client_error() && !status.is_server_error() {
3528 Ok(())
3529 } else {
3530 let content = resp.text().await?;
3531 let entity: Option<OrgGetRunnerRegistrationTokenError> = serde_json::from_str(&content).ok();
3532 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3533 }
3534}
3535
3536pub async fn org_get_team(configuration: &configuration::Configuration, id: i64) -> Result<models::Team, Error<OrgGetTeamError>> {
3537 let p_path_id = id;
3539
3540 let uri_str = format!("{}/teams/{id}", configuration.base_path, id=p_path_id);
3541 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3542
3543 if let Some(ref apikey) = configuration.api_key {
3544 let key = apikey.key.clone();
3545 let value = match apikey.prefix {
3546 Some(ref prefix) => format!("{} {}", prefix, key),
3547 None => key,
3548 };
3549 req_builder = req_builder.query(&[("access_token", value)]);
3550 }
3551 if let Some(ref apikey) = configuration.api_key {
3552 let key = apikey.key.clone();
3553 let value = match apikey.prefix {
3554 Some(ref prefix) => format!("{} {}", prefix, key),
3555 None => key,
3556 };
3557 req_builder = req_builder.query(&[("sudo", value)]);
3558 }
3559 if let Some(ref apikey) = configuration.api_key {
3560 let key = apikey.key.clone();
3561 let value = match apikey.prefix {
3562 Some(ref prefix) => format!("{} {}", prefix, key),
3563 None => key,
3564 };
3565 req_builder = req_builder.query(&[("token", value)]);
3566 }
3567 if let Some(ref user_agent) = configuration.user_agent {
3568 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3569 }
3570 if let Some(ref apikey) = configuration.api_key {
3571 let key = apikey.key.clone();
3572 let value = match apikey.prefix {
3573 Some(ref prefix) => format!("{} {}", prefix, key),
3574 None => key,
3575 };
3576 req_builder = req_builder.header("X-GITEA-OTP", value);
3577 };
3578 if let Some(ref apikey) = configuration.api_key {
3579 let key = apikey.key.clone();
3580 let value = match apikey.prefix {
3581 Some(ref prefix) => format!("{} {}", prefix, key),
3582 None => key,
3583 };
3584 req_builder = req_builder.header("Authorization", value);
3585 };
3586 if let Some(ref apikey) = configuration.api_key {
3587 let key = apikey.key.clone();
3588 let value = match apikey.prefix {
3589 Some(ref prefix) => format!("{} {}", prefix, key),
3590 None => key,
3591 };
3592 req_builder = req_builder.header("Sudo", value);
3593 };
3594 if let Some(ref auth_conf) = configuration.basic_auth {
3595 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3596 };
3597
3598 let req = req_builder.build()?;
3599 let resp = configuration.client.execute(req).await?;
3600
3601 let status = resp.status();
3602 let content_type = resp
3603 .headers()
3604 .get("content-type")
3605 .and_then(|v| v.to_str().ok())
3606 .unwrap_or("application/octet-stream");
3607 let content_type = super::ContentType::from(content_type);
3608
3609 if !status.is_client_error() && !status.is_server_error() {
3610 let content = resp.text().await?;
3611 match content_type {
3612 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3613 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))),
3614 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::Team`")))),
3615 }
3616 } else {
3617 let content = resp.text().await?;
3618 let entity: Option<OrgGetTeamError> = serde_json::from_str(&content).ok();
3619 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3620 }
3621}
3622
3623pub async fn org_get_user_permissions(configuration: &configuration::Configuration, username: &str, org: &str) -> Result<models::OrganizationPermissions, Error<OrgGetUserPermissionsError>> {
3624 let p_path_username = username;
3626 let p_path_org = org;
3627
3628 let uri_str = format!("{}/users/{username}/orgs/{org}/permissions", configuration.base_path, username=crate::apis::urlencode(p_path_username), org=crate::apis::urlencode(p_path_org));
3629 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3630
3631 if let Some(ref apikey) = configuration.api_key {
3632 let key = apikey.key.clone();
3633 let value = match apikey.prefix {
3634 Some(ref prefix) => format!("{} {}", prefix, key),
3635 None => key,
3636 };
3637 req_builder = req_builder.query(&[("access_token", value)]);
3638 }
3639 if let Some(ref apikey) = configuration.api_key {
3640 let key = apikey.key.clone();
3641 let value = match apikey.prefix {
3642 Some(ref prefix) => format!("{} {}", prefix, key),
3643 None => key,
3644 };
3645 req_builder = req_builder.query(&[("sudo", value)]);
3646 }
3647 if let Some(ref apikey) = configuration.api_key {
3648 let key = apikey.key.clone();
3649 let value = match apikey.prefix {
3650 Some(ref prefix) => format!("{} {}", prefix, key),
3651 None => key,
3652 };
3653 req_builder = req_builder.query(&[("token", value)]);
3654 }
3655 if let Some(ref user_agent) = configuration.user_agent {
3656 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3657 }
3658 if let Some(ref apikey) = configuration.api_key {
3659 let key = apikey.key.clone();
3660 let value = match apikey.prefix {
3661 Some(ref prefix) => format!("{} {}", prefix, key),
3662 None => key,
3663 };
3664 req_builder = req_builder.header("X-GITEA-OTP", value);
3665 };
3666 if let Some(ref apikey) = configuration.api_key {
3667 let key = apikey.key.clone();
3668 let value = match apikey.prefix {
3669 Some(ref prefix) => format!("{} {}", prefix, key),
3670 None => key,
3671 };
3672 req_builder = req_builder.header("Authorization", value);
3673 };
3674 if let Some(ref apikey) = configuration.api_key {
3675 let key = apikey.key.clone();
3676 let value = match apikey.prefix {
3677 Some(ref prefix) => format!("{} {}", prefix, key),
3678 None => key,
3679 };
3680 req_builder = req_builder.header("Sudo", value);
3681 };
3682 if let Some(ref auth_conf) = configuration.basic_auth {
3683 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3684 };
3685
3686 let req = req_builder.build()?;
3687 let resp = configuration.client.execute(req).await?;
3688
3689 let status = resp.status();
3690 let content_type = resp
3691 .headers()
3692 .get("content-type")
3693 .and_then(|v| v.to_str().ok())
3694 .unwrap_or("application/octet-stream");
3695 let content_type = super::ContentType::from(content_type);
3696
3697 if !status.is_client_error() && !status.is_server_error() {
3698 let content = resp.text().await?;
3699 match content_type {
3700 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3701 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationPermissions`"))),
3702 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::OrganizationPermissions`")))),
3703 }
3704 } else {
3705 let content = resp.text().await?;
3706 let entity: Option<OrgGetUserPermissionsError> = serde_json::from_str(&content).ok();
3707 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3708 }
3709}
3710
3711pub async fn org_is_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error<OrgIsMemberError>> {
3712 let p_path_org = org;
3714 let p_path_username = username;
3715
3716 let uri_str = format!("{}/orgs/{org}/members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
3717 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3718
3719 if let Some(ref apikey) = configuration.api_key {
3720 let key = apikey.key.clone();
3721 let value = match apikey.prefix {
3722 Some(ref prefix) => format!("{} {}", prefix, key),
3723 None => key,
3724 };
3725 req_builder = req_builder.query(&[("access_token", value)]);
3726 }
3727 if let Some(ref apikey) = configuration.api_key {
3728 let key = apikey.key.clone();
3729 let value = match apikey.prefix {
3730 Some(ref prefix) => format!("{} {}", prefix, key),
3731 None => key,
3732 };
3733 req_builder = req_builder.query(&[("sudo", value)]);
3734 }
3735 if let Some(ref apikey) = configuration.api_key {
3736 let key = apikey.key.clone();
3737 let value = match apikey.prefix {
3738 Some(ref prefix) => format!("{} {}", prefix, key),
3739 None => key,
3740 };
3741 req_builder = req_builder.query(&[("token", value)]);
3742 }
3743 if let Some(ref user_agent) = configuration.user_agent {
3744 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3745 }
3746 if let Some(ref apikey) = configuration.api_key {
3747 let key = apikey.key.clone();
3748 let value = match apikey.prefix {
3749 Some(ref prefix) => format!("{} {}", prefix, key),
3750 None => key,
3751 };
3752 req_builder = req_builder.header("X-GITEA-OTP", value);
3753 };
3754 if let Some(ref apikey) = configuration.api_key {
3755 let key = apikey.key.clone();
3756 let value = match apikey.prefix {
3757 Some(ref prefix) => format!("{} {}", prefix, key),
3758 None => key,
3759 };
3760 req_builder = req_builder.header("Authorization", value);
3761 };
3762 if let Some(ref apikey) = configuration.api_key {
3763 let key = apikey.key.clone();
3764 let value = match apikey.prefix {
3765 Some(ref prefix) => format!("{} {}", prefix, key),
3766 None => key,
3767 };
3768 req_builder = req_builder.header("Sudo", value);
3769 };
3770 if let Some(ref auth_conf) = configuration.basic_auth {
3771 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3772 };
3773
3774 let req = req_builder.build()?;
3775 let resp = configuration.client.execute(req).await?;
3776
3777 let status = resp.status();
3778
3779 if !status.is_client_error() && !status.is_server_error() {
3780 Ok(())
3781 } else {
3782 let content = resp.text().await?;
3783 let entity: Option<OrgIsMemberError> = serde_json::from_str(&content).ok();
3784 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3785 }
3786}
3787
3788pub async fn org_is_public_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error<OrgIsPublicMemberError>> {
3789 let p_path_org = org;
3791 let p_path_username = username;
3792
3793 let uri_str = format!("{}/orgs/{org}/public_members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
3794 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3795
3796 if let Some(ref apikey) = configuration.api_key {
3797 let key = apikey.key.clone();
3798 let value = match apikey.prefix {
3799 Some(ref prefix) => format!("{} {}", prefix, key),
3800 None => key,
3801 };
3802 req_builder = req_builder.query(&[("access_token", value)]);
3803 }
3804 if let Some(ref apikey) = configuration.api_key {
3805 let key = apikey.key.clone();
3806 let value = match apikey.prefix {
3807 Some(ref prefix) => format!("{} {}", prefix, key),
3808 None => key,
3809 };
3810 req_builder = req_builder.query(&[("sudo", value)]);
3811 }
3812 if let Some(ref apikey) = configuration.api_key {
3813 let key = apikey.key.clone();
3814 let value = match apikey.prefix {
3815 Some(ref prefix) => format!("{} {}", prefix, key),
3816 None => key,
3817 };
3818 req_builder = req_builder.query(&[("token", value)]);
3819 }
3820 if let Some(ref user_agent) = configuration.user_agent {
3821 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3822 }
3823 if let Some(ref apikey) = configuration.api_key {
3824 let key = apikey.key.clone();
3825 let value = match apikey.prefix {
3826 Some(ref prefix) => format!("{} {}", prefix, key),
3827 None => key,
3828 };
3829 req_builder = req_builder.header("X-GITEA-OTP", value);
3830 };
3831 if let Some(ref apikey) = configuration.api_key {
3832 let key = apikey.key.clone();
3833 let value = match apikey.prefix {
3834 Some(ref prefix) => format!("{} {}", prefix, key),
3835 None => key,
3836 };
3837 req_builder = req_builder.header("Authorization", value);
3838 };
3839 if let Some(ref apikey) = configuration.api_key {
3840 let key = apikey.key.clone();
3841 let value = match apikey.prefix {
3842 Some(ref prefix) => format!("{} {}", prefix, key),
3843 None => key,
3844 };
3845 req_builder = req_builder.header("Sudo", value);
3846 };
3847 if let Some(ref auth_conf) = configuration.basic_auth {
3848 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3849 };
3850
3851 let req = req_builder.build()?;
3852 let resp = configuration.client.execute(req).await?;
3853
3854 let status = resp.status();
3855
3856 if !status.is_client_error() && !status.is_server_error() {
3857 Ok(())
3858 } else {
3859 let content = resp.text().await?;
3860 let entity: Option<OrgIsPublicMemberError> = serde_json::from_str(&content).ok();
3861 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3862 }
3863}
3864
3865pub async fn org_list_actions_secrets(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Secret>, Error<OrgListActionsSecretsError>> {
3866 let p_path_org = org;
3868 let p_query_page = page;
3869 let p_query_limit = limit;
3870
3871 let uri_str = format!("{}/orgs/{org}/actions/secrets", configuration.base_path, org=crate::apis::urlencode(p_path_org));
3872 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3873
3874 if let Some(ref param_value) = p_query_page {
3875 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3876 }
3877 if let Some(ref param_value) = p_query_limit {
3878 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
3879 }
3880 if let Some(ref apikey) = configuration.api_key {
3881 let key = apikey.key.clone();
3882 let value = match apikey.prefix {
3883 Some(ref prefix) => format!("{} {}", prefix, key),
3884 None => key,
3885 };
3886 req_builder = req_builder.query(&[("access_token", value)]);
3887 }
3888 if let Some(ref apikey) = configuration.api_key {
3889 let key = apikey.key.clone();
3890 let value = match apikey.prefix {
3891 Some(ref prefix) => format!("{} {}", prefix, key),
3892 None => key,
3893 };
3894 req_builder = req_builder.query(&[("sudo", value)]);
3895 }
3896 if let Some(ref apikey) = configuration.api_key {
3897 let key = apikey.key.clone();
3898 let value = match apikey.prefix {
3899 Some(ref prefix) => format!("{} {}", prefix, key),
3900 None => key,
3901 };
3902 req_builder = req_builder.query(&[("token", value)]);
3903 }
3904 if let Some(ref user_agent) = configuration.user_agent {
3905 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3906 }
3907 if let Some(ref apikey) = configuration.api_key {
3908 let key = apikey.key.clone();
3909 let value = match apikey.prefix {
3910 Some(ref prefix) => format!("{} {}", prefix, key),
3911 None => key,
3912 };
3913 req_builder = req_builder.header("X-GITEA-OTP", value);
3914 };
3915 if let Some(ref apikey) = configuration.api_key {
3916 let key = apikey.key.clone();
3917 let value = match apikey.prefix {
3918 Some(ref prefix) => format!("{} {}", prefix, key),
3919 None => key,
3920 };
3921 req_builder = req_builder.header("Authorization", value);
3922 };
3923 if let Some(ref apikey) = configuration.api_key {
3924 let key = apikey.key.clone();
3925 let value = match apikey.prefix {
3926 Some(ref prefix) => format!("{} {}", prefix, key),
3927 None => key,
3928 };
3929 req_builder = req_builder.header("Sudo", value);
3930 };
3931 if let Some(ref auth_conf) = configuration.basic_auth {
3932 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3933 };
3934
3935 let req = req_builder.build()?;
3936 let resp = configuration.client.execute(req).await?;
3937
3938 let status = resp.status();
3939 let content_type = resp
3940 .headers()
3941 .get("content-type")
3942 .and_then(|v| v.to_str().ok())
3943 .unwrap_or("application/octet-stream");
3944 let content_type = super::ContentType::from(content_type);
3945
3946 if !status.is_client_error() && !status.is_server_error() {
3947 let content = resp.text().await?;
3948 match content_type {
3949 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3950 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Secret>`"))),
3951 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<models::Secret>`")))),
3952 }
3953 } else {
3954 let content = resp.text().await?;
3955 let entity: Option<OrgListActionsSecretsError> = serde_json::from_str(&content).ok();
3956 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3957 }
3958}
3959
3960pub async fn org_list_activity_feeds(configuration: &configuration::Configuration, org: &str, date: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Activity>, Error<OrgListActivityFeedsError>> {
3961 let p_path_org = org;
3963 let p_query_date = date;
3964 let p_query_page = page;
3965 let p_query_limit = limit;
3966
3967 let uri_str = format!("{}/orgs/{org}/activities/feeds", configuration.base_path, org=crate::apis::urlencode(p_path_org));
3968 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3969
3970 if let Some(ref param_value) = p_query_date {
3971 req_builder = req_builder.query(&[("date", ¶m_value.to_string())]);
3972 }
3973 if let Some(ref param_value) = p_query_page {
3974 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3975 }
3976 if let Some(ref param_value) = p_query_limit {
3977 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
3978 }
3979 if let Some(ref apikey) = configuration.api_key {
3980 let key = apikey.key.clone();
3981 let value = match apikey.prefix {
3982 Some(ref prefix) => format!("{} {}", prefix, key),
3983 None => key,
3984 };
3985 req_builder = req_builder.query(&[("access_token", value)]);
3986 }
3987 if let Some(ref apikey) = configuration.api_key {
3988 let key = apikey.key.clone();
3989 let value = match apikey.prefix {
3990 Some(ref prefix) => format!("{} {}", prefix, key),
3991 None => key,
3992 };
3993 req_builder = req_builder.query(&[("sudo", value)]);
3994 }
3995 if let Some(ref apikey) = configuration.api_key {
3996 let key = apikey.key.clone();
3997 let value = match apikey.prefix {
3998 Some(ref prefix) => format!("{} {}", prefix, key),
3999 None => key,
4000 };
4001 req_builder = req_builder.query(&[("token", value)]);
4002 }
4003 if let Some(ref user_agent) = configuration.user_agent {
4004 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4005 }
4006 if let Some(ref apikey) = configuration.api_key {
4007 let key = apikey.key.clone();
4008 let value = match apikey.prefix {
4009 Some(ref prefix) => format!("{} {}", prefix, key),
4010 None => key,
4011 };
4012 req_builder = req_builder.header("X-GITEA-OTP", value);
4013 };
4014 if let Some(ref apikey) = configuration.api_key {
4015 let key = apikey.key.clone();
4016 let value = match apikey.prefix {
4017 Some(ref prefix) => format!("{} {}", prefix, key),
4018 None => key,
4019 };
4020 req_builder = req_builder.header("Authorization", value);
4021 };
4022 if let Some(ref apikey) = configuration.api_key {
4023 let key = apikey.key.clone();
4024 let value = match apikey.prefix {
4025 Some(ref prefix) => format!("{} {}", prefix, key),
4026 None => key,
4027 };
4028 req_builder = req_builder.header("Sudo", value);
4029 };
4030 if let Some(ref auth_conf) = configuration.basic_auth {
4031 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4032 };
4033
4034 let req = req_builder.build()?;
4035 let resp = configuration.client.execute(req).await?;
4036
4037 let status = resp.status();
4038 let content_type = resp
4039 .headers()
4040 .get("content-type")
4041 .and_then(|v| v.to_str().ok())
4042 .unwrap_or("application/octet-stream");
4043 let content_type = super::ContentType::from(content_type);
4044
4045 if !status.is_client_error() && !status.is_server_error() {
4046 let content = resp.text().await?;
4047 match content_type {
4048 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4049 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Activity>`"))),
4050 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<models::Activity>`")))),
4051 }
4052 } else {
4053 let content = resp.text().await?;
4054 let entity: Option<OrgListActivityFeedsError> = serde_json::from_str(&content).ok();
4055 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4056 }
4057}
4058
4059pub async fn org_list_current_user_orgs(configuration: &configuration::Configuration, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Organization>, Error<OrgListCurrentUserOrgsError>> {
4060 let p_query_page = page;
4062 let p_query_limit = limit;
4063
4064 let uri_str = format!("{}/user/orgs", configuration.base_path);
4065 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4066
4067 if let Some(ref param_value) = p_query_page {
4068 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4069 }
4070 if let Some(ref param_value) = p_query_limit {
4071 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4072 }
4073 if let Some(ref apikey) = configuration.api_key {
4074 let key = apikey.key.clone();
4075 let value = match apikey.prefix {
4076 Some(ref prefix) => format!("{} {}", prefix, key),
4077 None => key,
4078 };
4079 req_builder = req_builder.query(&[("access_token", value)]);
4080 }
4081 if let Some(ref apikey) = configuration.api_key {
4082 let key = apikey.key.clone();
4083 let value = match apikey.prefix {
4084 Some(ref prefix) => format!("{} {}", prefix, key),
4085 None => key,
4086 };
4087 req_builder = req_builder.query(&[("sudo", value)]);
4088 }
4089 if let Some(ref apikey) = configuration.api_key {
4090 let key = apikey.key.clone();
4091 let value = match apikey.prefix {
4092 Some(ref prefix) => format!("{} {}", prefix, key),
4093 None => key,
4094 };
4095 req_builder = req_builder.query(&[("token", value)]);
4096 }
4097 if let Some(ref user_agent) = configuration.user_agent {
4098 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4099 }
4100 if let Some(ref apikey) = configuration.api_key {
4101 let key = apikey.key.clone();
4102 let value = match apikey.prefix {
4103 Some(ref prefix) => format!("{} {}", prefix, key),
4104 None => key,
4105 };
4106 req_builder = req_builder.header("X-GITEA-OTP", value);
4107 };
4108 if let Some(ref apikey) = configuration.api_key {
4109 let key = apikey.key.clone();
4110 let value = match apikey.prefix {
4111 Some(ref prefix) => format!("{} {}", prefix, key),
4112 None => key,
4113 };
4114 req_builder = req_builder.header("Authorization", value);
4115 };
4116 if let Some(ref apikey) = configuration.api_key {
4117 let key = apikey.key.clone();
4118 let value = match apikey.prefix {
4119 Some(ref prefix) => format!("{} {}", prefix, key),
4120 None => key,
4121 };
4122 req_builder = req_builder.header("Sudo", value);
4123 };
4124 if let Some(ref auth_conf) = configuration.basic_auth {
4125 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4126 };
4127
4128 let req = req_builder.build()?;
4129 let resp = configuration.client.execute(req).await?;
4130
4131 let status = resp.status();
4132 let content_type = resp
4133 .headers()
4134 .get("content-type")
4135 .and_then(|v| v.to_str().ok())
4136 .unwrap_or("application/octet-stream");
4137 let content_type = super::ContentType::from(content_type);
4138
4139 if !status.is_client_error() && !status.is_server_error() {
4140 let content = resp.text().await?;
4141 match content_type {
4142 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4143 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Organization>`"))),
4144 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<models::Organization>`")))),
4145 }
4146 } else {
4147 let content = resp.text().await?;
4148 let entity: Option<OrgListCurrentUserOrgsError> = serde_json::from_str(&content).ok();
4149 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4150 }
4151}
4152
4153pub async fn org_list_hooks(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Hook>, Error<OrgListHooksError>> {
4154 let p_path_org = org;
4156 let p_query_page = page;
4157 let p_query_limit = limit;
4158
4159 let uri_str = format!("{}/orgs/{org}/hooks", configuration.base_path, org=crate::apis::urlencode(p_path_org));
4160 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4161
4162 if let Some(ref param_value) = p_query_page {
4163 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4164 }
4165 if let Some(ref param_value) = p_query_limit {
4166 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4167 }
4168 if let Some(ref apikey) = configuration.api_key {
4169 let key = apikey.key.clone();
4170 let value = match apikey.prefix {
4171 Some(ref prefix) => format!("{} {}", prefix, key),
4172 None => key,
4173 };
4174 req_builder = req_builder.query(&[("access_token", value)]);
4175 }
4176 if let Some(ref apikey) = configuration.api_key {
4177 let key = apikey.key.clone();
4178 let value = match apikey.prefix {
4179 Some(ref prefix) => format!("{} {}", prefix, key),
4180 None => key,
4181 };
4182 req_builder = req_builder.query(&[("sudo", value)]);
4183 }
4184 if let Some(ref apikey) = configuration.api_key {
4185 let key = apikey.key.clone();
4186 let value = match apikey.prefix {
4187 Some(ref prefix) => format!("{} {}", prefix, key),
4188 None => key,
4189 };
4190 req_builder = req_builder.query(&[("token", value)]);
4191 }
4192 if let Some(ref user_agent) = configuration.user_agent {
4193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4194 }
4195 if let Some(ref apikey) = configuration.api_key {
4196 let key = apikey.key.clone();
4197 let value = match apikey.prefix {
4198 Some(ref prefix) => format!("{} {}", prefix, key),
4199 None => key,
4200 };
4201 req_builder = req_builder.header("X-GITEA-OTP", value);
4202 };
4203 if let Some(ref apikey) = configuration.api_key {
4204 let key = apikey.key.clone();
4205 let value = match apikey.prefix {
4206 Some(ref prefix) => format!("{} {}", prefix, key),
4207 None => key,
4208 };
4209 req_builder = req_builder.header("Authorization", value);
4210 };
4211 if let Some(ref apikey) = configuration.api_key {
4212 let key = apikey.key.clone();
4213 let value = match apikey.prefix {
4214 Some(ref prefix) => format!("{} {}", prefix, key),
4215 None => key,
4216 };
4217 req_builder = req_builder.header("Sudo", value);
4218 };
4219 if let Some(ref auth_conf) = configuration.basic_auth {
4220 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4221 };
4222
4223 let req = req_builder.build()?;
4224 let resp = configuration.client.execute(req).await?;
4225
4226 let status = resp.status();
4227 let content_type = resp
4228 .headers()
4229 .get("content-type")
4230 .and_then(|v| v.to_str().ok())
4231 .unwrap_or("application/octet-stream");
4232 let content_type = super::ContentType::from(content_type);
4233
4234 if !status.is_client_error() && !status.is_server_error() {
4235 let content = resp.text().await?;
4236 match content_type {
4237 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4238 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Hook>`"))),
4239 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<models::Hook>`")))),
4240 }
4241 } else {
4242 let content = resp.text().await?;
4243 let entity: Option<OrgListHooksError> = serde_json::from_str(&content).ok();
4244 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4245 }
4246}
4247
4248pub async fn org_list_labels(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Label>, Error<OrgListLabelsError>> {
4249 let p_path_org = org;
4251 let p_query_page = page;
4252 let p_query_limit = limit;
4253
4254 let uri_str = format!("{}/orgs/{org}/labels", configuration.base_path, org=crate::apis::urlencode(p_path_org));
4255 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4256
4257 if let Some(ref param_value) = p_query_page {
4258 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4259 }
4260 if let Some(ref param_value) = p_query_limit {
4261 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4262 }
4263 if let Some(ref apikey) = configuration.api_key {
4264 let key = apikey.key.clone();
4265 let value = match apikey.prefix {
4266 Some(ref prefix) => format!("{} {}", prefix, key),
4267 None => key,
4268 };
4269 req_builder = req_builder.query(&[("access_token", value)]);
4270 }
4271 if let Some(ref apikey) = configuration.api_key {
4272 let key = apikey.key.clone();
4273 let value = match apikey.prefix {
4274 Some(ref prefix) => format!("{} {}", prefix, key),
4275 None => key,
4276 };
4277 req_builder = req_builder.query(&[("sudo", value)]);
4278 }
4279 if let Some(ref apikey) = configuration.api_key {
4280 let key = apikey.key.clone();
4281 let value = match apikey.prefix {
4282 Some(ref prefix) => format!("{} {}", prefix, key),
4283 None => key,
4284 };
4285 req_builder = req_builder.query(&[("token", value)]);
4286 }
4287 if let Some(ref user_agent) = configuration.user_agent {
4288 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4289 }
4290 if let Some(ref apikey) = configuration.api_key {
4291 let key = apikey.key.clone();
4292 let value = match apikey.prefix {
4293 Some(ref prefix) => format!("{} {}", prefix, key),
4294 None => key,
4295 };
4296 req_builder = req_builder.header("X-GITEA-OTP", value);
4297 };
4298 if let Some(ref apikey) = configuration.api_key {
4299 let key = apikey.key.clone();
4300 let value = match apikey.prefix {
4301 Some(ref prefix) => format!("{} {}", prefix, key),
4302 None => key,
4303 };
4304 req_builder = req_builder.header("Authorization", value);
4305 };
4306 if let Some(ref apikey) = configuration.api_key {
4307 let key = apikey.key.clone();
4308 let value = match apikey.prefix {
4309 Some(ref prefix) => format!("{} {}", prefix, key),
4310 None => key,
4311 };
4312 req_builder = req_builder.header("Sudo", value);
4313 };
4314 if let Some(ref auth_conf) = configuration.basic_auth {
4315 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4316 };
4317
4318 let req = req_builder.build()?;
4319 let resp = configuration.client.execute(req).await?;
4320
4321 let status = resp.status();
4322 let content_type = resp
4323 .headers()
4324 .get("content-type")
4325 .and_then(|v| v.to_str().ok())
4326 .unwrap_or("application/octet-stream");
4327 let content_type = super::ContentType::from(content_type);
4328
4329 if !status.is_client_error() && !status.is_server_error() {
4330 let content = resp.text().await?;
4331 match content_type {
4332 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4333 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))),
4334 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<models::Label>`")))),
4335 }
4336 } else {
4337 let content = resp.text().await?;
4338 let entity: Option<OrgListLabelsError> = serde_json::from_str(&content).ok();
4339 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4340 }
4341}
4342
4343pub async fn org_list_members(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<OrgListMembersError>> {
4344 let p_path_org = org;
4346 let p_query_page = page;
4347 let p_query_limit = limit;
4348
4349 let uri_str = format!("{}/orgs/{org}/members", configuration.base_path, org=crate::apis::urlencode(p_path_org));
4350 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4351
4352 if let Some(ref param_value) = p_query_page {
4353 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4354 }
4355 if let Some(ref param_value) = p_query_limit {
4356 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4357 }
4358 if let Some(ref apikey) = configuration.api_key {
4359 let key = apikey.key.clone();
4360 let value = match apikey.prefix {
4361 Some(ref prefix) => format!("{} {}", prefix, key),
4362 None => key,
4363 };
4364 req_builder = req_builder.query(&[("access_token", value)]);
4365 }
4366 if let Some(ref apikey) = configuration.api_key {
4367 let key = apikey.key.clone();
4368 let value = match apikey.prefix {
4369 Some(ref prefix) => format!("{} {}", prefix, key),
4370 None => key,
4371 };
4372 req_builder = req_builder.query(&[("sudo", value)]);
4373 }
4374 if let Some(ref apikey) = configuration.api_key {
4375 let key = apikey.key.clone();
4376 let value = match apikey.prefix {
4377 Some(ref prefix) => format!("{} {}", prefix, key),
4378 None => key,
4379 };
4380 req_builder = req_builder.query(&[("token", value)]);
4381 }
4382 if let Some(ref user_agent) = configuration.user_agent {
4383 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4384 }
4385 if let Some(ref apikey) = configuration.api_key {
4386 let key = apikey.key.clone();
4387 let value = match apikey.prefix {
4388 Some(ref prefix) => format!("{} {}", prefix, key),
4389 None => key,
4390 };
4391 req_builder = req_builder.header("X-GITEA-OTP", value);
4392 };
4393 if let Some(ref apikey) = configuration.api_key {
4394 let key = apikey.key.clone();
4395 let value = match apikey.prefix {
4396 Some(ref prefix) => format!("{} {}", prefix, key),
4397 None => key,
4398 };
4399 req_builder = req_builder.header("Authorization", value);
4400 };
4401 if let Some(ref apikey) = configuration.api_key {
4402 let key = apikey.key.clone();
4403 let value = match apikey.prefix {
4404 Some(ref prefix) => format!("{} {}", prefix, key),
4405 None => key,
4406 };
4407 req_builder = req_builder.header("Sudo", value);
4408 };
4409 if let Some(ref auth_conf) = configuration.basic_auth {
4410 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4411 };
4412
4413 let req = req_builder.build()?;
4414 let resp = configuration.client.execute(req).await?;
4415
4416 let status = resp.status();
4417 let content_type = resp
4418 .headers()
4419 .get("content-type")
4420 .and_then(|v| v.to_str().ok())
4421 .unwrap_or("application/octet-stream");
4422 let content_type = super::ContentType::from(content_type);
4423
4424 if !status.is_client_error() && !status.is_server_error() {
4425 let content = resp.text().await?;
4426 match content_type {
4427 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4428 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
4429 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<models::User>`")))),
4430 }
4431 } else {
4432 let content = resp.text().await?;
4433 let entity: Option<OrgListMembersError> = serde_json::from_str(&content).ok();
4434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4435 }
4436}
4437
4438pub async fn org_list_public_members(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<OrgListPublicMembersError>> {
4439 let p_path_org = org;
4441 let p_query_page = page;
4442 let p_query_limit = limit;
4443
4444 let uri_str = format!("{}/orgs/{org}/public_members", configuration.base_path, org=crate::apis::urlencode(p_path_org));
4445 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4446
4447 if let Some(ref param_value) = p_query_page {
4448 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4449 }
4450 if let Some(ref param_value) = p_query_limit {
4451 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4452 }
4453 if let Some(ref apikey) = configuration.api_key {
4454 let key = apikey.key.clone();
4455 let value = match apikey.prefix {
4456 Some(ref prefix) => format!("{} {}", prefix, key),
4457 None => key,
4458 };
4459 req_builder = req_builder.query(&[("access_token", value)]);
4460 }
4461 if let Some(ref apikey) = configuration.api_key {
4462 let key = apikey.key.clone();
4463 let value = match apikey.prefix {
4464 Some(ref prefix) => format!("{} {}", prefix, key),
4465 None => key,
4466 };
4467 req_builder = req_builder.query(&[("sudo", value)]);
4468 }
4469 if let Some(ref apikey) = configuration.api_key {
4470 let key = apikey.key.clone();
4471 let value = match apikey.prefix {
4472 Some(ref prefix) => format!("{} {}", prefix, key),
4473 None => key,
4474 };
4475 req_builder = req_builder.query(&[("token", value)]);
4476 }
4477 if let Some(ref user_agent) = configuration.user_agent {
4478 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4479 }
4480 if let Some(ref apikey) = configuration.api_key {
4481 let key = apikey.key.clone();
4482 let value = match apikey.prefix {
4483 Some(ref prefix) => format!("{} {}", prefix, key),
4484 None => key,
4485 };
4486 req_builder = req_builder.header("X-GITEA-OTP", value);
4487 };
4488 if let Some(ref apikey) = configuration.api_key {
4489 let key = apikey.key.clone();
4490 let value = match apikey.prefix {
4491 Some(ref prefix) => format!("{} {}", prefix, key),
4492 None => key,
4493 };
4494 req_builder = req_builder.header("Authorization", value);
4495 };
4496 if let Some(ref apikey) = configuration.api_key {
4497 let key = apikey.key.clone();
4498 let value = match apikey.prefix {
4499 Some(ref prefix) => format!("{} {}", prefix, key),
4500 None => key,
4501 };
4502 req_builder = req_builder.header("Sudo", value);
4503 };
4504 if let Some(ref auth_conf) = configuration.basic_auth {
4505 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4506 };
4507
4508 let req = req_builder.build()?;
4509 let resp = configuration.client.execute(req).await?;
4510
4511 let status = resp.status();
4512 let content_type = resp
4513 .headers()
4514 .get("content-type")
4515 .and_then(|v| v.to_str().ok())
4516 .unwrap_or("application/octet-stream");
4517 let content_type = super::ContentType::from(content_type);
4518
4519 if !status.is_client_error() && !status.is_server_error() {
4520 let content = resp.text().await?;
4521 match content_type {
4522 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4523 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
4524 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<models::User>`")))),
4525 }
4526 } else {
4527 let content = resp.text().await?;
4528 let entity: Option<OrgListPublicMembersError> = serde_json::from_str(&content).ok();
4529 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4530 }
4531}
4532
4533pub async fn org_list_repos(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Repository>, Error<OrgListReposError>> {
4534 let p_path_org = org;
4536 let p_query_page = page;
4537 let p_query_limit = limit;
4538
4539 let uri_str = format!("{}/orgs/{org}/repos", configuration.base_path, org=crate::apis::urlencode(p_path_org));
4540 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4541
4542 if let Some(ref param_value) = p_query_page {
4543 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4544 }
4545 if let Some(ref param_value) = p_query_limit {
4546 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4547 }
4548 if let Some(ref apikey) = configuration.api_key {
4549 let key = apikey.key.clone();
4550 let value = match apikey.prefix {
4551 Some(ref prefix) => format!("{} {}", prefix, key),
4552 None => key,
4553 };
4554 req_builder = req_builder.query(&[("access_token", value)]);
4555 }
4556 if let Some(ref apikey) = configuration.api_key {
4557 let key = apikey.key.clone();
4558 let value = match apikey.prefix {
4559 Some(ref prefix) => format!("{} {}", prefix, key),
4560 None => key,
4561 };
4562 req_builder = req_builder.query(&[("sudo", value)]);
4563 }
4564 if let Some(ref apikey) = configuration.api_key {
4565 let key = apikey.key.clone();
4566 let value = match apikey.prefix {
4567 Some(ref prefix) => format!("{} {}", prefix, key),
4568 None => key,
4569 };
4570 req_builder = req_builder.query(&[("token", value)]);
4571 }
4572 if let Some(ref user_agent) = configuration.user_agent {
4573 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4574 }
4575 if let Some(ref apikey) = configuration.api_key {
4576 let key = apikey.key.clone();
4577 let value = match apikey.prefix {
4578 Some(ref prefix) => format!("{} {}", prefix, key),
4579 None => key,
4580 };
4581 req_builder = req_builder.header("X-GITEA-OTP", value);
4582 };
4583 if let Some(ref apikey) = configuration.api_key {
4584 let key = apikey.key.clone();
4585 let value = match apikey.prefix {
4586 Some(ref prefix) => format!("{} {}", prefix, key),
4587 None => key,
4588 };
4589 req_builder = req_builder.header("Authorization", value);
4590 };
4591 if let Some(ref apikey) = configuration.api_key {
4592 let key = apikey.key.clone();
4593 let value = match apikey.prefix {
4594 Some(ref prefix) => format!("{} {}", prefix, key),
4595 None => key,
4596 };
4597 req_builder = req_builder.header("Sudo", value);
4598 };
4599 if let Some(ref auth_conf) = configuration.basic_auth {
4600 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4601 };
4602
4603 let req = req_builder.build()?;
4604 let resp = configuration.client.execute(req).await?;
4605
4606 let status = resp.status();
4607 let content_type = resp
4608 .headers()
4609 .get("content-type")
4610 .and_then(|v| v.to_str().ok())
4611 .unwrap_or("application/octet-stream");
4612 let content_type = super::ContentType::from(content_type);
4613
4614 if !status.is_client_error() && !status.is_server_error() {
4615 let content = resp.text().await?;
4616 match content_type {
4617 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4618 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))),
4619 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<models::Repository>`")))),
4620 }
4621 } else {
4622 let content = resp.text().await?;
4623 let entity: Option<OrgListReposError> = serde_json::from_str(&content).ok();
4624 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4625 }
4626}
4627
4628pub async fn org_list_team_activity_feeds(configuration: &configuration::Configuration, id: i64, date: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Activity>, Error<OrgListTeamActivityFeedsError>> {
4629 let p_path_id = id;
4631 let p_query_date = date;
4632 let p_query_page = page;
4633 let p_query_limit = limit;
4634
4635 let uri_str = format!("{}/teams/{id}/activities/feeds", configuration.base_path, id=p_path_id);
4636 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4637
4638 if let Some(ref param_value) = p_query_date {
4639 req_builder = req_builder.query(&[("date", ¶m_value.to_string())]);
4640 }
4641 if let Some(ref param_value) = p_query_page {
4642 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4643 }
4644 if let Some(ref param_value) = p_query_limit {
4645 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4646 }
4647 if let Some(ref apikey) = configuration.api_key {
4648 let key = apikey.key.clone();
4649 let value = match apikey.prefix {
4650 Some(ref prefix) => format!("{} {}", prefix, key),
4651 None => key,
4652 };
4653 req_builder = req_builder.query(&[("access_token", value)]);
4654 }
4655 if let Some(ref apikey) = configuration.api_key {
4656 let key = apikey.key.clone();
4657 let value = match apikey.prefix {
4658 Some(ref prefix) => format!("{} {}", prefix, key),
4659 None => key,
4660 };
4661 req_builder = req_builder.query(&[("sudo", value)]);
4662 }
4663 if let Some(ref apikey) = configuration.api_key {
4664 let key = apikey.key.clone();
4665 let value = match apikey.prefix {
4666 Some(ref prefix) => format!("{} {}", prefix, key),
4667 None => key,
4668 };
4669 req_builder = req_builder.query(&[("token", value)]);
4670 }
4671 if let Some(ref user_agent) = configuration.user_agent {
4672 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4673 }
4674 if let Some(ref apikey) = configuration.api_key {
4675 let key = apikey.key.clone();
4676 let value = match apikey.prefix {
4677 Some(ref prefix) => format!("{} {}", prefix, key),
4678 None => key,
4679 };
4680 req_builder = req_builder.header("X-GITEA-OTP", value);
4681 };
4682 if let Some(ref apikey) = configuration.api_key {
4683 let key = apikey.key.clone();
4684 let value = match apikey.prefix {
4685 Some(ref prefix) => format!("{} {}", prefix, key),
4686 None => key,
4687 };
4688 req_builder = req_builder.header("Authorization", value);
4689 };
4690 if let Some(ref apikey) = configuration.api_key {
4691 let key = apikey.key.clone();
4692 let value = match apikey.prefix {
4693 Some(ref prefix) => format!("{} {}", prefix, key),
4694 None => key,
4695 };
4696 req_builder = req_builder.header("Sudo", value);
4697 };
4698 if let Some(ref auth_conf) = configuration.basic_auth {
4699 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4700 };
4701
4702 let req = req_builder.build()?;
4703 let resp = configuration.client.execute(req).await?;
4704
4705 let status = resp.status();
4706 let content_type = resp
4707 .headers()
4708 .get("content-type")
4709 .and_then(|v| v.to_str().ok())
4710 .unwrap_or("application/octet-stream");
4711 let content_type = super::ContentType::from(content_type);
4712
4713 if !status.is_client_error() && !status.is_server_error() {
4714 let content = resp.text().await?;
4715 match content_type {
4716 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4717 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Activity>`"))),
4718 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<models::Activity>`")))),
4719 }
4720 } else {
4721 let content = resp.text().await?;
4722 let entity: Option<OrgListTeamActivityFeedsError> = serde_json::from_str(&content).ok();
4723 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4724 }
4725}
4726
4727pub async fn org_list_team_member(configuration: &configuration::Configuration, id: i64, username: &str) -> Result<models::User, Error<OrgListTeamMemberError>> {
4728 let p_path_id = id;
4730 let p_path_username = username;
4731
4732 let uri_str = format!("{}/teams/{id}/members/{username}", configuration.base_path, id=p_path_id, username=crate::apis::urlencode(p_path_username));
4733 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4734
4735 if let Some(ref apikey) = configuration.api_key {
4736 let key = apikey.key.clone();
4737 let value = match apikey.prefix {
4738 Some(ref prefix) => format!("{} {}", prefix, key),
4739 None => key,
4740 };
4741 req_builder = req_builder.query(&[("access_token", value)]);
4742 }
4743 if let Some(ref apikey) = configuration.api_key {
4744 let key = apikey.key.clone();
4745 let value = match apikey.prefix {
4746 Some(ref prefix) => format!("{} {}", prefix, key),
4747 None => key,
4748 };
4749 req_builder = req_builder.query(&[("sudo", value)]);
4750 }
4751 if let Some(ref apikey) = configuration.api_key {
4752 let key = apikey.key.clone();
4753 let value = match apikey.prefix {
4754 Some(ref prefix) => format!("{} {}", prefix, key),
4755 None => key,
4756 };
4757 req_builder = req_builder.query(&[("token", value)]);
4758 }
4759 if let Some(ref user_agent) = configuration.user_agent {
4760 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4761 }
4762 if let Some(ref apikey) = configuration.api_key {
4763 let key = apikey.key.clone();
4764 let value = match apikey.prefix {
4765 Some(ref prefix) => format!("{} {}", prefix, key),
4766 None => key,
4767 };
4768 req_builder = req_builder.header("X-GITEA-OTP", value);
4769 };
4770 if let Some(ref apikey) = configuration.api_key {
4771 let key = apikey.key.clone();
4772 let value = match apikey.prefix {
4773 Some(ref prefix) => format!("{} {}", prefix, key),
4774 None => key,
4775 };
4776 req_builder = req_builder.header("Authorization", value);
4777 };
4778 if let Some(ref apikey) = configuration.api_key {
4779 let key = apikey.key.clone();
4780 let value = match apikey.prefix {
4781 Some(ref prefix) => format!("{} {}", prefix, key),
4782 None => key,
4783 };
4784 req_builder = req_builder.header("Sudo", value);
4785 };
4786 if let Some(ref auth_conf) = configuration.basic_auth {
4787 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4788 };
4789
4790 let req = req_builder.build()?;
4791 let resp = configuration.client.execute(req).await?;
4792
4793 let status = resp.status();
4794 let content_type = resp
4795 .headers()
4796 .get("content-type")
4797 .and_then(|v| v.to_str().ok())
4798 .unwrap_or("application/octet-stream");
4799 let content_type = super::ContentType::from(content_type);
4800
4801 if !status.is_client_error() && !status.is_server_error() {
4802 let content = resp.text().await?;
4803 match content_type {
4804 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4805 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))),
4806 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`")))),
4807 }
4808 } else {
4809 let content = resp.text().await?;
4810 let entity: Option<OrgListTeamMemberError> = serde_json::from_str(&content).ok();
4811 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4812 }
4813}
4814
4815pub async fn org_list_team_members(configuration: &configuration::Configuration, id: i64, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<OrgListTeamMembersError>> {
4816 let p_path_id = id;
4818 let p_query_page = page;
4819 let p_query_limit = limit;
4820
4821 let uri_str = format!("{}/teams/{id}/members", configuration.base_path, id=p_path_id);
4822 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4823
4824 if let Some(ref param_value) = p_query_page {
4825 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4826 }
4827 if let Some(ref param_value) = p_query_limit {
4828 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4829 }
4830 if let Some(ref apikey) = configuration.api_key {
4831 let key = apikey.key.clone();
4832 let value = match apikey.prefix {
4833 Some(ref prefix) => format!("{} {}", prefix, key),
4834 None => key,
4835 };
4836 req_builder = req_builder.query(&[("access_token", value)]);
4837 }
4838 if let Some(ref apikey) = configuration.api_key {
4839 let key = apikey.key.clone();
4840 let value = match apikey.prefix {
4841 Some(ref prefix) => format!("{} {}", prefix, key),
4842 None => key,
4843 };
4844 req_builder = req_builder.query(&[("sudo", value)]);
4845 }
4846 if let Some(ref apikey) = configuration.api_key {
4847 let key = apikey.key.clone();
4848 let value = match apikey.prefix {
4849 Some(ref prefix) => format!("{} {}", prefix, key),
4850 None => key,
4851 };
4852 req_builder = req_builder.query(&[("token", value)]);
4853 }
4854 if let Some(ref user_agent) = configuration.user_agent {
4855 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4856 }
4857 if let Some(ref apikey) = configuration.api_key {
4858 let key = apikey.key.clone();
4859 let value = match apikey.prefix {
4860 Some(ref prefix) => format!("{} {}", prefix, key),
4861 None => key,
4862 };
4863 req_builder = req_builder.header("X-GITEA-OTP", value);
4864 };
4865 if let Some(ref apikey) = configuration.api_key {
4866 let key = apikey.key.clone();
4867 let value = match apikey.prefix {
4868 Some(ref prefix) => format!("{} {}", prefix, key),
4869 None => key,
4870 };
4871 req_builder = req_builder.header("Authorization", value);
4872 };
4873 if let Some(ref apikey) = configuration.api_key {
4874 let key = apikey.key.clone();
4875 let value = match apikey.prefix {
4876 Some(ref prefix) => format!("{} {}", prefix, key),
4877 None => key,
4878 };
4879 req_builder = req_builder.header("Sudo", value);
4880 };
4881 if let Some(ref auth_conf) = configuration.basic_auth {
4882 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4883 };
4884
4885 let req = req_builder.build()?;
4886 let resp = configuration.client.execute(req).await?;
4887
4888 let status = resp.status();
4889 let content_type = resp
4890 .headers()
4891 .get("content-type")
4892 .and_then(|v| v.to_str().ok())
4893 .unwrap_or("application/octet-stream");
4894 let content_type = super::ContentType::from(content_type);
4895
4896 if !status.is_client_error() && !status.is_server_error() {
4897 let content = resp.text().await?;
4898 match content_type {
4899 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4900 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
4901 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<models::User>`")))),
4902 }
4903 } else {
4904 let content = resp.text().await?;
4905 let entity: Option<OrgListTeamMembersError> = serde_json::from_str(&content).ok();
4906 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4907 }
4908}
4909
4910pub async fn org_list_team_repo(configuration: &configuration::Configuration, id: i64, org: &str, repo: &str) -> Result<models::Repository, Error<OrgListTeamRepoError>> {
4911 let p_path_id = id;
4913 let p_path_org = org;
4914 let p_path_repo = repo;
4915
4916 let uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", configuration.base_path, id=p_path_id, org=crate::apis::urlencode(p_path_org), repo=crate::apis::urlencode(p_path_repo));
4917 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4918
4919 if let Some(ref apikey) = configuration.api_key {
4920 let key = apikey.key.clone();
4921 let value = match apikey.prefix {
4922 Some(ref prefix) => format!("{} {}", prefix, key),
4923 None => key,
4924 };
4925 req_builder = req_builder.query(&[("access_token", value)]);
4926 }
4927 if let Some(ref apikey) = configuration.api_key {
4928 let key = apikey.key.clone();
4929 let value = match apikey.prefix {
4930 Some(ref prefix) => format!("{} {}", prefix, key),
4931 None => key,
4932 };
4933 req_builder = req_builder.query(&[("sudo", value)]);
4934 }
4935 if let Some(ref apikey) = configuration.api_key {
4936 let key = apikey.key.clone();
4937 let value = match apikey.prefix {
4938 Some(ref prefix) => format!("{} {}", prefix, key),
4939 None => key,
4940 };
4941 req_builder = req_builder.query(&[("token", value)]);
4942 }
4943 if let Some(ref user_agent) = configuration.user_agent {
4944 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4945 }
4946 if let Some(ref apikey) = configuration.api_key {
4947 let key = apikey.key.clone();
4948 let value = match apikey.prefix {
4949 Some(ref prefix) => format!("{} {}", prefix, key),
4950 None => key,
4951 };
4952 req_builder = req_builder.header("X-GITEA-OTP", value);
4953 };
4954 if let Some(ref apikey) = configuration.api_key {
4955 let key = apikey.key.clone();
4956 let value = match apikey.prefix {
4957 Some(ref prefix) => format!("{} {}", prefix, key),
4958 None => key,
4959 };
4960 req_builder = req_builder.header("Authorization", value);
4961 };
4962 if let Some(ref apikey) = configuration.api_key {
4963 let key = apikey.key.clone();
4964 let value = match apikey.prefix {
4965 Some(ref prefix) => format!("{} {}", prefix, key),
4966 None => key,
4967 };
4968 req_builder = req_builder.header("Sudo", value);
4969 };
4970 if let Some(ref auth_conf) = configuration.basic_auth {
4971 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4972 };
4973
4974 let req = req_builder.build()?;
4975 let resp = configuration.client.execute(req).await?;
4976
4977 let status = resp.status();
4978 let content_type = resp
4979 .headers()
4980 .get("content-type")
4981 .and_then(|v| v.to_str().ok())
4982 .unwrap_or("application/octet-stream");
4983 let content_type = super::ContentType::from(content_type);
4984
4985 if !status.is_client_error() && !status.is_server_error() {
4986 let content = resp.text().await?;
4987 match content_type {
4988 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4989 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
4990 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`")))),
4991 }
4992 } else {
4993 let content = resp.text().await?;
4994 let entity: Option<OrgListTeamRepoError> = serde_json::from_str(&content).ok();
4995 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4996 }
4997}
4998
4999pub async fn org_list_team_repos(configuration: &configuration::Configuration, id: i64, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Repository>, Error<OrgListTeamReposError>> {
5000 let p_path_id = id;
5002 let p_query_page = page;
5003 let p_query_limit = limit;
5004
5005 let uri_str = format!("{}/teams/{id}/repos", configuration.base_path, id=p_path_id);
5006 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5007
5008 if let Some(ref param_value) = p_query_page {
5009 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
5010 }
5011 if let Some(ref param_value) = p_query_limit {
5012 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
5013 }
5014 if let Some(ref apikey) = configuration.api_key {
5015 let key = apikey.key.clone();
5016 let value = match apikey.prefix {
5017 Some(ref prefix) => format!("{} {}", prefix, key),
5018 None => key,
5019 };
5020 req_builder = req_builder.query(&[("access_token", value)]);
5021 }
5022 if let Some(ref apikey) = configuration.api_key {
5023 let key = apikey.key.clone();
5024 let value = match apikey.prefix {
5025 Some(ref prefix) => format!("{} {}", prefix, key),
5026 None => key,
5027 };
5028 req_builder = req_builder.query(&[("sudo", value)]);
5029 }
5030 if let Some(ref apikey) = configuration.api_key {
5031 let key = apikey.key.clone();
5032 let value = match apikey.prefix {
5033 Some(ref prefix) => format!("{} {}", prefix, key),
5034 None => key,
5035 };
5036 req_builder = req_builder.query(&[("token", value)]);
5037 }
5038 if let Some(ref user_agent) = configuration.user_agent {
5039 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5040 }
5041 if let Some(ref apikey) = configuration.api_key {
5042 let key = apikey.key.clone();
5043 let value = match apikey.prefix {
5044 Some(ref prefix) => format!("{} {}", prefix, key),
5045 None => key,
5046 };
5047 req_builder = req_builder.header("X-GITEA-OTP", value);
5048 };
5049 if let Some(ref apikey) = configuration.api_key {
5050 let key = apikey.key.clone();
5051 let value = match apikey.prefix {
5052 Some(ref prefix) => format!("{} {}", prefix, key),
5053 None => key,
5054 };
5055 req_builder = req_builder.header("Authorization", value);
5056 };
5057 if let Some(ref apikey) = configuration.api_key {
5058 let key = apikey.key.clone();
5059 let value = match apikey.prefix {
5060 Some(ref prefix) => format!("{} {}", prefix, key),
5061 None => key,
5062 };
5063 req_builder = req_builder.header("Sudo", value);
5064 };
5065 if let Some(ref auth_conf) = configuration.basic_auth {
5066 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5067 };
5068
5069 let req = req_builder.build()?;
5070 let resp = configuration.client.execute(req).await?;
5071
5072 let status = resp.status();
5073 let content_type = resp
5074 .headers()
5075 .get("content-type")
5076 .and_then(|v| v.to_str().ok())
5077 .unwrap_or("application/octet-stream");
5078 let content_type = super::ContentType::from(content_type);
5079
5080 if !status.is_client_error() && !status.is_server_error() {
5081 let content = resp.text().await?;
5082 match content_type {
5083 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5084 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))),
5085 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<models::Repository>`")))),
5086 }
5087 } else {
5088 let content = resp.text().await?;
5089 let entity: Option<OrgListTeamReposError> = serde_json::from_str(&content).ok();
5090 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5091 }
5092}
5093
5094pub async fn org_list_teams(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Team>, Error<OrgListTeamsError>> {
5095 let p_path_org = org;
5097 let p_query_page = page;
5098 let p_query_limit = limit;
5099
5100 let uri_str = format!("{}/orgs/{org}/teams", configuration.base_path, org=crate::apis::urlencode(p_path_org));
5101 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5102
5103 if let Some(ref param_value) = p_query_page {
5104 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
5105 }
5106 if let Some(ref param_value) = p_query_limit {
5107 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
5108 }
5109 if let Some(ref apikey) = configuration.api_key {
5110 let key = apikey.key.clone();
5111 let value = match apikey.prefix {
5112 Some(ref prefix) => format!("{} {}", prefix, key),
5113 None => key,
5114 };
5115 req_builder = req_builder.query(&[("access_token", value)]);
5116 }
5117 if let Some(ref apikey) = configuration.api_key {
5118 let key = apikey.key.clone();
5119 let value = match apikey.prefix {
5120 Some(ref prefix) => format!("{} {}", prefix, key),
5121 None => key,
5122 };
5123 req_builder = req_builder.query(&[("sudo", value)]);
5124 }
5125 if let Some(ref apikey) = configuration.api_key {
5126 let key = apikey.key.clone();
5127 let value = match apikey.prefix {
5128 Some(ref prefix) => format!("{} {}", prefix, key),
5129 None => key,
5130 };
5131 req_builder = req_builder.query(&[("token", value)]);
5132 }
5133 if let Some(ref user_agent) = configuration.user_agent {
5134 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5135 }
5136 if let Some(ref apikey) = configuration.api_key {
5137 let key = apikey.key.clone();
5138 let value = match apikey.prefix {
5139 Some(ref prefix) => format!("{} {}", prefix, key),
5140 None => key,
5141 };
5142 req_builder = req_builder.header("X-GITEA-OTP", value);
5143 };
5144 if let Some(ref apikey) = configuration.api_key {
5145 let key = apikey.key.clone();
5146 let value = match apikey.prefix {
5147 Some(ref prefix) => format!("{} {}", prefix, key),
5148 None => key,
5149 };
5150 req_builder = req_builder.header("Authorization", value);
5151 };
5152 if let Some(ref apikey) = configuration.api_key {
5153 let key = apikey.key.clone();
5154 let value = match apikey.prefix {
5155 Some(ref prefix) => format!("{} {}", prefix, key),
5156 None => key,
5157 };
5158 req_builder = req_builder.header("Sudo", value);
5159 };
5160 if let Some(ref auth_conf) = configuration.basic_auth {
5161 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5162 };
5163
5164 let req = req_builder.build()?;
5165 let resp = configuration.client.execute(req).await?;
5166
5167 let status = resp.status();
5168 let content_type = resp
5169 .headers()
5170 .get("content-type")
5171 .and_then(|v| v.to_str().ok())
5172 .unwrap_or("application/octet-stream");
5173 let content_type = super::ContentType::from(content_type);
5174
5175 if !status.is_client_error() && !status.is_server_error() {
5176 let content = resp.text().await?;
5177 match content_type {
5178 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5179 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Team>`"))),
5180 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<models::Team>`")))),
5181 }
5182 } else {
5183 let content = resp.text().await?;
5184 let entity: Option<OrgListTeamsError> = serde_json::from_str(&content).ok();
5185 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5186 }
5187}
5188
5189pub async fn org_list_user_orgs(configuration: &configuration::Configuration, username: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Organization>, Error<OrgListUserOrgsError>> {
5190 let p_path_username = username;
5192 let p_query_page = page;
5193 let p_query_limit = limit;
5194
5195 let uri_str = format!("{}/users/{username}/orgs", configuration.base_path, username=crate::apis::urlencode(p_path_username));
5196 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5197
5198 if let Some(ref param_value) = p_query_page {
5199 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
5200 }
5201 if let Some(ref param_value) = p_query_limit {
5202 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
5203 }
5204 if let Some(ref apikey) = configuration.api_key {
5205 let key = apikey.key.clone();
5206 let value = match apikey.prefix {
5207 Some(ref prefix) => format!("{} {}", prefix, key),
5208 None => key,
5209 };
5210 req_builder = req_builder.query(&[("access_token", value)]);
5211 }
5212 if let Some(ref apikey) = configuration.api_key {
5213 let key = apikey.key.clone();
5214 let value = match apikey.prefix {
5215 Some(ref prefix) => format!("{} {}", prefix, key),
5216 None => key,
5217 };
5218 req_builder = req_builder.query(&[("sudo", value)]);
5219 }
5220 if let Some(ref apikey) = configuration.api_key {
5221 let key = apikey.key.clone();
5222 let value = match apikey.prefix {
5223 Some(ref prefix) => format!("{} {}", prefix, key),
5224 None => key,
5225 };
5226 req_builder = req_builder.query(&[("token", value)]);
5227 }
5228 if let Some(ref user_agent) = configuration.user_agent {
5229 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5230 }
5231 if let Some(ref apikey) = configuration.api_key {
5232 let key = apikey.key.clone();
5233 let value = match apikey.prefix {
5234 Some(ref prefix) => format!("{} {}", prefix, key),
5235 None => key,
5236 };
5237 req_builder = req_builder.header("X-GITEA-OTP", value);
5238 };
5239 if let Some(ref apikey) = configuration.api_key {
5240 let key = apikey.key.clone();
5241 let value = match apikey.prefix {
5242 Some(ref prefix) => format!("{} {}", prefix, key),
5243 None => key,
5244 };
5245 req_builder = req_builder.header("Authorization", value);
5246 };
5247 if let Some(ref apikey) = configuration.api_key {
5248 let key = apikey.key.clone();
5249 let value = match apikey.prefix {
5250 Some(ref prefix) => format!("{} {}", prefix, key),
5251 None => key,
5252 };
5253 req_builder = req_builder.header("Sudo", value);
5254 };
5255 if let Some(ref auth_conf) = configuration.basic_auth {
5256 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5257 };
5258
5259 let req = req_builder.build()?;
5260 let resp = configuration.client.execute(req).await?;
5261
5262 let status = resp.status();
5263 let content_type = resp
5264 .headers()
5265 .get("content-type")
5266 .and_then(|v| v.to_str().ok())
5267 .unwrap_or("application/octet-stream");
5268 let content_type = super::ContentType::from(content_type);
5269
5270 if !status.is_client_error() && !status.is_server_error() {
5271 let content = resp.text().await?;
5272 match content_type {
5273 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5274 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Organization>`"))),
5275 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<models::Organization>`")))),
5276 }
5277 } else {
5278 let content = resp.text().await?;
5279 let entity: Option<OrgListUserOrgsError> = serde_json::from_str(&content).ok();
5280 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5281 }
5282}
5283
5284pub async fn org_publicize_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error<OrgPublicizeMemberError>> {
5285 let p_path_org = org;
5287 let p_path_username = username;
5288
5289 let uri_str = format!("{}/orgs/{org}/public_members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
5290 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5291
5292 if let Some(ref apikey) = configuration.api_key {
5293 let key = apikey.key.clone();
5294 let value = match apikey.prefix {
5295 Some(ref prefix) => format!("{} {}", prefix, key),
5296 None => key,
5297 };
5298 req_builder = req_builder.query(&[("access_token", value)]);
5299 }
5300 if let Some(ref apikey) = configuration.api_key {
5301 let key = apikey.key.clone();
5302 let value = match apikey.prefix {
5303 Some(ref prefix) => format!("{} {}", prefix, key),
5304 None => key,
5305 };
5306 req_builder = req_builder.query(&[("sudo", value)]);
5307 }
5308 if let Some(ref apikey) = configuration.api_key {
5309 let key = apikey.key.clone();
5310 let value = match apikey.prefix {
5311 Some(ref prefix) => format!("{} {}", prefix, key),
5312 None => key,
5313 };
5314 req_builder = req_builder.query(&[("token", value)]);
5315 }
5316 if let Some(ref user_agent) = configuration.user_agent {
5317 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5318 }
5319 if let Some(ref apikey) = configuration.api_key {
5320 let key = apikey.key.clone();
5321 let value = match apikey.prefix {
5322 Some(ref prefix) => format!("{} {}", prefix, key),
5323 None => key,
5324 };
5325 req_builder = req_builder.header("X-GITEA-OTP", value);
5326 };
5327 if let Some(ref apikey) = configuration.api_key {
5328 let key = apikey.key.clone();
5329 let value = match apikey.prefix {
5330 Some(ref prefix) => format!("{} {}", prefix, key),
5331 None => key,
5332 };
5333 req_builder = req_builder.header("Authorization", value);
5334 };
5335 if let Some(ref apikey) = configuration.api_key {
5336 let key = apikey.key.clone();
5337 let value = match apikey.prefix {
5338 Some(ref prefix) => format!("{} {}", prefix, key),
5339 None => key,
5340 };
5341 req_builder = req_builder.header("Sudo", value);
5342 };
5343 if let Some(ref auth_conf) = configuration.basic_auth {
5344 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5345 };
5346
5347 let req = req_builder.build()?;
5348 let resp = configuration.client.execute(req).await?;
5349
5350 let status = resp.status();
5351
5352 if !status.is_client_error() && !status.is_server_error() {
5353 Ok(())
5354 } else {
5355 let content = resp.text().await?;
5356 let entity: Option<OrgPublicizeMemberError> = serde_json::from_str(&content).ok();
5357 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5358 }
5359}
5360
5361pub async fn org_remove_team_member(configuration: &configuration::Configuration, id: i64, username: &str) -> Result<(), Error<OrgRemoveTeamMemberError>> {
5362 let p_path_id = id;
5364 let p_path_username = username;
5365
5366 let uri_str = format!("{}/teams/{id}/members/{username}", configuration.base_path, id=p_path_id, username=crate::apis::urlencode(p_path_username));
5367 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5368
5369 if let Some(ref apikey) = configuration.api_key {
5370 let key = apikey.key.clone();
5371 let value = match apikey.prefix {
5372 Some(ref prefix) => format!("{} {}", prefix, key),
5373 None => key,
5374 };
5375 req_builder = req_builder.query(&[("access_token", value)]);
5376 }
5377 if let Some(ref apikey) = configuration.api_key {
5378 let key = apikey.key.clone();
5379 let value = match apikey.prefix {
5380 Some(ref prefix) => format!("{} {}", prefix, key),
5381 None => key,
5382 };
5383 req_builder = req_builder.query(&[("sudo", value)]);
5384 }
5385 if let Some(ref apikey) = configuration.api_key {
5386 let key = apikey.key.clone();
5387 let value = match apikey.prefix {
5388 Some(ref prefix) => format!("{} {}", prefix, key),
5389 None => key,
5390 };
5391 req_builder = req_builder.query(&[("token", value)]);
5392 }
5393 if let Some(ref user_agent) = configuration.user_agent {
5394 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5395 }
5396 if let Some(ref apikey) = configuration.api_key {
5397 let key = apikey.key.clone();
5398 let value = match apikey.prefix {
5399 Some(ref prefix) => format!("{} {}", prefix, key),
5400 None => key,
5401 };
5402 req_builder = req_builder.header("X-GITEA-OTP", value);
5403 };
5404 if let Some(ref apikey) = configuration.api_key {
5405 let key = apikey.key.clone();
5406 let value = match apikey.prefix {
5407 Some(ref prefix) => format!("{} {}", prefix, key),
5408 None => key,
5409 };
5410 req_builder = req_builder.header("Authorization", value);
5411 };
5412 if let Some(ref apikey) = configuration.api_key {
5413 let key = apikey.key.clone();
5414 let value = match apikey.prefix {
5415 Some(ref prefix) => format!("{} {}", prefix, key),
5416 None => key,
5417 };
5418 req_builder = req_builder.header("Sudo", value);
5419 };
5420 if let Some(ref auth_conf) = configuration.basic_auth {
5421 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5422 };
5423
5424 let req = req_builder.build()?;
5425 let resp = configuration.client.execute(req).await?;
5426
5427 let status = resp.status();
5428
5429 if !status.is_client_error() && !status.is_server_error() {
5430 Ok(())
5431 } else {
5432 let content = resp.text().await?;
5433 let entity: Option<OrgRemoveTeamMemberError> = serde_json::from_str(&content).ok();
5434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5435 }
5436}
5437
5438pub async fn org_remove_team_repository(configuration: &configuration::Configuration, id: i64, org: &str, repo: &str) -> Result<(), Error<OrgRemoveTeamRepositoryError>> {
5440 let p_path_id = id;
5442 let p_path_org = org;
5443 let p_path_repo = repo;
5444
5445 let uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", configuration.base_path, id=p_path_id, org=crate::apis::urlencode(p_path_org), repo=crate::apis::urlencode(p_path_repo));
5446 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5447
5448 if let Some(ref apikey) = configuration.api_key {
5449 let key = apikey.key.clone();
5450 let value = match apikey.prefix {
5451 Some(ref prefix) => format!("{} {}", prefix, key),
5452 None => key,
5453 };
5454 req_builder = req_builder.query(&[("access_token", value)]);
5455 }
5456 if let Some(ref apikey) = configuration.api_key {
5457 let key = apikey.key.clone();
5458 let value = match apikey.prefix {
5459 Some(ref prefix) => format!("{} {}", prefix, key),
5460 None => key,
5461 };
5462 req_builder = req_builder.query(&[("sudo", value)]);
5463 }
5464 if let Some(ref apikey) = configuration.api_key {
5465 let key = apikey.key.clone();
5466 let value = match apikey.prefix {
5467 Some(ref prefix) => format!("{} {}", prefix, key),
5468 None => key,
5469 };
5470 req_builder = req_builder.query(&[("token", value)]);
5471 }
5472 if let Some(ref user_agent) = configuration.user_agent {
5473 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5474 }
5475 if let Some(ref apikey) = configuration.api_key {
5476 let key = apikey.key.clone();
5477 let value = match apikey.prefix {
5478 Some(ref prefix) => format!("{} {}", prefix, key),
5479 None => key,
5480 };
5481 req_builder = req_builder.header("X-GITEA-OTP", value);
5482 };
5483 if let Some(ref apikey) = configuration.api_key {
5484 let key = apikey.key.clone();
5485 let value = match apikey.prefix {
5486 Some(ref prefix) => format!("{} {}", prefix, key),
5487 None => key,
5488 };
5489 req_builder = req_builder.header("Authorization", value);
5490 };
5491 if let Some(ref apikey) = configuration.api_key {
5492 let key = apikey.key.clone();
5493 let value = match apikey.prefix {
5494 Some(ref prefix) => format!("{} {}", prefix, key),
5495 None => key,
5496 };
5497 req_builder = req_builder.header("Sudo", value);
5498 };
5499 if let Some(ref auth_conf) = configuration.basic_auth {
5500 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5501 };
5502
5503 let req = req_builder.build()?;
5504 let resp = configuration.client.execute(req).await?;
5505
5506 let status = resp.status();
5507
5508 if !status.is_client_error() && !status.is_server_error() {
5509 Ok(())
5510 } else {
5511 let content = resp.text().await?;
5512 let entity: Option<OrgRemoveTeamRepositoryError> = serde_json::from_str(&content).ok();
5513 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5514 }
5515}
5516
5517pub async fn org_update_avatar(configuration: &configuration::Configuration, org: &str, body: Option<models::UpdateUserAvatarOption>) -> Result<(), Error<OrgUpdateAvatarError>> {
5518 let p_path_org = org;
5520 let p_body_body = body;
5521
5522 let uri_str = format!("{}/orgs/{org}/avatar", configuration.base_path, org=crate::apis::urlencode(p_path_org));
5523 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5524
5525 if let Some(ref apikey) = configuration.api_key {
5526 let key = apikey.key.clone();
5527 let value = match apikey.prefix {
5528 Some(ref prefix) => format!("{} {}", prefix, key),
5529 None => key,
5530 };
5531 req_builder = req_builder.query(&[("access_token", value)]);
5532 }
5533 if let Some(ref apikey) = configuration.api_key {
5534 let key = apikey.key.clone();
5535 let value = match apikey.prefix {
5536 Some(ref prefix) => format!("{} {}", prefix, key),
5537 None => key,
5538 };
5539 req_builder = req_builder.query(&[("sudo", value)]);
5540 }
5541 if let Some(ref apikey) = configuration.api_key {
5542 let key = apikey.key.clone();
5543 let value = match apikey.prefix {
5544 Some(ref prefix) => format!("{} {}", prefix, key),
5545 None => key,
5546 };
5547 req_builder = req_builder.query(&[("token", value)]);
5548 }
5549 if let Some(ref user_agent) = configuration.user_agent {
5550 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5551 }
5552 if let Some(ref apikey) = configuration.api_key {
5553 let key = apikey.key.clone();
5554 let value = match apikey.prefix {
5555 Some(ref prefix) => format!("{} {}", prefix, key),
5556 None => key,
5557 };
5558 req_builder = req_builder.header("X-GITEA-OTP", value);
5559 };
5560 if let Some(ref apikey) = configuration.api_key {
5561 let key = apikey.key.clone();
5562 let value = match apikey.prefix {
5563 Some(ref prefix) => format!("{} {}", prefix, key),
5564 None => key,
5565 };
5566 req_builder = req_builder.header("Authorization", value);
5567 };
5568 if let Some(ref apikey) = configuration.api_key {
5569 let key = apikey.key.clone();
5570 let value = match apikey.prefix {
5571 Some(ref prefix) => format!("{} {}", prefix, key),
5572 None => key,
5573 };
5574 req_builder = req_builder.header("Sudo", value);
5575 };
5576 if let Some(ref auth_conf) = configuration.basic_auth {
5577 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5578 };
5579 req_builder = req_builder.json(&p_body_body);
5580
5581 let req = req_builder.build()?;
5582 let resp = configuration.client.execute(req).await?;
5583
5584 let status = resp.status();
5585
5586 if !status.is_client_error() && !status.is_server_error() {
5587 Ok(())
5588 } else {
5589 let content = resp.text().await?;
5590 let entity: Option<OrgUpdateAvatarError> = serde_json::from_str(&content).ok();
5591 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5592 }
5593}
5594
5595pub async fn organization_block_user(configuration: &configuration::Configuration, org: &str, username: &str, note: Option<&str>) -> Result<(), Error<OrganizationBlockUserError>> {
5596 let p_path_org = org;
5598 let p_path_username = username;
5599 let p_query_note = note;
5600
5601 let uri_str = format!("{}/orgs/{org}/blocks/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
5602 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5603
5604 if let Some(ref param_value) = p_query_note {
5605 req_builder = req_builder.query(&[("note", ¶m_value.to_string())]);
5606 }
5607 if let Some(ref apikey) = configuration.api_key {
5608 let key = apikey.key.clone();
5609 let value = match apikey.prefix {
5610 Some(ref prefix) => format!("{} {}", prefix, key),
5611 None => key,
5612 };
5613 req_builder = req_builder.query(&[("access_token", value)]);
5614 }
5615 if let Some(ref apikey) = configuration.api_key {
5616 let key = apikey.key.clone();
5617 let value = match apikey.prefix {
5618 Some(ref prefix) => format!("{} {}", prefix, key),
5619 None => key,
5620 };
5621 req_builder = req_builder.query(&[("sudo", value)]);
5622 }
5623 if let Some(ref apikey) = configuration.api_key {
5624 let key = apikey.key.clone();
5625 let value = match apikey.prefix {
5626 Some(ref prefix) => format!("{} {}", prefix, key),
5627 None => key,
5628 };
5629 req_builder = req_builder.query(&[("token", value)]);
5630 }
5631 if let Some(ref user_agent) = configuration.user_agent {
5632 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5633 }
5634 if let Some(ref apikey) = configuration.api_key {
5635 let key = apikey.key.clone();
5636 let value = match apikey.prefix {
5637 Some(ref prefix) => format!("{} {}", prefix, key),
5638 None => key,
5639 };
5640 req_builder = req_builder.header("X-GITEA-OTP", value);
5641 };
5642 if let Some(ref apikey) = configuration.api_key {
5643 let key = apikey.key.clone();
5644 let value = match apikey.prefix {
5645 Some(ref prefix) => format!("{} {}", prefix, key),
5646 None => key,
5647 };
5648 req_builder = req_builder.header("Authorization", value);
5649 };
5650 if let Some(ref apikey) = configuration.api_key {
5651 let key = apikey.key.clone();
5652 let value = match apikey.prefix {
5653 Some(ref prefix) => format!("{} {}", prefix, key),
5654 None => key,
5655 };
5656 req_builder = req_builder.header("Sudo", value);
5657 };
5658 if let Some(ref auth_conf) = configuration.basic_auth {
5659 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5660 };
5661
5662 let req = req_builder.build()?;
5663 let resp = configuration.client.execute(req).await?;
5664
5665 let status = resp.status();
5666
5667 if !status.is_client_error() && !status.is_server_error() {
5668 Ok(())
5669 } else {
5670 let content = resp.text().await?;
5671 let entity: Option<OrganizationBlockUserError> = serde_json::from_str(&content).ok();
5672 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5673 }
5674}
5675
5676pub async fn organization_check_user_block(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error<OrganizationCheckUserBlockError>> {
5677 let p_path_org = org;
5679 let p_path_username = username;
5680
5681 let uri_str = format!("{}/orgs/{org}/blocks/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
5682 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5683
5684 if let Some(ref apikey) = configuration.api_key {
5685 let key = apikey.key.clone();
5686 let value = match apikey.prefix {
5687 Some(ref prefix) => format!("{} {}", prefix, key),
5688 None => key,
5689 };
5690 req_builder = req_builder.query(&[("access_token", value)]);
5691 }
5692 if let Some(ref apikey) = configuration.api_key {
5693 let key = apikey.key.clone();
5694 let value = match apikey.prefix {
5695 Some(ref prefix) => format!("{} {}", prefix, key),
5696 None => key,
5697 };
5698 req_builder = req_builder.query(&[("sudo", value)]);
5699 }
5700 if let Some(ref apikey) = configuration.api_key {
5701 let key = apikey.key.clone();
5702 let value = match apikey.prefix {
5703 Some(ref prefix) => format!("{} {}", prefix, key),
5704 None => key,
5705 };
5706 req_builder = req_builder.query(&[("token", value)]);
5707 }
5708 if let Some(ref user_agent) = configuration.user_agent {
5709 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5710 }
5711 if let Some(ref apikey) = configuration.api_key {
5712 let key = apikey.key.clone();
5713 let value = match apikey.prefix {
5714 Some(ref prefix) => format!("{} {}", prefix, key),
5715 None => key,
5716 };
5717 req_builder = req_builder.header("X-GITEA-OTP", value);
5718 };
5719 if let Some(ref apikey) = configuration.api_key {
5720 let key = apikey.key.clone();
5721 let value = match apikey.prefix {
5722 Some(ref prefix) => format!("{} {}", prefix, key),
5723 None => key,
5724 };
5725 req_builder = req_builder.header("Authorization", value);
5726 };
5727 if let Some(ref apikey) = configuration.api_key {
5728 let key = apikey.key.clone();
5729 let value = match apikey.prefix {
5730 Some(ref prefix) => format!("{} {}", prefix, key),
5731 None => key,
5732 };
5733 req_builder = req_builder.header("Sudo", value);
5734 };
5735 if let Some(ref auth_conf) = configuration.basic_auth {
5736 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5737 };
5738
5739 let req = req_builder.build()?;
5740 let resp = configuration.client.execute(req).await?;
5741
5742 let status = resp.status();
5743
5744 if !status.is_client_error() && !status.is_server_error() {
5745 Ok(())
5746 } else {
5747 let content = resp.text().await?;
5748 let entity: Option<OrganizationCheckUserBlockError> = serde_json::from_str(&content).ok();
5749 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5750 }
5751}
5752
5753pub async fn organization_list_blocks(configuration: &configuration::Configuration, org: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<OrganizationListBlocksError>> {
5754 let p_path_org = org;
5756 let p_query_page = page;
5757 let p_query_limit = limit;
5758
5759 let uri_str = format!("{}/orgs/{org}/blocks", configuration.base_path, org=crate::apis::urlencode(p_path_org));
5760 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5761
5762 if let Some(ref param_value) = p_query_page {
5763 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
5764 }
5765 if let Some(ref param_value) = p_query_limit {
5766 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
5767 }
5768 if let Some(ref apikey) = configuration.api_key {
5769 let key = apikey.key.clone();
5770 let value = match apikey.prefix {
5771 Some(ref prefix) => format!("{} {}", prefix, key),
5772 None => key,
5773 };
5774 req_builder = req_builder.query(&[("access_token", value)]);
5775 }
5776 if let Some(ref apikey) = configuration.api_key {
5777 let key = apikey.key.clone();
5778 let value = match apikey.prefix {
5779 Some(ref prefix) => format!("{} {}", prefix, key),
5780 None => key,
5781 };
5782 req_builder = req_builder.query(&[("sudo", value)]);
5783 }
5784 if let Some(ref apikey) = configuration.api_key {
5785 let key = apikey.key.clone();
5786 let value = match apikey.prefix {
5787 Some(ref prefix) => format!("{} {}", prefix, key),
5788 None => key,
5789 };
5790 req_builder = req_builder.query(&[("token", value)]);
5791 }
5792 if let Some(ref user_agent) = configuration.user_agent {
5793 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5794 }
5795 if let Some(ref apikey) = configuration.api_key {
5796 let key = apikey.key.clone();
5797 let value = match apikey.prefix {
5798 Some(ref prefix) => format!("{} {}", prefix, key),
5799 None => key,
5800 };
5801 req_builder = req_builder.header("X-GITEA-OTP", value);
5802 };
5803 if let Some(ref apikey) = configuration.api_key {
5804 let key = apikey.key.clone();
5805 let value = match apikey.prefix {
5806 Some(ref prefix) => format!("{} {}", prefix, key),
5807 None => key,
5808 };
5809 req_builder = req_builder.header("Authorization", value);
5810 };
5811 if let Some(ref apikey) = configuration.api_key {
5812 let key = apikey.key.clone();
5813 let value = match apikey.prefix {
5814 Some(ref prefix) => format!("{} {}", prefix, key),
5815 None => key,
5816 };
5817 req_builder = req_builder.header("Sudo", value);
5818 };
5819 if let Some(ref auth_conf) = configuration.basic_auth {
5820 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5821 };
5822
5823 let req = req_builder.build()?;
5824 let resp = configuration.client.execute(req).await?;
5825
5826 let status = resp.status();
5827 let content_type = resp
5828 .headers()
5829 .get("content-type")
5830 .and_then(|v| v.to_str().ok())
5831 .unwrap_or("application/octet-stream");
5832 let content_type = super::ContentType::from(content_type);
5833
5834 if !status.is_client_error() && !status.is_server_error() {
5835 let content = resp.text().await?;
5836 match content_type {
5837 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5838 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
5839 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<models::User>`")))),
5840 }
5841 } else {
5842 let content = resp.text().await?;
5843 let entity: Option<OrganizationListBlocksError> = serde_json::from_str(&content).ok();
5844 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5845 }
5846}
5847
5848pub async fn organization_unblock_user(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error<OrganizationUnblockUserError>> {
5849 let p_path_org = org;
5851 let p_path_username = username;
5852
5853 let uri_str = format!("{}/orgs/{org}/blocks/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username));
5854 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5855
5856 if let Some(ref apikey) = configuration.api_key {
5857 let key = apikey.key.clone();
5858 let value = match apikey.prefix {
5859 Some(ref prefix) => format!("{} {}", prefix, key),
5860 None => key,
5861 };
5862 req_builder = req_builder.query(&[("access_token", value)]);
5863 }
5864 if let Some(ref apikey) = configuration.api_key {
5865 let key = apikey.key.clone();
5866 let value = match apikey.prefix {
5867 Some(ref prefix) => format!("{} {}", prefix, key),
5868 None => key,
5869 };
5870 req_builder = req_builder.query(&[("sudo", value)]);
5871 }
5872 if let Some(ref apikey) = configuration.api_key {
5873 let key = apikey.key.clone();
5874 let value = match apikey.prefix {
5875 Some(ref prefix) => format!("{} {}", prefix, key),
5876 None => key,
5877 };
5878 req_builder = req_builder.query(&[("token", value)]);
5879 }
5880 if let Some(ref user_agent) = configuration.user_agent {
5881 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5882 }
5883 if let Some(ref apikey) = configuration.api_key {
5884 let key = apikey.key.clone();
5885 let value = match apikey.prefix {
5886 Some(ref prefix) => format!("{} {}", prefix, key),
5887 None => key,
5888 };
5889 req_builder = req_builder.header("X-GITEA-OTP", value);
5890 };
5891 if let Some(ref apikey) = configuration.api_key {
5892 let key = apikey.key.clone();
5893 let value = match apikey.prefix {
5894 Some(ref prefix) => format!("{} {}", prefix, key),
5895 None => key,
5896 };
5897 req_builder = req_builder.header("Authorization", value);
5898 };
5899 if let Some(ref apikey) = configuration.api_key {
5900 let key = apikey.key.clone();
5901 let value = match apikey.prefix {
5902 Some(ref prefix) => format!("{} {}", prefix, key),
5903 None => key,
5904 };
5905 req_builder = req_builder.header("Sudo", value);
5906 };
5907 if let Some(ref auth_conf) = configuration.basic_auth {
5908 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5909 };
5910
5911 let req = req_builder.build()?;
5912 let resp = configuration.client.execute(req).await?;
5913
5914 let status = resp.status();
5915
5916 if !status.is_client_error() && !status.is_server_error() {
5917 Ok(())
5918 } else {
5919 let content = resp.text().await?;
5920 let entity: Option<OrganizationUnblockUserError> = serde_json::from_str(&content).ok();
5921 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5922 }
5923}
5924
5925pub async fn rename_org(configuration: &configuration::Configuration, org: &str, body: models::RenameOrgOption) -> Result<(), Error<RenameOrgError>> {
5926 let p_path_org = org;
5928 let p_body_body = body;
5929
5930 let uri_str = format!("{}/orgs/{org}/rename", configuration.base_path, org=crate::apis::urlencode(p_path_org));
5931 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5932
5933 if let Some(ref apikey) = configuration.api_key {
5934 let key = apikey.key.clone();
5935 let value = match apikey.prefix {
5936 Some(ref prefix) => format!("{} {}", prefix, key),
5937 None => key,
5938 };
5939 req_builder = req_builder.query(&[("access_token", value)]);
5940 }
5941 if let Some(ref apikey) = configuration.api_key {
5942 let key = apikey.key.clone();
5943 let value = match apikey.prefix {
5944 Some(ref prefix) => format!("{} {}", prefix, key),
5945 None => key,
5946 };
5947 req_builder = req_builder.query(&[("sudo", value)]);
5948 }
5949 if let Some(ref apikey) = configuration.api_key {
5950 let key = apikey.key.clone();
5951 let value = match apikey.prefix {
5952 Some(ref prefix) => format!("{} {}", prefix, key),
5953 None => key,
5954 };
5955 req_builder = req_builder.query(&[("token", value)]);
5956 }
5957 if let Some(ref user_agent) = configuration.user_agent {
5958 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5959 }
5960 if let Some(ref apikey) = configuration.api_key {
5961 let key = apikey.key.clone();
5962 let value = match apikey.prefix {
5963 Some(ref prefix) => format!("{} {}", prefix, key),
5964 None => key,
5965 };
5966 req_builder = req_builder.header("X-GITEA-OTP", value);
5967 };
5968 if let Some(ref apikey) = configuration.api_key {
5969 let key = apikey.key.clone();
5970 let value = match apikey.prefix {
5971 Some(ref prefix) => format!("{} {}", prefix, key),
5972 None => key,
5973 };
5974 req_builder = req_builder.header("Authorization", value);
5975 };
5976 if let Some(ref apikey) = configuration.api_key {
5977 let key = apikey.key.clone();
5978 let value = match apikey.prefix {
5979 Some(ref prefix) => format!("{} {}", prefix, key),
5980 None => key,
5981 };
5982 req_builder = req_builder.header("Sudo", value);
5983 };
5984 if let Some(ref auth_conf) = configuration.basic_auth {
5985 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5986 };
5987 req_builder = req_builder.json(&p_body_body);
5988
5989 let req = req_builder.build()?;
5990 let resp = configuration.client.execute(req).await?;
5991
5992 let status = resp.status();
5993
5994 if !status.is_client_error() && !status.is_server_error() {
5995 Ok(())
5996 } else {
5997 let content = resp.text().await?;
5998 let entity: Option<RenameOrgError> = serde_json::from_str(&content).ok();
5999 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6000 }
6001}
6002
6003pub async fn team_search(configuration: &configuration::Configuration, org: &str, q: Option<&str>, include_desc: Option<bool>, page: Option<i32>, limit: Option<i32>) -> Result<models::TeamSearch200Response, Error<TeamSearchError>> {
6004 let p_path_org = org;
6006 let p_query_q = q;
6007 let p_query_include_desc = include_desc;
6008 let p_query_page = page;
6009 let p_query_limit = limit;
6010
6011 let uri_str = format!("{}/orgs/{org}/teams/search", configuration.base_path, org=crate::apis::urlencode(p_path_org));
6012 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6013
6014 if let Some(ref param_value) = p_query_q {
6015 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
6016 }
6017 if let Some(ref param_value) = p_query_include_desc {
6018 req_builder = req_builder.query(&[("include_desc", ¶m_value.to_string())]);
6019 }
6020 if let Some(ref param_value) = p_query_page {
6021 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
6022 }
6023 if let Some(ref param_value) = p_query_limit {
6024 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
6025 }
6026 if let Some(ref apikey) = configuration.api_key {
6027 let key = apikey.key.clone();
6028 let value = match apikey.prefix {
6029 Some(ref prefix) => format!("{} {}", prefix, key),
6030 None => key,
6031 };
6032 req_builder = req_builder.query(&[("access_token", value)]);
6033 }
6034 if let Some(ref apikey) = configuration.api_key {
6035 let key = apikey.key.clone();
6036 let value = match apikey.prefix {
6037 Some(ref prefix) => format!("{} {}", prefix, key),
6038 None => key,
6039 };
6040 req_builder = req_builder.query(&[("sudo", value)]);
6041 }
6042 if let Some(ref apikey) = configuration.api_key {
6043 let key = apikey.key.clone();
6044 let value = match apikey.prefix {
6045 Some(ref prefix) => format!("{} {}", prefix, key),
6046 None => key,
6047 };
6048 req_builder = req_builder.query(&[("token", value)]);
6049 }
6050 if let Some(ref user_agent) = configuration.user_agent {
6051 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6052 }
6053 if let Some(ref apikey) = configuration.api_key {
6054 let key = apikey.key.clone();
6055 let value = match apikey.prefix {
6056 Some(ref prefix) => format!("{} {}", prefix, key),
6057 None => key,
6058 };
6059 req_builder = req_builder.header("X-GITEA-OTP", value);
6060 };
6061 if let Some(ref apikey) = configuration.api_key {
6062 let key = apikey.key.clone();
6063 let value = match apikey.prefix {
6064 Some(ref prefix) => format!("{} {}", prefix, key),
6065 None => key,
6066 };
6067 req_builder = req_builder.header("Authorization", value);
6068 };
6069 if let Some(ref apikey) = configuration.api_key {
6070 let key = apikey.key.clone();
6071 let value = match apikey.prefix {
6072 Some(ref prefix) => format!("{} {}", prefix, key),
6073 None => key,
6074 };
6075 req_builder = req_builder.header("Sudo", value);
6076 };
6077 if let Some(ref auth_conf) = configuration.basic_auth {
6078 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6079 };
6080
6081 let req = req_builder.build()?;
6082 let resp = configuration.client.execute(req).await?;
6083
6084 let status = resp.status();
6085 let content_type = resp
6086 .headers()
6087 .get("content-type")
6088 .and_then(|v| v.to_str().ok())
6089 .unwrap_or("application/octet-stream");
6090 let content_type = super::ContentType::from(content_type);
6091
6092 if !status.is_client_error() && !status.is_server_error() {
6093 let content = resp.text().await?;
6094 match content_type {
6095 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6096 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TeamSearch200Response`"))),
6097 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::TeamSearch200Response`")))),
6098 }
6099 } else {
6100 let content = resp.text().await?;
6101 let entity: Option<TeamSearchError> = serde_json::from_str(&content).ok();
6102 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6103 }
6104}
6105
6106pub async fn update_org_secret(configuration: &configuration::Configuration, org: &str, secretname: &str, body: Option<models::CreateOrUpdateSecretOption>) -> Result<(), Error<UpdateOrgSecretError>> {
6107 let p_path_org = org;
6109 let p_path_secretname = secretname;
6110 let p_body_body = body;
6111
6112 let uri_str = format!("{}/orgs/{org}/actions/secrets/{secretname}", configuration.base_path, org=crate::apis::urlencode(p_path_org), secretname=crate::apis::urlencode(p_path_secretname));
6113 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
6114
6115 if let Some(ref apikey) = configuration.api_key {
6116 let key = apikey.key.clone();
6117 let value = match apikey.prefix {
6118 Some(ref prefix) => format!("{} {}", prefix, key),
6119 None => key,
6120 };
6121 req_builder = req_builder.query(&[("access_token", value)]);
6122 }
6123 if let Some(ref apikey) = configuration.api_key {
6124 let key = apikey.key.clone();
6125 let value = match apikey.prefix {
6126 Some(ref prefix) => format!("{} {}", prefix, key),
6127 None => key,
6128 };
6129 req_builder = req_builder.query(&[("sudo", value)]);
6130 }
6131 if let Some(ref apikey) = configuration.api_key {
6132 let key = apikey.key.clone();
6133 let value = match apikey.prefix {
6134 Some(ref prefix) => format!("{} {}", prefix, key),
6135 None => key,
6136 };
6137 req_builder = req_builder.query(&[("token", value)]);
6138 }
6139 if let Some(ref user_agent) = configuration.user_agent {
6140 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6141 }
6142 if let Some(ref apikey) = configuration.api_key {
6143 let key = apikey.key.clone();
6144 let value = match apikey.prefix {
6145 Some(ref prefix) => format!("{} {}", prefix, key),
6146 None => key,
6147 };
6148 req_builder = req_builder.header("X-GITEA-OTP", value);
6149 };
6150 if let Some(ref apikey) = configuration.api_key {
6151 let key = apikey.key.clone();
6152 let value = match apikey.prefix {
6153 Some(ref prefix) => format!("{} {}", prefix, key),
6154 None => key,
6155 };
6156 req_builder = req_builder.header("Authorization", value);
6157 };
6158 if let Some(ref apikey) = configuration.api_key {
6159 let key = apikey.key.clone();
6160 let value = match apikey.prefix {
6161 Some(ref prefix) => format!("{} {}", prefix, key),
6162 None => key,
6163 };
6164 req_builder = req_builder.header("Sudo", value);
6165 };
6166 if let Some(ref auth_conf) = configuration.basic_auth {
6167 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6168 };
6169 req_builder = req_builder.json(&p_body_body);
6170
6171 let req = req_builder.build()?;
6172 let resp = configuration.client.execute(req).await?;
6173
6174 let status = resp.status();
6175
6176 if !status.is_client_error() && !status.is_server_error() {
6177 Ok(())
6178 } else {
6179 let content = resp.text().await?;
6180 let entity: Option<UpdateOrgSecretError> = serde_json::from_str(&content).ok();
6181 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6182 }
6183}
6184
6185pub async fn update_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str, body: Option<models::UpdateVariableOption>) -> Result<(), Error<UpdateOrgVariableError>> {
6186 let p_path_org = org;
6188 let p_path_variablename = variablename;
6189 let p_body_body = body;
6190
6191 let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename));
6192 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
6193
6194 if let Some(ref apikey) = configuration.api_key {
6195 let key = apikey.key.clone();
6196 let value = match apikey.prefix {
6197 Some(ref prefix) => format!("{} {}", prefix, key),
6198 None => key,
6199 };
6200 req_builder = req_builder.query(&[("access_token", value)]);
6201 }
6202 if let Some(ref apikey) = configuration.api_key {
6203 let key = apikey.key.clone();
6204 let value = match apikey.prefix {
6205 Some(ref prefix) => format!("{} {}", prefix, key),
6206 None => key,
6207 };
6208 req_builder = req_builder.query(&[("sudo", value)]);
6209 }
6210 if let Some(ref apikey) = configuration.api_key {
6211 let key = apikey.key.clone();
6212 let value = match apikey.prefix {
6213 Some(ref prefix) => format!("{} {}", prefix, key),
6214 None => key,
6215 };
6216 req_builder = req_builder.query(&[("token", value)]);
6217 }
6218 if let Some(ref user_agent) = configuration.user_agent {
6219 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6220 }
6221 if let Some(ref apikey) = configuration.api_key {
6222 let key = apikey.key.clone();
6223 let value = match apikey.prefix {
6224 Some(ref prefix) => format!("{} {}", prefix, key),
6225 None => key,
6226 };
6227 req_builder = req_builder.header("X-GITEA-OTP", value);
6228 };
6229 if let Some(ref apikey) = configuration.api_key {
6230 let key = apikey.key.clone();
6231 let value = match apikey.prefix {
6232 Some(ref prefix) => format!("{} {}", prefix, key),
6233 None => key,
6234 };
6235 req_builder = req_builder.header("Authorization", value);
6236 };
6237 if let Some(ref apikey) = configuration.api_key {
6238 let key = apikey.key.clone();
6239 let value = match apikey.prefix {
6240 Some(ref prefix) => format!("{} {}", prefix, key),
6241 None => key,
6242 };
6243 req_builder = req_builder.header("Sudo", value);
6244 };
6245 if let Some(ref auth_conf) = configuration.basic_auth {
6246 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6247 };
6248 req_builder = req_builder.json(&p_body_body);
6249
6250 let req = req_builder.build()?;
6251 let resp = configuration.client.execute(req).await?;
6252
6253 let status = resp.status();
6254
6255 if !status.is_client_error() && !status.is_server_error() {
6256 Ok(())
6257 } else {
6258 let content = resp.text().await?;
6259 let entity: Option<UpdateOrgVariableError> = serde_json::from_str(&content).ok();
6260 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6261 }
6262}
6263