1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16use tokio::fs::File as TokioFile;
17use tokio_util::codec::{BytesCodec, FramedRead};
18
19
20#[derive(Debug, Clone, Serialize, Deserialize)]
22#[serde(untagged)]
23pub enum AcceptRepoTransferError {
24 Status403(),
25 Status404(),
26 UnknownValue(serde_json::Value),
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum ActionsDisableWorkflowError {
33 Status400(),
34 Status403(),
35 Status404(),
36 Status422(),
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum ActionsDispatchWorkflowError {
44 Status400(),
45 Status403(),
46 Status404(),
47 Status422(),
48 UnknownValue(serde_json::Value),
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum ActionsEnableWorkflowError {
55 Status400(),
56 Status403(),
57 Status404(),
58 Status409(),
59 Status422(),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum ActionsGetWorkflowError {
67 Status400(),
68 Status403(),
69 Status404(),
70 Status422(),
71 Status500(),
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum ActionsListRepositoryWorkflowsError {
79 Status400(),
80 Status403(),
81 Status404(),
82 Status422(),
83 Status500(),
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum CreateCurrentUserRepoError {
91 Status400(),
92 Status409(),
93 Status422(),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum CreateForkError {
101 Status403(),
102 Status404(),
103 Status409(),
104 Status422(),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum CreateRepoVariableError {
112 Status400(),
113 Status409(),
114 Status500(),
115 UnknownValue(serde_json::Value),
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum DeleteActionRunError {
122 Status400(),
123 Status404(),
124 UnknownValue(serde_json::Value),
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum DeleteArtifactError {
131 Status400(),
132 Status404(),
133 UnknownValue(serde_json::Value),
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum DeleteRepoRunnerError {
140 Status400(),
141 Status404(),
142 UnknownValue(serde_json::Value),
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum DeleteRepoSecretError {
149 Status400(),
150 Status404(),
151 UnknownValue(serde_json::Value),
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum DeleteRepoVariableError {
158 Status400(),
159 Status404(),
160 UnknownValue(serde_json::Value),
161}
162
163#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum DownloadActionsRunJobLogsError {
167 Status400(),
168 Status404(),
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum DownloadArtifactError {
176 Status400(),
177 Status404(),
178 UnknownValue(serde_json::Value),
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum GenerateRepoError {
185 Status403(),
186 Status404(),
187 Status409(),
188 Status422(),
189 UnknownValue(serde_json::Value),
190}
191
192#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum GetAnnotatedTagError {
196 Status400(),
197 Status404(),
198 UnknownValue(serde_json::Value),
199}
200
201#[derive(Debug, Clone, Serialize, Deserialize)]
203#[serde(untagged)]
204pub enum GetArtifactError {
205 Status400(),
206 Status404(),
207 UnknownValue(serde_json::Value),
208}
209
210#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum GetArtifactsError {
214 Status400(),
215 Status404(),
216 UnknownValue(serde_json::Value),
217}
218
219#[derive(Debug, Clone, Serialize, Deserialize)]
221#[serde(untagged)]
222pub enum GetArtifactsOfRunError {
223 Status400(),
224 Status404(),
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum GetBlobError {
232 Status400(),
233 Status404(),
234 UnknownValue(serde_json::Value),
235}
236
237#[derive(Debug, Clone, Serialize, Deserialize)]
239#[serde(untagged)]
240pub enum GetRepoRunnerError {
241 Status400(),
242 Status404(),
243 UnknownValue(serde_json::Value),
244}
245
246#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum GetRepoRunnersError {
250 Status400(),
251 Status404(),
252 UnknownValue(serde_json::Value),
253}
254
255#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum GetRepoVariableError {
259 Status400(),
260 Status404(),
261 UnknownValue(serde_json::Value),
262}
263
264#[derive(Debug, Clone, Serialize, Deserialize)]
266#[serde(untagged)]
267pub enum GetRepoVariablesListError {
268 Status400(),
269 Status404(),
270 UnknownValue(serde_json::Value),
271}
272
273#[derive(Debug, Clone, Serialize, Deserialize)]
275#[serde(untagged)]
276pub enum GetTreeError {
277 Status400(),
278 Status404(),
279 UnknownValue(serde_json::Value),
280}
281
282#[derive(Debug, Clone, Serialize, Deserialize)]
284#[serde(untagged)]
285pub enum GetWorkflowJobError {
286 Status400(),
287 Status404(),
288 UnknownValue(serde_json::Value),
289}
290
291#[derive(Debug, Clone, Serialize, Deserialize)]
293#[serde(untagged)]
294pub enum GetWorkflowRunError {
295 Status400(),
296 Status404(),
297 UnknownValue(serde_json::Value),
298}
299
300#[derive(Debug, Clone, Serialize, Deserialize)]
302#[serde(untagged)]
303pub enum GetWorkflowRunsError {
304 Status400(),
305 Status404(),
306 UnknownValue(serde_json::Value),
307}
308
309#[derive(Debug, Clone, Serialize, Deserialize)]
311#[serde(untagged)]
312pub enum ListActionTasksError {
313 Status400(),
314 Status403(),
315 Status404(),
316 Status409(),
317 Status422(),
318 UnknownValue(serde_json::Value),
319}
320
321#[derive(Debug, Clone, Serialize, Deserialize)]
323#[serde(untagged)]
324pub enum ListForksError {
325 Status404(),
326 UnknownValue(serde_json::Value),
327}
328
329#[derive(Debug, Clone, Serialize, Deserialize)]
331#[serde(untagged)]
332pub enum ListWorkflowJobsError {
333 Status400(),
334 Status404(),
335 UnknownValue(serde_json::Value),
336}
337
338#[derive(Debug, Clone, Serialize, Deserialize)]
340#[serde(untagged)]
341pub enum ListWorkflowRunJobsError {
342 Status400(),
343 Status404(),
344 UnknownValue(serde_json::Value),
345}
346
347#[derive(Debug, Clone, Serialize, Deserialize)]
349#[serde(untagged)]
350pub enum RejectRepoTransferError {
351 Status403(),
352 Status404(),
353 UnknownValue(serde_json::Value),
354}
355
356#[derive(Debug, Clone, Serialize, Deserialize)]
358#[serde(untagged)]
359pub enum RepoAddCollaboratorError {
360 Status403(),
361 Status404(),
362 Status422(),
363 UnknownValue(serde_json::Value),
364}
365
366#[derive(Debug, Clone, Serialize, Deserialize)]
368#[serde(untagged)]
369pub enum RepoAddPushMirrorError {
370 Status400(),
371 Status403(),
372 Status404(),
373 UnknownValue(serde_json::Value),
374}
375
376#[derive(Debug, Clone, Serialize, Deserialize)]
378#[serde(untagged)]
379pub enum RepoAddTeamError {
380 Status404(),
381 Status405(),
382 Status422(),
383 UnknownValue(serde_json::Value),
384}
385
386#[derive(Debug, Clone, Serialize, Deserialize)]
388#[serde(untagged)]
389pub enum RepoAddTopicError {
390 Status404(),
391 Status422(),
392 UnknownValue(serde_json::Value),
393}
394
395#[derive(Debug, Clone, Serialize, Deserialize)]
397#[serde(untagged)]
398pub enum RepoApplyDiffPatchError {
399 Status404(),
400 Status423(),
401 UnknownValue(serde_json::Value),
402}
403
404#[derive(Debug, Clone, Serialize, Deserialize)]
406#[serde(untagged)]
407pub enum RepoCancelScheduledAutoMergeError {
408 Status403(),
409 Status404(),
410 Status423(),
411 UnknownValue(serde_json::Value),
412}
413
414#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum RepoChangeFilesError {
418 Status403(),
419 Status404(),
420 Status422(),
421 Status423(),
422 UnknownValue(serde_json::Value),
423}
424
425#[derive(Debug, Clone, Serialize, Deserialize)]
427#[serde(untagged)]
428pub enum RepoCheckCollaboratorError {
429 Status404(),
430 Status422(),
431 UnknownValue(serde_json::Value),
432}
433
434#[derive(Debug, Clone, Serialize, Deserialize)]
436#[serde(untagged)]
437pub enum RepoCheckTeamError {
438 Status404(),
439 Status405(),
440 UnknownValue(serde_json::Value),
441}
442
443#[derive(Debug, Clone, Serialize, Deserialize)]
445#[serde(untagged)]
446pub enum RepoCompareDiffError {
447 Status404(),
448 UnknownValue(serde_json::Value),
449}
450
451#[derive(Debug, Clone, Serialize, Deserialize)]
453#[serde(untagged)]
454pub enum RepoCreateBranchError {
455 Status403(),
456 Status404(),
457 Status409(),
458 Status423(),
459 UnknownValue(serde_json::Value),
460}
461
462#[derive(Debug, Clone, Serialize, Deserialize)]
464#[serde(untagged)]
465pub enum RepoCreateBranchProtectionError {
466 Status403(),
467 Status404(),
468 Status422(),
469 Status423(),
470 UnknownValue(serde_json::Value),
471}
472
473#[derive(Debug, Clone, Serialize, Deserialize)]
475#[serde(untagged)]
476pub enum RepoCreateFileError {
477 Status403(),
478 Status404(),
479 Status422(),
480 Status423(),
481 UnknownValue(serde_json::Value),
482}
483
484#[derive(Debug, Clone, Serialize, Deserialize)]
486#[serde(untagged)]
487pub enum RepoCreateHookError {
488 Status404(),
489 UnknownValue(serde_json::Value),
490}
491
492#[derive(Debug, Clone, Serialize, Deserialize)]
494#[serde(untagged)]
495pub enum RepoCreateKeyError {
496 Status404(),
497 Status422(),
498 UnknownValue(serde_json::Value),
499}
500
501#[derive(Debug, Clone, Serialize, Deserialize)]
503#[serde(untagged)]
504pub enum RepoCreatePullRequestError {
505 Status403(),
506 Status404(),
507 Status409(),
508 Status422(),
509 Status423(),
510 UnknownValue(serde_json::Value),
511}
512
513#[derive(Debug, Clone, Serialize, Deserialize)]
515#[serde(untagged)]
516pub enum RepoCreatePullReviewError {
517 Status404(),
518 Status422(),
519 UnknownValue(serde_json::Value),
520}
521
522#[derive(Debug, Clone, Serialize, Deserialize)]
524#[serde(untagged)]
525pub enum RepoCreatePullReviewRequestsError {
526 Status404(),
527 Status422(),
528 UnknownValue(serde_json::Value),
529}
530
531#[derive(Debug, Clone, Serialize, Deserialize)]
533#[serde(untagged)]
534pub enum RepoCreateReleaseError {
535 Status404(),
536 Status409(),
537 Status422(),
538 UnknownValue(serde_json::Value),
539}
540
541#[derive(Debug, Clone, Serialize, Deserialize)]
543#[serde(untagged)]
544pub enum RepoCreateReleaseAttachmentError {
545 Status400(),
546 Status404(),
547 Status413(),
548 UnknownValue(serde_json::Value),
549}
550
551#[derive(Debug, Clone, Serialize, Deserialize)]
553#[serde(untagged)]
554pub enum RepoCreateRunnerRegistrationTokenError {
555 UnknownValue(serde_json::Value),
556}
557
558#[derive(Debug, Clone, Serialize, Deserialize)]
560#[serde(untagged)]
561pub enum RepoCreateStatusError {
562 Status400(),
563 Status404(),
564 UnknownValue(serde_json::Value),
565}
566
567#[derive(Debug, Clone, Serialize, Deserialize)]
569#[serde(untagged)]
570pub enum RepoCreateTagError {
571 Status404(),
572 Status405(),
573 Status409(),
574 Status422(),
575 Status423(),
576 UnknownValue(serde_json::Value),
577}
578
579#[derive(Debug, Clone, Serialize, Deserialize)]
581#[serde(untagged)]
582pub enum RepoCreateTagProtectionError {
583 Status403(),
584 Status404(),
585 Status422(),
586 Status423(),
587 UnknownValue(serde_json::Value),
588}
589
590#[derive(Debug, Clone, Serialize, Deserialize)]
592#[serde(untagged)]
593pub enum RepoCreateWikiPageError {
594 Status400(),
595 Status403(),
596 Status404(),
597 Status423(),
598 UnknownValue(serde_json::Value),
599}
600
601#[derive(Debug, Clone, Serialize, Deserialize)]
603#[serde(untagged)]
604pub enum RepoDeleteError {
605 Status403(),
606 Status404(),
607 UnknownValue(serde_json::Value),
608}
609
610#[derive(Debug, Clone, Serialize, Deserialize)]
612#[serde(untagged)]
613pub enum RepoDeleteAvatarError {
614 Status404(),
615 UnknownValue(serde_json::Value),
616}
617
618#[derive(Debug, Clone, Serialize, Deserialize)]
620#[serde(untagged)]
621pub enum RepoDeleteBranchError {
622 Status403(),
623 Status404(),
624 Status423(),
625 UnknownValue(serde_json::Value),
626}
627
628#[derive(Debug, Clone, Serialize, Deserialize)]
630#[serde(untagged)]
631pub enum RepoDeleteBranchProtectionError {
632 Status404(),
633 UnknownValue(serde_json::Value),
634}
635
636#[derive(Debug, Clone, Serialize, Deserialize)]
638#[serde(untagged)]
639pub enum RepoDeleteCollaboratorError {
640 Status404(),
641 Status422(),
642 UnknownValue(serde_json::Value),
643}
644
645#[derive(Debug, Clone, Serialize, Deserialize)]
647#[serde(untagged)]
648pub enum RepoDeleteFileError {
649 Status400(),
650 Status403(),
651 Status404(),
652 Status422(),
653 Status423(),
654 UnknownValue(serde_json::Value),
655}
656
657#[derive(Debug, Clone, Serialize, Deserialize)]
659#[serde(untagged)]
660pub enum RepoDeleteGitHookError {
661 Status404(),
662 UnknownValue(serde_json::Value),
663}
664
665#[derive(Debug, Clone, Serialize, Deserialize)]
667#[serde(untagged)]
668pub enum RepoDeleteHookError {
669 Status404(),
670 UnknownValue(serde_json::Value),
671}
672
673#[derive(Debug, Clone, Serialize, Deserialize)]
675#[serde(untagged)]
676pub enum RepoDeleteKeyError {
677 Status403(),
678 Status404(),
679 UnknownValue(serde_json::Value),
680}
681
682#[derive(Debug, Clone, Serialize, Deserialize)]
684#[serde(untagged)]
685pub enum RepoDeletePullReviewError {
686 Status403(),
687 Status404(),
688 UnknownValue(serde_json::Value),
689}
690
691#[derive(Debug, Clone, Serialize, Deserialize)]
693#[serde(untagged)]
694pub enum RepoDeletePullReviewRequestsError {
695 Status403(),
696 Status404(),
697 Status422(),
698 UnknownValue(serde_json::Value),
699}
700
701#[derive(Debug, Clone, Serialize, Deserialize)]
703#[serde(untagged)]
704pub enum RepoDeletePushMirrorError {
705 Status400(),
706 Status404(),
707 UnknownValue(serde_json::Value),
708}
709
710#[derive(Debug, Clone, Serialize, Deserialize)]
712#[serde(untagged)]
713pub enum RepoDeleteReleaseError {
714 Status404(),
715 Status422(),
716 UnknownValue(serde_json::Value),
717}
718
719#[derive(Debug, Clone, Serialize, Deserialize)]
721#[serde(untagged)]
722pub enum RepoDeleteReleaseAttachmentError {
723 Status404(),
724 UnknownValue(serde_json::Value),
725}
726
727#[derive(Debug, Clone, Serialize, Deserialize)]
729#[serde(untagged)]
730pub enum RepoDeleteReleaseByTagError {
731 Status404(),
732 Status422(),
733 UnknownValue(serde_json::Value),
734}
735
736#[derive(Debug, Clone, Serialize, Deserialize)]
738#[serde(untagged)]
739pub enum RepoDeleteTagError {
740 Status404(),
741 Status405(),
742 Status409(),
743 Status422(),
744 Status423(),
745 UnknownValue(serde_json::Value),
746}
747
748#[derive(Debug, Clone, Serialize, Deserialize)]
750#[serde(untagged)]
751pub enum RepoDeleteTagProtectionError {
752 Status404(),
753 UnknownValue(serde_json::Value),
754}
755
756#[derive(Debug, Clone, Serialize, Deserialize)]
758#[serde(untagged)]
759pub enum RepoDeleteTeamError {
760 Status404(),
761 Status405(),
762 Status422(),
763 UnknownValue(serde_json::Value),
764}
765
766#[derive(Debug, Clone, Serialize, Deserialize)]
768#[serde(untagged)]
769pub enum RepoDeleteTopicError {
770 Status404(),
771 Status422(),
772 UnknownValue(serde_json::Value),
773}
774
775#[derive(Debug, Clone, Serialize, Deserialize)]
777#[serde(untagged)]
778pub enum RepoDeleteWikiPageError {
779 Status403(),
780 Status404(),
781 Status423(),
782 UnknownValue(serde_json::Value),
783}
784
785#[derive(Debug, Clone, Serialize, Deserialize)]
787#[serde(untagged)]
788pub enum RepoDismissPullReviewError {
789 Status403(),
790 Status404(),
791 Status422(),
792 UnknownValue(serde_json::Value),
793}
794
795#[derive(Debug, Clone, Serialize, Deserialize)]
797#[serde(untagged)]
798pub enum RepoDownloadCommitDiffOrPatchError {
799 Status404(),
800 UnknownValue(serde_json::Value),
801}
802
803#[derive(Debug, Clone, Serialize, Deserialize)]
805#[serde(untagged)]
806pub enum RepoDownloadPullDiffOrPatchError {
807 Status404(),
808 UnknownValue(serde_json::Value),
809}
810
811#[derive(Debug, Clone, Serialize, Deserialize)]
813#[serde(untagged)]
814pub enum RepoEditError {
815 Status403(),
816 Status404(),
817 Status422(),
818 UnknownValue(serde_json::Value),
819}
820
821#[derive(Debug, Clone, Serialize, Deserialize)]
823#[serde(untagged)]
824pub enum RepoEditBranchProtectionError {
825 Status404(),
826 Status422(),
827 Status423(),
828 UnknownValue(serde_json::Value),
829}
830
831#[derive(Debug, Clone, Serialize, Deserialize)]
833#[serde(untagged)]
834pub enum RepoEditGitHookError {
835 Status404(),
836 UnknownValue(serde_json::Value),
837}
838
839#[derive(Debug, Clone, Serialize, Deserialize)]
841#[serde(untagged)]
842pub enum RepoEditHookError {
843 Status404(),
844 UnknownValue(serde_json::Value),
845}
846
847#[derive(Debug, Clone, Serialize, Deserialize)]
849#[serde(untagged)]
850pub enum RepoEditPullRequestError {
851 Status403(),
852 Status404(),
853 Status409(),
854 Status412(),
855 Status422(),
856 UnknownValue(serde_json::Value),
857}
858
859#[derive(Debug, Clone, Serialize, Deserialize)]
861#[serde(untagged)]
862pub enum RepoEditReleaseError {
863 Status404(),
864 UnknownValue(serde_json::Value),
865}
866
867#[derive(Debug, Clone, Serialize, Deserialize)]
869#[serde(untagged)]
870pub enum RepoEditReleaseAttachmentError {
871 Status404(),
872 Status422(),
873 UnknownValue(serde_json::Value),
874}
875
876#[derive(Debug, Clone, Serialize, Deserialize)]
878#[serde(untagged)]
879pub enum RepoEditTagProtectionError {
880 Status404(),
881 Status422(),
882 Status423(),
883 UnknownValue(serde_json::Value),
884}
885
886#[derive(Debug, Clone, Serialize, Deserialize)]
888#[serde(untagged)]
889pub enum RepoEditWikiPageError {
890 Status400(),
891 Status403(),
892 Status404(),
893 Status423(),
894 UnknownValue(serde_json::Value),
895}
896
897#[derive(Debug, Clone, Serialize, Deserialize)]
899#[serde(untagged)]
900pub enum RepoGetError {
901 Status404(),
902 UnknownValue(serde_json::Value),
903}
904
905#[derive(Debug, Clone, Serialize, Deserialize)]
907#[serde(untagged)]
908pub enum RepoGetAllCommitsError {
909 Status404(),
910 Status409(models::ApiError),
911 UnknownValue(serde_json::Value),
912}
913
914#[derive(Debug, Clone, Serialize, Deserialize)]
916#[serde(untagged)]
917pub enum RepoGetArchiveError {
918 Status404(),
919 UnknownValue(serde_json::Value),
920}
921
922#[derive(Debug, Clone, Serialize, Deserialize)]
924#[serde(untagged)]
925pub enum RepoGetAssigneesError {
926 Status404(),
927 UnknownValue(serde_json::Value),
928}
929
930#[derive(Debug, Clone, Serialize, Deserialize)]
932#[serde(untagged)]
933pub enum RepoGetBranchError {
934 Status404(),
935 UnknownValue(serde_json::Value),
936}
937
938#[derive(Debug, Clone, Serialize, Deserialize)]
940#[serde(untagged)]
941pub enum RepoGetBranchProtectionError {
942 Status404(),
943 UnknownValue(serde_json::Value),
944}
945
946#[derive(Debug, Clone, Serialize, Deserialize)]
948#[serde(untagged)]
949pub enum RepoGetByIdError {
950 Status404(),
951 UnknownValue(serde_json::Value),
952}
953
954#[derive(Debug, Clone, Serialize, Deserialize)]
956#[serde(untagged)]
957pub enum RepoGetCombinedStatusByRefError {
958 Status400(),
959 Status404(),
960 UnknownValue(serde_json::Value),
961}
962
963#[derive(Debug, Clone, Serialize, Deserialize)]
965#[serde(untagged)]
966pub enum RepoGetCommitPullRequestError {
967 Status404(),
968 UnknownValue(serde_json::Value),
969}
970
971#[derive(Debug, Clone, Serialize, Deserialize)]
973#[serde(untagged)]
974pub enum RepoGetContentsError {
975 Status404(),
976 UnknownValue(serde_json::Value),
977}
978
979#[derive(Debug, Clone, Serialize, Deserialize)]
981#[serde(untagged)]
982pub enum RepoGetContentsExtError {
983 Status404(),
984 UnknownValue(serde_json::Value),
985}
986
987#[derive(Debug, Clone, Serialize, Deserialize)]
989#[serde(untagged)]
990pub enum RepoGetContentsListError {
991 Status404(),
992 UnknownValue(serde_json::Value),
993}
994
995#[derive(Debug, Clone, Serialize, Deserialize)]
997#[serde(untagged)]
998pub enum RepoGetEditorConfigError {
999 Status404(),
1000 UnknownValue(serde_json::Value),
1001}
1002
1003#[derive(Debug, Clone, Serialize, Deserialize)]
1005#[serde(untagged)]
1006pub enum RepoGetFileContentsError {
1007 Status404(),
1008 UnknownValue(serde_json::Value),
1009}
1010
1011#[derive(Debug, Clone, Serialize, Deserialize)]
1013#[serde(untagged)]
1014pub enum RepoGetFileContentsPostError {
1015 Status404(),
1016 UnknownValue(serde_json::Value),
1017}
1018
1019#[derive(Debug, Clone, Serialize, Deserialize)]
1021#[serde(untagged)]
1022pub enum RepoGetGitHookError {
1023 Status404(),
1024 UnknownValue(serde_json::Value),
1025}
1026
1027#[derive(Debug, Clone, Serialize, Deserialize)]
1029#[serde(untagged)]
1030pub enum RepoGetHookError {
1031 Status404(),
1032 UnknownValue(serde_json::Value),
1033}
1034
1035#[derive(Debug, Clone, Serialize, Deserialize)]
1037#[serde(untagged)]
1038pub enum RepoGetIssueConfigError {
1039 Status404(),
1040 UnknownValue(serde_json::Value),
1041}
1042
1043#[derive(Debug, Clone, Serialize, Deserialize)]
1045#[serde(untagged)]
1046pub enum RepoGetIssueTemplatesError {
1047 Status404(),
1048 UnknownValue(serde_json::Value),
1049}
1050
1051#[derive(Debug, Clone, Serialize, Deserialize)]
1053#[serde(untagged)]
1054pub enum RepoGetKeyError {
1055 Status404(),
1056 UnknownValue(serde_json::Value),
1057}
1058
1059#[derive(Debug, Clone, Serialize, Deserialize)]
1061#[serde(untagged)]
1062pub enum RepoGetLanguagesError {
1063 Status404(),
1064 UnknownValue(serde_json::Value),
1065}
1066
1067#[derive(Debug, Clone, Serialize, Deserialize)]
1069#[serde(untagged)]
1070pub enum RepoGetLatestReleaseError {
1071 Status404(),
1072 UnknownValue(serde_json::Value),
1073}
1074
1075#[derive(Debug, Clone, Serialize, Deserialize)]
1077#[serde(untagged)]
1078pub enum RepoGetLicensesError {
1079 Status404(),
1080 UnknownValue(serde_json::Value),
1081}
1082
1083#[derive(Debug, Clone, Serialize, Deserialize)]
1085#[serde(untagged)]
1086pub enum RepoGetNoteError {
1087 Status404(),
1088 Status422(),
1089 UnknownValue(serde_json::Value),
1090}
1091
1092#[derive(Debug, Clone, Serialize, Deserialize)]
1094#[serde(untagged)]
1095pub enum RepoGetPullRequestError {
1096 Status404(),
1097 UnknownValue(serde_json::Value),
1098}
1099
1100#[derive(Debug, Clone, Serialize, Deserialize)]
1102#[serde(untagged)]
1103pub enum RepoGetPullRequestByBaseHeadError {
1104 Status404(),
1105 UnknownValue(serde_json::Value),
1106}
1107
1108#[derive(Debug, Clone, Serialize, Deserialize)]
1110#[serde(untagged)]
1111pub enum RepoGetPullRequestCommitsError {
1112 Status404(),
1113 UnknownValue(serde_json::Value),
1114}
1115
1116#[derive(Debug, Clone, Serialize, Deserialize)]
1118#[serde(untagged)]
1119pub enum RepoGetPullRequestFilesError {
1120 Status404(),
1121 UnknownValue(serde_json::Value),
1122}
1123
1124#[derive(Debug, Clone, Serialize, Deserialize)]
1126#[serde(untagged)]
1127pub enum RepoGetPullReviewError {
1128 Status404(),
1129 UnknownValue(serde_json::Value),
1130}
1131
1132#[derive(Debug, Clone, Serialize, Deserialize)]
1134#[serde(untagged)]
1135pub enum RepoGetPullReviewCommentsError {
1136 Status404(),
1137 UnknownValue(serde_json::Value),
1138}
1139
1140#[derive(Debug, Clone, Serialize, Deserialize)]
1142#[serde(untagged)]
1143pub enum RepoGetPushMirrorByRemoteNameError {
1144 Status400(),
1145 Status403(),
1146 Status404(),
1147 UnknownValue(serde_json::Value),
1148}
1149
1150#[derive(Debug, Clone, Serialize, Deserialize)]
1152#[serde(untagged)]
1153pub enum RepoGetRawFileError {
1154 Status404(),
1155 UnknownValue(serde_json::Value),
1156}
1157
1158#[derive(Debug, Clone, Serialize, Deserialize)]
1160#[serde(untagged)]
1161pub enum RepoGetRawFileOrLfsError {
1162 Status404(),
1163 UnknownValue(serde_json::Value),
1164}
1165
1166#[derive(Debug, Clone, Serialize, Deserialize)]
1168#[serde(untagged)]
1169pub enum RepoGetReleaseError {
1170 Status404(),
1171 UnknownValue(serde_json::Value),
1172}
1173
1174#[derive(Debug, Clone, Serialize, Deserialize)]
1176#[serde(untagged)]
1177pub enum RepoGetReleaseAttachmentError {
1178 Status404(),
1179 UnknownValue(serde_json::Value),
1180}
1181
1182#[derive(Debug, Clone, Serialize, Deserialize)]
1184#[serde(untagged)]
1185pub enum RepoGetReleaseByTagError {
1186 Status404(),
1187 UnknownValue(serde_json::Value),
1188}
1189
1190#[derive(Debug, Clone, Serialize, Deserialize)]
1192#[serde(untagged)]
1193pub enum RepoGetRepoPermissionsError {
1194 Status403(),
1195 Status404(),
1196 UnknownValue(serde_json::Value),
1197}
1198
1199#[derive(Debug, Clone, Serialize, Deserialize)]
1201#[serde(untagged)]
1202pub enum RepoGetReviewersError {
1203 Status404(),
1204 UnknownValue(serde_json::Value),
1205}
1206
1207#[derive(Debug, Clone, Serialize, Deserialize)]
1209#[serde(untagged)]
1210pub enum RepoGetRunnerRegistrationTokenError {
1211 UnknownValue(serde_json::Value),
1212}
1213
1214#[derive(Debug, Clone, Serialize, Deserialize)]
1216#[serde(untagged)]
1217pub enum RepoGetSingleCommitError {
1218 Status404(),
1219 Status422(),
1220 UnknownValue(serde_json::Value),
1221}
1222
1223#[derive(Debug, Clone, Serialize, Deserialize)]
1225#[serde(untagged)]
1226pub enum RepoGetTagError {
1227 Status404(),
1228 UnknownValue(serde_json::Value),
1229}
1230
1231#[derive(Debug, Clone, Serialize, Deserialize)]
1233#[serde(untagged)]
1234pub enum RepoGetTagProtectionError {
1235 Status404(),
1236 UnknownValue(serde_json::Value),
1237}
1238
1239#[derive(Debug, Clone, Serialize, Deserialize)]
1241#[serde(untagged)]
1242pub enum RepoGetWikiPageError {
1243 Status404(),
1244 UnknownValue(serde_json::Value),
1245}
1246
1247#[derive(Debug, Clone, Serialize, Deserialize)]
1249#[serde(untagged)]
1250pub enum RepoGetWikiPageRevisionsError {
1251 Status404(),
1252 UnknownValue(serde_json::Value),
1253}
1254
1255#[derive(Debug, Clone, Serialize, Deserialize)]
1257#[serde(untagged)]
1258pub enum RepoGetWikiPagesError {
1259 Status404(),
1260 UnknownValue(serde_json::Value),
1261}
1262
1263#[derive(Debug, Clone, Serialize, Deserialize)]
1265#[serde(untagged)]
1266pub enum RepoListActionsSecretsError {
1267 Status404(),
1268 UnknownValue(serde_json::Value),
1269}
1270
1271#[derive(Debug, Clone, Serialize, Deserialize)]
1273#[serde(untagged)]
1274pub enum RepoListActivityFeedsError {
1275 Status404(),
1276 UnknownValue(serde_json::Value),
1277}
1278
1279#[derive(Debug, Clone, Serialize, Deserialize)]
1281#[serde(untagged)]
1282pub enum RepoListAllGitRefsError {
1283 Status404(),
1284 UnknownValue(serde_json::Value),
1285}
1286
1287#[derive(Debug, Clone, Serialize, Deserialize)]
1289#[serde(untagged)]
1290pub enum RepoListBranchProtectionError {
1291 UnknownValue(serde_json::Value),
1292}
1293
1294#[derive(Debug, Clone, Serialize, Deserialize)]
1296#[serde(untagged)]
1297pub enum RepoListBranchesError {
1298 UnknownValue(serde_json::Value),
1299}
1300
1301#[derive(Debug, Clone, Serialize, Deserialize)]
1303#[serde(untagged)]
1304pub enum RepoListCollaboratorsError {
1305 Status404(),
1306 UnknownValue(serde_json::Value),
1307}
1308
1309#[derive(Debug, Clone, Serialize, Deserialize)]
1311#[serde(untagged)]
1312pub enum RepoListGitHooksError {
1313 Status404(),
1314 UnknownValue(serde_json::Value),
1315}
1316
1317#[derive(Debug, Clone, Serialize, Deserialize)]
1319#[serde(untagged)]
1320pub enum RepoListGitRefsError {
1321 Status404(),
1322 UnknownValue(serde_json::Value),
1323}
1324
1325#[derive(Debug, Clone, Serialize, Deserialize)]
1327#[serde(untagged)]
1328pub enum RepoListHooksError {
1329 Status404(),
1330 UnknownValue(serde_json::Value),
1331}
1332
1333#[derive(Debug, Clone, Serialize, Deserialize)]
1335#[serde(untagged)]
1336pub enum RepoListKeysError {
1337 Status404(),
1338 UnknownValue(serde_json::Value),
1339}
1340
1341#[derive(Debug, Clone, Serialize, Deserialize)]
1343#[serde(untagged)]
1344pub enum RepoListPinnedIssuesError {
1345 Status404(),
1346 UnknownValue(serde_json::Value),
1347}
1348
1349#[derive(Debug, Clone, Serialize, Deserialize)]
1351#[serde(untagged)]
1352pub enum RepoListPinnedPullRequestsError {
1353 Status404(),
1354 UnknownValue(serde_json::Value),
1355}
1356
1357#[derive(Debug, Clone, Serialize, Deserialize)]
1359#[serde(untagged)]
1360pub enum RepoListPullRequestsError {
1361 Status404(),
1362 Status500(),
1363 UnknownValue(serde_json::Value),
1364}
1365
1366#[derive(Debug, Clone, Serialize, Deserialize)]
1368#[serde(untagged)]
1369pub enum RepoListPullReviewsError {
1370 Status404(),
1371 UnknownValue(serde_json::Value),
1372}
1373
1374#[derive(Debug, Clone, Serialize, Deserialize)]
1376#[serde(untagged)]
1377pub enum RepoListPushMirrorsError {
1378 Status400(),
1379 Status403(),
1380 Status404(),
1381 UnknownValue(serde_json::Value),
1382}
1383
1384#[derive(Debug, Clone, Serialize, Deserialize)]
1386#[serde(untagged)]
1387pub enum RepoListReleaseAttachmentsError {
1388 Status404(),
1389 UnknownValue(serde_json::Value),
1390}
1391
1392#[derive(Debug, Clone, Serialize, Deserialize)]
1394#[serde(untagged)]
1395pub enum RepoListReleasesError {
1396 Status404(),
1397 UnknownValue(serde_json::Value),
1398}
1399
1400#[derive(Debug, Clone, Serialize, Deserialize)]
1402#[serde(untagged)]
1403pub enum RepoListStargazersError {
1404 Status403(),
1405 Status404(),
1406 UnknownValue(serde_json::Value),
1407}
1408
1409#[derive(Debug, Clone, Serialize, Deserialize)]
1411#[serde(untagged)]
1412pub enum RepoListStatusesError {
1413 Status400(),
1414 Status404(),
1415 UnknownValue(serde_json::Value),
1416}
1417
1418#[derive(Debug, Clone, Serialize, Deserialize)]
1420#[serde(untagged)]
1421pub enum RepoListStatusesByRefError {
1422 Status400(),
1423 Status404(),
1424 UnknownValue(serde_json::Value),
1425}
1426
1427#[derive(Debug, Clone, Serialize, Deserialize)]
1429#[serde(untagged)]
1430pub enum RepoListSubscribersError {
1431 Status404(),
1432 UnknownValue(serde_json::Value),
1433}
1434
1435#[derive(Debug, Clone, Serialize, Deserialize)]
1437#[serde(untagged)]
1438pub enum RepoListTagProtectionError {
1439 UnknownValue(serde_json::Value),
1440}
1441
1442#[derive(Debug, Clone, Serialize, Deserialize)]
1444#[serde(untagged)]
1445pub enum RepoListTagsError {
1446 Status404(),
1447 UnknownValue(serde_json::Value),
1448}
1449
1450#[derive(Debug, Clone, Serialize, Deserialize)]
1452#[serde(untagged)]
1453pub enum RepoListTeamsError {
1454 Status404(),
1455 UnknownValue(serde_json::Value),
1456}
1457
1458#[derive(Debug, Clone, Serialize, Deserialize)]
1460#[serde(untagged)]
1461pub enum RepoListTopicsError {
1462 Status404(),
1463 UnknownValue(serde_json::Value),
1464}
1465
1466#[derive(Debug, Clone, Serialize, Deserialize)]
1468#[serde(untagged)]
1469pub enum RepoMergePullRequestError {
1470 Status404(),
1471 Status405(),
1472 Status409(),
1473 Status423(),
1474 UnknownValue(serde_json::Value),
1475}
1476
1477#[derive(Debug, Clone, Serialize, Deserialize)]
1479#[serde(untagged)]
1480pub enum RepoMergeUpstreamError {
1481 Status400(),
1482 Status404(),
1483 UnknownValue(serde_json::Value),
1484}
1485
1486#[derive(Debug, Clone, Serialize, Deserialize)]
1488#[serde(untagged)]
1489pub enum RepoMigrateError {
1490 Status403(),
1491 Status409(),
1492 Status422(),
1493 UnknownValue(serde_json::Value),
1494}
1495
1496#[derive(Debug, Clone, Serialize, Deserialize)]
1498#[serde(untagged)]
1499pub enum RepoMirrorSyncError {
1500 Status403(),
1501 Status404(),
1502 UnknownValue(serde_json::Value),
1503}
1504
1505#[derive(Debug, Clone, Serialize, Deserialize)]
1507#[serde(untagged)]
1508pub enum RepoNewPinAllowedError {
1509 Status404(),
1510 UnknownValue(serde_json::Value),
1511}
1512
1513#[derive(Debug, Clone, Serialize, Deserialize)]
1515#[serde(untagged)]
1516pub enum RepoPullRequestIsMergedError {
1517 Status404(),
1518 UnknownValue(serde_json::Value),
1519}
1520
1521#[derive(Debug, Clone, Serialize, Deserialize)]
1523#[serde(untagged)]
1524pub enum RepoPushMirrorSyncError {
1525 Status400(),
1526 Status403(),
1527 Status404(),
1528 UnknownValue(serde_json::Value),
1529}
1530
1531#[derive(Debug, Clone, Serialize, Deserialize)]
1533#[serde(untagged)]
1534pub enum RepoRenameBranchError {
1535 Status403(),
1536 Status404(),
1537 Status422(),
1538 UnknownValue(serde_json::Value),
1539}
1540
1541#[derive(Debug, Clone, Serialize, Deserialize)]
1543#[serde(untagged)]
1544pub enum RepoSearchError {
1545 Status422(),
1546 UnknownValue(serde_json::Value),
1547}
1548
1549#[derive(Debug, Clone, Serialize, Deserialize)]
1551#[serde(untagged)]
1552pub enum RepoSigningKeyError {
1553 UnknownValue(serde_json::Value),
1554}
1555
1556#[derive(Debug, Clone, Serialize, Deserialize)]
1558#[serde(untagged)]
1559pub enum RepoSigningKeySshError {
1560 UnknownValue(serde_json::Value),
1561}
1562
1563#[derive(Debug, Clone, Serialize, Deserialize)]
1565#[serde(untagged)]
1566pub enum RepoSubmitPullReviewError {
1567 Status404(),
1568 Status422(),
1569 UnknownValue(serde_json::Value),
1570}
1571
1572#[derive(Debug, Clone, Serialize, Deserialize)]
1574#[serde(untagged)]
1575pub enum RepoTestHookError {
1576 Status404(),
1577 UnknownValue(serde_json::Value),
1578}
1579
1580#[derive(Debug, Clone, Serialize, Deserialize)]
1582#[serde(untagged)]
1583pub enum RepoTrackedTimesError {
1584 Status400(),
1585 Status403(),
1586 Status404(),
1587 UnknownValue(serde_json::Value),
1588}
1589
1590#[derive(Debug, Clone, Serialize, Deserialize)]
1592#[serde(untagged)]
1593pub enum RepoTransferError {
1594 Status403(),
1595 Status404(),
1596 Status422(),
1597 UnknownValue(serde_json::Value),
1598}
1599
1600#[derive(Debug, Clone, Serialize, Deserialize)]
1602#[serde(untagged)]
1603pub enum RepoUnDismissPullReviewError {
1604 Status403(),
1605 Status404(),
1606 Status422(),
1607 UnknownValue(serde_json::Value),
1608}
1609
1610#[derive(Debug, Clone, Serialize, Deserialize)]
1612#[serde(untagged)]
1613pub enum RepoUpdateAvatarError {
1614 Status404(),
1615 UnknownValue(serde_json::Value),
1616}
1617
1618#[derive(Debug, Clone, Serialize, Deserialize)]
1620#[serde(untagged)]
1621pub enum RepoUpdateBranchProtectionPrioriesError {
1622 Status404(),
1623 Status422(),
1624 Status423(),
1625 UnknownValue(serde_json::Value),
1626}
1627
1628#[derive(Debug, Clone, Serialize, Deserialize)]
1630#[serde(untagged)]
1631pub enum RepoUpdateFileError {
1632 Status403(),
1633 Status404(),
1634 Status422(),
1635 Status423(),
1636 UnknownValue(serde_json::Value),
1637}
1638
1639#[derive(Debug, Clone, Serialize, Deserialize)]
1641#[serde(untagged)]
1642pub enum RepoUpdatePullRequestError {
1643 Status403(),
1644 Status404(),
1645 Status409(),
1646 Status422(),
1647 UnknownValue(serde_json::Value),
1648}
1649
1650#[derive(Debug, Clone, Serialize, Deserialize)]
1652#[serde(untagged)]
1653pub enum RepoUpdateTopicsError {
1654 Status404(),
1655 Status422(),
1656 UnknownValue(serde_json::Value),
1657}
1658
1659#[derive(Debug, Clone, Serialize, Deserialize)]
1661#[serde(untagged)]
1662pub enum RepoValidateIssueConfigError {
1663 Status404(),
1664 UnknownValue(serde_json::Value),
1665}
1666
1667#[derive(Debug, Clone, Serialize, Deserialize)]
1669#[serde(untagged)]
1670pub enum TopicSearchError {
1671 Status403(),
1672 Status404(),
1673 UnknownValue(serde_json::Value),
1674}
1675
1676#[derive(Debug, Clone, Serialize, Deserialize)]
1678#[serde(untagged)]
1679pub enum UpdateRepoSecretError {
1680 Status400(),
1681 Status404(),
1682 UnknownValue(serde_json::Value),
1683}
1684
1685#[derive(Debug, Clone, Serialize, Deserialize)]
1687#[serde(untagged)]
1688pub enum UpdateRepoVariableError {
1689 Status400(),
1690 Status404(),
1691 UnknownValue(serde_json::Value),
1692}
1693
1694#[derive(Debug, Clone, Serialize, Deserialize)]
1696#[serde(untagged)]
1697pub enum UserCurrentCheckSubscriptionError {
1698 Status404(),
1699 UnknownValue(serde_json::Value),
1700}
1701
1702#[derive(Debug, Clone, Serialize, Deserialize)]
1704#[serde(untagged)]
1705pub enum UserCurrentDeleteSubscriptionError {
1706 Status404(),
1707 UnknownValue(serde_json::Value),
1708}
1709
1710#[derive(Debug, Clone, Serialize, Deserialize)]
1712#[serde(untagged)]
1713pub enum UserCurrentPutSubscriptionError {
1714 Status403(),
1715 Status404(),
1716 UnknownValue(serde_json::Value),
1717}
1718
1719#[derive(Debug, Clone, Serialize, Deserialize)]
1721#[serde(untagged)]
1722pub enum UserTrackedTimesError {
1723 Status400(),
1724 Status403(),
1725 Status404(),
1726 UnknownValue(serde_json::Value),
1727}
1728
1729
1730pub async fn accept_repo_transfer(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::Repository, Error<AcceptRepoTransferError>> {
1731 let p_path_owner = owner;
1733 let p_path_repo = repo;
1734
1735 let uri_str = format!("{}/repos/{owner}/{repo}/transfer/accept", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1736 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1737
1738 if let Some(ref apikey) = configuration.api_key {
1739 let key = apikey.key.clone();
1740 let value = match apikey.prefix {
1741 Some(ref prefix) => format!("{} {}", prefix, key),
1742 None => key,
1743 };
1744 req_builder = req_builder.query(&[("access_token", value)]);
1745 }
1746 if let Some(ref apikey) = configuration.api_key {
1747 let key = apikey.key.clone();
1748 let value = match apikey.prefix {
1749 Some(ref prefix) => format!("{} {}", prefix, key),
1750 None => key,
1751 };
1752 req_builder = req_builder.query(&[("sudo", value)]);
1753 }
1754 if let Some(ref apikey) = configuration.api_key {
1755 let key = apikey.key.clone();
1756 let value = match apikey.prefix {
1757 Some(ref prefix) => format!("{} {}", prefix, key),
1758 None => key,
1759 };
1760 req_builder = req_builder.query(&[("token", value)]);
1761 }
1762 if let Some(ref user_agent) = configuration.user_agent {
1763 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1764 }
1765 if let Some(ref apikey) = configuration.api_key {
1766 let key = apikey.key.clone();
1767 let value = match apikey.prefix {
1768 Some(ref prefix) => format!("{} {}", prefix, key),
1769 None => key,
1770 };
1771 req_builder = req_builder.header("X-GITEA-OTP", value);
1772 };
1773 if let Some(ref apikey) = configuration.api_key {
1774 let key = apikey.key.clone();
1775 let value = match apikey.prefix {
1776 Some(ref prefix) => format!("{} {}", prefix, key),
1777 None => key,
1778 };
1779 req_builder = req_builder.header("Authorization", value);
1780 };
1781 if let Some(ref apikey) = configuration.api_key {
1782 let key = apikey.key.clone();
1783 let value = match apikey.prefix {
1784 Some(ref prefix) => format!("{} {}", prefix, key),
1785 None => key,
1786 };
1787 req_builder = req_builder.header("Sudo", value);
1788 };
1789 if let Some(ref auth_conf) = configuration.basic_auth {
1790 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1791 };
1792
1793 let req = req_builder.build()?;
1794 let resp = configuration.client.execute(req).await?;
1795
1796 let status = resp.status();
1797 let content_type = resp
1798 .headers()
1799 .get("content-type")
1800 .and_then(|v| v.to_str().ok())
1801 .unwrap_or("application/octet-stream");
1802 let content_type = super::ContentType::from(content_type);
1803
1804 if !status.is_client_error() && !status.is_server_error() {
1805 let content = resp.text().await?;
1806 match content_type {
1807 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1808 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
1809 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`")))),
1810 }
1811 } else {
1812 let content = resp.text().await?;
1813 let entity: Option<AcceptRepoTransferError> = serde_json::from_str(&content).ok();
1814 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1815 }
1816}
1817
1818pub async fn actions_disable_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str) -> Result<(), Error<ActionsDisableWorkflowError>> {
1819 let p_path_owner = owner;
1821 let p_path_repo = repo;
1822 let p_path_workflow_id = workflow_id;
1823
1824 let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id));
1825 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1826
1827 if let Some(ref apikey) = configuration.api_key {
1828 let key = apikey.key.clone();
1829 let value = match apikey.prefix {
1830 Some(ref prefix) => format!("{} {}", prefix, key),
1831 None => key,
1832 };
1833 req_builder = req_builder.query(&[("access_token", value)]);
1834 }
1835 if let Some(ref apikey) = configuration.api_key {
1836 let key = apikey.key.clone();
1837 let value = match apikey.prefix {
1838 Some(ref prefix) => format!("{} {}", prefix, key),
1839 None => key,
1840 };
1841 req_builder = req_builder.query(&[("sudo", value)]);
1842 }
1843 if let Some(ref apikey) = configuration.api_key {
1844 let key = apikey.key.clone();
1845 let value = match apikey.prefix {
1846 Some(ref prefix) => format!("{} {}", prefix, key),
1847 None => key,
1848 };
1849 req_builder = req_builder.query(&[("token", value)]);
1850 }
1851 if let Some(ref user_agent) = configuration.user_agent {
1852 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1853 }
1854 if let Some(ref apikey) = configuration.api_key {
1855 let key = apikey.key.clone();
1856 let value = match apikey.prefix {
1857 Some(ref prefix) => format!("{} {}", prefix, key),
1858 None => key,
1859 };
1860 req_builder = req_builder.header("X-GITEA-OTP", value);
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.header("Authorization", 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.header("Sudo", value);
1877 };
1878 if let Some(ref auth_conf) = configuration.basic_auth {
1879 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1880 };
1881
1882 let req = req_builder.build()?;
1883 let resp = configuration.client.execute(req).await?;
1884
1885 let status = resp.status();
1886
1887 if !status.is_client_error() && !status.is_server_error() {
1888 Ok(())
1889 } else {
1890 let content = resp.text().await?;
1891 let entity: Option<ActionsDisableWorkflowError> = serde_json::from_str(&content).ok();
1892 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1893 }
1894}
1895
1896pub async fn actions_dispatch_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str, body: Option<models::CreateActionWorkflowDispatch>) -> Result<(), Error<ActionsDispatchWorkflowError>> {
1897 let p_path_owner = owner;
1899 let p_path_repo = repo;
1900 let p_path_workflow_id = workflow_id;
1901 let p_body_body = body;
1902
1903 let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id));
1904 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1905
1906 if let Some(ref apikey) = configuration.api_key {
1907 let key = apikey.key.clone();
1908 let value = match apikey.prefix {
1909 Some(ref prefix) => format!("{} {}", prefix, key),
1910 None => key,
1911 };
1912 req_builder = req_builder.query(&[("access_token", value)]);
1913 }
1914 if let Some(ref apikey) = configuration.api_key {
1915 let key = apikey.key.clone();
1916 let value = match apikey.prefix {
1917 Some(ref prefix) => format!("{} {}", prefix, key),
1918 None => key,
1919 };
1920 req_builder = req_builder.query(&[("sudo", value)]);
1921 }
1922 if let Some(ref apikey) = configuration.api_key {
1923 let key = apikey.key.clone();
1924 let value = match apikey.prefix {
1925 Some(ref prefix) => format!("{} {}", prefix, key),
1926 None => key,
1927 };
1928 req_builder = req_builder.query(&[("token", value)]);
1929 }
1930 if let Some(ref user_agent) = configuration.user_agent {
1931 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1932 }
1933 if let Some(ref apikey) = configuration.api_key {
1934 let key = apikey.key.clone();
1935 let value = match apikey.prefix {
1936 Some(ref prefix) => format!("{} {}", prefix, key),
1937 None => key,
1938 };
1939 req_builder = req_builder.header("X-GITEA-OTP", value);
1940 };
1941 if let Some(ref apikey) = configuration.api_key {
1942 let key = apikey.key.clone();
1943 let value = match apikey.prefix {
1944 Some(ref prefix) => format!("{} {}", prefix, key),
1945 None => key,
1946 };
1947 req_builder = req_builder.header("Authorization", value);
1948 };
1949 if let Some(ref apikey) = configuration.api_key {
1950 let key = apikey.key.clone();
1951 let value = match apikey.prefix {
1952 Some(ref prefix) => format!("{} {}", prefix, key),
1953 None => key,
1954 };
1955 req_builder = req_builder.header("Sudo", value);
1956 };
1957 if let Some(ref auth_conf) = configuration.basic_auth {
1958 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1959 };
1960 req_builder = req_builder.json(&p_body_body);
1961
1962 let req = req_builder.build()?;
1963 let resp = configuration.client.execute(req).await?;
1964
1965 let status = resp.status();
1966
1967 if !status.is_client_error() && !status.is_server_error() {
1968 Ok(())
1969 } else {
1970 let content = resp.text().await?;
1971 let entity: Option<ActionsDispatchWorkflowError> = serde_json::from_str(&content).ok();
1972 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1973 }
1974}
1975
1976pub async fn actions_enable_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str) -> Result<(), Error<ActionsEnableWorkflowError>> {
1977 let p_path_owner = owner;
1979 let p_path_repo = repo;
1980 let p_path_workflow_id = workflow_id;
1981
1982 let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id));
1983 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1984
1985 if let Some(ref apikey) = configuration.api_key {
1986 let key = apikey.key.clone();
1987 let value = match apikey.prefix {
1988 Some(ref prefix) => format!("{} {}", prefix, key),
1989 None => key,
1990 };
1991 req_builder = req_builder.query(&[("access_token", value)]);
1992 }
1993 if let Some(ref apikey) = configuration.api_key {
1994 let key = apikey.key.clone();
1995 let value = match apikey.prefix {
1996 Some(ref prefix) => format!("{} {}", prefix, key),
1997 None => key,
1998 };
1999 req_builder = req_builder.query(&[("sudo", value)]);
2000 }
2001 if let Some(ref apikey) = configuration.api_key {
2002 let key = apikey.key.clone();
2003 let value = match apikey.prefix {
2004 Some(ref prefix) => format!("{} {}", prefix, key),
2005 None => key,
2006 };
2007 req_builder = req_builder.query(&[("token", value)]);
2008 }
2009 if let Some(ref user_agent) = configuration.user_agent {
2010 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2011 }
2012 if let Some(ref apikey) = configuration.api_key {
2013 let key = apikey.key.clone();
2014 let value = match apikey.prefix {
2015 Some(ref prefix) => format!("{} {}", prefix, key),
2016 None => key,
2017 };
2018 req_builder = req_builder.header("X-GITEA-OTP", value);
2019 };
2020 if let Some(ref apikey) = configuration.api_key {
2021 let key = apikey.key.clone();
2022 let value = match apikey.prefix {
2023 Some(ref prefix) => format!("{} {}", prefix, key),
2024 None => key,
2025 };
2026 req_builder = req_builder.header("Authorization", value);
2027 };
2028 if let Some(ref apikey) = configuration.api_key {
2029 let key = apikey.key.clone();
2030 let value = match apikey.prefix {
2031 Some(ref prefix) => format!("{} {}", prefix, key),
2032 None => key,
2033 };
2034 req_builder = req_builder.header("Sudo", value);
2035 };
2036 if let Some(ref auth_conf) = configuration.basic_auth {
2037 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2038 };
2039
2040 let req = req_builder.build()?;
2041 let resp = configuration.client.execute(req).await?;
2042
2043 let status = resp.status();
2044
2045 if !status.is_client_error() && !status.is_server_error() {
2046 Ok(())
2047 } else {
2048 let content = resp.text().await?;
2049 let entity: Option<ActionsEnableWorkflowError> = serde_json::from_str(&content).ok();
2050 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2051 }
2052}
2053
2054pub async fn actions_get_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str) -> Result<models::ActionWorkflow, Error<ActionsGetWorkflowError>> {
2055 let p_path_owner = owner;
2057 let p_path_repo = repo;
2058 let p_path_workflow_id = workflow_id;
2059
2060 let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id));
2061 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2062
2063 if let Some(ref apikey) = configuration.api_key {
2064 let key = apikey.key.clone();
2065 let value = match apikey.prefix {
2066 Some(ref prefix) => format!("{} {}", prefix, key),
2067 None => key,
2068 };
2069 req_builder = req_builder.query(&[("access_token", value)]);
2070 }
2071 if let Some(ref apikey) = configuration.api_key {
2072 let key = apikey.key.clone();
2073 let value = match apikey.prefix {
2074 Some(ref prefix) => format!("{} {}", prefix, key),
2075 None => key,
2076 };
2077 req_builder = req_builder.query(&[("sudo", value)]);
2078 }
2079 if let Some(ref apikey) = configuration.api_key {
2080 let key = apikey.key.clone();
2081 let value = match apikey.prefix {
2082 Some(ref prefix) => format!("{} {}", prefix, key),
2083 None => key,
2084 };
2085 req_builder = req_builder.query(&[("token", value)]);
2086 }
2087 if let Some(ref user_agent) = configuration.user_agent {
2088 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2089 }
2090 if let Some(ref apikey) = configuration.api_key {
2091 let key = apikey.key.clone();
2092 let value = match apikey.prefix {
2093 Some(ref prefix) => format!("{} {}", prefix, key),
2094 None => key,
2095 };
2096 req_builder = req_builder.header("X-GITEA-OTP", value);
2097 };
2098 if let Some(ref apikey) = configuration.api_key {
2099 let key = apikey.key.clone();
2100 let value = match apikey.prefix {
2101 Some(ref prefix) => format!("{} {}", prefix, key),
2102 None => key,
2103 };
2104 req_builder = req_builder.header("Authorization", value);
2105 };
2106 if let Some(ref apikey) = configuration.api_key {
2107 let key = apikey.key.clone();
2108 let value = match apikey.prefix {
2109 Some(ref prefix) => format!("{} {}", prefix, key),
2110 None => key,
2111 };
2112 req_builder = req_builder.header("Sudo", value);
2113 };
2114 if let Some(ref auth_conf) = configuration.basic_auth {
2115 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2116 };
2117
2118 let req = req_builder.build()?;
2119 let resp = configuration.client.execute(req).await?;
2120
2121 let status = resp.status();
2122 let content_type = resp
2123 .headers()
2124 .get("content-type")
2125 .and_then(|v| v.to_str().ok())
2126 .unwrap_or("application/octet-stream");
2127 let content_type = super::ContentType::from(content_type);
2128
2129 if !status.is_client_error() && !status.is_server_error() {
2130 let content = resp.text().await?;
2131 match content_type {
2132 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2133 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflow`"))),
2134 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::ActionWorkflow`")))),
2135 }
2136 } else {
2137 let content = resp.text().await?;
2138 let entity: Option<ActionsGetWorkflowError> = serde_json::from_str(&content).ok();
2139 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2140 }
2141}
2142
2143pub async fn actions_list_repository_workflows(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::ActionWorkflowResponse, Error<ActionsListRepositoryWorkflowsError>> {
2144 let p_path_owner = owner;
2146 let p_path_repo = repo;
2147
2148 let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
2149 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2150
2151 if let Some(ref apikey) = configuration.api_key {
2152 let key = apikey.key.clone();
2153 let value = match apikey.prefix {
2154 Some(ref prefix) => format!("{} {}", prefix, key),
2155 None => key,
2156 };
2157 req_builder = req_builder.query(&[("access_token", value)]);
2158 }
2159 if let Some(ref apikey) = configuration.api_key {
2160 let key = apikey.key.clone();
2161 let value = match apikey.prefix {
2162 Some(ref prefix) => format!("{} {}", prefix, key),
2163 None => key,
2164 };
2165 req_builder = req_builder.query(&[("sudo", value)]);
2166 }
2167 if let Some(ref apikey) = configuration.api_key {
2168 let key = apikey.key.clone();
2169 let value = match apikey.prefix {
2170 Some(ref prefix) => format!("{} {}", prefix, key),
2171 None => key,
2172 };
2173 req_builder = req_builder.query(&[("token", value)]);
2174 }
2175 if let Some(ref user_agent) = configuration.user_agent {
2176 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2177 }
2178 if let Some(ref apikey) = configuration.api_key {
2179 let key = apikey.key.clone();
2180 let value = match apikey.prefix {
2181 Some(ref prefix) => format!("{} {}", prefix, key),
2182 None => key,
2183 };
2184 req_builder = req_builder.header("X-GITEA-OTP", value);
2185 };
2186 if let Some(ref apikey) = configuration.api_key {
2187 let key = apikey.key.clone();
2188 let value = match apikey.prefix {
2189 Some(ref prefix) => format!("{} {}", prefix, key),
2190 None => key,
2191 };
2192 req_builder = req_builder.header("Authorization", value);
2193 };
2194 if let Some(ref apikey) = configuration.api_key {
2195 let key = apikey.key.clone();
2196 let value = match apikey.prefix {
2197 Some(ref prefix) => format!("{} {}", prefix, key),
2198 None => key,
2199 };
2200 req_builder = req_builder.header("Sudo", value);
2201 };
2202 if let Some(ref auth_conf) = configuration.basic_auth {
2203 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2204 };
2205
2206 let req = req_builder.build()?;
2207 let resp = configuration.client.execute(req).await?;
2208
2209 let status = resp.status();
2210 let content_type = resp
2211 .headers()
2212 .get("content-type")
2213 .and_then(|v| v.to_str().ok())
2214 .unwrap_or("application/octet-stream");
2215 let content_type = super::ContentType::from(content_type);
2216
2217 if !status.is_client_error() && !status.is_server_error() {
2218 let content = resp.text().await?;
2219 match content_type {
2220 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2221 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowResponse`"))),
2222 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowResponse`")))),
2223 }
2224 } else {
2225 let content = resp.text().await?;
2226 let entity: Option<ActionsListRepositoryWorkflowsError> = serde_json::from_str(&content).ok();
2227 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2228 }
2229}
2230
2231pub async fn create_current_user_repo(configuration: &configuration::Configuration, body: Option<models::CreateRepoOption>) -> Result<models::Repository, Error<CreateCurrentUserRepoError>> {
2232 let p_body_body = body;
2234
2235 let uri_str = format!("{}/user/repos", configuration.base_path);
2236 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2237
2238 if let Some(ref apikey) = configuration.api_key {
2239 let key = apikey.key.clone();
2240 let value = match apikey.prefix {
2241 Some(ref prefix) => format!("{} {}", prefix, key),
2242 None => key,
2243 };
2244 req_builder = req_builder.query(&[("access_token", value)]);
2245 }
2246 if let Some(ref apikey) = configuration.api_key {
2247 let key = apikey.key.clone();
2248 let value = match apikey.prefix {
2249 Some(ref prefix) => format!("{} {}", prefix, key),
2250 None => key,
2251 };
2252 req_builder = req_builder.query(&[("sudo", value)]);
2253 }
2254 if let Some(ref apikey) = configuration.api_key {
2255 let key = apikey.key.clone();
2256 let value = match apikey.prefix {
2257 Some(ref prefix) => format!("{} {}", prefix, key),
2258 None => key,
2259 };
2260 req_builder = req_builder.query(&[("token", value)]);
2261 }
2262 if let Some(ref user_agent) = configuration.user_agent {
2263 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2264 }
2265 if let Some(ref apikey) = configuration.api_key {
2266 let key = apikey.key.clone();
2267 let value = match apikey.prefix {
2268 Some(ref prefix) => format!("{} {}", prefix, key),
2269 None => key,
2270 };
2271 req_builder = req_builder.header("X-GITEA-OTP", value);
2272 };
2273 if let Some(ref apikey) = configuration.api_key {
2274 let key = apikey.key.clone();
2275 let value = match apikey.prefix {
2276 Some(ref prefix) => format!("{} {}", prefix, key),
2277 None => key,
2278 };
2279 req_builder = req_builder.header("Authorization", value);
2280 };
2281 if let Some(ref apikey) = configuration.api_key {
2282 let key = apikey.key.clone();
2283 let value = match apikey.prefix {
2284 Some(ref prefix) => format!("{} {}", prefix, key),
2285 None => key,
2286 };
2287 req_builder = req_builder.header("Sudo", value);
2288 };
2289 if let Some(ref auth_conf) = configuration.basic_auth {
2290 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2291 };
2292 req_builder = req_builder.json(&p_body_body);
2293
2294 let req = req_builder.build()?;
2295 let resp = configuration.client.execute(req).await?;
2296
2297 let status = resp.status();
2298 let content_type = resp
2299 .headers()
2300 .get("content-type")
2301 .and_then(|v| v.to_str().ok())
2302 .unwrap_or("application/octet-stream");
2303 let content_type = super::ContentType::from(content_type);
2304
2305 if !status.is_client_error() && !status.is_server_error() {
2306 let content = resp.text().await?;
2307 match content_type {
2308 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2309 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
2310 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`")))),
2311 }
2312 } else {
2313 let content = resp.text().await?;
2314 let entity: Option<CreateCurrentUserRepoError> = serde_json::from_str(&content).ok();
2315 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2316 }
2317}
2318
2319pub async fn create_fork(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateForkOption>) -> Result<models::Repository, Error<CreateForkError>> {
2320 let p_path_owner = owner;
2322 let p_path_repo = repo;
2323 let p_body_body = body;
2324
2325 let uri_str = format!("{}/repos/{owner}/{repo}/forks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
2326 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
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.query(&[("access_token", 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.query(&[("sudo", value)]);
2343 }
2344 if let Some(ref apikey) = configuration.api_key {
2345 let key = apikey.key.clone();
2346 let value = match apikey.prefix {
2347 Some(ref prefix) => format!("{} {}", prefix, key),
2348 None => key,
2349 };
2350 req_builder = req_builder.query(&[("token", value)]);
2351 }
2352 if let Some(ref user_agent) = configuration.user_agent {
2353 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2354 }
2355 if let Some(ref apikey) = configuration.api_key {
2356 let key = apikey.key.clone();
2357 let value = match apikey.prefix {
2358 Some(ref prefix) => format!("{} {}", prefix, key),
2359 None => key,
2360 };
2361 req_builder = req_builder.header("X-GITEA-OTP", value);
2362 };
2363 if let Some(ref apikey) = configuration.api_key {
2364 let key = apikey.key.clone();
2365 let value = match apikey.prefix {
2366 Some(ref prefix) => format!("{} {}", prefix, key),
2367 None => key,
2368 };
2369 req_builder = req_builder.header("Authorization", value);
2370 };
2371 if let Some(ref apikey) = configuration.api_key {
2372 let key = apikey.key.clone();
2373 let value = match apikey.prefix {
2374 Some(ref prefix) => format!("{} {}", prefix, key),
2375 None => key,
2376 };
2377 req_builder = req_builder.header("Sudo", value);
2378 };
2379 if let Some(ref auth_conf) = configuration.basic_auth {
2380 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2381 };
2382 req_builder = req_builder.json(&p_body_body);
2383
2384 let req = req_builder.build()?;
2385 let resp = configuration.client.execute(req).await?;
2386
2387 let status = resp.status();
2388 let content_type = resp
2389 .headers()
2390 .get("content-type")
2391 .and_then(|v| v.to_str().ok())
2392 .unwrap_or("application/octet-stream");
2393 let content_type = super::ContentType::from(content_type);
2394
2395 if !status.is_client_error() && !status.is_server_error() {
2396 let content = resp.text().await?;
2397 match content_type {
2398 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2399 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
2400 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`")))),
2401 }
2402 } else {
2403 let content = resp.text().await?;
2404 let entity: Option<CreateForkError> = serde_json::from_str(&content).ok();
2405 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2406 }
2407}
2408
2409pub async fn create_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str, body: Option<models::CreateVariableOption>) -> Result<(), Error<CreateRepoVariableError>> {
2410 let p_path_owner = owner;
2412 let p_path_repo = repo;
2413 let p_path_variablename = variablename;
2414 let p_body_body = body;
2415
2416 let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename));
2417 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2418
2419 if let Some(ref apikey) = configuration.api_key {
2420 let key = apikey.key.clone();
2421 let value = match apikey.prefix {
2422 Some(ref prefix) => format!("{} {}", prefix, key),
2423 None => key,
2424 };
2425 req_builder = req_builder.query(&[("access_token", value)]);
2426 }
2427 if let Some(ref apikey) = configuration.api_key {
2428 let key = apikey.key.clone();
2429 let value = match apikey.prefix {
2430 Some(ref prefix) => format!("{} {}", prefix, key),
2431 None => key,
2432 };
2433 req_builder = req_builder.query(&[("sudo", value)]);
2434 }
2435 if let Some(ref apikey) = configuration.api_key {
2436 let key = apikey.key.clone();
2437 let value = match apikey.prefix {
2438 Some(ref prefix) => format!("{} {}", prefix, key),
2439 None => key,
2440 };
2441 req_builder = req_builder.query(&[("token", value)]);
2442 }
2443 if let Some(ref user_agent) = configuration.user_agent {
2444 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", 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.header("Authorization", 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.header("Sudo", value);
2469 };
2470 if let Some(ref auth_conf) = configuration.basic_auth {
2471 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2472 };
2473 req_builder = req_builder.json(&p_body_body);
2474
2475 let req = req_builder.build()?;
2476 let resp = configuration.client.execute(req).await?;
2477
2478 let status = resp.status();
2479
2480 if !status.is_client_error() && !status.is_server_error() {
2481 Ok(())
2482 } else {
2483 let content = resp.text().await?;
2484 let entity: Option<CreateRepoVariableError> = serde_json::from_str(&content).ok();
2485 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2486 }
2487}
2488
2489pub async fn delete_action_run(configuration: &configuration::Configuration, owner: &str, repo: &str, run: i32) -> Result<(), Error<DeleteActionRunError>> {
2490 let p_path_owner = owner;
2492 let p_path_repo = repo;
2493 let p_path_run = run;
2494
2495 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=p_path_run);
2496 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2497
2498 if let Some(ref apikey) = configuration.api_key {
2499 let key = apikey.key.clone();
2500 let value = match apikey.prefix {
2501 Some(ref prefix) => format!("{} {}", prefix, key),
2502 None => key,
2503 };
2504 req_builder = req_builder.query(&[("access_token", value)]);
2505 }
2506 if let Some(ref apikey) = configuration.api_key {
2507 let key = apikey.key.clone();
2508 let value = match apikey.prefix {
2509 Some(ref prefix) => format!("{} {}", prefix, key),
2510 None => key,
2511 };
2512 req_builder = req_builder.query(&[("sudo", value)]);
2513 }
2514 if let Some(ref apikey) = configuration.api_key {
2515 let key = apikey.key.clone();
2516 let value = match apikey.prefix {
2517 Some(ref prefix) => format!("{} {}", prefix, key),
2518 None => key,
2519 };
2520 req_builder = req_builder.query(&[("token", value)]);
2521 }
2522 if let Some(ref user_agent) = configuration.user_agent {
2523 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2524 }
2525 if let Some(ref apikey) = configuration.api_key {
2526 let key = apikey.key.clone();
2527 let value = match apikey.prefix {
2528 Some(ref prefix) => format!("{} {}", prefix, key),
2529 None => key,
2530 };
2531 req_builder = req_builder.header("X-GITEA-OTP", value);
2532 };
2533 if let Some(ref apikey) = configuration.api_key {
2534 let key = apikey.key.clone();
2535 let value = match apikey.prefix {
2536 Some(ref prefix) => format!("{} {}", prefix, key),
2537 None => key,
2538 };
2539 req_builder = req_builder.header("Authorization", value);
2540 };
2541 if let Some(ref apikey) = configuration.api_key {
2542 let key = apikey.key.clone();
2543 let value = match apikey.prefix {
2544 Some(ref prefix) => format!("{} {}", prefix, key),
2545 None => key,
2546 };
2547 req_builder = req_builder.header("Sudo", value);
2548 };
2549 if let Some(ref auth_conf) = configuration.basic_auth {
2550 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2551 };
2552
2553 let req = req_builder.build()?;
2554 let resp = configuration.client.execute(req).await?;
2555
2556 let status = resp.status();
2557
2558 if !status.is_client_error() && !status.is_server_error() {
2559 Ok(())
2560 } else {
2561 let content = resp.text().await?;
2562 let entity: Option<DeleteActionRunError> = serde_json::from_str(&content).ok();
2563 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2564 }
2565}
2566
2567pub async fn delete_artifact(configuration: &configuration::Configuration, owner: &str, repo: &str, artifact_id: &str) -> Result<(), Error<DeleteArtifactError>> {
2568 let p_path_owner = owner;
2570 let p_path_repo = repo;
2571 let p_path_artifact_id = artifact_id;
2572
2573 let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts/{artifact_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), artifact_id=crate::apis::urlencode(p_path_artifact_id));
2574 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2575
2576 if let Some(ref apikey) = configuration.api_key {
2577 let key = apikey.key.clone();
2578 let value = match apikey.prefix {
2579 Some(ref prefix) => format!("{} {}", prefix, key),
2580 None => key,
2581 };
2582 req_builder = req_builder.query(&[("access_token", value)]);
2583 }
2584 if let Some(ref apikey) = configuration.api_key {
2585 let key = apikey.key.clone();
2586 let value = match apikey.prefix {
2587 Some(ref prefix) => format!("{} {}", prefix, key),
2588 None => key,
2589 };
2590 req_builder = req_builder.query(&[("sudo", value)]);
2591 }
2592 if let Some(ref apikey) = configuration.api_key {
2593 let key = apikey.key.clone();
2594 let value = match apikey.prefix {
2595 Some(ref prefix) => format!("{} {}", prefix, key),
2596 None => key,
2597 };
2598 req_builder = req_builder.query(&[("token", value)]);
2599 }
2600 if let Some(ref user_agent) = configuration.user_agent {
2601 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2602 }
2603 if let Some(ref apikey) = configuration.api_key {
2604 let key = apikey.key.clone();
2605 let value = match apikey.prefix {
2606 Some(ref prefix) => format!("{} {}", prefix, key),
2607 None => key,
2608 };
2609 req_builder = req_builder.header("X-GITEA-OTP", value);
2610 };
2611 if let Some(ref apikey) = configuration.api_key {
2612 let key = apikey.key.clone();
2613 let value = match apikey.prefix {
2614 Some(ref prefix) => format!("{} {}", prefix, key),
2615 None => key,
2616 };
2617 req_builder = req_builder.header("Authorization", value);
2618 };
2619 if let Some(ref apikey) = configuration.api_key {
2620 let key = apikey.key.clone();
2621 let value = match apikey.prefix {
2622 Some(ref prefix) => format!("{} {}", prefix, key),
2623 None => key,
2624 };
2625 req_builder = req_builder.header("Sudo", value);
2626 };
2627 if let Some(ref auth_conf) = configuration.basic_auth {
2628 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2629 };
2630
2631 let req = req_builder.build()?;
2632 let resp = configuration.client.execute(req).await?;
2633
2634 let status = resp.status();
2635
2636 if !status.is_client_error() && !status.is_server_error() {
2637 Ok(())
2638 } else {
2639 let content = resp.text().await?;
2640 let entity: Option<DeleteArtifactError> = serde_json::from_str(&content).ok();
2641 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2642 }
2643}
2644
2645pub async fn delete_repo_runner(configuration: &configuration::Configuration, owner: &str, repo: &str, runner_id: &str) -> Result<(), Error<DeleteRepoRunnerError>> {
2646 let p_path_owner = owner;
2648 let p_path_repo = repo;
2649 let p_path_runner_id = runner_id;
2650
2651 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/{runner_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), runner_id=crate::apis::urlencode(p_path_runner_id));
2652 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2653
2654 if let Some(ref apikey) = configuration.api_key {
2655 let key = apikey.key.clone();
2656 let value = match apikey.prefix {
2657 Some(ref prefix) => format!("{} {}", prefix, key),
2658 None => key,
2659 };
2660 req_builder = req_builder.query(&[("access_token", value)]);
2661 }
2662 if let Some(ref apikey) = configuration.api_key {
2663 let key = apikey.key.clone();
2664 let value = match apikey.prefix {
2665 Some(ref prefix) => format!("{} {}", prefix, key),
2666 None => key,
2667 };
2668 req_builder = req_builder.query(&[("sudo", value)]);
2669 }
2670 if let Some(ref apikey) = configuration.api_key {
2671 let key = apikey.key.clone();
2672 let value = match apikey.prefix {
2673 Some(ref prefix) => format!("{} {}", prefix, key),
2674 None => key,
2675 };
2676 req_builder = req_builder.query(&[("token", value)]);
2677 }
2678 if let Some(ref user_agent) = configuration.user_agent {
2679 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2680 }
2681 if let Some(ref apikey) = configuration.api_key {
2682 let key = apikey.key.clone();
2683 let value = match apikey.prefix {
2684 Some(ref prefix) => format!("{} {}", prefix, key),
2685 None => key,
2686 };
2687 req_builder = req_builder.header("X-GITEA-OTP", value);
2688 };
2689 if let Some(ref apikey) = configuration.api_key {
2690 let key = apikey.key.clone();
2691 let value = match apikey.prefix {
2692 Some(ref prefix) => format!("{} {}", prefix, key),
2693 None => key,
2694 };
2695 req_builder = req_builder.header("Authorization", value);
2696 };
2697 if let Some(ref apikey) = configuration.api_key {
2698 let key = apikey.key.clone();
2699 let value = match apikey.prefix {
2700 Some(ref prefix) => format!("{} {}", prefix, key),
2701 None => key,
2702 };
2703 req_builder = req_builder.header("Sudo", value);
2704 };
2705 if let Some(ref auth_conf) = configuration.basic_auth {
2706 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2707 };
2708
2709 let req = req_builder.build()?;
2710 let resp = configuration.client.execute(req).await?;
2711
2712 let status = resp.status();
2713
2714 if !status.is_client_error() && !status.is_server_error() {
2715 Ok(())
2716 } else {
2717 let content = resp.text().await?;
2718 let entity: Option<DeleteRepoRunnerError> = serde_json::from_str(&content).ok();
2719 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2720 }
2721}
2722
2723pub async fn delete_repo_secret(configuration: &configuration::Configuration, owner: &str, repo: &str, secretname: &str) -> Result<(), Error<DeleteRepoSecretError>> {
2724 let p_path_owner = owner;
2726 let p_path_repo = repo;
2727 let p_path_secretname = secretname;
2728
2729 let uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets/{secretname}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), secretname=crate::apis::urlencode(p_path_secretname));
2730 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2731
2732 if let Some(ref apikey) = configuration.api_key {
2733 let key = apikey.key.clone();
2734 let value = match apikey.prefix {
2735 Some(ref prefix) => format!("{} {}", prefix, key),
2736 None => key,
2737 };
2738 req_builder = req_builder.query(&[("access_token", value)]);
2739 }
2740 if let Some(ref apikey) = configuration.api_key {
2741 let key = apikey.key.clone();
2742 let value = match apikey.prefix {
2743 Some(ref prefix) => format!("{} {}", prefix, key),
2744 None => key,
2745 };
2746 req_builder = req_builder.query(&[("sudo", value)]);
2747 }
2748 if let Some(ref apikey) = configuration.api_key {
2749 let key = apikey.key.clone();
2750 let value = match apikey.prefix {
2751 Some(ref prefix) => format!("{} {}", prefix, key),
2752 None => key,
2753 };
2754 req_builder = req_builder.query(&[("token", value)]);
2755 }
2756 if let Some(ref user_agent) = configuration.user_agent {
2757 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2758 }
2759 if let Some(ref apikey) = configuration.api_key {
2760 let key = apikey.key.clone();
2761 let value = match apikey.prefix {
2762 Some(ref prefix) => format!("{} {}", prefix, key),
2763 None => key,
2764 };
2765 req_builder = req_builder.header("X-GITEA-OTP", value);
2766 };
2767 if let Some(ref apikey) = configuration.api_key {
2768 let key = apikey.key.clone();
2769 let value = match apikey.prefix {
2770 Some(ref prefix) => format!("{} {}", prefix, key),
2771 None => key,
2772 };
2773 req_builder = req_builder.header("Authorization", value);
2774 };
2775 if let Some(ref apikey) = configuration.api_key {
2776 let key = apikey.key.clone();
2777 let value = match apikey.prefix {
2778 Some(ref prefix) => format!("{} {}", prefix, key),
2779 None => key,
2780 };
2781 req_builder = req_builder.header("Sudo", value);
2782 };
2783 if let Some(ref auth_conf) = configuration.basic_auth {
2784 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2785 };
2786
2787 let req = req_builder.build()?;
2788 let resp = configuration.client.execute(req).await?;
2789
2790 let status = resp.status();
2791
2792 if !status.is_client_error() && !status.is_server_error() {
2793 Ok(())
2794 } else {
2795 let content = resp.text().await?;
2796 let entity: Option<DeleteRepoSecretError> = serde_json::from_str(&content).ok();
2797 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2798 }
2799}
2800
2801pub async fn delete_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str) -> Result<models::ActionVariable, Error<DeleteRepoVariableError>> {
2802 let p_path_owner = owner;
2804 let p_path_repo = repo;
2805 let p_path_variablename = variablename;
2806
2807 let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename));
2808 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2809
2810 if let Some(ref apikey) = configuration.api_key {
2811 let key = apikey.key.clone();
2812 let value = match apikey.prefix {
2813 Some(ref prefix) => format!("{} {}", prefix, key),
2814 None => key,
2815 };
2816 req_builder = req_builder.query(&[("access_token", value)]);
2817 }
2818 if let Some(ref apikey) = configuration.api_key {
2819 let key = apikey.key.clone();
2820 let value = match apikey.prefix {
2821 Some(ref prefix) => format!("{} {}", prefix, key),
2822 None => key,
2823 };
2824 req_builder = req_builder.query(&[("sudo", value)]);
2825 }
2826 if let Some(ref apikey) = configuration.api_key {
2827 let key = apikey.key.clone();
2828 let value = match apikey.prefix {
2829 Some(ref prefix) => format!("{} {}", prefix, key),
2830 None => key,
2831 };
2832 req_builder = req_builder.query(&[("token", value)]);
2833 }
2834 if let Some(ref user_agent) = configuration.user_agent {
2835 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2836 }
2837 if let Some(ref apikey) = configuration.api_key {
2838 let key = apikey.key.clone();
2839 let value = match apikey.prefix {
2840 Some(ref prefix) => format!("{} {}", prefix, key),
2841 None => key,
2842 };
2843 req_builder = req_builder.header("X-GITEA-OTP", value);
2844 };
2845 if let Some(ref apikey) = configuration.api_key {
2846 let key = apikey.key.clone();
2847 let value = match apikey.prefix {
2848 Some(ref prefix) => format!("{} {}", prefix, key),
2849 None => key,
2850 };
2851 req_builder = req_builder.header("Authorization", value);
2852 };
2853 if let Some(ref apikey) = configuration.api_key {
2854 let key = apikey.key.clone();
2855 let value = match apikey.prefix {
2856 Some(ref prefix) => format!("{} {}", prefix, key),
2857 None => key,
2858 };
2859 req_builder = req_builder.header("Sudo", value);
2860 };
2861 if let Some(ref auth_conf) = configuration.basic_auth {
2862 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2863 };
2864
2865 let req = req_builder.build()?;
2866 let resp = configuration.client.execute(req).await?;
2867
2868 let status = resp.status();
2869 let content_type = resp
2870 .headers()
2871 .get("content-type")
2872 .and_then(|v| v.to_str().ok())
2873 .unwrap_or("application/octet-stream");
2874 let content_type = super::ContentType::from(content_type);
2875
2876 if !status.is_client_error() && !status.is_server_error() {
2877 let content = resp.text().await?;
2878 match content_type {
2879 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2880 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))),
2881 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`")))),
2882 }
2883 } else {
2884 let content = resp.text().await?;
2885 let entity: Option<DeleteRepoVariableError> = serde_json::from_str(&content).ok();
2886 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2887 }
2888}
2889
2890pub async fn download_actions_run_job_logs(configuration: &configuration::Configuration, owner: &str, repo: &str, job_id: i32) -> Result<(), Error<DownloadActionsRunJobLogsError>> {
2891 let p_path_owner = owner;
2893 let p_path_repo = repo;
2894 let p_path_job_id = job_id;
2895
2896 let uri_str = format!("{}/repos/{owner}/{repo}/actions/jobs/{job_id}/logs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), job_id=p_path_job_id);
2897 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2898
2899 if let Some(ref apikey) = configuration.api_key {
2900 let key = apikey.key.clone();
2901 let value = match apikey.prefix {
2902 Some(ref prefix) => format!("{} {}", prefix, key),
2903 None => key,
2904 };
2905 req_builder = req_builder.query(&[("access_token", value)]);
2906 }
2907 if let Some(ref apikey) = configuration.api_key {
2908 let key = apikey.key.clone();
2909 let value = match apikey.prefix {
2910 Some(ref prefix) => format!("{} {}", prefix, key),
2911 None => key,
2912 };
2913 req_builder = req_builder.query(&[("sudo", value)]);
2914 }
2915 if let Some(ref apikey) = configuration.api_key {
2916 let key = apikey.key.clone();
2917 let value = match apikey.prefix {
2918 Some(ref prefix) => format!("{} {}", prefix, key),
2919 None => key,
2920 };
2921 req_builder = req_builder.query(&[("token", value)]);
2922 }
2923 if let Some(ref user_agent) = configuration.user_agent {
2924 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2925 }
2926 if let Some(ref apikey) = configuration.api_key {
2927 let key = apikey.key.clone();
2928 let value = match apikey.prefix {
2929 Some(ref prefix) => format!("{} {}", prefix, key),
2930 None => key,
2931 };
2932 req_builder = req_builder.header("X-GITEA-OTP", value);
2933 };
2934 if let Some(ref apikey) = configuration.api_key {
2935 let key = apikey.key.clone();
2936 let value = match apikey.prefix {
2937 Some(ref prefix) => format!("{} {}", prefix, key),
2938 None => key,
2939 };
2940 req_builder = req_builder.header("Authorization", value);
2941 };
2942 if let Some(ref apikey) = configuration.api_key {
2943 let key = apikey.key.clone();
2944 let value = match apikey.prefix {
2945 Some(ref prefix) => format!("{} {}", prefix, key),
2946 None => key,
2947 };
2948 req_builder = req_builder.header("Sudo", value);
2949 };
2950 if let Some(ref auth_conf) = configuration.basic_auth {
2951 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2952 };
2953
2954 let req = req_builder.build()?;
2955 let resp = configuration.client.execute(req).await?;
2956
2957 let status = resp.status();
2958
2959 if !status.is_client_error() && !status.is_server_error() {
2960 Ok(())
2961 } else {
2962 let content = resp.text().await?;
2963 let entity: Option<DownloadActionsRunJobLogsError> = serde_json::from_str(&content).ok();
2964 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2965 }
2966}
2967
2968pub async fn download_artifact(configuration: &configuration::Configuration, owner: &str, repo: &str, artifact_id: &str) -> Result<(), Error<DownloadArtifactError>> {
2969 let p_path_owner = owner;
2971 let p_path_repo = repo;
2972 let p_path_artifact_id = artifact_id;
2973
2974 let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), artifact_id=crate::apis::urlencode(p_path_artifact_id));
2975 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2976
2977 if let Some(ref apikey) = configuration.api_key {
2978 let key = apikey.key.clone();
2979 let value = match apikey.prefix {
2980 Some(ref prefix) => format!("{} {}", prefix, key),
2981 None => key,
2982 };
2983 req_builder = req_builder.query(&[("access_token", value)]);
2984 }
2985 if let Some(ref apikey) = configuration.api_key {
2986 let key = apikey.key.clone();
2987 let value = match apikey.prefix {
2988 Some(ref prefix) => format!("{} {}", prefix, key),
2989 None => key,
2990 };
2991 req_builder = req_builder.query(&[("sudo", value)]);
2992 }
2993 if let Some(ref apikey) = configuration.api_key {
2994 let key = apikey.key.clone();
2995 let value = match apikey.prefix {
2996 Some(ref prefix) => format!("{} {}", prefix, key),
2997 None => key,
2998 };
2999 req_builder = req_builder.query(&[("token", value)]);
3000 }
3001 if let Some(ref user_agent) = configuration.user_agent {
3002 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3003 }
3004 if let Some(ref apikey) = configuration.api_key {
3005 let key = apikey.key.clone();
3006 let value = match apikey.prefix {
3007 Some(ref prefix) => format!("{} {}", prefix, key),
3008 None => key,
3009 };
3010 req_builder = req_builder.header("X-GITEA-OTP", value);
3011 };
3012 if let Some(ref apikey) = configuration.api_key {
3013 let key = apikey.key.clone();
3014 let value = match apikey.prefix {
3015 Some(ref prefix) => format!("{} {}", prefix, key),
3016 None => key,
3017 };
3018 req_builder = req_builder.header("Authorization", value);
3019 };
3020 if let Some(ref apikey) = configuration.api_key {
3021 let key = apikey.key.clone();
3022 let value = match apikey.prefix {
3023 Some(ref prefix) => format!("{} {}", prefix, key),
3024 None => key,
3025 };
3026 req_builder = req_builder.header("Sudo", value);
3027 };
3028 if let Some(ref auth_conf) = configuration.basic_auth {
3029 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3030 };
3031
3032 let req = req_builder.build()?;
3033 let resp = configuration.client.execute(req).await?;
3034
3035 let status = resp.status();
3036
3037 if !status.is_client_error() && !status.is_server_error() {
3038 Ok(())
3039 } else {
3040 let content = resp.text().await?;
3041 let entity: Option<DownloadArtifactError> = serde_json::from_str(&content).ok();
3042 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3043 }
3044}
3045
3046pub async fn generate_repo(configuration: &configuration::Configuration, template_owner: &str, template_repo: &str, body: Option<models::GenerateRepoOption>) -> Result<models::Repository, Error<GenerateRepoError>> {
3047 let p_path_template_owner = template_owner;
3049 let p_path_template_repo = template_repo;
3050 let p_body_body = body;
3051
3052 let uri_str = format!("{}/repos/{template_owner}/{template_repo}/generate", configuration.base_path, template_owner=crate::apis::urlencode(p_path_template_owner), template_repo=crate::apis::urlencode(p_path_template_repo));
3053 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3054
3055 if let Some(ref apikey) = configuration.api_key {
3056 let key = apikey.key.clone();
3057 let value = match apikey.prefix {
3058 Some(ref prefix) => format!("{} {}", prefix, key),
3059 None => key,
3060 };
3061 req_builder = req_builder.query(&[("access_token", value)]);
3062 }
3063 if let Some(ref apikey) = configuration.api_key {
3064 let key = apikey.key.clone();
3065 let value = match apikey.prefix {
3066 Some(ref prefix) => format!("{} {}", prefix, key),
3067 None => key,
3068 };
3069 req_builder = req_builder.query(&[("sudo", value)]);
3070 }
3071 if let Some(ref apikey) = configuration.api_key {
3072 let key = apikey.key.clone();
3073 let value = match apikey.prefix {
3074 Some(ref prefix) => format!("{} {}", prefix, key),
3075 None => key,
3076 };
3077 req_builder = req_builder.query(&[("token", value)]);
3078 }
3079 if let Some(ref user_agent) = configuration.user_agent {
3080 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3081 }
3082 if let Some(ref apikey) = configuration.api_key {
3083 let key = apikey.key.clone();
3084 let value = match apikey.prefix {
3085 Some(ref prefix) => format!("{} {}", prefix, key),
3086 None => key,
3087 };
3088 req_builder = req_builder.header("X-GITEA-OTP", value);
3089 };
3090 if let Some(ref apikey) = configuration.api_key {
3091 let key = apikey.key.clone();
3092 let value = match apikey.prefix {
3093 Some(ref prefix) => format!("{} {}", prefix, key),
3094 None => key,
3095 };
3096 req_builder = req_builder.header("Authorization", value);
3097 };
3098 if let Some(ref apikey) = configuration.api_key {
3099 let key = apikey.key.clone();
3100 let value = match apikey.prefix {
3101 Some(ref prefix) => format!("{} {}", prefix, key),
3102 None => key,
3103 };
3104 req_builder = req_builder.header("Sudo", value);
3105 };
3106 if let Some(ref auth_conf) = configuration.basic_auth {
3107 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3108 };
3109 req_builder = req_builder.json(&p_body_body);
3110
3111 let req = req_builder.build()?;
3112 let resp = configuration.client.execute(req).await?;
3113
3114 let status = resp.status();
3115 let content_type = resp
3116 .headers()
3117 .get("content-type")
3118 .and_then(|v| v.to_str().ok())
3119 .unwrap_or("application/octet-stream");
3120 let content_type = super::ContentType::from(content_type);
3121
3122 if !status.is_client_error() && !status.is_server_error() {
3123 let content = resp.text().await?;
3124 match content_type {
3125 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3126 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
3127 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`")))),
3128 }
3129 } else {
3130 let content = resp.text().await?;
3131 let entity: Option<GenerateRepoError> = serde_json::from_str(&content).ok();
3132 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3133 }
3134}
3135
3136pub async fn get_annotated_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str) -> Result<models::AnnotatedTag, Error<GetAnnotatedTagError>> {
3137 let p_path_owner = owner;
3139 let p_path_repo = repo;
3140 let p_path_sha = sha;
3141
3142 let uri_str = format!("{}/repos/{owner}/{repo}/git/tags/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
3143 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
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.query(&[("access_token", 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.query(&[("sudo", value)]);
3160 }
3161 if let Some(ref apikey) = configuration.api_key {
3162 let key = apikey.key.clone();
3163 let value = match apikey.prefix {
3164 Some(ref prefix) => format!("{} {}", prefix, key),
3165 None => key,
3166 };
3167 req_builder = req_builder.query(&[("token", value)]);
3168 }
3169 if let Some(ref user_agent) = configuration.user_agent {
3170 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3171 }
3172 if let Some(ref apikey) = configuration.api_key {
3173 let key = apikey.key.clone();
3174 let value = match apikey.prefix {
3175 Some(ref prefix) => format!("{} {}", prefix, key),
3176 None => key,
3177 };
3178 req_builder = req_builder.header("X-GITEA-OTP", value);
3179 };
3180 if let Some(ref apikey) = configuration.api_key {
3181 let key = apikey.key.clone();
3182 let value = match apikey.prefix {
3183 Some(ref prefix) => format!("{} {}", prefix, key),
3184 None => key,
3185 };
3186 req_builder = req_builder.header("Authorization", value);
3187 };
3188 if let Some(ref apikey) = configuration.api_key {
3189 let key = apikey.key.clone();
3190 let value = match apikey.prefix {
3191 Some(ref prefix) => format!("{} {}", prefix, key),
3192 None => key,
3193 };
3194 req_builder = req_builder.header("Sudo", value);
3195 };
3196 if let Some(ref auth_conf) = configuration.basic_auth {
3197 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3198 };
3199
3200 let req = req_builder.build()?;
3201 let resp = configuration.client.execute(req).await?;
3202
3203 let status = resp.status();
3204 let content_type = resp
3205 .headers()
3206 .get("content-type")
3207 .and_then(|v| v.to_str().ok())
3208 .unwrap_or("application/octet-stream");
3209 let content_type = super::ContentType::from(content_type);
3210
3211 if !status.is_client_error() && !status.is_server_error() {
3212 let content = resp.text().await?;
3213 match content_type {
3214 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3215 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AnnotatedTag`"))),
3216 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::AnnotatedTag`")))),
3217 }
3218 } else {
3219 let content = resp.text().await?;
3220 let entity: Option<GetAnnotatedTagError> = serde_json::from_str(&content).ok();
3221 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3222 }
3223}
3224
3225pub async fn get_artifact(configuration: &configuration::Configuration, owner: &str, repo: &str, artifact_id: &str) -> Result<models::ActionArtifact, Error<GetArtifactError>> {
3226 let p_path_owner = owner;
3228 let p_path_repo = repo;
3229 let p_path_artifact_id = artifact_id;
3230
3231 let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts/{artifact_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), artifact_id=crate::apis::urlencode(p_path_artifact_id));
3232 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3233
3234 if let Some(ref apikey) = configuration.api_key {
3235 let key = apikey.key.clone();
3236 let value = match apikey.prefix {
3237 Some(ref prefix) => format!("{} {}", prefix, key),
3238 None => key,
3239 };
3240 req_builder = req_builder.query(&[("access_token", value)]);
3241 }
3242 if let Some(ref apikey) = configuration.api_key {
3243 let key = apikey.key.clone();
3244 let value = match apikey.prefix {
3245 Some(ref prefix) => format!("{} {}", prefix, key),
3246 None => key,
3247 };
3248 req_builder = req_builder.query(&[("sudo", value)]);
3249 }
3250 if let Some(ref apikey) = configuration.api_key {
3251 let key = apikey.key.clone();
3252 let value = match apikey.prefix {
3253 Some(ref prefix) => format!("{} {}", prefix, key),
3254 None => key,
3255 };
3256 req_builder = req_builder.query(&[("token", value)]);
3257 }
3258 if let Some(ref user_agent) = configuration.user_agent {
3259 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3260 }
3261 if let Some(ref apikey) = configuration.api_key {
3262 let key = apikey.key.clone();
3263 let value = match apikey.prefix {
3264 Some(ref prefix) => format!("{} {}", prefix, key),
3265 None => key,
3266 };
3267 req_builder = req_builder.header("X-GITEA-OTP", value);
3268 };
3269 if let Some(ref apikey) = configuration.api_key {
3270 let key = apikey.key.clone();
3271 let value = match apikey.prefix {
3272 Some(ref prefix) => format!("{} {}", prefix, key),
3273 None => key,
3274 };
3275 req_builder = req_builder.header("Authorization", value);
3276 };
3277 if let Some(ref apikey) = configuration.api_key {
3278 let key = apikey.key.clone();
3279 let value = match apikey.prefix {
3280 Some(ref prefix) => format!("{} {}", prefix, key),
3281 None => key,
3282 };
3283 req_builder = req_builder.header("Sudo", value);
3284 };
3285 if let Some(ref auth_conf) = configuration.basic_auth {
3286 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3287 };
3288
3289 let req = req_builder.build()?;
3290 let resp = configuration.client.execute(req).await?;
3291
3292 let status = resp.status();
3293 let content_type = resp
3294 .headers()
3295 .get("content-type")
3296 .and_then(|v| v.to_str().ok())
3297 .unwrap_or("application/octet-stream");
3298 let content_type = super::ContentType::from(content_type);
3299
3300 if !status.is_client_error() && !status.is_server_error() {
3301 let content = resp.text().await?;
3302 match content_type {
3303 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3304 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionArtifact`"))),
3305 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::ActionArtifact`")))),
3306 }
3307 } else {
3308 let content = resp.text().await?;
3309 let entity: Option<GetArtifactError> = serde_json::from_str(&content).ok();
3310 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3311 }
3312}
3313
3314pub async fn get_artifacts(configuration: &configuration::Configuration, owner: &str, repo: &str, name: Option<&str>) -> Result<models::ActionArtifactsResponse, Error<GetArtifactsError>> {
3315 let p_path_owner = owner;
3317 let p_path_repo = repo;
3318 let p_query_name = name;
3319
3320 let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
3321 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3322
3323 if let Some(ref param_value) = p_query_name {
3324 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
3325 }
3326 if let Some(ref apikey) = configuration.api_key {
3327 let key = apikey.key.clone();
3328 let value = match apikey.prefix {
3329 Some(ref prefix) => format!("{} {}", prefix, key),
3330 None => key,
3331 };
3332 req_builder = req_builder.query(&[("access_token", value)]);
3333 }
3334 if let Some(ref apikey) = configuration.api_key {
3335 let key = apikey.key.clone();
3336 let value = match apikey.prefix {
3337 Some(ref prefix) => format!("{} {}", prefix, key),
3338 None => key,
3339 };
3340 req_builder = req_builder.query(&[("sudo", value)]);
3341 }
3342 if let Some(ref apikey) = configuration.api_key {
3343 let key = apikey.key.clone();
3344 let value = match apikey.prefix {
3345 Some(ref prefix) => format!("{} {}", prefix, key),
3346 None => key,
3347 };
3348 req_builder = req_builder.query(&[("token", value)]);
3349 }
3350 if let Some(ref user_agent) = configuration.user_agent {
3351 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3352 }
3353 if let Some(ref apikey) = configuration.api_key {
3354 let key = apikey.key.clone();
3355 let value = match apikey.prefix {
3356 Some(ref prefix) => format!("{} {}", prefix, key),
3357 None => key,
3358 };
3359 req_builder = req_builder.header("X-GITEA-OTP", value);
3360 };
3361 if let Some(ref apikey) = configuration.api_key {
3362 let key = apikey.key.clone();
3363 let value = match apikey.prefix {
3364 Some(ref prefix) => format!("{} {}", prefix, key),
3365 None => key,
3366 };
3367 req_builder = req_builder.header("Authorization", value);
3368 };
3369 if let Some(ref apikey) = configuration.api_key {
3370 let key = apikey.key.clone();
3371 let value = match apikey.prefix {
3372 Some(ref prefix) => format!("{} {}", prefix, key),
3373 None => key,
3374 };
3375 req_builder = req_builder.header("Sudo", value);
3376 };
3377 if let Some(ref auth_conf) = configuration.basic_auth {
3378 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3379 };
3380
3381 let req = req_builder.build()?;
3382 let resp = configuration.client.execute(req).await?;
3383
3384 let status = resp.status();
3385 let content_type = resp
3386 .headers()
3387 .get("content-type")
3388 .and_then(|v| v.to_str().ok())
3389 .unwrap_or("application/octet-stream");
3390 let content_type = super::ContentType::from(content_type);
3391
3392 if !status.is_client_error() && !status.is_server_error() {
3393 let content = resp.text().await?;
3394 match content_type {
3395 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3396 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionArtifactsResponse`"))),
3397 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::ActionArtifactsResponse`")))),
3398 }
3399 } else {
3400 let content = resp.text().await?;
3401 let entity: Option<GetArtifactsError> = serde_json::from_str(&content).ok();
3402 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3403 }
3404}
3405
3406pub async fn get_artifacts_of_run(configuration: &configuration::Configuration, owner: &str, repo: &str, run: i32, name: Option<&str>) -> Result<models::ActionArtifactsResponse, Error<GetArtifactsOfRunError>> {
3407 let p_path_owner = owner;
3409 let p_path_repo = repo;
3410 let p_path_run = run;
3411 let p_query_name = name;
3412
3413 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}/artifacts", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=p_path_run);
3414 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3415
3416 if let Some(ref param_value) = p_query_name {
3417 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
3418 }
3419 if let Some(ref apikey) = configuration.api_key {
3420 let key = apikey.key.clone();
3421 let value = match apikey.prefix {
3422 Some(ref prefix) => format!("{} {}", prefix, key),
3423 None => key,
3424 };
3425 req_builder = req_builder.query(&[("access_token", value)]);
3426 }
3427 if let Some(ref apikey) = configuration.api_key {
3428 let key = apikey.key.clone();
3429 let value = match apikey.prefix {
3430 Some(ref prefix) => format!("{} {}", prefix, key),
3431 None => key,
3432 };
3433 req_builder = req_builder.query(&[("sudo", value)]);
3434 }
3435 if let Some(ref apikey) = configuration.api_key {
3436 let key = apikey.key.clone();
3437 let value = match apikey.prefix {
3438 Some(ref prefix) => format!("{} {}", prefix, key),
3439 None => key,
3440 };
3441 req_builder = req_builder.query(&[("token", value)]);
3442 }
3443 if let Some(ref user_agent) = configuration.user_agent {
3444 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3445 }
3446 if let Some(ref apikey) = configuration.api_key {
3447 let key = apikey.key.clone();
3448 let value = match apikey.prefix {
3449 Some(ref prefix) => format!("{} {}", prefix, key),
3450 None => key,
3451 };
3452 req_builder = req_builder.header("X-GITEA-OTP", value);
3453 };
3454 if let Some(ref apikey) = configuration.api_key {
3455 let key = apikey.key.clone();
3456 let value = match apikey.prefix {
3457 Some(ref prefix) => format!("{} {}", prefix, key),
3458 None => key,
3459 };
3460 req_builder = req_builder.header("Authorization", value);
3461 };
3462 if let Some(ref apikey) = configuration.api_key {
3463 let key = apikey.key.clone();
3464 let value = match apikey.prefix {
3465 Some(ref prefix) => format!("{} {}", prefix, key),
3466 None => key,
3467 };
3468 req_builder = req_builder.header("Sudo", value);
3469 };
3470 if let Some(ref auth_conf) = configuration.basic_auth {
3471 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3472 };
3473
3474 let req = req_builder.build()?;
3475 let resp = configuration.client.execute(req).await?;
3476
3477 let status = resp.status();
3478 let content_type = resp
3479 .headers()
3480 .get("content-type")
3481 .and_then(|v| v.to_str().ok())
3482 .unwrap_or("application/octet-stream");
3483 let content_type = super::ContentType::from(content_type);
3484
3485 if !status.is_client_error() && !status.is_server_error() {
3486 let content = resp.text().await?;
3487 match content_type {
3488 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3489 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionArtifactsResponse`"))),
3490 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::ActionArtifactsResponse`")))),
3491 }
3492 } else {
3493 let content = resp.text().await?;
3494 let entity: Option<GetArtifactsOfRunError> = serde_json::from_str(&content).ok();
3495 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3496 }
3497}
3498
3499pub async fn get_blob(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str) -> Result<models::GitBlobResponse, Error<GetBlobError>> {
3500 let p_path_owner = owner;
3502 let p_path_repo = repo;
3503 let p_path_sha = sha;
3504
3505 let uri_str = format!("{}/repos/{owner}/{repo}/git/blobs/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
3506 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3507
3508 if let Some(ref apikey) = configuration.api_key {
3509 let key = apikey.key.clone();
3510 let value = match apikey.prefix {
3511 Some(ref prefix) => format!("{} {}", prefix, key),
3512 None => key,
3513 };
3514 req_builder = req_builder.query(&[("access_token", value)]);
3515 }
3516 if let Some(ref apikey) = configuration.api_key {
3517 let key = apikey.key.clone();
3518 let value = match apikey.prefix {
3519 Some(ref prefix) => format!("{} {}", prefix, key),
3520 None => key,
3521 };
3522 req_builder = req_builder.query(&[("sudo", value)]);
3523 }
3524 if let Some(ref apikey) = configuration.api_key {
3525 let key = apikey.key.clone();
3526 let value = match apikey.prefix {
3527 Some(ref prefix) => format!("{} {}", prefix, key),
3528 None => key,
3529 };
3530 req_builder = req_builder.query(&[("token", value)]);
3531 }
3532 if let Some(ref user_agent) = configuration.user_agent {
3533 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3534 }
3535 if let Some(ref apikey) = configuration.api_key {
3536 let key = apikey.key.clone();
3537 let value = match apikey.prefix {
3538 Some(ref prefix) => format!("{} {}", prefix, key),
3539 None => key,
3540 };
3541 req_builder = req_builder.header("X-GITEA-OTP", value);
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.header("Authorization", 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.header("Sudo", value);
3558 };
3559 if let Some(ref auth_conf) = configuration.basic_auth {
3560 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3561 };
3562
3563 let req = req_builder.build()?;
3564 let resp = configuration.client.execute(req).await?;
3565
3566 let status = resp.status();
3567 let content_type = resp
3568 .headers()
3569 .get("content-type")
3570 .and_then(|v| v.to_str().ok())
3571 .unwrap_or("application/octet-stream");
3572 let content_type = super::ContentType::from(content_type);
3573
3574 if !status.is_client_error() && !status.is_server_error() {
3575 let content = resp.text().await?;
3576 match content_type {
3577 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3578 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitBlobResponse`"))),
3579 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::GitBlobResponse`")))),
3580 }
3581 } else {
3582 let content = resp.text().await?;
3583 let entity: Option<GetBlobError> = serde_json::from_str(&content).ok();
3584 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3585 }
3586}
3587
3588pub async fn get_repo_runner(configuration: &configuration::Configuration, owner: &str, repo: &str, runner_id: &str) -> Result<(), Error<GetRepoRunnerError>> {
3589 let p_path_owner = owner;
3591 let p_path_repo = repo;
3592 let p_path_runner_id = runner_id;
3593
3594 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/{runner_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), runner_id=crate::apis::urlencode(p_path_runner_id));
3595 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3596
3597 if let Some(ref apikey) = configuration.api_key {
3598 let key = apikey.key.clone();
3599 let value = match apikey.prefix {
3600 Some(ref prefix) => format!("{} {}", prefix, key),
3601 None => key,
3602 };
3603 req_builder = req_builder.query(&[("access_token", value)]);
3604 }
3605 if let Some(ref apikey) = configuration.api_key {
3606 let key = apikey.key.clone();
3607 let value = match apikey.prefix {
3608 Some(ref prefix) => format!("{} {}", prefix, key),
3609 None => key,
3610 };
3611 req_builder = req_builder.query(&[("sudo", value)]);
3612 }
3613 if let Some(ref apikey) = configuration.api_key {
3614 let key = apikey.key.clone();
3615 let value = match apikey.prefix {
3616 Some(ref prefix) => format!("{} {}", prefix, key),
3617 None => key,
3618 };
3619 req_builder = req_builder.query(&[("token", value)]);
3620 }
3621 if let Some(ref user_agent) = configuration.user_agent {
3622 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3623 }
3624 if let Some(ref apikey) = configuration.api_key {
3625 let key = apikey.key.clone();
3626 let value = match apikey.prefix {
3627 Some(ref prefix) => format!("{} {}", prefix, key),
3628 None => key,
3629 };
3630 req_builder = req_builder.header("X-GITEA-OTP", value);
3631 };
3632 if let Some(ref apikey) = configuration.api_key {
3633 let key = apikey.key.clone();
3634 let value = match apikey.prefix {
3635 Some(ref prefix) => format!("{} {}", prefix, key),
3636 None => key,
3637 };
3638 req_builder = req_builder.header("Authorization", value);
3639 };
3640 if let Some(ref apikey) = configuration.api_key {
3641 let key = apikey.key.clone();
3642 let value = match apikey.prefix {
3643 Some(ref prefix) => format!("{} {}", prefix, key),
3644 None => key,
3645 };
3646 req_builder = req_builder.header("Sudo", value);
3647 };
3648 if let Some(ref auth_conf) = configuration.basic_auth {
3649 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3650 };
3651
3652 let req = req_builder.build()?;
3653 let resp = configuration.client.execute(req).await?;
3654
3655 let status = resp.status();
3656
3657 if !status.is_client_error() && !status.is_server_error() {
3658 Ok(())
3659 } else {
3660 let content = resp.text().await?;
3661 let entity: Option<GetRepoRunnerError> = serde_json::from_str(&content).ok();
3662 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3663 }
3664}
3665
3666pub async fn get_repo_runners(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<GetRepoRunnersError>> {
3667 let p_path_owner = owner;
3669 let p_path_repo = repo;
3670
3671 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
3672 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
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.query(&[("access_token", value)]);
3681 }
3682 if let Some(ref apikey) = configuration.api_key {
3683 let key = apikey.key.clone();
3684 let value = match apikey.prefix {
3685 Some(ref prefix) => format!("{} {}", prefix, key),
3686 None => key,
3687 };
3688 req_builder = req_builder.query(&[("sudo", value)]);
3689 }
3690 if let Some(ref apikey) = configuration.api_key {
3691 let key = apikey.key.clone();
3692 let value = match apikey.prefix {
3693 Some(ref prefix) => format!("{} {}", prefix, key),
3694 None => key,
3695 };
3696 req_builder = req_builder.query(&[("token", value)]);
3697 }
3698 if let Some(ref user_agent) = configuration.user_agent {
3699 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3700 }
3701 if let Some(ref apikey) = configuration.api_key {
3702 let key = apikey.key.clone();
3703 let value = match apikey.prefix {
3704 Some(ref prefix) => format!("{} {}", prefix, key),
3705 None => key,
3706 };
3707 req_builder = req_builder.header("X-GITEA-OTP", value);
3708 };
3709 if let Some(ref apikey) = configuration.api_key {
3710 let key = apikey.key.clone();
3711 let value = match apikey.prefix {
3712 Some(ref prefix) => format!("{} {}", prefix, key),
3713 None => key,
3714 };
3715 req_builder = req_builder.header("Authorization", value);
3716 };
3717 if let Some(ref apikey) = configuration.api_key {
3718 let key = apikey.key.clone();
3719 let value = match apikey.prefix {
3720 Some(ref prefix) => format!("{} {}", prefix, key),
3721 None => key,
3722 };
3723 req_builder = req_builder.header("Sudo", value);
3724 };
3725 if let Some(ref auth_conf) = configuration.basic_auth {
3726 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3727 };
3728
3729 let req = req_builder.build()?;
3730 let resp = configuration.client.execute(req).await?;
3731
3732 let status = resp.status();
3733
3734 if !status.is_client_error() && !status.is_server_error() {
3735 Ok(())
3736 } else {
3737 let content = resp.text().await?;
3738 let entity: Option<GetRepoRunnersError> = serde_json::from_str(&content).ok();
3739 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3740 }
3741}
3742
3743pub async fn get_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str) -> Result<models::ActionVariable, Error<GetRepoVariableError>> {
3744 let p_path_owner = owner;
3746 let p_path_repo = repo;
3747 let p_path_variablename = variablename;
3748
3749 let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename));
3750 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3751
3752 if let Some(ref apikey) = configuration.api_key {
3753 let key = apikey.key.clone();
3754 let value = match apikey.prefix {
3755 Some(ref prefix) => format!("{} {}", prefix, key),
3756 None => key,
3757 };
3758 req_builder = req_builder.query(&[("access_token", value)]);
3759 }
3760 if let Some(ref apikey) = configuration.api_key {
3761 let key = apikey.key.clone();
3762 let value = match apikey.prefix {
3763 Some(ref prefix) => format!("{} {}", prefix, key),
3764 None => key,
3765 };
3766 req_builder = req_builder.query(&[("sudo", value)]);
3767 }
3768 if let Some(ref apikey) = configuration.api_key {
3769 let key = apikey.key.clone();
3770 let value = match apikey.prefix {
3771 Some(ref prefix) => format!("{} {}", prefix, key),
3772 None => key,
3773 };
3774 req_builder = req_builder.query(&[("token", value)]);
3775 }
3776 if let Some(ref user_agent) = configuration.user_agent {
3777 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3778 }
3779 if let Some(ref apikey) = configuration.api_key {
3780 let key = apikey.key.clone();
3781 let value = match apikey.prefix {
3782 Some(ref prefix) => format!("{} {}", prefix, key),
3783 None => key,
3784 };
3785 req_builder = req_builder.header("X-GITEA-OTP", value);
3786 };
3787 if let Some(ref apikey) = configuration.api_key {
3788 let key = apikey.key.clone();
3789 let value = match apikey.prefix {
3790 Some(ref prefix) => format!("{} {}", prefix, key),
3791 None => key,
3792 };
3793 req_builder = req_builder.header("Authorization", value);
3794 };
3795 if let Some(ref apikey) = configuration.api_key {
3796 let key = apikey.key.clone();
3797 let value = match apikey.prefix {
3798 Some(ref prefix) => format!("{} {}", prefix, key),
3799 None => key,
3800 };
3801 req_builder = req_builder.header("Sudo", value);
3802 };
3803 if let Some(ref auth_conf) = configuration.basic_auth {
3804 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3805 };
3806
3807 let req = req_builder.build()?;
3808 let resp = configuration.client.execute(req).await?;
3809
3810 let status = resp.status();
3811 let content_type = resp
3812 .headers()
3813 .get("content-type")
3814 .and_then(|v| v.to_str().ok())
3815 .unwrap_or("application/octet-stream");
3816 let content_type = super::ContentType::from(content_type);
3817
3818 if !status.is_client_error() && !status.is_server_error() {
3819 let content = resp.text().await?;
3820 match content_type {
3821 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3822 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))),
3823 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`")))),
3824 }
3825 } else {
3826 let content = resp.text().await?;
3827 let entity: Option<GetRepoVariableError> = serde_json::from_str(&content).ok();
3828 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3829 }
3830}
3831
3832pub async fn get_repo_variables_list(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::ActionVariable>, Error<GetRepoVariablesListError>> {
3833 let p_path_owner = owner;
3835 let p_path_repo = repo;
3836 let p_query_page = page;
3837 let p_query_limit = limit;
3838
3839 let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
3840 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3841
3842 if let Some(ref param_value) = p_query_page {
3843 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3844 }
3845 if let Some(ref param_value) = p_query_limit {
3846 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
3847 }
3848 if let Some(ref apikey) = configuration.api_key {
3849 let key = apikey.key.clone();
3850 let value = match apikey.prefix {
3851 Some(ref prefix) => format!("{} {}", prefix, key),
3852 None => key,
3853 };
3854 req_builder = req_builder.query(&[("access_token", value)]);
3855 }
3856 if let Some(ref apikey) = configuration.api_key {
3857 let key = apikey.key.clone();
3858 let value = match apikey.prefix {
3859 Some(ref prefix) => format!("{} {}", prefix, key),
3860 None => key,
3861 };
3862 req_builder = req_builder.query(&[("sudo", value)]);
3863 }
3864 if let Some(ref apikey) = configuration.api_key {
3865 let key = apikey.key.clone();
3866 let value = match apikey.prefix {
3867 Some(ref prefix) => format!("{} {}", prefix, key),
3868 None => key,
3869 };
3870 req_builder = req_builder.query(&[("token", value)]);
3871 }
3872 if let Some(ref user_agent) = configuration.user_agent {
3873 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3874 }
3875 if let Some(ref apikey) = configuration.api_key {
3876 let key = apikey.key.clone();
3877 let value = match apikey.prefix {
3878 Some(ref prefix) => format!("{} {}", prefix, key),
3879 None => key,
3880 };
3881 req_builder = req_builder.header("X-GITEA-OTP", value);
3882 };
3883 if let Some(ref apikey) = configuration.api_key {
3884 let key = apikey.key.clone();
3885 let value = match apikey.prefix {
3886 Some(ref prefix) => format!("{} {}", prefix, key),
3887 None => key,
3888 };
3889 req_builder = req_builder.header("Authorization", value);
3890 };
3891 if let Some(ref apikey) = configuration.api_key {
3892 let key = apikey.key.clone();
3893 let value = match apikey.prefix {
3894 Some(ref prefix) => format!("{} {}", prefix, key),
3895 None => key,
3896 };
3897 req_builder = req_builder.header("Sudo", value);
3898 };
3899 if let Some(ref auth_conf) = configuration.basic_auth {
3900 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3901 };
3902
3903 let req = req_builder.build()?;
3904 let resp = configuration.client.execute(req).await?;
3905
3906 let status = resp.status();
3907 let content_type = resp
3908 .headers()
3909 .get("content-type")
3910 .and_then(|v| v.to_str().ok())
3911 .unwrap_or("application/octet-stream");
3912 let content_type = super::ContentType::from(content_type);
3913
3914 if !status.is_client_error() && !status.is_server_error() {
3915 let content = resp.text().await?;
3916 match content_type {
3917 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3918 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ActionVariable>`"))),
3919 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>`")))),
3920 }
3921 } else {
3922 let content = resp.text().await?;
3923 let entity: Option<GetRepoVariablesListError> = serde_json::from_str(&content).ok();
3924 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3925 }
3926}
3927
3928pub async fn get_tree(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, recursive: Option<bool>, page: Option<i32>, per_page: Option<i32>) -> Result<models::GitTreeResponse, Error<GetTreeError>> {
3929 let p_path_owner = owner;
3931 let p_path_repo = repo;
3932 let p_path_sha = sha;
3933 let p_query_recursive = recursive;
3934 let p_query_page = page;
3935 let p_query_per_page = per_page;
3936
3937 let uri_str = format!("{}/repos/{owner}/{repo}/git/trees/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
3938 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3939
3940 if let Some(ref param_value) = p_query_recursive {
3941 req_builder = req_builder.query(&[("recursive", ¶m_value.to_string())]);
3942 }
3943 if let Some(ref param_value) = p_query_page {
3944 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3945 }
3946 if let Some(ref param_value) = p_query_per_page {
3947 req_builder = req_builder.query(&[("per_page", ¶m_value.to_string())]);
3948 }
3949 if let Some(ref apikey) = configuration.api_key {
3950 let key = apikey.key.clone();
3951 let value = match apikey.prefix {
3952 Some(ref prefix) => format!("{} {}", prefix, key),
3953 None => key,
3954 };
3955 req_builder = req_builder.query(&[("access_token", value)]);
3956 }
3957 if let Some(ref apikey) = configuration.api_key {
3958 let key = apikey.key.clone();
3959 let value = match apikey.prefix {
3960 Some(ref prefix) => format!("{} {}", prefix, key),
3961 None => key,
3962 };
3963 req_builder = req_builder.query(&[("sudo", value)]);
3964 }
3965 if let Some(ref apikey) = configuration.api_key {
3966 let key = apikey.key.clone();
3967 let value = match apikey.prefix {
3968 Some(ref prefix) => format!("{} {}", prefix, key),
3969 None => key,
3970 };
3971 req_builder = req_builder.query(&[("token", value)]);
3972 }
3973 if let Some(ref user_agent) = configuration.user_agent {
3974 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3975 }
3976 if let Some(ref apikey) = configuration.api_key {
3977 let key = apikey.key.clone();
3978 let value = match apikey.prefix {
3979 Some(ref prefix) => format!("{} {}", prefix, key),
3980 None => key,
3981 };
3982 req_builder = req_builder.header("X-GITEA-OTP", value);
3983 };
3984 if let Some(ref apikey) = configuration.api_key {
3985 let key = apikey.key.clone();
3986 let value = match apikey.prefix {
3987 Some(ref prefix) => format!("{} {}", prefix, key),
3988 None => key,
3989 };
3990 req_builder = req_builder.header("Authorization", value);
3991 };
3992 if let Some(ref apikey) = configuration.api_key {
3993 let key = apikey.key.clone();
3994 let value = match apikey.prefix {
3995 Some(ref prefix) => format!("{} {}", prefix, key),
3996 None => key,
3997 };
3998 req_builder = req_builder.header("Sudo", value);
3999 };
4000 if let Some(ref auth_conf) = configuration.basic_auth {
4001 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4002 };
4003
4004 let req = req_builder.build()?;
4005 let resp = configuration.client.execute(req).await?;
4006
4007 let status = resp.status();
4008 let content_type = resp
4009 .headers()
4010 .get("content-type")
4011 .and_then(|v| v.to_str().ok())
4012 .unwrap_or("application/octet-stream");
4013 let content_type = super::ContentType::from(content_type);
4014
4015 if !status.is_client_error() && !status.is_server_error() {
4016 let content = resp.text().await?;
4017 match content_type {
4018 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4019 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitTreeResponse`"))),
4020 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::GitTreeResponse`")))),
4021 }
4022 } else {
4023 let content = resp.text().await?;
4024 let entity: Option<GetTreeError> = serde_json::from_str(&content).ok();
4025 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4026 }
4027}
4028
4029pub async fn get_workflow_job(configuration: &configuration::Configuration, owner: &str, repo: &str, job_id: &str) -> Result<models::ActionWorkflowJob, Error<GetWorkflowJobError>> {
4030 let p_path_owner = owner;
4032 let p_path_repo = repo;
4033 let p_path_job_id = job_id;
4034
4035 let uri_str = format!("{}/repos/{owner}/{repo}/actions/jobs/{job_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), job_id=crate::apis::urlencode(p_path_job_id));
4036 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4037
4038 if let Some(ref apikey) = configuration.api_key {
4039 let key = apikey.key.clone();
4040 let value = match apikey.prefix {
4041 Some(ref prefix) => format!("{} {}", prefix, key),
4042 None => key,
4043 };
4044 req_builder = req_builder.query(&[("access_token", value)]);
4045 }
4046 if let Some(ref apikey) = configuration.api_key {
4047 let key = apikey.key.clone();
4048 let value = match apikey.prefix {
4049 Some(ref prefix) => format!("{} {}", prefix, key),
4050 None => key,
4051 };
4052 req_builder = req_builder.query(&[("sudo", value)]);
4053 }
4054 if let Some(ref apikey) = configuration.api_key {
4055 let key = apikey.key.clone();
4056 let value = match apikey.prefix {
4057 Some(ref prefix) => format!("{} {}", prefix, key),
4058 None => key,
4059 };
4060 req_builder = req_builder.query(&[("token", value)]);
4061 }
4062 if let Some(ref user_agent) = configuration.user_agent {
4063 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4064 }
4065 if let Some(ref apikey) = configuration.api_key {
4066 let key = apikey.key.clone();
4067 let value = match apikey.prefix {
4068 Some(ref prefix) => format!("{} {}", prefix, key),
4069 None => key,
4070 };
4071 req_builder = req_builder.header("X-GITEA-OTP", value);
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.header("Authorization", 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.header("Sudo", value);
4088 };
4089 if let Some(ref auth_conf) = configuration.basic_auth {
4090 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4091 };
4092
4093 let req = req_builder.build()?;
4094 let resp = configuration.client.execute(req).await?;
4095
4096 let status = resp.status();
4097 let content_type = resp
4098 .headers()
4099 .get("content-type")
4100 .and_then(|v| v.to_str().ok())
4101 .unwrap_or("application/octet-stream");
4102 let content_type = super::ContentType::from(content_type);
4103
4104 if !status.is_client_error() && !status.is_server_error() {
4105 let content = resp.text().await?;
4106 match content_type {
4107 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4108 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJob`"))),
4109 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::ActionWorkflowJob`")))),
4110 }
4111 } else {
4112 let content = resp.text().await?;
4113 let entity: Option<GetWorkflowJobError> = serde_json::from_str(&content).ok();
4114 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4115 }
4116}
4117
4118pub async fn get_workflow_run(configuration: &configuration::Configuration, owner: &str, repo: &str, run: &str) -> Result<models::ActionWorkflowRun, Error<GetWorkflowRunError>> {
4119 let p_path_owner = owner;
4121 let p_path_repo = repo;
4122 let p_path_run = run;
4123
4124 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=crate::apis::urlencode(p_path_run));
4125 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4126
4127 if let Some(ref apikey) = configuration.api_key {
4128 let key = apikey.key.clone();
4129 let value = match apikey.prefix {
4130 Some(ref prefix) => format!("{} {}", prefix, key),
4131 None => key,
4132 };
4133 req_builder = req_builder.query(&[("access_token", value)]);
4134 }
4135 if let Some(ref apikey) = configuration.api_key {
4136 let key = apikey.key.clone();
4137 let value = match apikey.prefix {
4138 Some(ref prefix) => format!("{} {}", prefix, key),
4139 None => key,
4140 };
4141 req_builder = req_builder.query(&[("sudo", value)]);
4142 }
4143 if let Some(ref apikey) = configuration.api_key {
4144 let key = apikey.key.clone();
4145 let value = match apikey.prefix {
4146 Some(ref prefix) => format!("{} {}", prefix, key),
4147 None => key,
4148 };
4149 req_builder = req_builder.query(&[("token", value)]);
4150 }
4151 if let Some(ref user_agent) = configuration.user_agent {
4152 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4153 }
4154 if let Some(ref apikey) = configuration.api_key {
4155 let key = apikey.key.clone();
4156 let value = match apikey.prefix {
4157 Some(ref prefix) => format!("{} {}", prefix, key),
4158 None => key,
4159 };
4160 req_builder = req_builder.header("X-GITEA-OTP", value);
4161 };
4162 if let Some(ref apikey) = configuration.api_key {
4163 let key = apikey.key.clone();
4164 let value = match apikey.prefix {
4165 Some(ref prefix) => format!("{} {}", prefix, key),
4166 None => key,
4167 };
4168 req_builder = req_builder.header("Authorization", value);
4169 };
4170 if let Some(ref apikey) = configuration.api_key {
4171 let key = apikey.key.clone();
4172 let value = match apikey.prefix {
4173 Some(ref prefix) => format!("{} {}", prefix, key),
4174 None => key,
4175 };
4176 req_builder = req_builder.header("Sudo", value);
4177 };
4178 if let Some(ref auth_conf) = configuration.basic_auth {
4179 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4180 };
4181
4182 let req = req_builder.build()?;
4183 let resp = configuration.client.execute(req).await?;
4184
4185 let status = resp.status();
4186 let content_type = resp
4187 .headers()
4188 .get("content-type")
4189 .and_then(|v| v.to_str().ok())
4190 .unwrap_or("application/octet-stream");
4191 let content_type = super::ContentType::from(content_type);
4192
4193 if !status.is_client_error() && !status.is_server_error() {
4194 let content = resp.text().await?;
4195 match content_type {
4196 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4197 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRun`"))),
4198 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::ActionWorkflowRun`")))),
4199 }
4200 } else {
4201 let content = resp.text().await?;
4202 let entity: Option<GetWorkflowRunError> = serde_json::from_str(&content).ok();
4203 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4204 }
4205}
4206
4207pub async fn get_workflow_runs(configuration: &configuration::Configuration, owner: &str, repo: &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<GetWorkflowRunsError>> {
4208 let p_path_owner = owner;
4210 let p_path_repo = repo;
4211 let p_query_event = event;
4212 let p_query_branch = branch;
4213 let p_query_status = status;
4214 let p_query_actor = actor;
4215 let p_query_head_sha = head_sha;
4216 let p_query_page = page;
4217 let p_query_limit = limit;
4218
4219 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4220 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4221
4222 if let Some(ref param_value) = p_query_event {
4223 req_builder = req_builder.query(&[("event", ¶m_value.to_string())]);
4224 }
4225 if let Some(ref param_value) = p_query_branch {
4226 req_builder = req_builder.query(&[("branch", ¶m_value.to_string())]);
4227 }
4228 if let Some(ref param_value) = p_query_status {
4229 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
4230 }
4231 if let Some(ref param_value) = p_query_actor {
4232 req_builder = req_builder.query(&[("actor", ¶m_value.to_string())]);
4233 }
4234 if let Some(ref param_value) = p_query_head_sha {
4235 req_builder = req_builder.query(&[("head_sha", ¶m_value.to_string())]);
4236 }
4237 if let Some(ref param_value) = p_query_page {
4238 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4239 }
4240 if let Some(ref param_value) = p_query_limit {
4241 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4242 }
4243 if let Some(ref apikey) = configuration.api_key {
4244 let key = apikey.key.clone();
4245 let value = match apikey.prefix {
4246 Some(ref prefix) => format!("{} {}", prefix, key),
4247 None => key,
4248 };
4249 req_builder = req_builder.query(&[("access_token", value)]);
4250 }
4251 if let Some(ref apikey) = configuration.api_key {
4252 let key = apikey.key.clone();
4253 let value = match apikey.prefix {
4254 Some(ref prefix) => format!("{} {}", prefix, key),
4255 None => key,
4256 };
4257 req_builder = req_builder.query(&[("sudo", value)]);
4258 }
4259 if let Some(ref apikey) = configuration.api_key {
4260 let key = apikey.key.clone();
4261 let value = match apikey.prefix {
4262 Some(ref prefix) => format!("{} {}", prefix, key),
4263 None => key,
4264 };
4265 req_builder = req_builder.query(&[("token", value)]);
4266 }
4267 if let Some(ref user_agent) = configuration.user_agent {
4268 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4269 }
4270 if let Some(ref apikey) = configuration.api_key {
4271 let key = apikey.key.clone();
4272 let value = match apikey.prefix {
4273 Some(ref prefix) => format!("{} {}", prefix, key),
4274 None => key,
4275 };
4276 req_builder = req_builder.header("X-GITEA-OTP", value);
4277 };
4278 if let Some(ref apikey) = configuration.api_key {
4279 let key = apikey.key.clone();
4280 let value = match apikey.prefix {
4281 Some(ref prefix) => format!("{} {}", prefix, key),
4282 None => key,
4283 };
4284 req_builder = req_builder.header("Authorization", value);
4285 };
4286 if let Some(ref apikey) = configuration.api_key {
4287 let key = apikey.key.clone();
4288 let value = match apikey.prefix {
4289 Some(ref prefix) => format!("{} {}", prefix, key),
4290 None => key,
4291 };
4292 req_builder = req_builder.header("Sudo", value);
4293 };
4294 if let Some(ref auth_conf) = configuration.basic_auth {
4295 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4296 };
4297
4298 let req = req_builder.build()?;
4299 let resp = configuration.client.execute(req).await?;
4300
4301 let status = resp.status();
4302 let content_type = resp
4303 .headers()
4304 .get("content-type")
4305 .and_then(|v| v.to_str().ok())
4306 .unwrap_or("application/octet-stream");
4307 let content_type = super::ContentType::from(content_type);
4308
4309 if !status.is_client_error() && !status.is_server_error() {
4310 let content = resp.text().await?;
4311 match content_type {
4312 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4313 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`"))),
4314 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`")))),
4315 }
4316 } else {
4317 let content = resp.text().await?;
4318 let entity: Option<GetWorkflowRunsError> = serde_json::from_str(&content).ok();
4319 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4320 }
4321}
4322
4323pub async fn list_action_tasks(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<models::ActionTaskResponse, Error<ListActionTasksError>> {
4324 let p_path_owner = owner;
4326 let p_path_repo = repo;
4327 let p_query_page = page;
4328 let p_query_limit = limit;
4329
4330 let uri_str = format!("{}/repos/{owner}/{repo}/actions/tasks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4331 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4332
4333 if let Some(ref param_value) = p_query_page {
4334 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4335 }
4336 if let Some(ref param_value) = p_query_limit {
4337 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4338 }
4339 if let Some(ref apikey) = configuration.api_key {
4340 let key = apikey.key.clone();
4341 let value = match apikey.prefix {
4342 Some(ref prefix) => format!("{} {}", prefix, key),
4343 None => key,
4344 };
4345 req_builder = req_builder.query(&[("access_token", value)]);
4346 }
4347 if let Some(ref apikey) = configuration.api_key {
4348 let key = apikey.key.clone();
4349 let value = match apikey.prefix {
4350 Some(ref prefix) => format!("{} {}", prefix, key),
4351 None => key,
4352 };
4353 req_builder = req_builder.query(&[("sudo", value)]);
4354 }
4355 if let Some(ref apikey) = configuration.api_key {
4356 let key = apikey.key.clone();
4357 let value = match apikey.prefix {
4358 Some(ref prefix) => format!("{} {}", prefix, key),
4359 None => key,
4360 };
4361 req_builder = req_builder.query(&[("token", value)]);
4362 }
4363 if let Some(ref user_agent) = configuration.user_agent {
4364 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", 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.header("Authorization", value);
4381 };
4382 if let Some(ref apikey) = configuration.api_key {
4383 let key = apikey.key.clone();
4384 let value = match apikey.prefix {
4385 Some(ref prefix) => format!("{} {}", prefix, key),
4386 None => key,
4387 };
4388 req_builder = req_builder.header("Sudo", value);
4389 };
4390 if let Some(ref auth_conf) = configuration.basic_auth {
4391 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4392 };
4393
4394 let req = req_builder.build()?;
4395 let resp = configuration.client.execute(req).await?;
4396
4397 let status = resp.status();
4398 let content_type = resp
4399 .headers()
4400 .get("content-type")
4401 .and_then(|v| v.to_str().ok())
4402 .unwrap_or("application/octet-stream");
4403 let content_type = super::ContentType::from(content_type);
4404
4405 if !status.is_client_error() && !status.is_server_error() {
4406 let content = resp.text().await?;
4407 match content_type {
4408 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4409 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionTaskResponse`"))),
4410 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::ActionTaskResponse`")))),
4411 }
4412 } else {
4413 let content = resp.text().await?;
4414 let entity: Option<ListActionTasksError> = serde_json::from_str(&content).ok();
4415 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4416 }
4417}
4418
4419pub async fn list_forks(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Repository>, Error<ListForksError>> {
4420 let p_path_owner = owner;
4422 let p_path_repo = repo;
4423 let p_query_page = page;
4424 let p_query_limit = limit;
4425
4426 let uri_str = format!("{}/repos/{owner}/{repo}/forks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4427 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4428
4429 if let Some(ref param_value) = p_query_page {
4430 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4431 }
4432 if let Some(ref param_value) = p_query_limit {
4433 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4434 }
4435 if let Some(ref apikey) = configuration.api_key {
4436 let key = apikey.key.clone();
4437 let value = match apikey.prefix {
4438 Some(ref prefix) => format!("{} {}", prefix, key),
4439 None => key,
4440 };
4441 req_builder = req_builder.query(&[("access_token", value)]);
4442 }
4443 if let Some(ref apikey) = configuration.api_key {
4444 let key = apikey.key.clone();
4445 let value = match apikey.prefix {
4446 Some(ref prefix) => format!("{} {}", prefix, key),
4447 None => key,
4448 };
4449 req_builder = req_builder.query(&[("sudo", value)]);
4450 }
4451 if let Some(ref apikey) = configuration.api_key {
4452 let key = apikey.key.clone();
4453 let value = match apikey.prefix {
4454 Some(ref prefix) => format!("{} {}", prefix, key),
4455 None => key,
4456 };
4457 req_builder = req_builder.query(&[("token", value)]);
4458 }
4459 if let Some(ref user_agent) = configuration.user_agent {
4460 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4461 }
4462 if let Some(ref apikey) = configuration.api_key {
4463 let key = apikey.key.clone();
4464 let value = match apikey.prefix {
4465 Some(ref prefix) => format!("{} {}", prefix, key),
4466 None => key,
4467 };
4468 req_builder = req_builder.header("X-GITEA-OTP", value);
4469 };
4470 if let Some(ref apikey) = configuration.api_key {
4471 let key = apikey.key.clone();
4472 let value = match apikey.prefix {
4473 Some(ref prefix) => format!("{} {}", prefix, key),
4474 None => key,
4475 };
4476 req_builder = req_builder.header("Authorization", value);
4477 };
4478 if let Some(ref apikey) = configuration.api_key {
4479 let key = apikey.key.clone();
4480 let value = match apikey.prefix {
4481 Some(ref prefix) => format!("{} {}", prefix, key),
4482 None => key,
4483 };
4484 req_builder = req_builder.header("Sudo", value);
4485 };
4486 if let Some(ref auth_conf) = configuration.basic_auth {
4487 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4488 };
4489
4490 let req = req_builder.build()?;
4491 let resp = configuration.client.execute(req).await?;
4492
4493 let status = resp.status();
4494 let content_type = resp
4495 .headers()
4496 .get("content-type")
4497 .and_then(|v| v.to_str().ok())
4498 .unwrap_or("application/octet-stream");
4499 let content_type = super::ContentType::from(content_type);
4500
4501 if !status.is_client_error() && !status.is_server_error() {
4502 let content = resp.text().await?;
4503 match content_type {
4504 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4505 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))),
4506 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>`")))),
4507 }
4508 } else {
4509 let content = resp.text().await?;
4510 let entity: Option<ListForksError> = serde_json::from_str(&content).ok();
4511 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4512 }
4513}
4514
4515pub async fn list_workflow_jobs(configuration: &configuration::Configuration, owner: &str, repo: &str, status: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<models::ActionWorkflowJobsResponse, Error<ListWorkflowJobsError>> {
4516 let p_path_owner = owner;
4518 let p_path_repo = repo;
4519 let p_query_status = status;
4520 let p_query_page = page;
4521 let p_query_limit = limit;
4522
4523 let uri_str = format!("{}/repos/{owner}/{repo}/actions/jobs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4524 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4525
4526 if let Some(ref param_value) = p_query_status {
4527 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
4528 }
4529 if let Some(ref param_value) = p_query_page {
4530 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4531 }
4532 if let Some(ref param_value) = p_query_limit {
4533 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4534 }
4535 if let Some(ref apikey) = configuration.api_key {
4536 let key = apikey.key.clone();
4537 let value = match apikey.prefix {
4538 Some(ref prefix) => format!("{} {}", prefix, key),
4539 None => key,
4540 };
4541 req_builder = req_builder.query(&[("access_token", value)]);
4542 }
4543 if let Some(ref apikey) = configuration.api_key {
4544 let key = apikey.key.clone();
4545 let value = match apikey.prefix {
4546 Some(ref prefix) => format!("{} {}", prefix, key),
4547 None => key,
4548 };
4549 req_builder = req_builder.query(&[("sudo", value)]);
4550 }
4551 if let Some(ref apikey) = configuration.api_key {
4552 let key = apikey.key.clone();
4553 let value = match apikey.prefix {
4554 Some(ref prefix) => format!("{} {}", prefix, key),
4555 None => key,
4556 };
4557 req_builder = req_builder.query(&[("token", value)]);
4558 }
4559 if let Some(ref user_agent) = configuration.user_agent {
4560 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4561 }
4562 if let Some(ref apikey) = configuration.api_key {
4563 let key = apikey.key.clone();
4564 let value = match apikey.prefix {
4565 Some(ref prefix) => format!("{} {}", prefix, key),
4566 None => key,
4567 };
4568 req_builder = req_builder.header("X-GITEA-OTP", value);
4569 };
4570 if let Some(ref apikey) = configuration.api_key {
4571 let key = apikey.key.clone();
4572 let value = match apikey.prefix {
4573 Some(ref prefix) => format!("{} {}", prefix, key),
4574 None => key,
4575 };
4576 req_builder = req_builder.header("Authorization", value);
4577 };
4578 if let Some(ref apikey) = configuration.api_key {
4579 let key = apikey.key.clone();
4580 let value = match apikey.prefix {
4581 Some(ref prefix) => format!("{} {}", prefix, key),
4582 None => key,
4583 };
4584 req_builder = req_builder.header("Sudo", value);
4585 };
4586 if let Some(ref auth_conf) = configuration.basic_auth {
4587 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4588 };
4589
4590 let req = req_builder.build()?;
4591 let resp = configuration.client.execute(req).await?;
4592
4593 let status = resp.status();
4594 let content_type = resp
4595 .headers()
4596 .get("content-type")
4597 .and_then(|v| v.to_str().ok())
4598 .unwrap_or("application/octet-stream");
4599 let content_type = super::ContentType::from(content_type);
4600
4601 if !status.is_client_error() && !status.is_server_error() {
4602 let content = resp.text().await?;
4603 match content_type {
4604 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4605 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))),
4606 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`")))),
4607 }
4608 } else {
4609 let content = resp.text().await?;
4610 let entity: Option<ListWorkflowJobsError> = serde_json::from_str(&content).ok();
4611 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4612 }
4613}
4614
4615pub async fn list_workflow_run_jobs(configuration: &configuration::Configuration, owner: &str, repo: &str, run: i32, status: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<models::ActionWorkflowJobsResponse, Error<ListWorkflowRunJobsError>> {
4616 let p_path_owner = owner;
4618 let p_path_repo = repo;
4619 let p_path_run = run;
4620 let p_query_status = status;
4621 let p_query_page = page;
4622 let p_query_limit = limit;
4623
4624 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}/jobs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=p_path_run);
4625 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4626
4627 if let Some(ref param_value) = p_query_status {
4628 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
4629 }
4630 if let Some(ref param_value) = p_query_page {
4631 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4632 }
4633 if let Some(ref param_value) = p_query_limit {
4634 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4635 }
4636 if let Some(ref apikey) = configuration.api_key {
4637 let key = apikey.key.clone();
4638 let value = match apikey.prefix {
4639 Some(ref prefix) => format!("{} {}", prefix, key),
4640 None => key,
4641 };
4642 req_builder = req_builder.query(&[("access_token", value)]);
4643 }
4644 if let Some(ref apikey) = configuration.api_key {
4645 let key = apikey.key.clone();
4646 let value = match apikey.prefix {
4647 Some(ref prefix) => format!("{} {}", prefix, key),
4648 None => key,
4649 };
4650 req_builder = req_builder.query(&[("sudo", value)]);
4651 }
4652 if let Some(ref apikey) = configuration.api_key {
4653 let key = apikey.key.clone();
4654 let value = match apikey.prefix {
4655 Some(ref prefix) => format!("{} {}", prefix, key),
4656 None => key,
4657 };
4658 req_builder = req_builder.query(&[("token", value)]);
4659 }
4660 if let Some(ref user_agent) = configuration.user_agent {
4661 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
4670 };
4671 if let Some(ref apikey) = configuration.api_key {
4672 let key = apikey.key.clone();
4673 let value = match apikey.prefix {
4674 Some(ref prefix) => format!("{} {}", prefix, key),
4675 None => key,
4676 };
4677 req_builder = req_builder.header("Authorization", value);
4678 };
4679 if let Some(ref apikey) = configuration.api_key {
4680 let key = apikey.key.clone();
4681 let value = match apikey.prefix {
4682 Some(ref prefix) => format!("{} {}", prefix, key),
4683 None => key,
4684 };
4685 req_builder = req_builder.header("Sudo", value);
4686 };
4687 if let Some(ref auth_conf) = configuration.basic_auth {
4688 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4689 };
4690
4691 let req = req_builder.build()?;
4692 let resp = configuration.client.execute(req).await?;
4693
4694 let status = resp.status();
4695 let content_type = resp
4696 .headers()
4697 .get("content-type")
4698 .and_then(|v| v.to_str().ok())
4699 .unwrap_or("application/octet-stream");
4700 let content_type = super::ContentType::from(content_type);
4701
4702 if !status.is_client_error() && !status.is_server_error() {
4703 let content = resp.text().await?;
4704 match content_type {
4705 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4706 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))),
4707 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`")))),
4708 }
4709 } else {
4710 let content = resp.text().await?;
4711 let entity: Option<ListWorkflowRunJobsError> = serde_json::from_str(&content).ok();
4712 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4713 }
4714}
4715
4716pub async fn reject_repo_transfer(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::Repository, Error<RejectRepoTransferError>> {
4717 let p_path_owner = owner;
4719 let p_path_repo = repo;
4720
4721 let uri_str = format!("{}/repos/{owner}/{repo}/transfer/reject", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4722 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4723
4724 if let Some(ref apikey) = configuration.api_key {
4725 let key = apikey.key.clone();
4726 let value = match apikey.prefix {
4727 Some(ref prefix) => format!("{} {}", prefix, key),
4728 None => key,
4729 };
4730 req_builder = req_builder.query(&[("access_token", value)]);
4731 }
4732 if let Some(ref apikey) = configuration.api_key {
4733 let key = apikey.key.clone();
4734 let value = match apikey.prefix {
4735 Some(ref prefix) => format!("{} {}", prefix, key),
4736 None => key,
4737 };
4738 req_builder = req_builder.query(&[("sudo", value)]);
4739 }
4740 if let Some(ref apikey) = configuration.api_key {
4741 let key = apikey.key.clone();
4742 let value = match apikey.prefix {
4743 Some(ref prefix) => format!("{} {}", prefix, key),
4744 None => key,
4745 };
4746 req_builder = req_builder.query(&[("token", value)]);
4747 }
4748 if let Some(ref user_agent) = configuration.user_agent {
4749 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
4758 };
4759 if let Some(ref apikey) = configuration.api_key {
4760 let key = apikey.key.clone();
4761 let value = match apikey.prefix {
4762 Some(ref prefix) => format!("{} {}", prefix, key),
4763 None => key,
4764 };
4765 req_builder = req_builder.header("Authorization", value);
4766 };
4767 if let Some(ref apikey) = configuration.api_key {
4768 let key = apikey.key.clone();
4769 let value = match apikey.prefix {
4770 Some(ref prefix) => format!("{} {}", prefix, key),
4771 None => key,
4772 };
4773 req_builder = req_builder.header("Sudo", value);
4774 };
4775 if let Some(ref auth_conf) = configuration.basic_auth {
4776 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4777 };
4778
4779 let req = req_builder.build()?;
4780 let resp = configuration.client.execute(req).await?;
4781
4782 let status = resp.status();
4783 let content_type = resp
4784 .headers()
4785 .get("content-type")
4786 .and_then(|v| v.to_str().ok())
4787 .unwrap_or("application/octet-stream");
4788 let content_type = super::ContentType::from(content_type);
4789
4790 if !status.is_client_error() && !status.is_server_error() {
4791 let content = resp.text().await?;
4792 match content_type {
4793 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4794 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
4795 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`")))),
4796 }
4797 } else {
4798 let content = resp.text().await?;
4799 let entity: Option<RejectRepoTransferError> = serde_json::from_str(&content).ok();
4800 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4801 }
4802}
4803
4804pub async fn repo_add_collaborator(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str, body: Option<models::AddCollaboratorOption>) -> Result<(), Error<RepoAddCollaboratorError>> {
4805 let p_path_owner = owner;
4807 let p_path_repo = repo;
4808 let p_path_collaborator = collaborator;
4809 let p_body_body = body;
4810
4811 let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator));
4812 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4813
4814 if let Some(ref apikey) = configuration.api_key {
4815 let key = apikey.key.clone();
4816 let value = match apikey.prefix {
4817 Some(ref prefix) => format!("{} {}", prefix, key),
4818 None => key,
4819 };
4820 req_builder = req_builder.query(&[("access_token", value)]);
4821 }
4822 if let Some(ref apikey) = configuration.api_key {
4823 let key = apikey.key.clone();
4824 let value = match apikey.prefix {
4825 Some(ref prefix) => format!("{} {}", prefix, key),
4826 None => key,
4827 };
4828 req_builder = req_builder.query(&[("sudo", value)]);
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(&[("token", value)]);
4837 }
4838 if let Some(ref user_agent) = configuration.user_agent {
4839 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4840 }
4841 if let Some(ref apikey) = configuration.api_key {
4842 let key = apikey.key.clone();
4843 let value = match apikey.prefix {
4844 Some(ref prefix) => format!("{} {}", prefix, key),
4845 None => key,
4846 };
4847 req_builder = req_builder.header("X-GITEA-OTP", value);
4848 };
4849 if let Some(ref apikey) = configuration.api_key {
4850 let key = apikey.key.clone();
4851 let value = match apikey.prefix {
4852 Some(ref prefix) => format!("{} {}", prefix, key),
4853 None => key,
4854 };
4855 req_builder = req_builder.header("Authorization", value);
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("Sudo", value);
4864 };
4865 if let Some(ref auth_conf) = configuration.basic_auth {
4866 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4867 };
4868 req_builder = req_builder.json(&p_body_body);
4869
4870 let req = req_builder.build()?;
4871 let resp = configuration.client.execute(req).await?;
4872
4873 let status = resp.status();
4874
4875 if !status.is_client_error() && !status.is_server_error() {
4876 Ok(())
4877 } else {
4878 let content = resp.text().await?;
4879 let entity: Option<RepoAddCollaboratorError> = serde_json::from_str(&content).ok();
4880 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4881 }
4882}
4883
4884pub async fn repo_add_push_mirror(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreatePushMirrorOption>) -> Result<models::PushMirror, Error<RepoAddPushMirrorError>> {
4885 let p_path_owner = owner;
4887 let p_path_repo = repo;
4888 let p_body_body = body;
4889
4890 let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4891 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4892
4893 if let Some(ref apikey) = configuration.api_key {
4894 let key = apikey.key.clone();
4895 let value = match apikey.prefix {
4896 Some(ref prefix) => format!("{} {}", prefix, key),
4897 None => key,
4898 };
4899 req_builder = req_builder.query(&[("access_token", value)]);
4900 }
4901 if let Some(ref apikey) = configuration.api_key {
4902 let key = apikey.key.clone();
4903 let value = match apikey.prefix {
4904 Some(ref prefix) => format!("{} {}", prefix, key),
4905 None => key,
4906 };
4907 req_builder = req_builder.query(&[("sudo", value)]);
4908 }
4909 if let Some(ref apikey) = configuration.api_key {
4910 let key = apikey.key.clone();
4911 let value = match apikey.prefix {
4912 Some(ref prefix) => format!("{} {}", prefix, key),
4913 None => key,
4914 };
4915 req_builder = req_builder.query(&[("token", value)]);
4916 }
4917 if let Some(ref user_agent) = configuration.user_agent {
4918 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4919 }
4920 if let Some(ref apikey) = configuration.api_key {
4921 let key = apikey.key.clone();
4922 let value = match apikey.prefix {
4923 Some(ref prefix) => format!("{} {}", prefix, key),
4924 None => key,
4925 };
4926 req_builder = req_builder.header("X-GITEA-OTP", value);
4927 };
4928 if let Some(ref apikey) = configuration.api_key {
4929 let key = apikey.key.clone();
4930 let value = match apikey.prefix {
4931 Some(ref prefix) => format!("{} {}", prefix, key),
4932 None => key,
4933 };
4934 req_builder = req_builder.header("Authorization", value);
4935 };
4936 if let Some(ref apikey) = configuration.api_key {
4937 let key = apikey.key.clone();
4938 let value = match apikey.prefix {
4939 Some(ref prefix) => format!("{} {}", prefix, key),
4940 None => key,
4941 };
4942 req_builder = req_builder.header("Sudo", value);
4943 };
4944 if let Some(ref auth_conf) = configuration.basic_auth {
4945 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4946 };
4947 req_builder = req_builder.json(&p_body_body);
4948
4949 let req = req_builder.build()?;
4950 let resp = configuration.client.execute(req).await?;
4951
4952 let status = resp.status();
4953 let content_type = resp
4954 .headers()
4955 .get("content-type")
4956 .and_then(|v| v.to_str().ok())
4957 .unwrap_or("application/octet-stream");
4958 let content_type = super::ContentType::from(content_type);
4959
4960 if !status.is_client_error() && !status.is_server_error() {
4961 let content = resp.text().await?;
4962 match content_type {
4963 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4964 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PushMirror`"))),
4965 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::PushMirror`")))),
4966 }
4967 } else {
4968 let content = resp.text().await?;
4969 let entity: Option<RepoAddPushMirrorError> = serde_json::from_str(&content).ok();
4970 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4971 }
4972}
4973
4974pub async fn repo_add_team(configuration: &configuration::Configuration, owner: &str, repo: &str, team: &str) -> Result<(), Error<RepoAddTeamError>> {
4975 let p_path_owner = owner;
4977 let p_path_repo = repo;
4978 let p_path_team = team;
4979
4980 let uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), team=crate::apis::urlencode(p_path_team));
4981 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4982
4983 if let Some(ref apikey) = configuration.api_key {
4984 let key = apikey.key.clone();
4985 let value = match apikey.prefix {
4986 Some(ref prefix) => format!("{} {}", prefix, key),
4987 None => key,
4988 };
4989 req_builder = req_builder.query(&[("access_token", value)]);
4990 }
4991 if let Some(ref apikey) = configuration.api_key {
4992 let key = apikey.key.clone();
4993 let value = match apikey.prefix {
4994 Some(ref prefix) => format!("{} {}", prefix, key),
4995 None => key,
4996 };
4997 req_builder = req_builder.query(&[("sudo", value)]);
4998 }
4999 if let Some(ref apikey) = configuration.api_key {
5000 let key = apikey.key.clone();
5001 let value = match apikey.prefix {
5002 Some(ref prefix) => format!("{} {}", prefix, key),
5003 None => key,
5004 };
5005 req_builder = req_builder.query(&[("token", value)]);
5006 }
5007 if let Some(ref user_agent) = configuration.user_agent {
5008 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5009 }
5010 if let Some(ref apikey) = configuration.api_key {
5011 let key = apikey.key.clone();
5012 let value = match apikey.prefix {
5013 Some(ref prefix) => format!("{} {}", prefix, key),
5014 None => key,
5015 };
5016 req_builder = req_builder.header("X-GITEA-OTP", value);
5017 };
5018 if let Some(ref apikey) = configuration.api_key {
5019 let key = apikey.key.clone();
5020 let value = match apikey.prefix {
5021 Some(ref prefix) => format!("{} {}", prefix, key),
5022 None => key,
5023 };
5024 req_builder = req_builder.header("Authorization", value);
5025 };
5026 if let Some(ref apikey) = configuration.api_key {
5027 let key = apikey.key.clone();
5028 let value = match apikey.prefix {
5029 Some(ref prefix) => format!("{} {}", prefix, key),
5030 None => key,
5031 };
5032 req_builder = req_builder.header("Sudo", value);
5033 };
5034 if let Some(ref auth_conf) = configuration.basic_auth {
5035 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5036 };
5037
5038 let req = req_builder.build()?;
5039 let resp = configuration.client.execute(req).await?;
5040
5041 let status = resp.status();
5042
5043 if !status.is_client_error() && !status.is_server_error() {
5044 Ok(())
5045 } else {
5046 let content = resp.text().await?;
5047 let entity: Option<RepoAddTeamError> = serde_json::from_str(&content).ok();
5048 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5049 }
5050}
5051
5052pub async fn repo_add_topic(configuration: &configuration::Configuration, owner: &str, repo: &str, topic: &str) -> Result<(), Error<RepoAddTopicError>> {
5053 let p_path_owner = owner;
5055 let p_path_repo = repo;
5056 let p_path_topic = topic;
5057
5058 let uri_str = format!("{}/repos/{owner}/{repo}/topics/{topic}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), topic=crate::apis::urlencode(p_path_topic));
5059 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5060
5061 if let Some(ref apikey) = configuration.api_key {
5062 let key = apikey.key.clone();
5063 let value = match apikey.prefix {
5064 Some(ref prefix) => format!("{} {}", prefix, key),
5065 None => key,
5066 };
5067 req_builder = req_builder.query(&[("access_token", value)]);
5068 }
5069 if let Some(ref apikey) = configuration.api_key {
5070 let key = apikey.key.clone();
5071 let value = match apikey.prefix {
5072 Some(ref prefix) => format!("{} {}", prefix, key),
5073 None => key,
5074 };
5075 req_builder = req_builder.query(&[("sudo", value)]);
5076 }
5077 if let Some(ref apikey) = configuration.api_key {
5078 let key = apikey.key.clone();
5079 let value = match apikey.prefix {
5080 Some(ref prefix) => format!("{} {}", prefix, key),
5081 None => key,
5082 };
5083 req_builder = req_builder.query(&[("token", value)]);
5084 }
5085 if let Some(ref user_agent) = configuration.user_agent {
5086 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5087 }
5088 if let Some(ref apikey) = configuration.api_key {
5089 let key = apikey.key.clone();
5090 let value = match apikey.prefix {
5091 Some(ref prefix) => format!("{} {}", prefix, key),
5092 None => key,
5093 };
5094 req_builder = req_builder.header("X-GITEA-OTP", value);
5095 };
5096 if let Some(ref apikey) = configuration.api_key {
5097 let key = apikey.key.clone();
5098 let value = match apikey.prefix {
5099 Some(ref prefix) => format!("{} {}", prefix, key),
5100 None => key,
5101 };
5102 req_builder = req_builder.header("Authorization", value);
5103 };
5104 if let Some(ref apikey) = configuration.api_key {
5105 let key = apikey.key.clone();
5106 let value = match apikey.prefix {
5107 Some(ref prefix) => format!("{} {}", prefix, key),
5108 None => key,
5109 };
5110 req_builder = req_builder.header("Sudo", value);
5111 };
5112 if let Some(ref auth_conf) = configuration.basic_auth {
5113 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5114 };
5115
5116 let req = req_builder.build()?;
5117 let resp = configuration.client.execute(req).await?;
5118
5119 let status = resp.status();
5120
5121 if !status.is_client_error() && !status.is_server_error() {
5122 Ok(())
5123 } else {
5124 let content = resp.text().await?;
5125 let entity: Option<RepoAddTopicError> = serde_json::from_str(&content).ok();
5126 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5127 }
5128}
5129
5130pub async fn repo_apply_diff_patch(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::ApplyDiffPatchFileOptions) -> Result<models::FileResponse, Error<RepoApplyDiffPatchError>> {
5131 let p_path_owner = owner;
5133 let p_path_repo = repo;
5134 let p_body_body = body;
5135
5136 let uri_str = format!("{}/repos/{owner}/{repo}/diffpatch", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
5137 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5138
5139 if let Some(ref apikey) = configuration.api_key {
5140 let key = apikey.key.clone();
5141 let value = match apikey.prefix {
5142 Some(ref prefix) => format!("{} {}", prefix, key),
5143 None => key,
5144 };
5145 req_builder = req_builder.query(&[("access_token", value)]);
5146 }
5147 if let Some(ref apikey) = configuration.api_key {
5148 let key = apikey.key.clone();
5149 let value = match apikey.prefix {
5150 Some(ref prefix) => format!("{} {}", prefix, key),
5151 None => key,
5152 };
5153 req_builder = req_builder.query(&[("sudo", value)]);
5154 }
5155 if let Some(ref apikey) = configuration.api_key {
5156 let key = apikey.key.clone();
5157 let value = match apikey.prefix {
5158 Some(ref prefix) => format!("{} {}", prefix, key),
5159 None => key,
5160 };
5161 req_builder = req_builder.query(&[("token", value)]);
5162 }
5163 if let Some(ref user_agent) = configuration.user_agent {
5164 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5165 }
5166 if let Some(ref apikey) = configuration.api_key {
5167 let key = apikey.key.clone();
5168 let value = match apikey.prefix {
5169 Some(ref prefix) => format!("{} {}", prefix, key),
5170 None => key,
5171 };
5172 req_builder = req_builder.header("X-GITEA-OTP", value);
5173 };
5174 if let Some(ref apikey) = configuration.api_key {
5175 let key = apikey.key.clone();
5176 let value = match apikey.prefix {
5177 Some(ref prefix) => format!("{} {}", prefix, key),
5178 None => key,
5179 };
5180 req_builder = req_builder.header("Authorization", value);
5181 };
5182 if let Some(ref apikey) = configuration.api_key {
5183 let key = apikey.key.clone();
5184 let value = match apikey.prefix {
5185 Some(ref prefix) => format!("{} {}", prefix, key),
5186 None => key,
5187 };
5188 req_builder = req_builder.header("Sudo", value);
5189 };
5190 if let Some(ref auth_conf) = configuration.basic_auth {
5191 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5192 };
5193 req_builder = req_builder.json(&p_body_body);
5194
5195 let req = req_builder.build()?;
5196 let resp = configuration.client.execute(req).await?;
5197
5198 let status = resp.status();
5199 let content_type = resp
5200 .headers()
5201 .get("content-type")
5202 .and_then(|v| v.to_str().ok())
5203 .unwrap_or("application/octet-stream");
5204 let content_type = super::ContentType::from(content_type);
5205
5206 if !status.is_client_error() && !status.is_server_error() {
5207 let content = resp.text().await?;
5208 match content_type {
5209 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5210 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileResponse`"))),
5211 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::FileResponse`")))),
5212 }
5213 } else {
5214 let content = resp.text().await?;
5215 let entity: Option<RepoApplyDiffPatchError> = serde_json::from_str(&content).ok();
5216 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5217 }
5218}
5219
5220pub async fn repo_cancel_scheduled_auto_merge(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<RepoCancelScheduledAutoMergeError>> {
5221 let p_path_owner = owner;
5223 let p_path_repo = repo;
5224 let p_path_index = index;
5225
5226 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
5227 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5228
5229 if let Some(ref apikey) = configuration.api_key {
5230 let key = apikey.key.clone();
5231 let value = match apikey.prefix {
5232 Some(ref prefix) => format!("{} {}", prefix, key),
5233 None => key,
5234 };
5235 req_builder = req_builder.query(&[("access_token", value)]);
5236 }
5237 if let Some(ref apikey) = configuration.api_key {
5238 let key = apikey.key.clone();
5239 let value = match apikey.prefix {
5240 Some(ref prefix) => format!("{} {}", prefix, key),
5241 None => key,
5242 };
5243 req_builder = req_builder.query(&[("sudo", value)]);
5244 }
5245 if let Some(ref apikey) = configuration.api_key {
5246 let key = apikey.key.clone();
5247 let value = match apikey.prefix {
5248 Some(ref prefix) => format!("{} {}", prefix, key),
5249 None => key,
5250 };
5251 req_builder = req_builder.query(&[("token", value)]);
5252 }
5253 if let Some(ref user_agent) = configuration.user_agent {
5254 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5255 }
5256 if let Some(ref apikey) = configuration.api_key {
5257 let key = apikey.key.clone();
5258 let value = match apikey.prefix {
5259 Some(ref prefix) => format!("{} {}", prefix, key),
5260 None => key,
5261 };
5262 req_builder = req_builder.header("X-GITEA-OTP", value);
5263 };
5264 if let Some(ref apikey) = configuration.api_key {
5265 let key = apikey.key.clone();
5266 let value = match apikey.prefix {
5267 Some(ref prefix) => format!("{} {}", prefix, key),
5268 None => key,
5269 };
5270 req_builder = req_builder.header("Authorization", value);
5271 };
5272 if let Some(ref apikey) = configuration.api_key {
5273 let key = apikey.key.clone();
5274 let value = match apikey.prefix {
5275 Some(ref prefix) => format!("{} {}", prefix, key),
5276 None => key,
5277 };
5278 req_builder = req_builder.header("Sudo", value);
5279 };
5280 if let Some(ref auth_conf) = configuration.basic_auth {
5281 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5282 };
5283
5284 let req = req_builder.build()?;
5285 let resp = configuration.client.execute(req).await?;
5286
5287 let status = resp.status();
5288
5289 if !status.is_client_error() && !status.is_server_error() {
5290 Ok(())
5291 } else {
5292 let content = resp.text().await?;
5293 let entity: Option<RepoCancelScheduledAutoMergeError> = serde_json::from_str(&content).ok();
5294 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5295 }
5296}
5297
5298pub async fn repo_change_files(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::ChangeFilesOptions) -> Result<models::FilesResponse, Error<RepoChangeFilesError>> {
5299 let p_path_owner = owner;
5301 let p_path_repo = repo;
5302 let p_body_body = body;
5303
5304 let uri_str = format!("{}/repos/{owner}/{repo}/contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
5305 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5306
5307 if let Some(ref apikey) = configuration.api_key {
5308 let key = apikey.key.clone();
5309 let value = match apikey.prefix {
5310 Some(ref prefix) => format!("{} {}", prefix, key),
5311 None => key,
5312 };
5313 req_builder = req_builder.query(&[("access_token", value)]);
5314 }
5315 if let Some(ref apikey) = configuration.api_key {
5316 let key = apikey.key.clone();
5317 let value = match apikey.prefix {
5318 Some(ref prefix) => format!("{} {}", prefix, key),
5319 None => key,
5320 };
5321 req_builder = req_builder.query(&[("sudo", value)]);
5322 }
5323 if let Some(ref apikey) = configuration.api_key {
5324 let key = apikey.key.clone();
5325 let value = match apikey.prefix {
5326 Some(ref prefix) => format!("{} {}", prefix, key),
5327 None => key,
5328 };
5329 req_builder = req_builder.query(&[("token", value)]);
5330 }
5331 if let Some(ref user_agent) = configuration.user_agent {
5332 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5333 }
5334 if let Some(ref apikey) = configuration.api_key {
5335 let key = apikey.key.clone();
5336 let value = match apikey.prefix {
5337 Some(ref prefix) => format!("{} {}", prefix, key),
5338 None => key,
5339 };
5340 req_builder = req_builder.header("X-GITEA-OTP", value);
5341 };
5342 if let Some(ref apikey) = configuration.api_key {
5343 let key = apikey.key.clone();
5344 let value = match apikey.prefix {
5345 Some(ref prefix) => format!("{} {}", prefix, key),
5346 None => key,
5347 };
5348 req_builder = req_builder.header("Authorization", value);
5349 };
5350 if let Some(ref apikey) = configuration.api_key {
5351 let key = apikey.key.clone();
5352 let value = match apikey.prefix {
5353 Some(ref prefix) => format!("{} {}", prefix, key),
5354 None => key,
5355 };
5356 req_builder = req_builder.header("Sudo", value);
5357 };
5358 if let Some(ref auth_conf) = configuration.basic_auth {
5359 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5360 };
5361 req_builder = req_builder.json(&p_body_body);
5362
5363 let req = req_builder.build()?;
5364 let resp = configuration.client.execute(req).await?;
5365
5366 let status = resp.status();
5367 let content_type = resp
5368 .headers()
5369 .get("content-type")
5370 .and_then(|v| v.to_str().ok())
5371 .unwrap_or("application/octet-stream");
5372 let content_type = super::ContentType::from(content_type);
5373
5374 if !status.is_client_error() && !status.is_server_error() {
5375 let content = resp.text().await?;
5376 match content_type {
5377 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5378 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FilesResponse`"))),
5379 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::FilesResponse`")))),
5380 }
5381 } else {
5382 let content = resp.text().await?;
5383 let entity: Option<RepoChangeFilesError> = serde_json::from_str(&content).ok();
5384 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5385 }
5386}
5387
5388pub async fn repo_check_collaborator(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str) -> Result<(), Error<RepoCheckCollaboratorError>> {
5389 let p_path_owner = owner;
5391 let p_path_repo = repo;
5392 let p_path_collaborator = collaborator;
5393
5394 let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator));
5395 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5396
5397 if let Some(ref apikey) = configuration.api_key {
5398 let key = apikey.key.clone();
5399 let value = match apikey.prefix {
5400 Some(ref prefix) => format!("{} {}", prefix, key),
5401 None => key,
5402 };
5403 req_builder = req_builder.query(&[("access_token", value)]);
5404 }
5405 if let Some(ref apikey) = configuration.api_key {
5406 let key = apikey.key.clone();
5407 let value = match apikey.prefix {
5408 Some(ref prefix) => format!("{} {}", prefix, key),
5409 None => key,
5410 };
5411 req_builder = req_builder.query(&[("sudo", value)]);
5412 }
5413 if let Some(ref apikey) = configuration.api_key {
5414 let key = apikey.key.clone();
5415 let value = match apikey.prefix {
5416 Some(ref prefix) => format!("{} {}", prefix, key),
5417 None => key,
5418 };
5419 req_builder = req_builder.query(&[("token", value)]);
5420 }
5421 if let Some(ref user_agent) = configuration.user_agent {
5422 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5423 }
5424 if let Some(ref apikey) = configuration.api_key {
5425 let key = apikey.key.clone();
5426 let value = match apikey.prefix {
5427 Some(ref prefix) => format!("{} {}", prefix, key),
5428 None => key,
5429 };
5430 req_builder = req_builder.header("X-GITEA-OTP", value);
5431 };
5432 if let Some(ref apikey) = configuration.api_key {
5433 let key = apikey.key.clone();
5434 let value = match apikey.prefix {
5435 Some(ref prefix) => format!("{} {}", prefix, key),
5436 None => key,
5437 };
5438 req_builder = req_builder.header("Authorization", value);
5439 };
5440 if let Some(ref apikey) = configuration.api_key {
5441 let key = apikey.key.clone();
5442 let value = match apikey.prefix {
5443 Some(ref prefix) => format!("{} {}", prefix, key),
5444 None => key,
5445 };
5446 req_builder = req_builder.header("Sudo", value);
5447 };
5448 if let Some(ref auth_conf) = configuration.basic_auth {
5449 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5450 };
5451
5452 let req = req_builder.build()?;
5453 let resp = configuration.client.execute(req).await?;
5454
5455 let status = resp.status();
5456
5457 if !status.is_client_error() && !status.is_server_error() {
5458 Ok(())
5459 } else {
5460 let content = resp.text().await?;
5461 let entity: Option<RepoCheckCollaboratorError> = serde_json::from_str(&content).ok();
5462 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5463 }
5464}
5465
5466pub async fn repo_check_team(configuration: &configuration::Configuration, owner: &str, repo: &str, team: &str) -> Result<models::Team, Error<RepoCheckTeamError>> {
5467 let p_path_owner = owner;
5469 let p_path_repo = repo;
5470 let p_path_team = team;
5471
5472 let uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), team=crate::apis::urlencode(p_path_team));
5473 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
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.query(&[("access_token", 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.query(&[("sudo", 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.query(&[("token", value)]);
5498 }
5499 if let Some(ref user_agent) = configuration.user_agent {
5500 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5501 }
5502 if let Some(ref apikey) = configuration.api_key {
5503 let key = apikey.key.clone();
5504 let value = match apikey.prefix {
5505 Some(ref prefix) => format!("{} {}", prefix, key),
5506 None => key,
5507 };
5508 req_builder = req_builder.header("X-GITEA-OTP", value);
5509 };
5510 if let Some(ref apikey) = configuration.api_key {
5511 let key = apikey.key.clone();
5512 let value = match apikey.prefix {
5513 Some(ref prefix) => format!("{} {}", prefix, key),
5514 None => key,
5515 };
5516 req_builder = req_builder.header("Authorization", value);
5517 };
5518 if let Some(ref apikey) = configuration.api_key {
5519 let key = apikey.key.clone();
5520 let value = match apikey.prefix {
5521 Some(ref prefix) => format!("{} {}", prefix, key),
5522 None => key,
5523 };
5524 req_builder = req_builder.header("Sudo", value);
5525 };
5526 if let Some(ref auth_conf) = configuration.basic_auth {
5527 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5528 };
5529
5530 let req = req_builder.build()?;
5531 let resp = configuration.client.execute(req).await?;
5532
5533 let status = resp.status();
5534 let content_type = resp
5535 .headers()
5536 .get("content-type")
5537 .and_then(|v| v.to_str().ok())
5538 .unwrap_or("application/octet-stream");
5539 let content_type = super::ContentType::from(content_type);
5540
5541 if !status.is_client_error() && !status.is_server_error() {
5542 let content = resp.text().await?;
5543 match content_type {
5544 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5545 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))),
5546 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`")))),
5547 }
5548 } else {
5549 let content = resp.text().await?;
5550 let entity: Option<RepoCheckTeamError> = serde_json::from_str(&content).ok();
5551 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5552 }
5553}
5554
5555pub async fn repo_compare_diff(configuration: &configuration::Configuration, owner: &str, repo: &str, basehead: &str) -> Result<models::Compare, Error<RepoCompareDiffError>> {
5556 let p_path_owner = owner;
5558 let p_path_repo = repo;
5559 let p_path_basehead = basehead;
5560
5561 let uri_str = format!("{}/repos/{owner}/{repo}/compare/{basehead}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), basehead=crate::apis::urlencode(p_path_basehead));
5562 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5563
5564 if let Some(ref apikey) = configuration.api_key {
5565 let key = apikey.key.clone();
5566 let value = match apikey.prefix {
5567 Some(ref prefix) => format!("{} {}", prefix, key),
5568 None => key,
5569 };
5570 req_builder = req_builder.query(&[("access_token", value)]);
5571 }
5572 if let Some(ref apikey) = configuration.api_key {
5573 let key = apikey.key.clone();
5574 let value = match apikey.prefix {
5575 Some(ref prefix) => format!("{} {}", prefix, key),
5576 None => key,
5577 };
5578 req_builder = req_builder.query(&[("sudo", value)]);
5579 }
5580 if let Some(ref apikey) = configuration.api_key {
5581 let key = apikey.key.clone();
5582 let value = match apikey.prefix {
5583 Some(ref prefix) => format!("{} {}", prefix, key),
5584 None => key,
5585 };
5586 req_builder = req_builder.query(&[("token", value)]);
5587 }
5588 if let Some(ref user_agent) = configuration.user_agent {
5589 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5590 }
5591 if let Some(ref apikey) = configuration.api_key {
5592 let key = apikey.key.clone();
5593 let value = match apikey.prefix {
5594 Some(ref prefix) => format!("{} {}", prefix, key),
5595 None => key,
5596 };
5597 req_builder = req_builder.header("X-GITEA-OTP", value);
5598 };
5599 if let Some(ref apikey) = configuration.api_key {
5600 let key = apikey.key.clone();
5601 let value = match apikey.prefix {
5602 Some(ref prefix) => format!("{} {}", prefix, key),
5603 None => key,
5604 };
5605 req_builder = req_builder.header("Authorization", value);
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.header("Sudo", value);
5614 };
5615 if let Some(ref auth_conf) = configuration.basic_auth {
5616 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5617 };
5618
5619 let req = req_builder.build()?;
5620 let resp = configuration.client.execute(req).await?;
5621
5622 let status = resp.status();
5623 let content_type = resp
5624 .headers()
5625 .get("content-type")
5626 .and_then(|v| v.to_str().ok())
5627 .unwrap_or("application/octet-stream");
5628 let content_type = super::ContentType::from(content_type);
5629
5630 if !status.is_client_error() && !status.is_server_error() {
5631 let content = resp.text().await?;
5632 match content_type {
5633 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5634 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Compare`"))),
5635 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::Compare`")))),
5636 }
5637 } else {
5638 let content = resp.text().await?;
5639 let entity: Option<RepoCompareDiffError> = serde_json::from_str(&content).ok();
5640 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5641 }
5642}
5643
5644pub async fn repo_create_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateBranchRepoOption>) -> Result<models::Branch, Error<RepoCreateBranchError>> {
5645 let p_path_owner = owner;
5647 let p_path_repo = repo;
5648 let p_body_body = body;
5649
5650 let uri_str = format!("{}/repos/{owner}/{repo}/branches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
5651 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5652
5653 if let Some(ref apikey) = configuration.api_key {
5654 let key = apikey.key.clone();
5655 let value = match apikey.prefix {
5656 Some(ref prefix) => format!("{} {}", prefix, key),
5657 None => key,
5658 };
5659 req_builder = req_builder.query(&[("access_token", value)]);
5660 }
5661 if let Some(ref apikey) = configuration.api_key {
5662 let key = apikey.key.clone();
5663 let value = match apikey.prefix {
5664 Some(ref prefix) => format!("{} {}", prefix, key),
5665 None => key,
5666 };
5667 req_builder = req_builder.query(&[("sudo", value)]);
5668 }
5669 if let Some(ref apikey) = configuration.api_key {
5670 let key = apikey.key.clone();
5671 let value = match apikey.prefix {
5672 Some(ref prefix) => format!("{} {}", prefix, key),
5673 None => key,
5674 };
5675 req_builder = req_builder.query(&[("token", value)]);
5676 }
5677 if let Some(ref user_agent) = configuration.user_agent {
5678 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5679 }
5680 if let Some(ref apikey) = configuration.api_key {
5681 let key = apikey.key.clone();
5682 let value = match apikey.prefix {
5683 Some(ref prefix) => format!("{} {}", prefix, key),
5684 None => key,
5685 };
5686 req_builder = req_builder.header("X-GITEA-OTP", value);
5687 };
5688 if let Some(ref apikey) = configuration.api_key {
5689 let key = apikey.key.clone();
5690 let value = match apikey.prefix {
5691 Some(ref prefix) => format!("{} {}", prefix, key),
5692 None => key,
5693 };
5694 req_builder = req_builder.header("Authorization", value);
5695 };
5696 if let Some(ref apikey) = configuration.api_key {
5697 let key = apikey.key.clone();
5698 let value = match apikey.prefix {
5699 Some(ref prefix) => format!("{} {}", prefix, key),
5700 None => key,
5701 };
5702 req_builder = req_builder.header("Sudo", value);
5703 };
5704 if let Some(ref auth_conf) = configuration.basic_auth {
5705 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5706 };
5707 req_builder = req_builder.json(&p_body_body);
5708
5709 let req = req_builder.build()?;
5710 let resp = configuration.client.execute(req).await?;
5711
5712 let status = resp.status();
5713 let content_type = resp
5714 .headers()
5715 .get("content-type")
5716 .and_then(|v| v.to_str().ok())
5717 .unwrap_or("application/octet-stream");
5718 let content_type = super::ContentType::from(content_type);
5719
5720 if !status.is_client_error() && !status.is_server_error() {
5721 let content = resp.text().await?;
5722 match content_type {
5723 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5724 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Branch`"))),
5725 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::Branch`")))),
5726 }
5727 } else {
5728 let content = resp.text().await?;
5729 let entity: Option<RepoCreateBranchError> = serde_json::from_str(&content).ok();
5730 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5731 }
5732}
5733
5734pub async fn repo_create_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateBranchProtectionOption>) -> Result<models::BranchProtection, Error<RepoCreateBranchProtectionError>> {
5735 let p_path_owner = owner;
5737 let p_path_repo = repo;
5738 let p_body_body = body;
5739
5740 let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
5741 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5742
5743 if let Some(ref apikey) = configuration.api_key {
5744 let key = apikey.key.clone();
5745 let value = match apikey.prefix {
5746 Some(ref prefix) => format!("{} {}", prefix, key),
5747 None => key,
5748 };
5749 req_builder = req_builder.query(&[("access_token", value)]);
5750 }
5751 if let Some(ref apikey) = configuration.api_key {
5752 let key = apikey.key.clone();
5753 let value = match apikey.prefix {
5754 Some(ref prefix) => format!("{} {}", prefix, key),
5755 None => key,
5756 };
5757 req_builder = req_builder.query(&[("sudo", value)]);
5758 }
5759 if let Some(ref apikey) = configuration.api_key {
5760 let key = apikey.key.clone();
5761 let value = match apikey.prefix {
5762 Some(ref prefix) => format!("{} {}", prefix, key),
5763 None => key,
5764 };
5765 req_builder = req_builder.query(&[("token", value)]);
5766 }
5767 if let Some(ref user_agent) = configuration.user_agent {
5768 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5769 }
5770 if let Some(ref apikey) = configuration.api_key {
5771 let key = apikey.key.clone();
5772 let value = match apikey.prefix {
5773 Some(ref prefix) => format!("{} {}", prefix, key),
5774 None => key,
5775 };
5776 req_builder = req_builder.header("X-GITEA-OTP", value);
5777 };
5778 if let Some(ref apikey) = configuration.api_key {
5779 let key = apikey.key.clone();
5780 let value = match apikey.prefix {
5781 Some(ref prefix) => format!("{} {}", prefix, key),
5782 None => key,
5783 };
5784 req_builder = req_builder.header("Authorization", value);
5785 };
5786 if let Some(ref apikey) = configuration.api_key {
5787 let key = apikey.key.clone();
5788 let value = match apikey.prefix {
5789 Some(ref prefix) => format!("{} {}", prefix, key),
5790 None => key,
5791 };
5792 req_builder = req_builder.header("Sudo", value);
5793 };
5794 if let Some(ref auth_conf) = configuration.basic_auth {
5795 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5796 };
5797 req_builder = req_builder.json(&p_body_body);
5798
5799 let req = req_builder.build()?;
5800 let resp = configuration.client.execute(req).await?;
5801
5802 let status = resp.status();
5803 let content_type = resp
5804 .headers()
5805 .get("content-type")
5806 .and_then(|v| v.to_str().ok())
5807 .unwrap_or("application/octet-stream");
5808 let content_type = super::ContentType::from(content_type);
5809
5810 if !status.is_client_error() && !status.is_server_error() {
5811 let content = resp.text().await?;
5812 match content_type {
5813 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5814 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BranchProtection`"))),
5815 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::BranchProtection`")))),
5816 }
5817 } else {
5818 let content = resp.text().await?;
5819 let entity: Option<RepoCreateBranchProtectionError> = serde_json::from_str(&content).ok();
5820 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5821 }
5822}
5823
5824pub async fn repo_create_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, body: models::CreateFileOptions) -> Result<models::FileResponse, Error<RepoCreateFileError>> {
5825 let p_path_owner = owner;
5827 let p_path_repo = repo;
5828 let p_path_filepath = filepath;
5829 let p_body_body = body;
5830
5831 let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
5832 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5833
5834 if let Some(ref apikey) = configuration.api_key {
5835 let key = apikey.key.clone();
5836 let value = match apikey.prefix {
5837 Some(ref prefix) => format!("{} {}", prefix, key),
5838 None => key,
5839 };
5840 req_builder = req_builder.query(&[("access_token", value)]);
5841 }
5842 if let Some(ref apikey) = configuration.api_key {
5843 let key = apikey.key.clone();
5844 let value = match apikey.prefix {
5845 Some(ref prefix) => format!("{} {}", prefix, key),
5846 None => key,
5847 };
5848 req_builder = req_builder.query(&[("sudo", value)]);
5849 }
5850 if let Some(ref apikey) = configuration.api_key {
5851 let key = apikey.key.clone();
5852 let value = match apikey.prefix {
5853 Some(ref prefix) => format!("{} {}", prefix, key),
5854 None => key,
5855 };
5856 req_builder = req_builder.query(&[("token", value)]);
5857 }
5858 if let Some(ref user_agent) = configuration.user_agent {
5859 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5860 }
5861 if let Some(ref apikey) = configuration.api_key {
5862 let key = apikey.key.clone();
5863 let value = match apikey.prefix {
5864 Some(ref prefix) => format!("{} {}", prefix, key),
5865 None => key,
5866 };
5867 req_builder = req_builder.header("X-GITEA-OTP", value);
5868 };
5869 if let Some(ref apikey) = configuration.api_key {
5870 let key = apikey.key.clone();
5871 let value = match apikey.prefix {
5872 Some(ref prefix) => format!("{} {}", prefix, key),
5873 None => key,
5874 };
5875 req_builder = req_builder.header("Authorization", value);
5876 };
5877 if let Some(ref apikey) = configuration.api_key {
5878 let key = apikey.key.clone();
5879 let value = match apikey.prefix {
5880 Some(ref prefix) => format!("{} {}", prefix, key),
5881 None => key,
5882 };
5883 req_builder = req_builder.header("Sudo", value);
5884 };
5885 if let Some(ref auth_conf) = configuration.basic_auth {
5886 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5887 };
5888 req_builder = req_builder.json(&p_body_body);
5889
5890 let req = req_builder.build()?;
5891 let resp = configuration.client.execute(req).await?;
5892
5893 let status = resp.status();
5894 let content_type = resp
5895 .headers()
5896 .get("content-type")
5897 .and_then(|v| v.to_str().ok())
5898 .unwrap_or("application/octet-stream");
5899 let content_type = super::ContentType::from(content_type);
5900
5901 if !status.is_client_error() && !status.is_server_error() {
5902 let content = resp.text().await?;
5903 match content_type {
5904 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5905 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileResponse`"))),
5906 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::FileResponse`")))),
5907 }
5908 } else {
5909 let content = resp.text().await?;
5910 let entity: Option<RepoCreateFileError> = serde_json::from_str(&content).ok();
5911 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5912 }
5913}
5914
5915pub async fn repo_create_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateHookOption>) -> Result<models::Hook, Error<RepoCreateHookError>> {
5916 let p_path_owner = owner;
5918 let p_path_repo = repo;
5919 let p_body_body = body;
5920
5921 let uri_str = format!("{}/repos/{owner}/{repo}/hooks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
5922 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5923
5924 if let Some(ref apikey) = configuration.api_key {
5925 let key = apikey.key.clone();
5926 let value = match apikey.prefix {
5927 Some(ref prefix) => format!("{} {}", prefix, key),
5928 None => key,
5929 };
5930 req_builder = req_builder.query(&[("access_token", value)]);
5931 }
5932 if let Some(ref apikey) = configuration.api_key {
5933 let key = apikey.key.clone();
5934 let value = match apikey.prefix {
5935 Some(ref prefix) => format!("{} {}", prefix, key),
5936 None => key,
5937 };
5938 req_builder = req_builder.query(&[("sudo", value)]);
5939 }
5940 if let Some(ref apikey) = configuration.api_key {
5941 let key = apikey.key.clone();
5942 let value = match apikey.prefix {
5943 Some(ref prefix) => format!("{} {}", prefix, key),
5944 None => key,
5945 };
5946 req_builder = req_builder.query(&[("token", value)]);
5947 }
5948 if let Some(ref user_agent) = configuration.user_agent {
5949 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5950 }
5951 if let Some(ref apikey) = configuration.api_key {
5952 let key = apikey.key.clone();
5953 let value = match apikey.prefix {
5954 Some(ref prefix) => format!("{} {}", prefix, key),
5955 None => key,
5956 };
5957 req_builder = req_builder.header("X-GITEA-OTP", value);
5958 };
5959 if let Some(ref apikey) = configuration.api_key {
5960 let key = apikey.key.clone();
5961 let value = match apikey.prefix {
5962 Some(ref prefix) => format!("{} {}", prefix, key),
5963 None => key,
5964 };
5965 req_builder = req_builder.header("Authorization", value);
5966 };
5967 if let Some(ref apikey) = configuration.api_key {
5968 let key = apikey.key.clone();
5969 let value = match apikey.prefix {
5970 Some(ref prefix) => format!("{} {}", prefix, key),
5971 None => key,
5972 };
5973 req_builder = req_builder.header("Sudo", value);
5974 };
5975 if let Some(ref auth_conf) = configuration.basic_auth {
5976 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5977 };
5978 req_builder = req_builder.json(&p_body_body);
5979
5980 let req = req_builder.build()?;
5981 let resp = configuration.client.execute(req).await?;
5982
5983 let status = resp.status();
5984 let content_type = resp
5985 .headers()
5986 .get("content-type")
5987 .and_then(|v| v.to_str().ok())
5988 .unwrap_or("application/octet-stream");
5989 let content_type = super::ContentType::from(content_type);
5990
5991 if !status.is_client_error() && !status.is_server_error() {
5992 let content = resp.text().await?;
5993 match content_type {
5994 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5995 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
5996 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`")))),
5997 }
5998 } else {
5999 let content = resp.text().await?;
6000 let entity: Option<RepoCreateHookError> = serde_json::from_str(&content).ok();
6001 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6002 }
6003}
6004
6005pub async fn repo_create_key(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateKeyOption>) -> Result<models::DeployKey, Error<RepoCreateKeyError>> {
6006 let p_path_owner = owner;
6008 let p_path_repo = repo;
6009 let p_body_body = body;
6010
6011 let uri_str = format!("{}/repos/{owner}/{repo}/keys", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
6012 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6013
6014 if let Some(ref apikey) = configuration.api_key {
6015 let key = apikey.key.clone();
6016 let value = match apikey.prefix {
6017 Some(ref prefix) => format!("{} {}", prefix, key),
6018 None => key,
6019 };
6020 req_builder = req_builder.query(&[("access_token", value)]);
6021 }
6022 if let Some(ref apikey) = configuration.api_key {
6023 let key = apikey.key.clone();
6024 let value = match apikey.prefix {
6025 Some(ref prefix) => format!("{} {}", prefix, key),
6026 None => key,
6027 };
6028 req_builder = req_builder.query(&[("sudo", value)]);
6029 }
6030 if let Some(ref apikey) = configuration.api_key {
6031 let key = apikey.key.clone();
6032 let value = match apikey.prefix {
6033 Some(ref prefix) => format!("{} {}", prefix, key),
6034 None => key,
6035 };
6036 req_builder = req_builder.query(&[("token", value)]);
6037 }
6038 if let Some(ref user_agent) = configuration.user_agent {
6039 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6040 }
6041 if let Some(ref apikey) = configuration.api_key {
6042 let key = apikey.key.clone();
6043 let value = match apikey.prefix {
6044 Some(ref prefix) => format!("{} {}", prefix, key),
6045 None => key,
6046 };
6047 req_builder = req_builder.header("X-GITEA-OTP", value);
6048 };
6049 if let Some(ref apikey) = configuration.api_key {
6050 let key = apikey.key.clone();
6051 let value = match apikey.prefix {
6052 Some(ref prefix) => format!("{} {}", prefix, key),
6053 None => key,
6054 };
6055 req_builder = req_builder.header("Authorization", value);
6056 };
6057 if let Some(ref apikey) = configuration.api_key {
6058 let key = apikey.key.clone();
6059 let value = match apikey.prefix {
6060 Some(ref prefix) => format!("{} {}", prefix, key),
6061 None => key,
6062 };
6063 req_builder = req_builder.header("Sudo", value);
6064 };
6065 if let Some(ref auth_conf) = configuration.basic_auth {
6066 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6067 };
6068 req_builder = req_builder.json(&p_body_body);
6069
6070 let req = req_builder.build()?;
6071 let resp = configuration.client.execute(req).await?;
6072
6073 let status = resp.status();
6074 let content_type = resp
6075 .headers()
6076 .get("content-type")
6077 .and_then(|v| v.to_str().ok())
6078 .unwrap_or("application/octet-stream");
6079 let content_type = super::ContentType::from(content_type);
6080
6081 if !status.is_client_error() && !status.is_server_error() {
6082 let content = resp.text().await?;
6083 match content_type {
6084 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6085 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployKey`"))),
6086 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::DeployKey`")))),
6087 }
6088 } else {
6089 let content = resp.text().await?;
6090 let entity: Option<RepoCreateKeyError> = serde_json::from_str(&content).ok();
6091 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6092 }
6093}
6094
6095pub async fn repo_create_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreatePullRequestOption>) -> Result<models::PullRequest, Error<RepoCreatePullRequestError>> {
6096 let p_path_owner = owner;
6098 let p_path_repo = repo;
6099 let p_body_body = body;
6100
6101 let uri_str = format!("{}/repos/{owner}/{repo}/pulls", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
6102 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6103
6104 if let Some(ref apikey) = configuration.api_key {
6105 let key = apikey.key.clone();
6106 let value = match apikey.prefix {
6107 Some(ref prefix) => format!("{} {}", prefix, key),
6108 None => key,
6109 };
6110 req_builder = req_builder.query(&[("access_token", value)]);
6111 }
6112 if let Some(ref apikey) = configuration.api_key {
6113 let key = apikey.key.clone();
6114 let value = match apikey.prefix {
6115 Some(ref prefix) => format!("{} {}", prefix, key),
6116 None => key,
6117 };
6118 req_builder = req_builder.query(&[("sudo", value)]);
6119 }
6120 if let Some(ref apikey) = configuration.api_key {
6121 let key = apikey.key.clone();
6122 let value = match apikey.prefix {
6123 Some(ref prefix) => format!("{} {}", prefix, key),
6124 None => key,
6125 };
6126 req_builder = req_builder.query(&[("token", value)]);
6127 }
6128 if let Some(ref user_agent) = configuration.user_agent {
6129 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
6138 };
6139 if let Some(ref apikey) = configuration.api_key {
6140 let key = apikey.key.clone();
6141 let value = match apikey.prefix {
6142 Some(ref prefix) => format!("{} {}", prefix, key),
6143 None => key,
6144 };
6145 req_builder = req_builder.header("Authorization", value);
6146 };
6147 if let Some(ref apikey) = configuration.api_key {
6148 let key = apikey.key.clone();
6149 let value = match apikey.prefix {
6150 Some(ref prefix) => format!("{} {}", prefix, key),
6151 None => key,
6152 };
6153 req_builder = req_builder.header("Sudo", value);
6154 };
6155 if let Some(ref auth_conf) = configuration.basic_auth {
6156 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6157 };
6158 req_builder = req_builder.json(&p_body_body);
6159
6160 let req = req_builder.build()?;
6161 let resp = configuration.client.execute(req).await?;
6162
6163 let status = resp.status();
6164 let content_type = resp
6165 .headers()
6166 .get("content-type")
6167 .and_then(|v| v.to_str().ok())
6168 .unwrap_or("application/octet-stream");
6169 let content_type = super::ContentType::from(content_type);
6170
6171 if !status.is_client_error() && !status.is_server_error() {
6172 let content = resp.text().await?;
6173 match content_type {
6174 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6175 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))),
6176 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::PullRequest`")))),
6177 }
6178 } else {
6179 let content = resp.text().await?;
6180 let entity: Option<RepoCreatePullRequestError> = serde_json::from_str(&content).ok();
6181 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6182 }
6183}
6184
6185pub async fn repo_create_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: models::CreatePullReviewOptions) -> Result<models::PullReview, Error<RepoCreatePullReviewError>> {
6186 let p_path_owner = owner;
6188 let p_path_repo = repo;
6189 let p_path_index = index;
6190 let p_body_body = body;
6191
6192 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6193 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6194
6195 if let Some(ref apikey) = configuration.api_key {
6196 let key = apikey.key.clone();
6197 let value = match apikey.prefix {
6198 Some(ref prefix) => format!("{} {}", prefix, key),
6199 None => key,
6200 };
6201 req_builder = req_builder.query(&[("access_token", value)]);
6202 }
6203 if let Some(ref apikey) = configuration.api_key {
6204 let key = apikey.key.clone();
6205 let value = match apikey.prefix {
6206 Some(ref prefix) => format!("{} {}", prefix, key),
6207 None => key,
6208 };
6209 req_builder = req_builder.query(&[("sudo", value)]);
6210 }
6211 if let Some(ref apikey) = configuration.api_key {
6212 let key = apikey.key.clone();
6213 let value = match apikey.prefix {
6214 Some(ref prefix) => format!("{} {}", prefix, key),
6215 None => key,
6216 };
6217 req_builder = req_builder.query(&[("token", value)]);
6218 }
6219 if let Some(ref user_agent) = configuration.user_agent {
6220 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6221 }
6222 if let Some(ref apikey) = configuration.api_key {
6223 let key = apikey.key.clone();
6224 let value = match apikey.prefix {
6225 Some(ref prefix) => format!("{} {}", prefix, key),
6226 None => key,
6227 };
6228 req_builder = req_builder.header("X-GITEA-OTP", value);
6229 };
6230 if let Some(ref apikey) = configuration.api_key {
6231 let key = apikey.key.clone();
6232 let value = match apikey.prefix {
6233 Some(ref prefix) => format!("{} {}", prefix, key),
6234 None => key,
6235 };
6236 req_builder = req_builder.header("Authorization", value);
6237 };
6238 if let Some(ref apikey) = configuration.api_key {
6239 let key = apikey.key.clone();
6240 let value = match apikey.prefix {
6241 Some(ref prefix) => format!("{} {}", prefix, key),
6242 None => key,
6243 };
6244 req_builder = req_builder.header("Sudo", value);
6245 };
6246 if let Some(ref auth_conf) = configuration.basic_auth {
6247 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6248 };
6249 req_builder = req_builder.json(&p_body_body);
6250
6251 let req = req_builder.build()?;
6252 let resp = configuration.client.execute(req).await?;
6253
6254 let status = resp.status();
6255 let content_type = resp
6256 .headers()
6257 .get("content-type")
6258 .and_then(|v| v.to_str().ok())
6259 .unwrap_or("application/octet-stream");
6260 let content_type = super::ContentType::from(content_type);
6261
6262 if !status.is_client_error() && !status.is_server_error() {
6263 let content = resp.text().await?;
6264 match content_type {
6265 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6266 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))),
6267 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::PullReview`")))),
6268 }
6269 } else {
6270 let content = resp.text().await?;
6271 let entity: Option<RepoCreatePullReviewError> = serde_json::from_str(&content).ok();
6272 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6273 }
6274}
6275
6276pub async fn repo_create_pull_review_requests(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: models::PullReviewRequestOptions) -> Result<Vec<models::PullReview>, Error<RepoCreatePullReviewRequestsError>> {
6277 let p_path_owner = owner;
6279 let p_path_repo = repo;
6280 let p_path_index = index;
6281 let p_body_body = body;
6282
6283 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/requested_reviewers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6284 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6285
6286 if let Some(ref apikey) = configuration.api_key {
6287 let key = apikey.key.clone();
6288 let value = match apikey.prefix {
6289 Some(ref prefix) => format!("{} {}", prefix, key),
6290 None => key,
6291 };
6292 req_builder = req_builder.query(&[("access_token", value)]);
6293 }
6294 if let Some(ref apikey) = configuration.api_key {
6295 let key = apikey.key.clone();
6296 let value = match apikey.prefix {
6297 Some(ref prefix) => format!("{} {}", prefix, key),
6298 None => key,
6299 };
6300 req_builder = req_builder.query(&[("sudo", value)]);
6301 }
6302 if let Some(ref apikey) = configuration.api_key {
6303 let key = apikey.key.clone();
6304 let value = match apikey.prefix {
6305 Some(ref prefix) => format!("{} {}", prefix, key),
6306 None => key,
6307 };
6308 req_builder = req_builder.query(&[("token", value)]);
6309 }
6310 if let Some(ref user_agent) = configuration.user_agent {
6311 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6312 }
6313 if let Some(ref apikey) = configuration.api_key {
6314 let key = apikey.key.clone();
6315 let value = match apikey.prefix {
6316 Some(ref prefix) => format!("{} {}", prefix, key),
6317 None => key,
6318 };
6319 req_builder = req_builder.header("X-GITEA-OTP", value);
6320 };
6321 if let Some(ref apikey) = configuration.api_key {
6322 let key = apikey.key.clone();
6323 let value = match apikey.prefix {
6324 Some(ref prefix) => format!("{} {}", prefix, key),
6325 None => key,
6326 };
6327 req_builder = req_builder.header("Authorization", value);
6328 };
6329 if let Some(ref apikey) = configuration.api_key {
6330 let key = apikey.key.clone();
6331 let value = match apikey.prefix {
6332 Some(ref prefix) => format!("{} {}", prefix, key),
6333 None => key,
6334 };
6335 req_builder = req_builder.header("Sudo", value);
6336 };
6337 if let Some(ref auth_conf) = configuration.basic_auth {
6338 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6339 };
6340 req_builder = req_builder.json(&p_body_body);
6341
6342 let req = req_builder.build()?;
6343 let resp = configuration.client.execute(req).await?;
6344
6345 let status = resp.status();
6346 let content_type = resp
6347 .headers()
6348 .get("content-type")
6349 .and_then(|v| v.to_str().ok())
6350 .unwrap_or("application/octet-stream");
6351 let content_type = super::ContentType::from(content_type);
6352
6353 if !status.is_client_error() && !status.is_server_error() {
6354 let content = resp.text().await?;
6355 match content_type {
6356 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6357 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullReview>`"))),
6358 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::PullReview>`")))),
6359 }
6360 } else {
6361 let content = resp.text().await?;
6362 let entity: Option<RepoCreatePullReviewRequestsError> = serde_json::from_str(&content).ok();
6363 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6364 }
6365}
6366
6367pub async fn repo_create_release(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateReleaseOption>) -> Result<models::Release, Error<RepoCreateReleaseError>> {
6368 let p_path_owner = owner;
6370 let p_path_repo = repo;
6371 let p_body_body = body;
6372
6373 let uri_str = format!("{}/repos/{owner}/{repo}/releases", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
6374 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6375
6376 if let Some(ref apikey) = configuration.api_key {
6377 let key = apikey.key.clone();
6378 let value = match apikey.prefix {
6379 Some(ref prefix) => format!("{} {}", prefix, key),
6380 None => key,
6381 };
6382 req_builder = req_builder.query(&[("access_token", value)]);
6383 }
6384 if let Some(ref apikey) = configuration.api_key {
6385 let key = apikey.key.clone();
6386 let value = match apikey.prefix {
6387 Some(ref prefix) => format!("{} {}", prefix, key),
6388 None => key,
6389 };
6390 req_builder = req_builder.query(&[("sudo", value)]);
6391 }
6392 if let Some(ref apikey) = configuration.api_key {
6393 let key = apikey.key.clone();
6394 let value = match apikey.prefix {
6395 Some(ref prefix) => format!("{} {}", prefix, key),
6396 None => key,
6397 };
6398 req_builder = req_builder.query(&[("token", value)]);
6399 }
6400 if let Some(ref user_agent) = configuration.user_agent {
6401 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6402 }
6403 if let Some(ref apikey) = configuration.api_key {
6404 let key = apikey.key.clone();
6405 let value = match apikey.prefix {
6406 Some(ref prefix) => format!("{} {}", prefix, key),
6407 None => key,
6408 };
6409 req_builder = req_builder.header("X-GITEA-OTP", value);
6410 };
6411 if let Some(ref apikey) = configuration.api_key {
6412 let key = apikey.key.clone();
6413 let value = match apikey.prefix {
6414 Some(ref prefix) => format!("{} {}", prefix, key),
6415 None => key,
6416 };
6417 req_builder = req_builder.header("Authorization", value);
6418 };
6419 if let Some(ref apikey) = configuration.api_key {
6420 let key = apikey.key.clone();
6421 let value = match apikey.prefix {
6422 Some(ref prefix) => format!("{} {}", prefix, key),
6423 None => key,
6424 };
6425 req_builder = req_builder.header("Sudo", value);
6426 };
6427 if let Some(ref auth_conf) = configuration.basic_auth {
6428 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6429 };
6430 req_builder = req_builder.json(&p_body_body);
6431
6432 let req = req_builder.build()?;
6433 let resp = configuration.client.execute(req).await?;
6434
6435 let status = resp.status();
6436 let content_type = resp
6437 .headers()
6438 .get("content-type")
6439 .and_then(|v| v.to_str().ok())
6440 .unwrap_or("application/octet-stream");
6441 let content_type = super::ContentType::from(content_type);
6442
6443 if !status.is_client_error() && !status.is_server_error() {
6444 let content = resp.text().await?;
6445 match content_type {
6446 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6447 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))),
6448 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::Release`")))),
6449 }
6450 } else {
6451 let content = resp.text().await?;
6452 let entity: Option<RepoCreateReleaseError> = serde_json::from_str(&content).ok();
6453 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6454 }
6455}
6456
6457pub async fn repo_create_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, name: Option<&str>, attachment: Option<std::path::PathBuf>) -> Result<models::Attachment, Error<RepoCreateReleaseAttachmentError>> {
6458 let p_path_owner = owner;
6460 let p_path_repo = repo;
6461 let p_path_id = id;
6462 let p_query_name = name;
6463 let p_form_attachment = attachment;
6464
6465 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
6466 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6467
6468 if let Some(ref param_value) = p_query_name {
6469 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
6470 }
6471 if let Some(ref apikey) = configuration.api_key {
6472 let key = apikey.key.clone();
6473 let value = match apikey.prefix {
6474 Some(ref prefix) => format!("{} {}", prefix, key),
6475 None => key,
6476 };
6477 req_builder = req_builder.query(&[("access_token", value)]);
6478 }
6479 if let Some(ref apikey) = configuration.api_key {
6480 let key = apikey.key.clone();
6481 let value = match apikey.prefix {
6482 Some(ref prefix) => format!("{} {}", prefix, key),
6483 None => key,
6484 };
6485 req_builder = req_builder.query(&[("sudo", value)]);
6486 }
6487 if let Some(ref apikey) = configuration.api_key {
6488 let key = apikey.key.clone();
6489 let value = match apikey.prefix {
6490 Some(ref prefix) => format!("{} {}", prefix, key),
6491 None => key,
6492 };
6493 req_builder = req_builder.query(&[("token", value)]);
6494 }
6495 if let Some(ref user_agent) = configuration.user_agent {
6496 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6497 }
6498 if let Some(ref apikey) = configuration.api_key {
6499 let key = apikey.key.clone();
6500 let value = match apikey.prefix {
6501 Some(ref prefix) => format!("{} {}", prefix, key),
6502 None => key,
6503 };
6504 req_builder = req_builder.header("X-GITEA-OTP", value);
6505 };
6506 if let Some(ref apikey) = configuration.api_key {
6507 let key = apikey.key.clone();
6508 let value = match apikey.prefix {
6509 Some(ref prefix) => format!("{} {}", prefix, key),
6510 None => key,
6511 };
6512 req_builder = req_builder.header("Authorization", value);
6513 };
6514 if let Some(ref apikey) = configuration.api_key {
6515 let key = apikey.key.clone();
6516 let value = match apikey.prefix {
6517 Some(ref prefix) => format!("{} {}", prefix, key),
6518 None => key,
6519 };
6520 req_builder = req_builder.header("Sudo", value);
6521 };
6522 if let Some(ref auth_conf) = configuration.basic_auth {
6523 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6524 };
6525 let mut multipart_form = reqwest::multipart::Form::new();
6526 if let Some(ref param_value) = p_form_attachment {
6527 let file = TokioFile::open(param_value).await?;
6528 let stream = FramedRead::new(file, BytesCodec::new());
6529 let file_name = param_value.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default();
6530 let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name);
6531 multipart_form = multipart_form.part("attachment", file_part);
6532 }
6533 req_builder = req_builder.multipart(multipart_form);
6534
6535 let req = req_builder.build()?;
6536 let resp = configuration.client.execute(req).await?;
6537
6538 let status = resp.status();
6539 let content_type = resp
6540 .headers()
6541 .get("content-type")
6542 .and_then(|v| v.to_str().ok())
6543 .unwrap_or("application/octet-stream");
6544 let content_type = super::ContentType::from(content_type);
6545
6546 if !status.is_client_error() && !status.is_server_error() {
6547 let content = resp.text().await?;
6548 match content_type {
6549 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6550 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
6551 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::Attachment`")))),
6552 }
6553 } else {
6554 let content = resp.text().await?;
6555 let entity: Option<RepoCreateReleaseAttachmentError> = serde_json::from_str(&content).ok();
6556 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6557 }
6558}
6559
6560pub async fn repo_create_runner_registration_token(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<RepoCreateRunnerRegistrationTokenError>> {
6561 let p_path_owner = owner;
6563 let p_path_repo = repo;
6564
6565 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/registration-token", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
6566 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6567
6568 if let Some(ref apikey) = configuration.api_key {
6569 let key = apikey.key.clone();
6570 let value = match apikey.prefix {
6571 Some(ref prefix) => format!("{} {}", prefix, key),
6572 None => key,
6573 };
6574 req_builder = req_builder.query(&[("access_token", value)]);
6575 }
6576 if let Some(ref apikey) = configuration.api_key {
6577 let key = apikey.key.clone();
6578 let value = match apikey.prefix {
6579 Some(ref prefix) => format!("{} {}", prefix, key),
6580 None => key,
6581 };
6582 req_builder = req_builder.query(&[("sudo", value)]);
6583 }
6584 if let Some(ref apikey) = configuration.api_key {
6585 let key = apikey.key.clone();
6586 let value = match apikey.prefix {
6587 Some(ref prefix) => format!("{} {}", prefix, key),
6588 None => key,
6589 };
6590 req_builder = req_builder.query(&[("token", value)]);
6591 }
6592 if let Some(ref user_agent) = configuration.user_agent {
6593 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6594 }
6595 if let Some(ref apikey) = configuration.api_key {
6596 let key = apikey.key.clone();
6597 let value = match apikey.prefix {
6598 Some(ref prefix) => format!("{} {}", prefix, key),
6599 None => key,
6600 };
6601 req_builder = req_builder.header("X-GITEA-OTP", value);
6602 };
6603 if let Some(ref apikey) = configuration.api_key {
6604 let key = apikey.key.clone();
6605 let value = match apikey.prefix {
6606 Some(ref prefix) => format!("{} {}", prefix, key),
6607 None => key,
6608 };
6609 req_builder = req_builder.header("Authorization", value);
6610 };
6611 if let Some(ref apikey) = configuration.api_key {
6612 let key = apikey.key.clone();
6613 let value = match apikey.prefix {
6614 Some(ref prefix) => format!("{} {}", prefix, key),
6615 None => key,
6616 };
6617 req_builder = req_builder.header("Sudo", value);
6618 };
6619 if let Some(ref auth_conf) = configuration.basic_auth {
6620 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6621 };
6622
6623 let req = req_builder.build()?;
6624 let resp = configuration.client.execute(req).await?;
6625
6626 let status = resp.status();
6627
6628 if !status.is_client_error() && !status.is_server_error() {
6629 Ok(())
6630 } else {
6631 let content = resp.text().await?;
6632 let entity: Option<RepoCreateRunnerRegistrationTokenError> = serde_json::from_str(&content).ok();
6633 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6634 }
6635}
6636
6637pub async fn repo_create_status(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, body: Option<models::CreateStatusOption>) -> Result<models::CommitStatus, Error<RepoCreateStatusError>> {
6638 let p_path_owner = owner;
6640 let p_path_repo = repo;
6641 let p_path_sha = sha;
6642 let p_body_body = body;
6643
6644 let uri_str = format!("{}/repos/{owner}/{repo}/statuses/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
6645 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6646
6647 if let Some(ref apikey) = configuration.api_key {
6648 let key = apikey.key.clone();
6649 let value = match apikey.prefix {
6650 Some(ref prefix) => format!("{} {}", prefix, key),
6651 None => key,
6652 };
6653 req_builder = req_builder.query(&[("access_token", value)]);
6654 }
6655 if let Some(ref apikey) = configuration.api_key {
6656 let key = apikey.key.clone();
6657 let value = match apikey.prefix {
6658 Some(ref prefix) => format!("{} {}", prefix, key),
6659 None => key,
6660 };
6661 req_builder = req_builder.query(&[("sudo", value)]);
6662 }
6663 if let Some(ref apikey) = configuration.api_key {
6664 let key = apikey.key.clone();
6665 let value = match apikey.prefix {
6666 Some(ref prefix) => format!("{} {}", prefix, key),
6667 None => key,
6668 };
6669 req_builder = req_builder.query(&[("token", value)]);
6670 }
6671 if let Some(ref user_agent) = configuration.user_agent {
6672 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6673 }
6674 if let Some(ref apikey) = configuration.api_key {
6675 let key = apikey.key.clone();
6676 let value = match apikey.prefix {
6677 Some(ref prefix) => format!("{} {}", prefix, key),
6678 None => key,
6679 };
6680 req_builder = req_builder.header("X-GITEA-OTP", value);
6681 };
6682 if let Some(ref apikey) = configuration.api_key {
6683 let key = apikey.key.clone();
6684 let value = match apikey.prefix {
6685 Some(ref prefix) => format!("{} {}", prefix, key),
6686 None => key,
6687 };
6688 req_builder = req_builder.header("Authorization", value);
6689 };
6690 if let Some(ref apikey) = configuration.api_key {
6691 let key = apikey.key.clone();
6692 let value = match apikey.prefix {
6693 Some(ref prefix) => format!("{} {}", prefix, key),
6694 None => key,
6695 };
6696 req_builder = req_builder.header("Sudo", value);
6697 };
6698 if let Some(ref auth_conf) = configuration.basic_auth {
6699 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6700 };
6701 req_builder = req_builder.json(&p_body_body);
6702
6703 let req = req_builder.build()?;
6704 let resp = configuration.client.execute(req).await?;
6705
6706 let status = resp.status();
6707 let content_type = resp
6708 .headers()
6709 .get("content-type")
6710 .and_then(|v| v.to_str().ok())
6711 .unwrap_or("application/octet-stream");
6712 let content_type = super::ContentType::from(content_type);
6713
6714 if !status.is_client_error() && !status.is_server_error() {
6715 let content = resp.text().await?;
6716 match content_type {
6717 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6718 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CommitStatus`"))),
6719 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::CommitStatus`")))),
6720 }
6721 } else {
6722 let content = resp.text().await?;
6723 let entity: Option<RepoCreateStatusError> = serde_json::from_str(&content).ok();
6724 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6725 }
6726}
6727
6728pub async fn repo_create_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateTagOption>) -> Result<models::Tag, Error<RepoCreateTagError>> {
6729 let p_path_owner = owner;
6731 let p_path_repo = repo;
6732 let p_body_body = body;
6733
6734 let uri_str = format!("{}/repos/{owner}/{repo}/tags", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
6735 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6736
6737 if let Some(ref apikey) = configuration.api_key {
6738 let key = apikey.key.clone();
6739 let value = match apikey.prefix {
6740 Some(ref prefix) => format!("{} {}", prefix, key),
6741 None => key,
6742 };
6743 req_builder = req_builder.query(&[("access_token", value)]);
6744 }
6745 if let Some(ref apikey) = configuration.api_key {
6746 let key = apikey.key.clone();
6747 let value = match apikey.prefix {
6748 Some(ref prefix) => format!("{} {}", prefix, key),
6749 None => key,
6750 };
6751 req_builder = req_builder.query(&[("sudo", value)]);
6752 }
6753 if let Some(ref apikey) = configuration.api_key {
6754 let key = apikey.key.clone();
6755 let value = match apikey.prefix {
6756 Some(ref prefix) => format!("{} {}", prefix, key),
6757 None => key,
6758 };
6759 req_builder = req_builder.query(&[("token", value)]);
6760 }
6761 if let Some(ref user_agent) = configuration.user_agent {
6762 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6763 }
6764 if let Some(ref apikey) = configuration.api_key {
6765 let key = apikey.key.clone();
6766 let value = match apikey.prefix {
6767 Some(ref prefix) => format!("{} {}", prefix, key),
6768 None => key,
6769 };
6770 req_builder = req_builder.header("X-GITEA-OTP", value);
6771 };
6772 if let Some(ref apikey) = configuration.api_key {
6773 let key = apikey.key.clone();
6774 let value = match apikey.prefix {
6775 Some(ref prefix) => format!("{} {}", prefix, key),
6776 None => key,
6777 };
6778 req_builder = req_builder.header("Authorization", value);
6779 };
6780 if let Some(ref apikey) = configuration.api_key {
6781 let key = apikey.key.clone();
6782 let value = match apikey.prefix {
6783 Some(ref prefix) => format!("{} {}", prefix, key),
6784 None => key,
6785 };
6786 req_builder = req_builder.header("Sudo", value);
6787 };
6788 if let Some(ref auth_conf) = configuration.basic_auth {
6789 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6790 };
6791 req_builder = req_builder.json(&p_body_body);
6792
6793 let req = req_builder.build()?;
6794 let resp = configuration.client.execute(req).await?;
6795
6796 let status = resp.status();
6797 let content_type = resp
6798 .headers()
6799 .get("content-type")
6800 .and_then(|v| v.to_str().ok())
6801 .unwrap_or("application/octet-stream");
6802 let content_type = super::ContentType::from(content_type);
6803
6804 if !status.is_client_error() && !status.is_server_error() {
6805 let content = resp.text().await?;
6806 match content_type {
6807 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6808 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Tag`"))),
6809 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::Tag`")))),
6810 }
6811 } else {
6812 let content = resp.text().await?;
6813 let entity: Option<RepoCreateTagError> = serde_json::from_str(&content).ok();
6814 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6815 }
6816}
6817
6818pub async fn repo_create_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateTagProtectionOption>) -> Result<models::TagProtection, Error<RepoCreateTagProtectionError>> {
6819 let p_path_owner = owner;
6821 let p_path_repo = repo;
6822 let p_body_body = body;
6823
6824 let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
6825 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6826
6827 if let Some(ref apikey) = configuration.api_key {
6828 let key = apikey.key.clone();
6829 let value = match apikey.prefix {
6830 Some(ref prefix) => format!("{} {}", prefix, key),
6831 None => key,
6832 };
6833 req_builder = req_builder.query(&[("access_token", value)]);
6834 }
6835 if let Some(ref apikey) = configuration.api_key {
6836 let key = apikey.key.clone();
6837 let value = match apikey.prefix {
6838 Some(ref prefix) => format!("{} {}", prefix, key),
6839 None => key,
6840 };
6841 req_builder = req_builder.query(&[("sudo", value)]);
6842 }
6843 if let Some(ref apikey) = configuration.api_key {
6844 let key = apikey.key.clone();
6845 let value = match apikey.prefix {
6846 Some(ref prefix) => format!("{} {}", prefix, key),
6847 None => key,
6848 };
6849 req_builder = req_builder.query(&[("token", value)]);
6850 }
6851 if let Some(ref user_agent) = configuration.user_agent {
6852 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6853 }
6854 if let Some(ref apikey) = configuration.api_key {
6855 let key = apikey.key.clone();
6856 let value = match apikey.prefix {
6857 Some(ref prefix) => format!("{} {}", prefix, key),
6858 None => key,
6859 };
6860 req_builder = req_builder.header("X-GITEA-OTP", value);
6861 };
6862 if let Some(ref apikey) = configuration.api_key {
6863 let key = apikey.key.clone();
6864 let value = match apikey.prefix {
6865 Some(ref prefix) => format!("{} {}", prefix, key),
6866 None => key,
6867 };
6868 req_builder = req_builder.header("Authorization", value);
6869 };
6870 if let Some(ref apikey) = configuration.api_key {
6871 let key = apikey.key.clone();
6872 let value = match apikey.prefix {
6873 Some(ref prefix) => format!("{} {}", prefix, key),
6874 None => key,
6875 };
6876 req_builder = req_builder.header("Sudo", value);
6877 };
6878 if let Some(ref auth_conf) = configuration.basic_auth {
6879 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6880 };
6881 req_builder = req_builder.json(&p_body_body);
6882
6883 let req = req_builder.build()?;
6884 let resp = configuration.client.execute(req).await?;
6885
6886 let status = resp.status();
6887 let content_type = resp
6888 .headers()
6889 .get("content-type")
6890 .and_then(|v| v.to_str().ok())
6891 .unwrap_or("application/octet-stream");
6892 let content_type = super::ContentType::from(content_type);
6893
6894 if !status.is_client_error() && !status.is_server_error() {
6895 let content = resp.text().await?;
6896 match content_type {
6897 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6898 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TagProtection`"))),
6899 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::TagProtection`")))),
6900 }
6901 } else {
6902 let content = resp.text().await?;
6903 let entity: Option<RepoCreateTagProtectionError> = serde_json::from_str(&content).ok();
6904 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6905 }
6906}
6907
6908pub async fn repo_create_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateWikiPageOptions>) -> Result<models::WikiPage, Error<RepoCreateWikiPageError>> {
6909 let p_path_owner = owner;
6911 let p_path_repo = repo;
6912 let p_body_body = body;
6913
6914 let uri_str = format!("{}/repos/{owner}/{repo}/wiki/new", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
6915 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6916
6917 if let Some(ref apikey) = configuration.api_key {
6918 let key = apikey.key.clone();
6919 let value = match apikey.prefix {
6920 Some(ref prefix) => format!("{} {}", prefix, key),
6921 None => key,
6922 };
6923 req_builder = req_builder.query(&[("access_token", value)]);
6924 }
6925 if let Some(ref apikey) = configuration.api_key {
6926 let key = apikey.key.clone();
6927 let value = match apikey.prefix {
6928 Some(ref prefix) => format!("{} {}", prefix, key),
6929 None => key,
6930 };
6931 req_builder = req_builder.query(&[("sudo", value)]);
6932 }
6933 if let Some(ref apikey) = configuration.api_key {
6934 let key = apikey.key.clone();
6935 let value = match apikey.prefix {
6936 Some(ref prefix) => format!("{} {}", prefix, key),
6937 None => key,
6938 };
6939 req_builder = req_builder.query(&[("token", value)]);
6940 }
6941 if let Some(ref user_agent) = configuration.user_agent {
6942 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6943 }
6944 if let Some(ref apikey) = configuration.api_key {
6945 let key = apikey.key.clone();
6946 let value = match apikey.prefix {
6947 Some(ref prefix) => format!("{} {}", prefix, key),
6948 None => key,
6949 };
6950 req_builder = req_builder.header("X-GITEA-OTP", value);
6951 };
6952 if let Some(ref apikey) = configuration.api_key {
6953 let key = apikey.key.clone();
6954 let value = match apikey.prefix {
6955 Some(ref prefix) => format!("{} {}", prefix, key),
6956 None => key,
6957 };
6958 req_builder = req_builder.header("Authorization", value);
6959 };
6960 if let Some(ref apikey) = configuration.api_key {
6961 let key = apikey.key.clone();
6962 let value = match apikey.prefix {
6963 Some(ref prefix) => format!("{} {}", prefix, key),
6964 None => key,
6965 };
6966 req_builder = req_builder.header("Sudo", value);
6967 };
6968 if let Some(ref auth_conf) = configuration.basic_auth {
6969 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6970 };
6971 req_builder = req_builder.json(&p_body_body);
6972
6973 let req = req_builder.build()?;
6974 let resp = configuration.client.execute(req).await?;
6975
6976 let status = resp.status();
6977 let content_type = resp
6978 .headers()
6979 .get("content-type")
6980 .and_then(|v| v.to_str().ok())
6981 .unwrap_or("application/octet-stream");
6982 let content_type = super::ContentType::from(content_type);
6983
6984 if !status.is_client_error() && !status.is_server_error() {
6985 let content = resp.text().await?;
6986 match content_type {
6987 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6988 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiPage`"))),
6989 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::WikiPage`")))),
6990 }
6991 } else {
6992 let content = resp.text().await?;
6993 let entity: Option<RepoCreateWikiPageError> = serde_json::from_str(&content).ok();
6994 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6995 }
6996}
6997
6998pub async fn repo_delete(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<RepoDeleteError>> {
6999 let p_path_owner = owner;
7001 let p_path_repo = repo;
7002
7003 let uri_str = format!("{}/repos/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
7004 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7005
7006 if let Some(ref apikey) = configuration.api_key {
7007 let key = apikey.key.clone();
7008 let value = match apikey.prefix {
7009 Some(ref prefix) => format!("{} {}", prefix, key),
7010 None => key,
7011 };
7012 req_builder = req_builder.query(&[("access_token", value)]);
7013 }
7014 if let Some(ref apikey) = configuration.api_key {
7015 let key = apikey.key.clone();
7016 let value = match apikey.prefix {
7017 Some(ref prefix) => format!("{} {}", prefix, key),
7018 None => key,
7019 };
7020 req_builder = req_builder.query(&[("sudo", value)]);
7021 }
7022 if let Some(ref apikey) = configuration.api_key {
7023 let key = apikey.key.clone();
7024 let value = match apikey.prefix {
7025 Some(ref prefix) => format!("{} {}", prefix, key),
7026 None => key,
7027 };
7028 req_builder = req_builder.query(&[("token", value)]);
7029 }
7030 if let Some(ref user_agent) = configuration.user_agent {
7031 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7032 }
7033 if let Some(ref apikey) = configuration.api_key {
7034 let key = apikey.key.clone();
7035 let value = match apikey.prefix {
7036 Some(ref prefix) => format!("{} {}", prefix, key),
7037 None => key,
7038 };
7039 req_builder = req_builder.header("X-GITEA-OTP", value);
7040 };
7041 if let Some(ref apikey) = configuration.api_key {
7042 let key = apikey.key.clone();
7043 let value = match apikey.prefix {
7044 Some(ref prefix) => format!("{} {}", prefix, key),
7045 None => key,
7046 };
7047 req_builder = req_builder.header("Authorization", value);
7048 };
7049 if let Some(ref apikey) = configuration.api_key {
7050 let key = apikey.key.clone();
7051 let value = match apikey.prefix {
7052 Some(ref prefix) => format!("{} {}", prefix, key),
7053 None => key,
7054 };
7055 req_builder = req_builder.header("Sudo", value);
7056 };
7057 if let Some(ref auth_conf) = configuration.basic_auth {
7058 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7059 };
7060
7061 let req = req_builder.build()?;
7062 let resp = configuration.client.execute(req).await?;
7063
7064 let status = resp.status();
7065
7066 if !status.is_client_error() && !status.is_server_error() {
7067 Ok(())
7068 } else {
7069 let content = resp.text().await?;
7070 let entity: Option<RepoDeleteError> = serde_json::from_str(&content).ok();
7071 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7072 }
7073}
7074
7075pub async fn repo_delete_avatar(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<RepoDeleteAvatarError>> {
7076 let p_path_owner = owner;
7078 let p_path_repo = repo;
7079
7080 let uri_str = format!("{}/repos/{owner}/{repo}/avatar", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
7081 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7082
7083 if let Some(ref apikey) = configuration.api_key {
7084 let key = apikey.key.clone();
7085 let value = match apikey.prefix {
7086 Some(ref prefix) => format!("{} {}", prefix, key),
7087 None => key,
7088 };
7089 req_builder = req_builder.query(&[("access_token", value)]);
7090 }
7091 if let Some(ref apikey) = configuration.api_key {
7092 let key = apikey.key.clone();
7093 let value = match apikey.prefix {
7094 Some(ref prefix) => format!("{} {}", prefix, key),
7095 None => key,
7096 };
7097 req_builder = req_builder.query(&[("sudo", value)]);
7098 }
7099 if let Some(ref apikey) = configuration.api_key {
7100 let key = apikey.key.clone();
7101 let value = match apikey.prefix {
7102 Some(ref prefix) => format!("{} {}", prefix, key),
7103 None => key,
7104 };
7105 req_builder = req_builder.query(&[("token", value)]);
7106 }
7107 if let Some(ref user_agent) = configuration.user_agent {
7108 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7109 }
7110 if let Some(ref apikey) = configuration.api_key {
7111 let key = apikey.key.clone();
7112 let value = match apikey.prefix {
7113 Some(ref prefix) => format!("{} {}", prefix, key),
7114 None => key,
7115 };
7116 req_builder = req_builder.header("X-GITEA-OTP", value);
7117 };
7118 if let Some(ref apikey) = configuration.api_key {
7119 let key = apikey.key.clone();
7120 let value = match apikey.prefix {
7121 Some(ref prefix) => format!("{} {}", prefix, key),
7122 None => key,
7123 };
7124 req_builder = req_builder.header("Authorization", value);
7125 };
7126 if let Some(ref apikey) = configuration.api_key {
7127 let key = apikey.key.clone();
7128 let value = match apikey.prefix {
7129 Some(ref prefix) => format!("{} {}", prefix, key),
7130 None => key,
7131 };
7132 req_builder = req_builder.header("Sudo", value);
7133 };
7134 if let Some(ref auth_conf) = configuration.basic_auth {
7135 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7136 };
7137
7138 let req = req_builder.build()?;
7139 let resp = configuration.client.execute(req).await?;
7140
7141 let status = resp.status();
7142
7143 if !status.is_client_error() && !status.is_server_error() {
7144 Ok(())
7145 } else {
7146 let content = resp.text().await?;
7147 let entity: Option<RepoDeleteAvatarError> = serde_json::from_str(&content).ok();
7148 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7149 }
7150}
7151
7152pub async fn repo_delete_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, branch: &str) -> Result<(), Error<RepoDeleteBranchError>> {
7153 let p_path_owner = owner;
7155 let p_path_repo = repo;
7156 let p_path_branch = branch;
7157
7158 let uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), branch=crate::apis::urlencode(p_path_branch));
7159 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7160
7161 if let Some(ref apikey) = configuration.api_key {
7162 let key = apikey.key.clone();
7163 let value = match apikey.prefix {
7164 Some(ref prefix) => format!("{} {}", prefix, key),
7165 None => key,
7166 };
7167 req_builder = req_builder.query(&[("access_token", value)]);
7168 }
7169 if let Some(ref apikey) = configuration.api_key {
7170 let key = apikey.key.clone();
7171 let value = match apikey.prefix {
7172 Some(ref prefix) => format!("{} {}", prefix, key),
7173 None => key,
7174 };
7175 req_builder = req_builder.query(&[("sudo", value)]);
7176 }
7177 if let Some(ref apikey) = configuration.api_key {
7178 let key = apikey.key.clone();
7179 let value = match apikey.prefix {
7180 Some(ref prefix) => format!("{} {}", prefix, key),
7181 None => key,
7182 };
7183 req_builder = req_builder.query(&[("token", value)]);
7184 }
7185 if let Some(ref user_agent) = configuration.user_agent {
7186 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7187 }
7188 if let Some(ref apikey) = configuration.api_key {
7189 let key = apikey.key.clone();
7190 let value = match apikey.prefix {
7191 Some(ref prefix) => format!("{} {}", prefix, key),
7192 None => key,
7193 };
7194 req_builder = req_builder.header("X-GITEA-OTP", value);
7195 };
7196 if let Some(ref apikey) = configuration.api_key {
7197 let key = apikey.key.clone();
7198 let value = match apikey.prefix {
7199 Some(ref prefix) => format!("{} {}", prefix, key),
7200 None => key,
7201 };
7202 req_builder = req_builder.header("Authorization", value);
7203 };
7204 if let Some(ref apikey) = configuration.api_key {
7205 let key = apikey.key.clone();
7206 let value = match apikey.prefix {
7207 Some(ref prefix) => format!("{} {}", prefix, key),
7208 None => key,
7209 };
7210 req_builder = req_builder.header("Sudo", value);
7211 };
7212 if let Some(ref auth_conf) = configuration.basic_auth {
7213 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7214 };
7215
7216 let req = req_builder.build()?;
7217 let resp = configuration.client.execute(req).await?;
7218
7219 let status = resp.status();
7220
7221 if !status.is_client_error() && !status.is_server_error() {
7222 Ok(())
7223 } else {
7224 let content = resp.text().await?;
7225 let entity: Option<RepoDeleteBranchError> = serde_json::from_str(&content).ok();
7226 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7227 }
7228}
7229
7230pub async fn repo_delete_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result<(), Error<RepoDeleteBranchProtectionError>> {
7231 let p_path_owner = owner;
7233 let p_path_repo = repo;
7234 let p_path_name = name;
7235
7236 let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name));
7237 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7238
7239 if let Some(ref apikey) = configuration.api_key {
7240 let key = apikey.key.clone();
7241 let value = match apikey.prefix {
7242 Some(ref prefix) => format!("{} {}", prefix, key),
7243 None => key,
7244 };
7245 req_builder = req_builder.query(&[("access_token", value)]);
7246 }
7247 if let Some(ref apikey) = configuration.api_key {
7248 let key = apikey.key.clone();
7249 let value = match apikey.prefix {
7250 Some(ref prefix) => format!("{} {}", prefix, key),
7251 None => key,
7252 };
7253 req_builder = req_builder.query(&[("sudo", value)]);
7254 }
7255 if let Some(ref apikey) = configuration.api_key {
7256 let key = apikey.key.clone();
7257 let value = match apikey.prefix {
7258 Some(ref prefix) => format!("{} {}", prefix, key),
7259 None => key,
7260 };
7261 req_builder = req_builder.query(&[("token", value)]);
7262 }
7263 if let Some(ref user_agent) = configuration.user_agent {
7264 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7265 }
7266 if let Some(ref apikey) = configuration.api_key {
7267 let key = apikey.key.clone();
7268 let value = match apikey.prefix {
7269 Some(ref prefix) => format!("{} {}", prefix, key),
7270 None => key,
7271 };
7272 req_builder = req_builder.header("X-GITEA-OTP", value);
7273 };
7274 if let Some(ref apikey) = configuration.api_key {
7275 let key = apikey.key.clone();
7276 let value = match apikey.prefix {
7277 Some(ref prefix) => format!("{} {}", prefix, key),
7278 None => key,
7279 };
7280 req_builder = req_builder.header("Authorization", value);
7281 };
7282 if let Some(ref apikey) = configuration.api_key {
7283 let key = apikey.key.clone();
7284 let value = match apikey.prefix {
7285 Some(ref prefix) => format!("{} {}", prefix, key),
7286 None => key,
7287 };
7288 req_builder = req_builder.header("Sudo", value);
7289 };
7290 if let Some(ref auth_conf) = configuration.basic_auth {
7291 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7292 };
7293
7294 let req = req_builder.build()?;
7295 let resp = configuration.client.execute(req).await?;
7296
7297 let status = resp.status();
7298
7299 if !status.is_client_error() && !status.is_server_error() {
7300 Ok(())
7301 } else {
7302 let content = resp.text().await?;
7303 let entity: Option<RepoDeleteBranchProtectionError> = serde_json::from_str(&content).ok();
7304 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7305 }
7306}
7307
7308pub async fn repo_delete_collaborator(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str) -> Result<(), Error<RepoDeleteCollaboratorError>> {
7309 let p_path_owner = owner;
7311 let p_path_repo = repo;
7312 let p_path_collaborator = collaborator;
7313
7314 let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator));
7315 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7316
7317 if let Some(ref apikey) = configuration.api_key {
7318 let key = apikey.key.clone();
7319 let value = match apikey.prefix {
7320 Some(ref prefix) => format!("{} {}", prefix, key),
7321 None => key,
7322 };
7323 req_builder = req_builder.query(&[("access_token", value)]);
7324 }
7325 if let Some(ref apikey) = configuration.api_key {
7326 let key = apikey.key.clone();
7327 let value = match apikey.prefix {
7328 Some(ref prefix) => format!("{} {}", prefix, key),
7329 None => key,
7330 };
7331 req_builder = req_builder.query(&[("sudo", value)]);
7332 }
7333 if let Some(ref apikey) = configuration.api_key {
7334 let key = apikey.key.clone();
7335 let value = match apikey.prefix {
7336 Some(ref prefix) => format!("{} {}", prefix, key),
7337 None => key,
7338 };
7339 req_builder = req_builder.query(&[("token", value)]);
7340 }
7341 if let Some(ref user_agent) = configuration.user_agent {
7342 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7343 }
7344 if let Some(ref apikey) = configuration.api_key {
7345 let key = apikey.key.clone();
7346 let value = match apikey.prefix {
7347 Some(ref prefix) => format!("{} {}", prefix, key),
7348 None => key,
7349 };
7350 req_builder = req_builder.header("X-GITEA-OTP", value);
7351 };
7352 if let Some(ref apikey) = configuration.api_key {
7353 let key = apikey.key.clone();
7354 let value = match apikey.prefix {
7355 Some(ref prefix) => format!("{} {}", prefix, key),
7356 None => key,
7357 };
7358 req_builder = req_builder.header("Authorization", value);
7359 };
7360 if let Some(ref apikey) = configuration.api_key {
7361 let key = apikey.key.clone();
7362 let value = match apikey.prefix {
7363 Some(ref prefix) => format!("{} {}", prefix, key),
7364 None => key,
7365 };
7366 req_builder = req_builder.header("Sudo", value);
7367 };
7368 if let Some(ref auth_conf) = configuration.basic_auth {
7369 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7370 };
7371
7372 let req = req_builder.build()?;
7373 let resp = configuration.client.execute(req).await?;
7374
7375 let status = resp.status();
7376
7377 if !status.is_client_error() && !status.is_server_error() {
7378 Ok(())
7379 } else {
7380 let content = resp.text().await?;
7381 let entity: Option<RepoDeleteCollaboratorError> = serde_json::from_str(&content).ok();
7382 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7383 }
7384}
7385
7386pub async fn repo_delete_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, body: models::DeleteFileOptions) -> Result<models::FileDeleteResponse, Error<RepoDeleteFileError>> {
7387 let p_path_owner = owner;
7389 let p_path_repo = repo;
7390 let p_path_filepath = filepath;
7391 let p_body_body = body;
7392
7393 let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
7394 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7395
7396 if let Some(ref apikey) = configuration.api_key {
7397 let key = apikey.key.clone();
7398 let value = match apikey.prefix {
7399 Some(ref prefix) => format!("{} {}", prefix, key),
7400 None => key,
7401 };
7402 req_builder = req_builder.query(&[("access_token", value)]);
7403 }
7404 if let Some(ref apikey) = configuration.api_key {
7405 let key = apikey.key.clone();
7406 let value = match apikey.prefix {
7407 Some(ref prefix) => format!("{} {}", prefix, key),
7408 None => key,
7409 };
7410 req_builder = req_builder.query(&[("sudo", value)]);
7411 }
7412 if let Some(ref apikey) = configuration.api_key {
7413 let key = apikey.key.clone();
7414 let value = match apikey.prefix {
7415 Some(ref prefix) => format!("{} {}", prefix, key),
7416 None => key,
7417 };
7418 req_builder = req_builder.query(&[("token", value)]);
7419 }
7420 if let Some(ref user_agent) = configuration.user_agent {
7421 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7422 }
7423 if let Some(ref apikey) = configuration.api_key {
7424 let key = apikey.key.clone();
7425 let value = match apikey.prefix {
7426 Some(ref prefix) => format!("{} {}", prefix, key),
7427 None => key,
7428 };
7429 req_builder = req_builder.header("X-GITEA-OTP", value);
7430 };
7431 if let Some(ref apikey) = configuration.api_key {
7432 let key = apikey.key.clone();
7433 let value = match apikey.prefix {
7434 Some(ref prefix) => format!("{} {}", prefix, key),
7435 None => key,
7436 };
7437 req_builder = req_builder.header("Authorization", value);
7438 };
7439 if let Some(ref apikey) = configuration.api_key {
7440 let key = apikey.key.clone();
7441 let value = match apikey.prefix {
7442 Some(ref prefix) => format!("{} {}", prefix, key),
7443 None => key,
7444 };
7445 req_builder = req_builder.header("Sudo", value);
7446 };
7447 if let Some(ref auth_conf) = configuration.basic_auth {
7448 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7449 };
7450 req_builder = req_builder.json(&p_body_body);
7451
7452 let req = req_builder.build()?;
7453 let resp = configuration.client.execute(req).await?;
7454
7455 let status = resp.status();
7456 let content_type = resp
7457 .headers()
7458 .get("content-type")
7459 .and_then(|v| v.to_str().ok())
7460 .unwrap_or("application/octet-stream");
7461 let content_type = super::ContentType::from(content_type);
7462
7463 if !status.is_client_error() && !status.is_server_error() {
7464 let content = resp.text().await?;
7465 match content_type {
7466 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
7467 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileDeleteResponse`"))),
7468 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::FileDeleteResponse`")))),
7469 }
7470 } else {
7471 let content = resp.text().await?;
7472 let entity: Option<RepoDeleteFileError> = serde_json::from_str(&content).ok();
7473 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7474 }
7475}
7476
7477pub async fn repo_delete_git_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result<(), Error<RepoDeleteGitHookError>> {
7478 let p_path_owner = owner;
7480 let p_path_repo = repo;
7481 let p_path_id = id;
7482
7483 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id));
7484 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7485
7486 if let Some(ref apikey) = configuration.api_key {
7487 let key = apikey.key.clone();
7488 let value = match apikey.prefix {
7489 Some(ref prefix) => format!("{} {}", prefix, key),
7490 None => key,
7491 };
7492 req_builder = req_builder.query(&[("access_token", value)]);
7493 }
7494 if let Some(ref apikey) = configuration.api_key {
7495 let key = apikey.key.clone();
7496 let value = match apikey.prefix {
7497 Some(ref prefix) => format!("{} {}", prefix, key),
7498 None => key,
7499 };
7500 req_builder = req_builder.query(&[("sudo", value)]);
7501 }
7502 if let Some(ref apikey) = configuration.api_key {
7503 let key = apikey.key.clone();
7504 let value = match apikey.prefix {
7505 Some(ref prefix) => format!("{} {}", prefix, key),
7506 None => key,
7507 };
7508 req_builder = req_builder.query(&[("token", value)]);
7509 }
7510 if let Some(ref user_agent) = configuration.user_agent {
7511 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7512 }
7513 if let Some(ref apikey) = configuration.api_key {
7514 let key = apikey.key.clone();
7515 let value = match apikey.prefix {
7516 Some(ref prefix) => format!("{} {}", prefix, key),
7517 None => key,
7518 };
7519 req_builder = req_builder.header("X-GITEA-OTP", value);
7520 };
7521 if let Some(ref apikey) = configuration.api_key {
7522 let key = apikey.key.clone();
7523 let value = match apikey.prefix {
7524 Some(ref prefix) => format!("{} {}", prefix, key),
7525 None => key,
7526 };
7527 req_builder = req_builder.header("Authorization", value);
7528 };
7529 if let Some(ref apikey) = configuration.api_key {
7530 let key = apikey.key.clone();
7531 let value = match apikey.prefix {
7532 Some(ref prefix) => format!("{} {}", prefix, key),
7533 None => key,
7534 };
7535 req_builder = req_builder.header("Sudo", value);
7536 };
7537 if let Some(ref auth_conf) = configuration.basic_auth {
7538 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7539 };
7540
7541 let req = req_builder.build()?;
7542 let resp = configuration.client.execute(req).await?;
7543
7544 let status = resp.status();
7545
7546 if !status.is_client_error() && !status.is_server_error() {
7547 Ok(())
7548 } else {
7549 let content = resp.text().await?;
7550 let entity: Option<RepoDeleteGitHookError> = serde_json::from_str(&content).ok();
7551 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7552 }
7553}
7554
7555pub async fn repo_delete_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error<RepoDeleteHookError>> {
7556 let p_path_owner = owner;
7558 let p_path_repo = repo;
7559 let p_path_id = id;
7560
7561 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
7562 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7563
7564 if let Some(ref apikey) = configuration.api_key {
7565 let key = apikey.key.clone();
7566 let value = match apikey.prefix {
7567 Some(ref prefix) => format!("{} {}", prefix, key),
7568 None => key,
7569 };
7570 req_builder = req_builder.query(&[("access_token", value)]);
7571 }
7572 if let Some(ref apikey) = configuration.api_key {
7573 let key = apikey.key.clone();
7574 let value = match apikey.prefix {
7575 Some(ref prefix) => format!("{} {}", prefix, key),
7576 None => key,
7577 };
7578 req_builder = req_builder.query(&[("sudo", value)]);
7579 }
7580 if let Some(ref apikey) = configuration.api_key {
7581 let key = apikey.key.clone();
7582 let value = match apikey.prefix {
7583 Some(ref prefix) => format!("{} {}", prefix, key),
7584 None => key,
7585 };
7586 req_builder = req_builder.query(&[("token", value)]);
7587 }
7588 if let Some(ref user_agent) = configuration.user_agent {
7589 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7590 }
7591 if let Some(ref apikey) = configuration.api_key {
7592 let key = apikey.key.clone();
7593 let value = match apikey.prefix {
7594 Some(ref prefix) => format!("{} {}", prefix, key),
7595 None => key,
7596 };
7597 req_builder = req_builder.header("X-GITEA-OTP", value);
7598 };
7599 if let Some(ref apikey) = configuration.api_key {
7600 let key = apikey.key.clone();
7601 let value = match apikey.prefix {
7602 Some(ref prefix) => format!("{} {}", prefix, key),
7603 None => key,
7604 };
7605 req_builder = req_builder.header("Authorization", value);
7606 };
7607 if let Some(ref apikey) = configuration.api_key {
7608 let key = apikey.key.clone();
7609 let value = match apikey.prefix {
7610 Some(ref prefix) => format!("{} {}", prefix, key),
7611 None => key,
7612 };
7613 req_builder = req_builder.header("Sudo", value);
7614 };
7615 if let Some(ref auth_conf) = configuration.basic_auth {
7616 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7617 };
7618
7619 let req = req_builder.build()?;
7620 let resp = configuration.client.execute(req).await?;
7621
7622 let status = resp.status();
7623
7624 if !status.is_client_error() && !status.is_server_error() {
7625 Ok(())
7626 } else {
7627 let content = resp.text().await?;
7628 let entity: Option<RepoDeleteHookError> = serde_json::from_str(&content).ok();
7629 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7630 }
7631}
7632
7633pub async fn repo_delete_key(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error<RepoDeleteKeyError>> {
7634 let p_path_owner = owner;
7636 let p_path_repo = repo;
7637 let p_path_id = id;
7638
7639 let uri_str = format!("{}/repos/{owner}/{repo}/keys/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
7640 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7641
7642 if let Some(ref apikey) = configuration.api_key {
7643 let key = apikey.key.clone();
7644 let value = match apikey.prefix {
7645 Some(ref prefix) => format!("{} {}", prefix, key),
7646 None => key,
7647 };
7648 req_builder = req_builder.query(&[("access_token", value)]);
7649 }
7650 if let Some(ref apikey) = configuration.api_key {
7651 let key = apikey.key.clone();
7652 let value = match apikey.prefix {
7653 Some(ref prefix) => format!("{} {}", prefix, key),
7654 None => key,
7655 };
7656 req_builder = req_builder.query(&[("sudo", value)]);
7657 }
7658 if let Some(ref apikey) = configuration.api_key {
7659 let key = apikey.key.clone();
7660 let value = match apikey.prefix {
7661 Some(ref prefix) => format!("{} {}", prefix, key),
7662 None => key,
7663 };
7664 req_builder = req_builder.query(&[("token", value)]);
7665 }
7666 if let Some(ref user_agent) = configuration.user_agent {
7667 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7668 }
7669 if let Some(ref apikey) = configuration.api_key {
7670 let key = apikey.key.clone();
7671 let value = match apikey.prefix {
7672 Some(ref prefix) => format!("{} {}", prefix, key),
7673 None => key,
7674 };
7675 req_builder = req_builder.header("X-GITEA-OTP", value);
7676 };
7677 if let Some(ref apikey) = configuration.api_key {
7678 let key = apikey.key.clone();
7679 let value = match apikey.prefix {
7680 Some(ref prefix) => format!("{} {}", prefix, key),
7681 None => key,
7682 };
7683 req_builder = req_builder.header("Authorization", value);
7684 };
7685 if let Some(ref apikey) = configuration.api_key {
7686 let key = apikey.key.clone();
7687 let value = match apikey.prefix {
7688 Some(ref prefix) => format!("{} {}", prefix, key),
7689 None => key,
7690 };
7691 req_builder = req_builder.header("Sudo", value);
7692 };
7693 if let Some(ref auth_conf) = configuration.basic_auth {
7694 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7695 };
7696
7697 let req = req_builder.build()?;
7698 let resp = configuration.client.execute(req).await?;
7699
7700 let status = resp.status();
7701
7702 if !status.is_client_error() && !status.is_server_error() {
7703 Ok(())
7704 } else {
7705 let content = resp.text().await?;
7706 let entity: Option<RepoDeleteKeyError> = serde_json::from_str(&content).ok();
7707 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7708 }
7709}
7710
7711pub async fn repo_delete_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<(), Error<RepoDeletePullReviewError>> {
7712 let p_path_owner = owner;
7714 let p_path_repo = repo;
7715 let p_path_index = index;
7716 let p_path_id = id;
7717
7718 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id);
7719 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7720
7721 if let Some(ref apikey) = configuration.api_key {
7722 let key = apikey.key.clone();
7723 let value = match apikey.prefix {
7724 Some(ref prefix) => format!("{} {}", prefix, key),
7725 None => key,
7726 };
7727 req_builder = req_builder.query(&[("access_token", value)]);
7728 }
7729 if let Some(ref apikey) = configuration.api_key {
7730 let key = apikey.key.clone();
7731 let value = match apikey.prefix {
7732 Some(ref prefix) => format!("{} {}", prefix, key),
7733 None => key,
7734 };
7735 req_builder = req_builder.query(&[("sudo", value)]);
7736 }
7737 if let Some(ref apikey) = configuration.api_key {
7738 let key = apikey.key.clone();
7739 let value = match apikey.prefix {
7740 Some(ref prefix) => format!("{} {}", prefix, key),
7741 None => key,
7742 };
7743 req_builder = req_builder.query(&[("token", value)]);
7744 }
7745 if let Some(ref user_agent) = configuration.user_agent {
7746 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7747 }
7748 if let Some(ref apikey) = configuration.api_key {
7749 let key = apikey.key.clone();
7750 let value = match apikey.prefix {
7751 Some(ref prefix) => format!("{} {}", prefix, key),
7752 None => key,
7753 };
7754 req_builder = req_builder.header("X-GITEA-OTP", value);
7755 };
7756 if let Some(ref apikey) = configuration.api_key {
7757 let key = apikey.key.clone();
7758 let value = match apikey.prefix {
7759 Some(ref prefix) => format!("{} {}", prefix, key),
7760 None => key,
7761 };
7762 req_builder = req_builder.header("Authorization", value);
7763 };
7764 if let Some(ref apikey) = configuration.api_key {
7765 let key = apikey.key.clone();
7766 let value = match apikey.prefix {
7767 Some(ref prefix) => format!("{} {}", prefix, key),
7768 None => key,
7769 };
7770 req_builder = req_builder.header("Sudo", value);
7771 };
7772 if let Some(ref auth_conf) = configuration.basic_auth {
7773 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7774 };
7775
7776 let req = req_builder.build()?;
7777 let resp = configuration.client.execute(req).await?;
7778
7779 let status = resp.status();
7780
7781 if !status.is_client_error() && !status.is_server_error() {
7782 Ok(())
7783 } else {
7784 let content = resp.text().await?;
7785 let entity: Option<RepoDeletePullReviewError> = serde_json::from_str(&content).ok();
7786 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7787 }
7788}
7789
7790pub async fn repo_delete_pull_review_requests(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: models::PullReviewRequestOptions) -> Result<(), Error<RepoDeletePullReviewRequestsError>> {
7791 let p_path_owner = owner;
7793 let p_path_repo = repo;
7794 let p_path_index = index;
7795 let p_body_body = body;
7796
7797 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/requested_reviewers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
7798 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7799
7800 if let Some(ref apikey) = configuration.api_key {
7801 let key = apikey.key.clone();
7802 let value = match apikey.prefix {
7803 Some(ref prefix) => format!("{} {}", prefix, key),
7804 None => key,
7805 };
7806 req_builder = req_builder.query(&[("access_token", value)]);
7807 }
7808 if let Some(ref apikey) = configuration.api_key {
7809 let key = apikey.key.clone();
7810 let value = match apikey.prefix {
7811 Some(ref prefix) => format!("{} {}", prefix, key),
7812 None => key,
7813 };
7814 req_builder = req_builder.query(&[("sudo", value)]);
7815 }
7816 if let Some(ref apikey) = configuration.api_key {
7817 let key = apikey.key.clone();
7818 let value = match apikey.prefix {
7819 Some(ref prefix) => format!("{} {}", prefix, key),
7820 None => key,
7821 };
7822 req_builder = req_builder.query(&[("token", value)]);
7823 }
7824 if let Some(ref user_agent) = configuration.user_agent {
7825 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7826 }
7827 if let Some(ref apikey) = configuration.api_key {
7828 let key = apikey.key.clone();
7829 let value = match apikey.prefix {
7830 Some(ref prefix) => format!("{} {}", prefix, key),
7831 None => key,
7832 };
7833 req_builder = req_builder.header("X-GITEA-OTP", value);
7834 };
7835 if let Some(ref apikey) = configuration.api_key {
7836 let key = apikey.key.clone();
7837 let value = match apikey.prefix {
7838 Some(ref prefix) => format!("{} {}", prefix, key),
7839 None => key,
7840 };
7841 req_builder = req_builder.header("Authorization", value);
7842 };
7843 if let Some(ref apikey) = configuration.api_key {
7844 let key = apikey.key.clone();
7845 let value = match apikey.prefix {
7846 Some(ref prefix) => format!("{} {}", prefix, key),
7847 None => key,
7848 };
7849 req_builder = req_builder.header("Sudo", value);
7850 };
7851 if let Some(ref auth_conf) = configuration.basic_auth {
7852 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7853 };
7854 req_builder = req_builder.json(&p_body_body);
7855
7856 let req = req_builder.build()?;
7857 let resp = configuration.client.execute(req).await?;
7858
7859 let status = resp.status();
7860
7861 if !status.is_client_error() && !status.is_server_error() {
7862 Ok(())
7863 } else {
7864 let content = resp.text().await?;
7865 let entity: Option<RepoDeletePullReviewRequestsError> = serde_json::from_str(&content).ok();
7866 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7867 }
7868}
7869
7870pub async fn repo_delete_push_mirror(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result<(), Error<RepoDeletePushMirrorError>> {
7871 let p_path_owner = owner;
7873 let p_path_repo = repo;
7874 let p_path_name = name;
7875
7876 let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name));
7877 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7878
7879 if let Some(ref apikey) = configuration.api_key {
7880 let key = apikey.key.clone();
7881 let value = match apikey.prefix {
7882 Some(ref prefix) => format!("{} {}", prefix, key),
7883 None => key,
7884 };
7885 req_builder = req_builder.query(&[("access_token", value)]);
7886 }
7887 if let Some(ref apikey) = configuration.api_key {
7888 let key = apikey.key.clone();
7889 let value = match apikey.prefix {
7890 Some(ref prefix) => format!("{} {}", prefix, key),
7891 None => key,
7892 };
7893 req_builder = req_builder.query(&[("sudo", value)]);
7894 }
7895 if let Some(ref apikey) = configuration.api_key {
7896 let key = apikey.key.clone();
7897 let value = match apikey.prefix {
7898 Some(ref prefix) => format!("{} {}", prefix, key),
7899 None => key,
7900 };
7901 req_builder = req_builder.query(&[("token", value)]);
7902 }
7903 if let Some(ref user_agent) = configuration.user_agent {
7904 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7905 }
7906 if let Some(ref apikey) = configuration.api_key {
7907 let key = apikey.key.clone();
7908 let value = match apikey.prefix {
7909 Some(ref prefix) => format!("{} {}", prefix, key),
7910 None => key,
7911 };
7912 req_builder = req_builder.header("X-GITEA-OTP", value);
7913 };
7914 if let Some(ref apikey) = configuration.api_key {
7915 let key = apikey.key.clone();
7916 let value = match apikey.prefix {
7917 Some(ref prefix) => format!("{} {}", prefix, key),
7918 None => key,
7919 };
7920 req_builder = req_builder.header("Authorization", value);
7921 };
7922 if let Some(ref apikey) = configuration.api_key {
7923 let key = apikey.key.clone();
7924 let value = match apikey.prefix {
7925 Some(ref prefix) => format!("{} {}", prefix, key),
7926 None => key,
7927 };
7928 req_builder = req_builder.header("Sudo", value);
7929 };
7930 if let Some(ref auth_conf) = configuration.basic_auth {
7931 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
7932 };
7933
7934 let req = req_builder.build()?;
7935 let resp = configuration.client.execute(req).await?;
7936
7937 let status = resp.status();
7938
7939 if !status.is_client_error() && !status.is_server_error() {
7940 Ok(())
7941 } else {
7942 let content = resp.text().await?;
7943 let entity: Option<RepoDeletePushMirrorError> = serde_json::from_str(&content).ok();
7944 Err(Error::ResponseError(ResponseContent { status, content, entity }))
7945 }
7946}
7947
7948pub async fn repo_delete_release(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error<RepoDeleteReleaseError>> {
7949 let p_path_owner = owner;
7951 let p_path_repo = repo;
7952 let p_path_id = id;
7953
7954 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
7955 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
7956
7957 if let Some(ref apikey) = configuration.api_key {
7958 let key = apikey.key.clone();
7959 let value = match apikey.prefix {
7960 Some(ref prefix) => format!("{} {}", prefix, key),
7961 None => key,
7962 };
7963 req_builder = req_builder.query(&[("access_token", value)]);
7964 }
7965 if let Some(ref apikey) = configuration.api_key {
7966 let key = apikey.key.clone();
7967 let value = match apikey.prefix {
7968 Some(ref prefix) => format!("{} {}", prefix, key),
7969 None => key,
7970 };
7971 req_builder = req_builder.query(&[("sudo", value)]);
7972 }
7973 if let Some(ref apikey) = configuration.api_key {
7974 let key = apikey.key.clone();
7975 let value = match apikey.prefix {
7976 Some(ref prefix) => format!("{} {}", prefix, key),
7977 None => key,
7978 };
7979 req_builder = req_builder.query(&[("token", value)]);
7980 }
7981 if let Some(ref user_agent) = configuration.user_agent {
7982 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
7983 }
7984 if let Some(ref apikey) = configuration.api_key {
7985 let key = apikey.key.clone();
7986 let value = match apikey.prefix {
7987 Some(ref prefix) => format!("{} {}", prefix, key),
7988 None => key,
7989 };
7990 req_builder = req_builder.header("X-GITEA-OTP", value);
7991 };
7992 if let Some(ref apikey) = configuration.api_key {
7993 let key = apikey.key.clone();
7994 let value = match apikey.prefix {
7995 Some(ref prefix) => format!("{} {}", prefix, key),
7996 None => key,
7997 };
7998 req_builder = req_builder.header("Authorization", value);
7999 };
8000 if let Some(ref apikey) = configuration.api_key {
8001 let key = apikey.key.clone();
8002 let value = match apikey.prefix {
8003 Some(ref prefix) => format!("{} {}", prefix, key),
8004 None => key,
8005 };
8006 req_builder = req_builder.header("Sudo", value);
8007 };
8008 if let Some(ref auth_conf) = configuration.basic_auth {
8009 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8010 };
8011
8012 let req = req_builder.build()?;
8013 let resp = configuration.client.execute(req).await?;
8014
8015 let status = resp.status();
8016
8017 if !status.is_client_error() && !status.is_server_error() {
8018 Ok(())
8019 } else {
8020 let content = resp.text().await?;
8021 let entity: Option<RepoDeleteReleaseError> = serde_json::from_str(&content).ok();
8022 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8023 }
8024}
8025
8026pub async fn repo_delete_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result<(), Error<RepoDeleteReleaseAttachmentError>> {
8027 let p_path_owner = owner;
8029 let p_path_repo = repo;
8030 let p_path_id = id;
8031 let p_path_attachment_id = attachment_id;
8032
8033 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id);
8034 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
8035
8036 if let Some(ref apikey) = configuration.api_key {
8037 let key = apikey.key.clone();
8038 let value = match apikey.prefix {
8039 Some(ref prefix) => format!("{} {}", prefix, key),
8040 None => key,
8041 };
8042 req_builder = req_builder.query(&[("access_token", value)]);
8043 }
8044 if let Some(ref apikey) = configuration.api_key {
8045 let key = apikey.key.clone();
8046 let value = match apikey.prefix {
8047 Some(ref prefix) => format!("{} {}", prefix, key),
8048 None => key,
8049 };
8050 req_builder = req_builder.query(&[("sudo", value)]);
8051 }
8052 if let Some(ref apikey) = configuration.api_key {
8053 let key = apikey.key.clone();
8054 let value = match apikey.prefix {
8055 Some(ref prefix) => format!("{} {}", prefix, key),
8056 None => key,
8057 };
8058 req_builder = req_builder.query(&[("token", value)]);
8059 }
8060 if let Some(ref user_agent) = configuration.user_agent {
8061 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8062 }
8063 if let Some(ref apikey) = configuration.api_key {
8064 let key = apikey.key.clone();
8065 let value = match apikey.prefix {
8066 Some(ref prefix) => format!("{} {}", prefix, key),
8067 None => key,
8068 };
8069 req_builder = req_builder.header("X-GITEA-OTP", value);
8070 };
8071 if let Some(ref apikey) = configuration.api_key {
8072 let key = apikey.key.clone();
8073 let value = match apikey.prefix {
8074 Some(ref prefix) => format!("{} {}", prefix, key),
8075 None => key,
8076 };
8077 req_builder = req_builder.header("Authorization", value);
8078 };
8079 if let Some(ref apikey) = configuration.api_key {
8080 let key = apikey.key.clone();
8081 let value = match apikey.prefix {
8082 Some(ref prefix) => format!("{} {}", prefix, key),
8083 None => key,
8084 };
8085 req_builder = req_builder.header("Sudo", value);
8086 };
8087 if let Some(ref auth_conf) = configuration.basic_auth {
8088 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8089 };
8090
8091 let req = req_builder.build()?;
8092 let resp = configuration.client.execute(req).await?;
8093
8094 let status = resp.status();
8095
8096 if !status.is_client_error() && !status.is_server_error() {
8097 Ok(())
8098 } else {
8099 let content = resp.text().await?;
8100 let entity: Option<RepoDeleteReleaseAttachmentError> = serde_json::from_str(&content).ok();
8101 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8102 }
8103}
8104
8105pub async fn repo_delete_release_by_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result<(), Error<RepoDeleteReleaseByTagError>> {
8106 let p_path_owner = owner;
8108 let p_path_repo = repo;
8109 let p_path_tag = tag;
8110
8111 let uri_str = format!("{}/repos/{owner}/{repo}/releases/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag));
8112 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
8113
8114 if let Some(ref apikey) = configuration.api_key {
8115 let key = apikey.key.clone();
8116 let value = match apikey.prefix {
8117 Some(ref prefix) => format!("{} {}", prefix, key),
8118 None => key,
8119 };
8120 req_builder = req_builder.query(&[("access_token", value)]);
8121 }
8122 if let Some(ref apikey) = configuration.api_key {
8123 let key = apikey.key.clone();
8124 let value = match apikey.prefix {
8125 Some(ref prefix) => format!("{} {}", prefix, key),
8126 None => key,
8127 };
8128 req_builder = req_builder.query(&[("sudo", value)]);
8129 }
8130 if let Some(ref apikey) = configuration.api_key {
8131 let key = apikey.key.clone();
8132 let value = match apikey.prefix {
8133 Some(ref prefix) => format!("{} {}", prefix, key),
8134 None => key,
8135 };
8136 req_builder = req_builder.query(&[("token", value)]);
8137 }
8138 if let Some(ref user_agent) = configuration.user_agent {
8139 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8140 }
8141 if let Some(ref apikey) = configuration.api_key {
8142 let key = apikey.key.clone();
8143 let value = match apikey.prefix {
8144 Some(ref prefix) => format!("{} {}", prefix, key),
8145 None => key,
8146 };
8147 req_builder = req_builder.header("X-GITEA-OTP", value);
8148 };
8149 if let Some(ref apikey) = configuration.api_key {
8150 let key = apikey.key.clone();
8151 let value = match apikey.prefix {
8152 Some(ref prefix) => format!("{} {}", prefix, key),
8153 None => key,
8154 };
8155 req_builder = req_builder.header("Authorization", value);
8156 };
8157 if let Some(ref apikey) = configuration.api_key {
8158 let key = apikey.key.clone();
8159 let value = match apikey.prefix {
8160 Some(ref prefix) => format!("{} {}", prefix, key),
8161 None => key,
8162 };
8163 req_builder = req_builder.header("Sudo", value);
8164 };
8165 if let Some(ref auth_conf) = configuration.basic_auth {
8166 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8167 };
8168
8169 let req = req_builder.build()?;
8170 let resp = configuration.client.execute(req).await?;
8171
8172 let status = resp.status();
8173
8174 if !status.is_client_error() && !status.is_server_error() {
8175 Ok(())
8176 } else {
8177 let content = resp.text().await?;
8178 let entity: Option<RepoDeleteReleaseByTagError> = serde_json::from_str(&content).ok();
8179 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8180 }
8181}
8182
8183pub async fn repo_delete_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result<(), Error<RepoDeleteTagError>> {
8184 let p_path_owner = owner;
8186 let p_path_repo = repo;
8187 let p_path_tag = tag;
8188
8189 let uri_str = format!("{}/repos/{owner}/{repo}/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag));
8190 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
8191
8192 if let Some(ref apikey) = configuration.api_key {
8193 let key = apikey.key.clone();
8194 let value = match apikey.prefix {
8195 Some(ref prefix) => format!("{} {}", prefix, key),
8196 None => key,
8197 };
8198 req_builder = req_builder.query(&[("access_token", value)]);
8199 }
8200 if let Some(ref apikey) = configuration.api_key {
8201 let key = apikey.key.clone();
8202 let value = match apikey.prefix {
8203 Some(ref prefix) => format!("{} {}", prefix, key),
8204 None => key,
8205 };
8206 req_builder = req_builder.query(&[("sudo", value)]);
8207 }
8208 if let Some(ref apikey) = configuration.api_key {
8209 let key = apikey.key.clone();
8210 let value = match apikey.prefix {
8211 Some(ref prefix) => format!("{} {}", prefix, key),
8212 None => key,
8213 };
8214 req_builder = req_builder.query(&[("token", value)]);
8215 }
8216 if let Some(ref user_agent) = configuration.user_agent {
8217 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8218 }
8219 if let Some(ref apikey) = configuration.api_key {
8220 let key = apikey.key.clone();
8221 let value = match apikey.prefix {
8222 Some(ref prefix) => format!("{} {}", prefix, key),
8223 None => key,
8224 };
8225 req_builder = req_builder.header("X-GITEA-OTP", value);
8226 };
8227 if let Some(ref apikey) = configuration.api_key {
8228 let key = apikey.key.clone();
8229 let value = match apikey.prefix {
8230 Some(ref prefix) => format!("{} {}", prefix, key),
8231 None => key,
8232 };
8233 req_builder = req_builder.header("Authorization", value);
8234 };
8235 if let Some(ref apikey) = configuration.api_key {
8236 let key = apikey.key.clone();
8237 let value = match apikey.prefix {
8238 Some(ref prefix) => format!("{} {}", prefix, key),
8239 None => key,
8240 };
8241 req_builder = req_builder.header("Sudo", value);
8242 };
8243 if let Some(ref auth_conf) = configuration.basic_auth {
8244 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8245 };
8246
8247 let req = req_builder.build()?;
8248 let resp = configuration.client.execute(req).await?;
8249
8250 let status = resp.status();
8251
8252 if !status.is_client_error() && !status.is_server_error() {
8253 Ok(())
8254 } else {
8255 let content = resp.text().await?;
8256 let entity: Option<RepoDeleteTagError> = serde_json::from_str(&content).ok();
8257 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8258 }
8259}
8260
8261pub async fn repo_delete_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i32) -> Result<(), Error<RepoDeleteTagProtectionError>> {
8262 let p_path_owner = owner;
8264 let p_path_repo = repo;
8265 let p_path_id = id;
8266
8267 let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
8268 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
8269
8270 if let Some(ref apikey) = configuration.api_key {
8271 let key = apikey.key.clone();
8272 let value = match apikey.prefix {
8273 Some(ref prefix) => format!("{} {}", prefix, key),
8274 None => key,
8275 };
8276 req_builder = req_builder.query(&[("access_token", value)]);
8277 }
8278 if let Some(ref apikey) = configuration.api_key {
8279 let key = apikey.key.clone();
8280 let value = match apikey.prefix {
8281 Some(ref prefix) => format!("{} {}", prefix, key),
8282 None => key,
8283 };
8284 req_builder = req_builder.query(&[("sudo", value)]);
8285 }
8286 if let Some(ref apikey) = configuration.api_key {
8287 let key = apikey.key.clone();
8288 let value = match apikey.prefix {
8289 Some(ref prefix) => format!("{} {}", prefix, key),
8290 None => key,
8291 };
8292 req_builder = req_builder.query(&[("token", value)]);
8293 }
8294 if let Some(ref user_agent) = configuration.user_agent {
8295 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8296 }
8297 if let Some(ref apikey) = configuration.api_key {
8298 let key = apikey.key.clone();
8299 let value = match apikey.prefix {
8300 Some(ref prefix) => format!("{} {}", prefix, key),
8301 None => key,
8302 };
8303 req_builder = req_builder.header("X-GITEA-OTP", value);
8304 };
8305 if let Some(ref apikey) = configuration.api_key {
8306 let key = apikey.key.clone();
8307 let value = match apikey.prefix {
8308 Some(ref prefix) => format!("{} {}", prefix, key),
8309 None => key,
8310 };
8311 req_builder = req_builder.header("Authorization", value);
8312 };
8313 if let Some(ref apikey) = configuration.api_key {
8314 let key = apikey.key.clone();
8315 let value = match apikey.prefix {
8316 Some(ref prefix) => format!("{} {}", prefix, key),
8317 None => key,
8318 };
8319 req_builder = req_builder.header("Sudo", value);
8320 };
8321 if let Some(ref auth_conf) = configuration.basic_auth {
8322 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8323 };
8324
8325 let req = req_builder.build()?;
8326 let resp = configuration.client.execute(req).await?;
8327
8328 let status = resp.status();
8329
8330 if !status.is_client_error() && !status.is_server_error() {
8331 Ok(())
8332 } else {
8333 let content = resp.text().await?;
8334 let entity: Option<RepoDeleteTagProtectionError> = serde_json::from_str(&content).ok();
8335 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8336 }
8337}
8338
8339pub async fn repo_delete_team(configuration: &configuration::Configuration, owner: &str, repo: &str, team: &str) -> Result<(), Error<RepoDeleteTeamError>> {
8340 let p_path_owner = owner;
8342 let p_path_repo = repo;
8343 let p_path_team = team;
8344
8345 let uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), team=crate::apis::urlencode(p_path_team));
8346 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
8347
8348 if let Some(ref apikey) = configuration.api_key {
8349 let key = apikey.key.clone();
8350 let value = match apikey.prefix {
8351 Some(ref prefix) => format!("{} {}", prefix, key),
8352 None => key,
8353 };
8354 req_builder = req_builder.query(&[("access_token", value)]);
8355 }
8356 if let Some(ref apikey) = configuration.api_key {
8357 let key = apikey.key.clone();
8358 let value = match apikey.prefix {
8359 Some(ref prefix) => format!("{} {}", prefix, key),
8360 None => key,
8361 };
8362 req_builder = req_builder.query(&[("sudo", value)]);
8363 }
8364 if let Some(ref apikey) = configuration.api_key {
8365 let key = apikey.key.clone();
8366 let value = match apikey.prefix {
8367 Some(ref prefix) => format!("{} {}", prefix, key),
8368 None => key,
8369 };
8370 req_builder = req_builder.query(&[("token", value)]);
8371 }
8372 if let Some(ref user_agent) = configuration.user_agent {
8373 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8374 }
8375 if let Some(ref apikey) = configuration.api_key {
8376 let key = apikey.key.clone();
8377 let value = match apikey.prefix {
8378 Some(ref prefix) => format!("{} {}", prefix, key),
8379 None => key,
8380 };
8381 req_builder = req_builder.header("X-GITEA-OTP", value);
8382 };
8383 if let Some(ref apikey) = configuration.api_key {
8384 let key = apikey.key.clone();
8385 let value = match apikey.prefix {
8386 Some(ref prefix) => format!("{} {}", prefix, key),
8387 None => key,
8388 };
8389 req_builder = req_builder.header("Authorization", value);
8390 };
8391 if let Some(ref apikey) = configuration.api_key {
8392 let key = apikey.key.clone();
8393 let value = match apikey.prefix {
8394 Some(ref prefix) => format!("{} {}", prefix, key),
8395 None => key,
8396 };
8397 req_builder = req_builder.header("Sudo", value);
8398 };
8399 if let Some(ref auth_conf) = configuration.basic_auth {
8400 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8401 };
8402
8403 let req = req_builder.build()?;
8404 let resp = configuration.client.execute(req).await?;
8405
8406 let status = resp.status();
8407
8408 if !status.is_client_error() && !status.is_server_error() {
8409 Ok(())
8410 } else {
8411 let content = resp.text().await?;
8412 let entity: Option<RepoDeleteTeamError> = serde_json::from_str(&content).ok();
8413 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8414 }
8415}
8416
8417pub async fn repo_delete_topic(configuration: &configuration::Configuration, owner: &str, repo: &str, topic: &str) -> Result<(), Error<RepoDeleteTopicError>> {
8418 let p_path_owner = owner;
8420 let p_path_repo = repo;
8421 let p_path_topic = topic;
8422
8423 let uri_str = format!("{}/repos/{owner}/{repo}/topics/{topic}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), topic=crate::apis::urlencode(p_path_topic));
8424 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
8425
8426 if let Some(ref apikey) = configuration.api_key {
8427 let key = apikey.key.clone();
8428 let value = match apikey.prefix {
8429 Some(ref prefix) => format!("{} {}", prefix, key),
8430 None => key,
8431 };
8432 req_builder = req_builder.query(&[("access_token", value)]);
8433 }
8434 if let Some(ref apikey) = configuration.api_key {
8435 let key = apikey.key.clone();
8436 let value = match apikey.prefix {
8437 Some(ref prefix) => format!("{} {}", prefix, key),
8438 None => key,
8439 };
8440 req_builder = req_builder.query(&[("sudo", value)]);
8441 }
8442 if let Some(ref apikey) = configuration.api_key {
8443 let key = apikey.key.clone();
8444 let value = match apikey.prefix {
8445 Some(ref prefix) => format!("{} {}", prefix, key),
8446 None => key,
8447 };
8448 req_builder = req_builder.query(&[("token", value)]);
8449 }
8450 if let Some(ref user_agent) = configuration.user_agent {
8451 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8452 }
8453 if let Some(ref apikey) = configuration.api_key {
8454 let key = apikey.key.clone();
8455 let value = match apikey.prefix {
8456 Some(ref prefix) => format!("{} {}", prefix, key),
8457 None => key,
8458 };
8459 req_builder = req_builder.header("X-GITEA-OTP", value);
8460 };
8461 if let Some(ref apikey) = configuration.api_key {
8462 let key = apikey.key.clone();
8463 let value = match apikey.prefix {
8464 Some(ref prefix) => format!("{} {}", prefix, key),
8465 None => key,
8466 };
8467 req_builder = req_builder.header("Authorization", value);
8468 };
8469 if let Some(ref apikey) = configuration.api_key {
8470 let key = apikey.key.clone();
8471 let value = match apikey.prefix {
8472 Some(ref prefix) => format!("{} {}", prefix, key),
8473 None => key,
8474 };
8475 req_builder = req_builder.header("Sudo", value);
8476 };
8477 if let Some(ref auth_conf) = configuration.basic_auth {
8478 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8479 };
8480
8481 let req = req_builder.build()?;
8482 let resp = configuration.client.execute(req).await?;
8483
8484 let status = resp.status();
8485
8486 if !status.is_client_error() && !status.is_server_error() {
8487 Ok(())
8488 } else {
8489 let content = resp.text().await?;
8490 let entity: Option<RepoDeleteTopicError> = serde_json::from_str(&content).ok();
8491 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8492 }
8493}
8494
8495pub async fn repo_delete_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str) -> Result<(), Error<RepoDeleteWikiPageError>> {
8496 let p_path_owner = owner;
8498 let p_path_repo = repo;
8499 let p_path_page_name = page_name;
8500
8501 let uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name));
8502 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
8503
8504 if let Some(ref apikey) = configuration.api_key {
8505 let key = apikey.key.clone();
8506 let value = match apikey.prefix {
8507 Some(ref prefix) => format!("{} {}", prefix, key),
8508 None => key,
8509 };
8510 req_builder = req_builder.query(&[("access_token", value)]);
8511 }
8512 if let Some(ref apikey) = configuration.api_key {
8513 let key = apikey.key.clone();
8514 let value = match apikey.prefix {
8515 Some(ref prefix) => format!("{} {}", prefix, key),
8516 None => key,
8517 };
8518 req_builder = req_builder.query(&[("sudo", value)]);
8519 }
8520 if let Some(ref apikey) = configuration.api_key {
8521 let key = apikey.key.clone();
8522 let value = match apikey.prefix {
8523 Some(ref prefix) => format!("{} {}", prefix, key),
8524 None => key,
8525 };
8526 req_builder = req_builder.query(&[("token", value)]);
8527 }
8528 if let Some(ref user_agent) = configuration.user_agent {
8529 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8530 }
8531 if let Some(ref apikey) = configuration.api_key {
8532 let key = apikey.key.clone();
8533 let value = match apikey.prefix {
8534 Some(ref prefix) => format!("{} {}", prefix, key),
8535 None => key,
8536 };
8537 req_builder = req_builder.header("X-GITEA-OTP", value);
8538 };
8539 if let Some(ref apikey) = configuration.api_key {
8540 let key = apikey.key.clone();
8541 let value = match apikey.prefix {
8542 Some(ref prefix) => format!("{} {}", prefix, key),
8543 None => key,
8544 };
8545 req_builder = req_builder.header("Authorization", value);
8546 };
8547 if let Some(ref apikey) = configuration.api_key {
8548 let key = apikey.key.clone();
8549 let value = match apikey.prefix {
8550 Some(ref prefix) => format!("{} {}", prefix, key),
8551 None => key,
8552 };
8553 req_builder = req_builder.header("Sudo", value);
8554 };
8555 if let Some(ref auth_conf) = configuration.basic_auth {
8556 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8557 };
8558
8559 let req = req_builder.build()?;
8560 let resp = configuration.client.execute(req).await?;
8561
8562 let status = resp.status();
8563
8564 if !status.is_client_error() && !status.is_server_error() {
8565 Ok(())
8566 } else {
8567 let content = resp.text().await?;
8568 let entity: Option<RepoDeleteWikiPageError> = serde_json::from_str(&content).ok();
8569 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8570 }
8571}
8572
8573pub async fn repo_dismiss_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64, body: models::DismissPullReviewOptions) -> Result<models::PullReview, Error<RepoDismissPullReviewError>> {
8574 let p_path_owner = owner;
8576 let p_path_repo = repo;
8577 let p_path_index = index;
8578 let p_path_id = id;
8579 let p_body_body = body;
8580
8581 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/dismissals", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id);
8582 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
8583
8584 if let Some(ref apikey) = configuration.api_key {
8585 let key = apikey.key.clone();
8586 let value = match apikey.prefix {
8587 Some(ref prefix) => format!("{} {}", prefix, key),
8588 None => key,
8589 };
8590 req_builder = req_builder.query(&[("access_token", value)]);
8591 }
8592 if let Some(ref apikey) = configuration.api_key {
8593 let key = apikey.key.clone();
8594 let value = match apikey.prefix {
8595 Some(ref prefix) => format!("{} {}", prefix, key),
8596 None => key,
8597 };
8598 req_builder = req_builder.query(&[("sudo", value)]);
8599 }
8600 if let Some(ref apikey) = configuration.api_key {
8601 let key = apikey.key.clone();
8602 let value = match apikey.prefix {
8603 Some(ref prefix) => format!("{} {}", prefix, key),
8604 None => key,
8605 };
8606 req_builder = req_builder.query(&[("token", value)]);
8607 }
8608 if let Some(ref user_agent) = configuration.user_agent {
8609 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8610 }
8611 if let Some(ref apikey) = configuration.api_key {
8612 let key = apikey.key.clone();
8613 let value = match apikey.prefix {
8614 Some(ref prefix) => format!("{} {}", prefix, key),
8615 None => key,
8616 };
8617 req_builder = req_builder.header("X-GITEA-OTP", value);
8618 };
8619 if let Some(ref apikey) = configuration.api_key {
8620 let key = apikey.key.clone();
8621 let value = match apikey.prefix {
8622 Some(ref prefix) => format!("{} {}", prefix, key),
8623 None => key,
8624 };
8625 req_builder = req_builder.header("Authorization", value);
8626 };
8627 if let Some(ref apikey) = configuration.api_key {
8628 let key = apikey.key.clone();
8629 let value = match apikey.prefix {
8630 Some(ref prefix) => format!("{} {}", prefix, key),
8631 None => key,
8632 };
8633 req_builder = req_builder.header("Sudo", value);
8634 };
8635 if let Some(ref auth_conf) = configuration.basic_auth {
8636 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8637 };
8638 req_builder = req_builder.json(&p_body_body);
8639
8640 let req = req_builder.build()?;
8641 let resp = configuration.client.execute(req).await?;
8642
8643 let status = resp.status();
8644 let content_type = resp
8645 .headers()
8646 .get("content-type")
8647 .and_then(|v| v.to_str().ok())
8648 .unwrap_or("application/octet-stream");
8649 let content_type = super::ContentType::from(content_type);
8650
8651 if !status.is_client_error() && !status.is_server_error() {
8652 let content = resp.text().await?;
8653 match content_type {
8654 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8655 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))),
8656 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::PullReview`")))),
8657 }
8658 } else {
8659 let content = resp.text().await?;
8660 let entity: Option<RepoDismissPullReviewError> = serde_json::from_str(&content).ok();
8661 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8662 }
8663}
8664
8665pub async fn repo_download_commit_diff_or_patch(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, diff_type: &str) -> Result<String, Error<RepoDownloadCommitDiffOrPatchError>> {
8666 let p_path_owner = owner;
8668 let p_path_repo = repo;
8669 let p_path_sha = sha;
8670 let p_path_diff_type = diff_type;
8671
8672 let uri_str = format!("{}/repos/{owner}/{repo}/git/commits/{sha}.{diffType}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha), diffType=crate::apis::urlencode(p_path_diff_type));
8673 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8674
8675 if let Some(ref apikey) = configuration.api_key {
8676 let key = apikey.key.clone();
8677 let value = match apikey.prefix {
8678 Some(ref prefix) => format!("{} {}", prefix, key),
8679 None => key,
8680 };
8681 req_builder = req_builder.query(&[("access_token", value)]);
8682 }
8683 if let Some(ref apikey) = configuration.api_key {
8684 let key = apikey.key.clone();
8685 let value = match apikey.prefix {
8686 Some(ref prefix) => format!("{} {}", prefix, key),
8687 None => key,
8688 };
8689 req_builder = req_builder.query(&[("sudo", value)]);
8690 }
8691 if let Some(ref apikey) = configuration.api_key {
8692 let key = apikey.key.clone();
8693 let value = match apikey.prefix {
8694 Some(ref prefix) => format!("{} {}", prefix, key),
8695 None => key,
8696 };
8697 req_builder = req_builder.query(&[("token", value)]);
8698 }
8699 if let Some(ref user_agent) = configuration.user_agent {
8700 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8701 }
8702 if let Some(ref apikey) = configuration.api_key {
8703 let key = apikey.key.clone();
8704 let value = match apikey.prefix {
8705 Some(ref prefix) => format!("{} {}", prefix, key),
8706 None => key,
8707 };
8708 req_builder = req_builder.header("X-GITEA-OTP", value);
8709 };
8710 if let Some(ref apikey) = configuration.api_key {
8711 let key = apikey.key.clone();
8712 let value = match apikey.prefix {
8713 Some(ref prefix) => format!("{} {}", prefix, key),
8714 None => key,
8715 };
8716 req_builder = req_builder.header("Authorization", value);
8717 };
8718 if let Some(ref apikey) = configuration.api_key {
8719 let key = apikey.key.clone();
8720 let value = match apikey.prefix {
8721 Some(ref prefix) => format!("{} {}", prefix, key),
8722 None => key,
8723 };
8724 req_builder = req_builder.header("Sudo", value);
8725 };
8726 if let Some(ref auth_conf) = configuration.basic_auth {
8727 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8728 };
8729
8730 let req = req_builder.build()?;
8731 let resp = configuration.client.execute(req).await?;
8732
8733 let status = resp.status();
8734 let content_type = resp
8735 .headers()
8736 .get("content-type")
8737 .and_then(|v| v.to_str().ok())
8738 .unwrap_or("application/octet-stream");
8739 let content_type = super::ContentType::from(content_type);
8740
8741 if !status.is_client_error() && !status.is_server_error() {
8742 let content = resp.text().await?;
8743 match content_type {
8744 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8745 ContentType::Text => return Ok(content),
8746 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
8747 }
8748 } else {
8749 let content = resp.text().await?;
8750 let entity: Option<RepoDownloadCommitDiffOrPatchError> = serde_json::from_str(&content).ok();
8751 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8752 }
8753}
8754
8755pub async fn repo_download_pull_diff_or_patch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, diff_type: &str, binary: Option<bool>) -> Result<String, Error<RepoDownloadPullDiffOrPatchError>> {
8756 let p_path_owner = owner;
8758 let p_path_repo = repo;
8759 let p_path_index = index;
8760 let p_path_diff_type = diff_type;
8761 let p_query_binary = binary;
8762
8763 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}.{diffType}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, diffType=crate::apis::urlencode(p_path_diff_type));
8764 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
8765
8766 if let Some(ref param_value) = p_query_binary {
8767 req_builder = req_builder.query(&[("binary", ¶m_value.to_string())]);
8768 }
8769 if let Some(ref apikey) = configuration.api_key {
8770 let key = apikey.key.clone();
8771 let value = match apikey.prefix {
8772 Some(ref prefix) => format!("{} {}", prefix, key),
8773 None => key,
8774 };
8775 req_builder = req_builder.query(&[("access_token", value)]);
8776 }
8777 if let Some(ref apikey) = configuration.api_key {
8778 let key = apikey.key.clone();
8779 let value = match apikey.prefix {
8780 Some(ref prefix) => format!("{} {}", prefix, key),
8781 None => key,
8782 };
8783 req_builder = req_builder.query(&[("sudo", value)]);
8784 }
8785 if let Some(ref apikey) = configuration.api_key {
8786 let key = apikey.key.clone();
8787 let value = match apikey.prefix {
8788 Some(ref prefix) => format!("{} {}", prefix, key),
8789 None => key,
8790 };
8791 req_builder = req_builder.query(&[("token", value)]);
8792 }
8793 if let Some(ref user_agent) = configuration.user_agent {
8794 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8795 }
8796 if let Some(ref apikey) = configuration.api_key {
8797 let key = apikey.key.clone();
8798 let value = match apikey.prefix {
8799 Some(ref prefix) => format!("{} {}", prefix, key),
8800 None => key,
8801 };
8802 req_builder = req_builder.header("X-GITEA-OTP", value);
8803 };
8804 if let Some(ref apikey) = configuration.api_key {
8805 let key = apikey.key.clone();
8806 let value = match apikey.prefix {
8807 Some(ref prefix) => format!("{} {}", prefix, key),
8808 None => key,
8809 };
8810 req_builder = req_builder.header("Authorization", value);
8811 };
8812 if let Some(ref apikey) = configuration.api_key {
8813 let key = apikey.key.clone();
8814 let value = match apikey.prefix {
8815 Some(ref prefix) => format!("{} {}", prefix, key),
8816 None => key,
8817 };
8818 req_builder = req_builder.header("Sudo", value);
8819 };
8820 if let Some(ref auth_conf) = configuration.basic_auth {
8821 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8822 };
8823
8824 let req = req_builder.build()?;
8825 let resp = configuration.client.execute(req).await?;
8826
8827 let status = resp.status();
8828 let content_type = resp
8829 .headers()
8830 .get("content-type")
8831 .and_then(|v| v.to_str().ok())
8832 .unwrap_or("application/octet-stream");
8833 let content_type = super::ContentType::from(content_type);
8834
8835 if !status.is_client_error() && !status.is_server_error() {
8836 let content = resp.text().await?;
8837 match content_type {
8838 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8839 ContentType::Text => return Ok(content),
8840 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
8841 }
8842 } else {
8843 let content = resp.text().await?;
8844 let entity: Option<RepoDownloadPullDiffOrPatchError> = serde_json::from_str(&content).ok();
8845 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8846 }
8847}
8848
8849pub async fn repo_edit(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::EditRepoOption>) -> Result<models::Repository, Error<RepoEditError>> {
8850 let p_path_owner = owner;
8852 let p_path_repo = repo;
8853 let p_body_body = body;
8854
8855 let uri_str = format!("{}/repos/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
8856 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
8857
8858 if let Some(ref apikey) = configuration.api_key {
8859 let key = apikey.key.clone();
8860 let value = match apikey.prefix {
8861 Some(ref prefix) => format!("{} {}", prefix, key),
8862 None => key,
8863 };
8864 req_builder = req_builder.query(&[("access_token", value)]);
8865 }
8866 if let Some(ref apikey) = configuration.api_key {
8867 let key = apikey.key.clone();
8868 let value = match apikey.prefix {
8869 Some(ref prefix) => format!("{} {}", prefix, key),
8870 None => key,
8871 };
8872 req_builder = req_builder.query(&[("sudo", value)]);
8873 }
8874 if let Some(ref apikey) = configuration.api_key {
8875 let key = apikey.key.clone();
8876 let value = match apikey.prefix {
8877 Some(ref prefix) => format!("{} {}", prefix, key),
8878 None => key,
8879 };
8880 req_builder = req_builder.query(&[("token", value)]);
8881 }
8882 if let Some(ref user_agent) = configuration.user_agent {
8883 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8884 }
8885 if let Some(ref apikey) = configuration.api_key {
8886 let key = apikey.key.clone();
8887 let value = match apikey.prefix {
8888 Some(ref prefix) => format!("{} {}", prefix, key),
8889 None => key,
8890 };
8891 req_builder = req_builder.header("X-GITEA-OTP", value);
8892 };
8893 if let Some(ref apikey) = configuration.api_key {
8894 let key = apikey.key.clone();
8895 let value = match apikey.prefix {
8896 Some(ref prefix) => format!("{} {}", prefix, key),
8897 None => key,
8898 };
8899 req_builder = req_builder.header("Authorization", value);
8900 };
8901 if let Some(ref apikey) = configuration.api_key {
8902 let key = apikey.key.clone();
8903 let value = match apikey.prefix {
8904 Some(ref prefix) => format!("{} {}", prefix, key),
8905 None => key,
8906 };
8907 req_builder = req_builder.header("Sudo", value);
8908 };
8909 if let Some(ref auth_conf) = configuration.basic_auth {
8910 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
8911 };
8912 req_builder = req_builder.json(&p_body_body);
8913
8914 let req = req_builder.build()?;
8915 let resp = configuration.client.execute(req).await?;
8916
8917 let status = resp.status();
8918 let content_type = resp
8919 .headers()
8920 .get("content-type")
8921 .and_then(|v| v.to_str().ok())
8922 .unwrap_or("application/octet-stream");
8923 let content_type = super::ContentType::from(content_type);
8924
8925 if !status.is_client_error() && !status.is_server_error() {
8926 let content = resp.text().await?;
8927 match content_type {
8928 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
8929 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
8930 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`")))),
8931 }
8932 } else {
8933 let content = resp.text().await?;
8934 let entity: Option<RepoEditError> = serde_json::from_str(&content).ok();
8935 Err(Error::ResponseError(ResponseContent { status, content, entity }))
8936 }
8937}
8938
8939pub async fn repo_edit_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str, body: Option<models::EditBranchProtectionOption>) -> Result<models::BranchProtection, Error<RepoEditBranchProtectionError>> {
8940 let p_path_owner = owner;
8942 let p_path_repo = repo;
8943 let p_path_name = name;
8944 let p_body_body = body;
8945
8946 let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name));
8947 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
8948
8949 if let Some(ref apikey) = configuration.api_key {
8950 let key = apikey.key.clone();
8951 let value = match apikey.prefix {
8952 Some(ref prefix) => format!("{} {}", prefix, key),
8953 None => key,
8954 };
8955 req_builder = req_builder.query(&[("access_token", value)]);
8956 }
8957 if let Some(ref apikey) = configuration.api_key {
8958 let key = apikey.key.clone();
8959 let value = match apikey.prefix {
8960 Some(ref prefix) => format!("{} {}", prefix, key),
8961 None => key,
8962 };
8963 req_builder = req_builder.query(&[("sudo", value)]);
8964 }
8965 if let Some(ref apikey) = configuration.api_key {
8966 let key = apikey.key.clone();
8967 let value = match apikey.prefix {
8968 Some(ref prefix) => format!("{} {}", prefix, key),
8969 None => key,
8970 };
8971 req_builder = req_builder.query(&[("token", value)]);
8972 }
8973 if let Some(ref user_agent) = configuration.user_agent {
8974 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
8975 }
8976 if let Some(ref apikey) = configuration.api_key {
8977 let key = apikey.key.clone();
8978 let value = match apikey.prefix {
8979 Some(ref prefix) => format!("{} {}", prefix, key),
8980 None => key,
8981 };
8982 req_builder = req_builder.header("X-GITEA-OTP", value);
8983 };
8984 if let Some(ref apikey) = configuration.api_key {
8985 let key = apikey.key.clone();
8986 let value = match apikey.prefix {
8987 Some(ref prefix) => format!("{} {}", prefix, key),
8988 None => key,
8989 };
8990 req_builder = req_builder.header("Authorization", value);
8991 };
8992 if let Some(ref apikey) = configuration.api_key {
8993 let key = apikey.key.clone();
8994 let value = match apikey.prefix {
8995 Some(ref prefix) => format!("{} {}", prefix, key),
8996 None => key,
8997 };
8998 req_builder = req_builder.header("Sudo", value);
8999 };
9000 if let Some(ref auth_conf) = configuration.basic_auth {
9001 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9002 };
9003 req_builder = req_builder.json(&p_body_body);
9004
9005 let req = req_builder.build()?;
9006 let resp = configuration.client.execute(req).await?;
9007
9008 let status = resp.status();
9009 let content_type = resp
9010 .headers()
9011 .get("content-type")
9012 .and_then(|v| v.to_str().ok())
9013 .unwrap_or("application/octet-stream");
9014 let content_type = super::ContentType::from(content_type);
9015
9016 if !status.is_client_error() && !status.is_server_error() {
9017 let content = resp.text().await?;
9018 match content_type {
9019 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9020 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BranchProtection`"))),
9021 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::BranchProtection`")))),
9022 }
9023 } else {
9024 let content = resp.text().await?;
9025 let entity: Option<RepoEditBranchProtectionError> = serde_json::from_str(&content).ok();
9026 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9027 }
9028}
9029
9030pub async fn repo_edit_git_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str, body: Option<models::EditGitHookOption>) -> Result<models::GitHook, Error<RepoEditGitHookError>> {
9031 let p_path_owner = owner;
9033 let p_path_repo = repo;
9034 let p_path_id = id;
9035 let p_body_body = body;
9036
9037 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id));
9038 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
9039
9040 if let Some(ref apikey) = configuration.api_key {
9041 let key = apikey.key.clone();
9042 let value = match apikey.prefix {
9043 Some(ref prefix) => format!("{} {}", prefix, key),
9044 None => key,
9045 };
9046 req_builder = req_builder.query(&[("access_token", value)]);
9047 }
9048 if let Some(ref apikey) = configuration.api_key {
9049 let key = apikey.key.clone();
9050 let value = match apikey.prefix {
9051 Some(ref prefix) => format!("{} {}", prefix, key),
9052 None => key,
9053 };
9054 req_builder = req_builder.query(&[("sudo", value)]);
9055 }
9056 if let Some(ref apikey) = configuration.api_key {
9057 let key = apikey.key.clone();
9058 let value = match apikey.prefix {
9059 Some(ref prefix) => format!("{} {}", prefix, key),
9060 None => key,
9061 };
9062 req_builder = req_builder.query(&[("token", value)]);
9063 }
9064 if let Some(ref user_agent) = configuration.user_agent {
9065 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9066 }
9067 if let Some(ref apikey) = configuration.api_key {
9068 let key = apikey.key.clone();
9069 let value = match apikey.prefix {
9070 Some(ref prefix) => format!("{} {}", prefix, key),
9071 None => key,
9072 };
9073 req_builder = req_builder.header("X-GITEA-OTP", value);
9074 };
9075 if let Some(ref apikey) = configuration.api_key {
9076 let key = apikey.key.clone();
9077 let value = match apikey.prefix {
9078 Some(ref prefix) => format!("{} {}", prefix, key),
9079 None => key,
9080 };
9081 req_builder = req_builder.header("Authorization", value);
9082 };
9083 if let Some(ref apikey) = configuration.api_key {
9084 let key = apikey.key.clone();
9085 let value = match apikey.prefix {
9086 Some(ref prefix) => format!("{} {}", prefix, key),
9087 None => key,
9088 };
9089 req_builder = req_builder.header("Sudo", value);
9090 };
9091 if let Some(ref auth_conf) = configuration.basic_auth {
9092 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9093 };
9094 req_builder = req_builder.json(&p_body_body);
9095
9096 let req = req_builder.build()?;
9097 let resp = configuration.client.execute(req).await?;
9098
9099 let status = resp.status();
9100 let content_type = resp
9101 .headers()
9102 .get("content-type")
9103 .and_then(|v| v.to_str().ok())
9104 .unwrap_or("application/octet-stream");
9105 let content_type = super::ContentType::from(content_type);
9106
9107 if !status.is_client_error() && !status.is_server_error() {
9108 let content = resp.text().await?;
9109 match content_type {
9110 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9111 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitHook`"))),
9112 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::GitHook`")))),
9113 }
9114 } else {
9115 let content = resp.text().await?;
9116 let entity: Option<RepoEditGitHookError> = serde_json::from_str(&content).ok();
9117 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9118 }
9119}
9120
9121pub async fn repo_edit_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option<models::EditHookOption>) -> Result<models::Hook, Error<RepoEditHookError>> {
9122 let p_path_owner = owner;
9124 let p_path_repo = repo;
9125 let p_path_id = id;
9126 let p_body_body = body;
9127
9128 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
9129 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
9130
9131 if let Some(ref apikey) = configuration.api_key {
9132 let key = apikey.key.clone();
9133 let value = match apikey.prefix {
9134 Some(ref prefix) => format!("{} {}", prefix, key),
9135 None => key,
9136 };
9137 req_builder = req_builder.query(&[("access_token", value)]);
9138 }
9139 if let Some(ref apikey) = configuration.api_key {
9140 let key = apikey.key.clone();
9141 let value = match apikey.prefix {
9142 Some(ref prefix) => format!("{} {}", prefix, key),
9143 None => key,
9144 };
9145 req_builder = req_builder.query(&[("sudo", value)]);
9146 }
9147 if let Some(ref apikey) = configuration.api_key {
9148 let key = apikey.key.clone();
9149 let value = match apikey.prefix {
9150 Some(ref prefix) => format!("{} {}", prefix, key),
9151 None => key,
9152 };
9153 req_builder = req_builder.query(&[("token", value)]);
9154 }
9155 if let Some(ref user_agent) = configuration.user_agent {
9156 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9157 }
9158 if let Some(ref apikey) = configuration.api_key {
9159 let key = apikey.key.clone();
9160 let value = match apikey.prefix {
9161 Some(ref prefix) => format!("{} {}", prefix, key),
9162 None => key,
9163 };
9164 req_builder = req_builder.header("X-GITEA-OTP", value);
9165 };
9166 if let Some(ref apikey) = configuration.api_key {
9167 let key = apikey.key.clone();
9168 let value = match apikey.prefix {
9169 Some(ref prefix) => format!("{} {}", prefix, key),
9170 None => key,
9171 };
9172 req_builder = req_builder.header("Authorization", value);
9173 };
9174 if let Some(ref apikey) = configuration.api_key {
9175 let key = apikey.key.clone();
9176 let value = match apikey.prefix {
9177 Some(ref prefix) => format!("{} {}", prefix, key),
9178 None => key,
9179 };
9180 req_builder = req_builder.header("Sudo", value);
9181 };
9182 if let Some(ref auth_conf) = configuration.basic_auth {
9183 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9184 };
9185 req_builder = req_builder.json(&p_body_body);
9186
9187 let req = req_builder.build()?;
9188 let resp = configuration.client.execute(req).await?;
9189
9190 let status = resp.status();
9191 let content_type = resp
9192 .headers()
9193 .get("content-type")
9194 .and_then(|v| v.to_str().ok())
9195 .unwrap_or("application/octet-stream");
9196 let content_type = super::ContentType::from(content_type);
9197
9198 if !status.is_client_error() && !status.is_server_error() {
9199 let content = resp.text().await?;
9200 match content_type {
9201 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9202 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
9203 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`")))),
9204 }
9205 } else {
9206 let content = resp.text().await?;
9207 let entity: Option<RepoEditHookError> = serde_json::from_str(&content).ok();
9208 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9209 }
9210}
9211
9212pub async fn repo_edit_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::EditPullRequestOption>) -> Result<models::PullRequest, Error<RepoEditPullRequestError>> {
9213 let p_path_owner = owner;
9215 let p_path_repo = repo;
9216 let p_path_index = index;
9217 let p_body_body = body;
9218
9219 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
9220 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
9221
9222 if let Some(ref apikey) = configuration.api_key {
9223 let key = apikey.key.clone();
9224 let value = match apikey.prefix {
9225 Some(ref prefix) => format!("{} {}", prefix, key),
9226 None => key,
9227 };
9228 req_builder = req_builder.query(&[("access_token", value)]);
9229 }
9230 if let Some(ref apikey) = configuration.api_key {
9231 let key = apikey.key.clone();
9232 let value = match apikey.prefix {
9233 Some(ref prefix) => format!("{} {}", prefix, key),
9234 None => key,
9235 };
9236 req_builder = req_builder.query(&[("sudo", value)]);
9237 }
9238 if let Some(ref apikey) = configuration.api_key {
9239 let key = apikey.key.clone();
9240 let value = match apikey.prefix {
9241 Some(ref prefix) => format!("{} {}", prefix, key),
9242 None => key,
9243 };
9244 req_builder = req_builder.query(&[("token", value)]);
9245 }
9246 if let Some(ref user_agent) = configuration.user_agent {
9247 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9248 }
9249 if let Some(ref apikey) = configuration.api_key {
9250 let key = apikey.key.clone();
9251 let value = match apikey.prefix {
9252 Some(ref prefix) => format!("{} {}", prefix, key),
9253 None => key,
9254 };
9255 req_builder = req_builder.header("X-GITEA-OTP", value);
9256 };
9257 if let Some(ref apikey) = configuration.api_key {
9258 let key = apikey.key.clone();
9259 let value = match apikey.prefix {
9260 Some(ref prefix) => format!("{} {}", prefix, key),
9261 None => key,
9262 };
9263 req_builder = req_builder.header("Authorization", value);
9264 };
9265 if let Some(ref apikey) = configuration.api_key {
9266 let key = apikey.key.clone();
9267 let value = match apikey.prefix {
9268 Some(ref prefix) => format!("{} {}", prefix, key),
9269 None => key,
9270 };
9271 req_builder = req_builder.header("Sudo", value);
9272 };
9273 if let Some(ref auth_conf) = configuration.basic_auth {
9274 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9275 };
9276 req_builder = req_builder.json(&p_body_body);
9277
9278 let req = req_builder.build()?;
9279 let resp = configuration.client.execute(req).await?;
9280
9281 let status = resp.status();
9282 let content_type = resp
9283 .headers()
9284 .get("content-type")
9285 .and_then(|v| v.to_str().ok())
9286 .unwrap_or("application/octet-stream");
9287 let content_type = super::ContentType::from(content_type);
9288
9289 if !status.is_client_error() && !status.is_server_error() {
9290 let content = resp.text().await?;
9291 match content_type {
9292 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9293 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))),
9294 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::PullRequest`")))),
9295 }
9296 } else {
9297 let content = resp.text().await?;
9298 let entity: Option<RepoEditPullRequestError> = serde_json::from_str(&content).ok();
9299 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9300 }
9301}
9302
9303pub async fn repo_edit_release(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option<models::EditReleaseOption>) -> Result<models::Release, Error<RepoEditReleaseError>> {
9304 let p_path_owner = owner;
9306 let p_path_repo = repo;
9307 let p_path_id = id;
9308 let p_body_body = body;
9309
9310 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
9311 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
9312
9313 if let Some(ref apikey) = configuration.api_key {
9314 let key = apikey.key.clone();
9315 let value = match apikey.prefix {
9316 Some(ref prefix) => format!("{} {}", prefix, key),
9317 None => key,
9318 };
9319 req_builder = req_builder.query(&[("access_token", value)]);
9320 }
9321 if let Some(ref apikey) = configuration.api_key {
9322 let key = apikey.key.clone();
9323 let value = match apikey.prefix {
9324 Some(ref prefix) => format!("{} {}", prefix, key),
9325 None => key,
9326 };
9327 req_builder = req_builder.query(&[("sudo", value)]);
9328 }
9329 if let Some(ref apikey) = configuration.api_key {
9330 let key = apikey.key.clone();
9331 let value = match apikey.prefix {
9332 Some(ref prefix) => format!("{} {}", prefix, key),
9333 None => key,
9334 };
9335 req_builder = req_builder.query(&[("token", value)]);
9336 }
9337 if let Some(ref user_agent) = configuration.user_agent {
9338 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9339 }
9340 if let Some(ref apikey) = configuration.api_key {
9341 let key = apikey.key.clone();
9342 let value = match apikey.prefix {
9343 Some(ref prefix) => format!("{} {}", prefix, key),
9344 None => key,
9345 };
9346 req_builder = req_builder.header("X-GITEA-OTP", value);
9347 };
9348 if let Some(ref apikey) = configuration.api_key {
9349 let key = apikey.key.clone();
9350 let value = match apikey.prefix {
9351 Some(ref prefix) => format!("{} {}", prefix, key),
9352 None => key,
9353 };
9354 req_builder = req_builder.header("Authorization", value);
9355 };
9356 if let Some(ref apikey) = configuration.api_key {
9357 let key = apikey.key.clone();
9358 let value = match apikey.prefix {
9359 Some(ref prefix) => format!("{} {}", prefix, key),
9360 None => key,
9361 };
9362 req_builder = req_builder.header("Sudo", value);
9363 };
9364 if let Some(ref auth_conf) = configuration.basic_auth {
9365 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9366 };
9367 req_builder = req_builder.json(&p_body_body);
9368
9369 let req = req_builder.build()?;
9370 let resp = configuration.client.execute(req).await?;
9371
9372 let status = resp.status();
9373 let content_type = resp
9374 .headers()
9375 .get("content-type")
9376 .and_then(|v| v.to_str().ok())
9377 .unwrap_or("application/octet-stream");
9378 let content_type = super::ContentType::from(content_type);
9379
9380 if !status.is_client_error() && !status.is_server_error() {
9381 let content = resp.text().await?;
9382 match content_type {
9383 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9384 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))),
9385 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::Release`")))),
9386 }
9387 } else {
9388 let content = resp.text().await?;
9389 let entity: Option<RepoEditReleaseError> = serde_json::from_str(&content).ok();
9390 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9391 }
9392}
9393
9394pub async fn repo_edit_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64, body: Option<models::EditAttachmentOptions>) -> Result<models::Attachment, Error<RepoEditReleaseAttachmentError>> {
9395 let p_path_owner = owner;
9397 let p_path_repo = repo;
9398 let p_path_id = id;
9399 let p_path_attachment_id = attachment_id;
9400 let p_body_body = body;
9401
9402 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id);
9403 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
9404
9405 if let Some(ref apikey) = configuration.api_key {
9406 let key = apikey.key.clone();
9407 let value = match apikey.prefix {
9408 Some(ref prefix) => format!("{} {}", prefix, key),
9409 None => key,
9410 };
9411 req_builder = req_builder.query(&[("access_token", value)]);
9412 }
9413 if let Some(ref apikey) = configuration.api_key {
9414 let key = apikey.key.clone();
9415 let value = match apikey.prefix {
9416 Some(ref prefix) => format!("{} {}", prefix, key),
9417 None => key,
9418 };
9419 req_builder = req_builder.query(&[("sudo", value)]);
9420 }
9421 if let Some(ref apikey) = configuration.api_key {
9422 let key = apikey.key.clone();
9423 let value = match apikey.prefix {
9424 Some(ref prefix) => format!("{} {}", prefix, key),
9425 None => key,
9426 };
9427 req_builder = req_builder.query(&[("token", value)]);
9428 }
9429 if let Some(ref user_agent) = configuration.user_agent {
9430 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9431 }
9432 if let Some(ref apikey) = configuration.api_key {
9433 let key = apikey.key.clone();
9434 let value = match apikey.prefix {
9435 Some(ref prefix) => format!("{} {}", prefix, key),
9436 None => key,
9437 };
9438 req_builder = req_builder.header("X-GITEA-OTP", value);
9439 };
9440 if let Some(ref apikey) = configuration.api_key {
9441 let key = apikey.key.clone();
9442 let value = match apikey.prefix {
9443 Some(ref prefix) => format!("{} {}", prefix, key),
9444 None => key,
9445 };
9446 req_builder = req_builder.header("Authorization", value);
9447 };
9448 if let Some(ref apikey) = configuration.api_key {
9449 let key = apikey.key.clone();
9450 let value = match apikey.prefix {
9451 Some(ref prefix) => format!("{} {}", prefix, key),
9452 None => key,
9453 };
9454 req_builder = req_builder.header("Sudo", value);
9455 };
9456 if let Some(ref auth_conf) = configuration.basic_auth {
9457 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9458 };
9459 req_builder = req_builder.json(&p_body_body);
9460
9461 let req = req_builder.build()?;
9462 let resp = configuration.client.execute(req).await?;
9463
9464 let status = resp.status();
9465 let content_type = resp
9466 .headers()
9467 .get("content-type")
9468 .and_then(|v| v.to_str().ok())
9469 .unwrap_or("application/octet-stream");
9470 let content_type = super::ContentType::from(content_type);
9471
9472 if !status.is_client_error() && !status.is_server_error() {
9473 let content = resp.text().await?;
9474 match content_type {
9475 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9476 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
9477 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::Attachment`")))),
9478 }
9479 } else {
9480 let content = resp.text().await?;
9481 let entity: Option<RepoEditReleaseAttachmentError> = serde_json::from_str(&content).ok();
9482 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9483 }
9484}
9485
9486pub async fn repo_edit_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i32, body: Option<models::EditTagProtectionOption>) -> Result<models::TagProtection, Error<RepoEditTagProtectionError>> {
9487 let p_path_owner = owner;
9489 let p_path_repo = repo;
9490 let p_path_id = id;
9491 let p_body_body = body;
9492
9493 let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
9494 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
9495
9496 if let Some(ref apikey) = configuration.api_key {
9497 let key = apikey.key.clone();
9498 let value = match apikey.prefix {
9499 Some(ref prefix) => format!("{} {}", prefix, key),
9500 None => key,
9501 };
9502 req_builder = req_builder.query(&[("access_token", value)]);
9503 }
9504 if let Some(ref apikey) = configuration.api_key {
9505 let key = apikey.key.clone();
9506 let value = match apikey.prefix {
9507 Some(ref prefix) => format!("{} {}", prefix, key),
9508 None => key,
9509 };
9510 req_builder = req_builder.query(&[("sudo", value)]);
9511 }
9512 if let Some(ref apikey) = configuration.api_key {
9513 let key = apikey.key.clone();
9514 let value = match apikey.prefix {
9515 Some(ref prefix) => format!("{} {}", prefix, key),
9516 None => key,
9517 };
9518 req_builder = req_builder.query(&[("token", value)]);
9519 }
9520 if let Some(ref user_agent) = configuration.user_agent {
9521 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9522 }
9523 if let Some(ref apikey) = configuration.api_key {
9524 let key = apikey.key.clone();
9525 let value = match apikey.prefix {
9526 Some(ref prefix) => format!("{} {}", prefix, key),
9527 None => key,
9528 };
9529 req_builder = req_builder.header("X-GITEA-OTP", value);
9530 };
9531 if let Some(ref apikey) = configuration.api_key {
9532 let key = apikey.key.clone();
9533 let value = match apikey.prefix {
9534 Some(ref prefix) => format!("{} {}", prefix, key),
9535 None => key,
9536 };
9537 req_builder = req_builder.header("Authorization", value);
9538 };
9539 if let Some(ref apikey) = configuration.api_key {
9540 let key = apikey.key.clone();
9541 let value = match apikey.prefix {
9542 Some(ref prefix) => format!("{} {}", prefix, key),
9543 None => key,
9544 };
9545 req_builder = req_builder.header("Sudo", value);
9546 };
9547 if let Some(ref auth_conf) = configuration.basic_auth {
9548 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9549 };
9550 req_builder = req_builder.json(&p_body_body);
9551
9552 let req = req_builder.build()?;
9553 let resp = configuration.client.execute(req).await?;
9554
9555 let status = resp.status();
9556 let content_type = resp
9557 .headers()
9558 .get("content-type")
9559 .and_then(|v| v.to_str().ok())
9560 .unwrap_or("application/octet-stream");
9561 let content_type = super::ContentType::from(content_type);
9562
9563 if !status.is_client_error() && !status.is_server_error() {
9564 let content = resp.text().await?;
9565 match content_type {
9566 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9567 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TagProtection`"))),
9568 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::TagProtection`")))),
9569 }
9570 } else {
9571 let content = resp.text().await?;
9572 let entity: Option<RepoEditTagProtectionError> = serde_json::from_str(&content).ok();
9573 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9574 }
9575}
9576
9577pub async fn repo_edit_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str, body: Option<models::CreateWikiPageOptions>) -> Result<models::WikiPage, Error<RepoEditWikiPageError>> {
9578 let p_path_owner = owner;
9580 let p_path_repo = repo;
9581 let p_path_page_name = page_name;
9582 let p_body_body = body;
9583
9584 let uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name));
9585 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
9586
9587 if let Some(ref apikey) = configuration.api_key {
9588 let key = apikey.key.clone();
9589 let value = match apikey.prefix {
9590 Some(ref prefix) => format!("{} {}", prefix, key),
9591 None => key,
9592 };
9593 req_builder = req_builder.query(&[("access_token", value)]);
9594 }
9595 if let Some(ref apikey) = configuration.api_key {
9596 let key = apikey.key.clone();
9597 let value = match apikey.prefix {
9598 Some(ref prefix) => format!("{} {}", prefix, key),
9599 None => key,
9600 };
9601 req_builder = req_builder.query(&[("sudo", value)]);
9602 }
9603 if let Some(ref apikey) = configuration.api_key {
9604 let key = apikey.key.clone();
9605 let value = match apikey.prefix {
9606 Some(ref prefix) => format!("{} {}", prefix, key),
9607 None => key,
9608 };
9609 req_builder = req_builder.query(&[("token", value)]);
9610 }
9611 if let Some(ref user_agent) = configuration.user_agent {
9612 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9613 }
9614 if let Some(ref apikey) = configuration.api_key {
9615 let key = apikey.key.clone();
9616 let value = match apikey.prefix {
9617 Some(ref prefix) => format!("{} {}", prefix, key),
9618 None => key,
9619 };
9620 req_builder = req_builder.header("X-GITEA-OTP", value);
9621 };
9622 if let Some(ref apikey) = configuration.api_key {
9623 let key = apikey.key.clone();
9624 let value = match apikey.prefix {
9625 Some(ref prefix) => format!("{} {}", prefix, key),
9626 None => key,
9627 };
9628 req_builder = req_builder.header("Authorization", value);
9629 };
9630 if let Some(ref apikey) = configuration.api_key {
9631 let key = apikey.key.clone();
9632 let value = match apikey.prefix {
9633 Some(ref prefix) => format!("{} {}", prefix, key),
9634 None => key,
9635 };
9636 req_builder = req_builder.header("Sudo", value);
9637 };
9638 if let Some(ref auth_conf) = configuration.basic_auth {
9639 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9640 };
9641 req_builder = req_builder.json(&p_body_body);
9642
9643 let req = req_builder.build()?;
9644 let resp = configuration.client.execute(req).await?;
9645
9646 let status = resp.status();
9647 let content_type = resp
9648 .headers()
9649 .get("content-type")
9650 .and_then(|v| v.to_str().ok())
9651 .unwrap_or("application/octet-stream");
9652 let content_type = super::ContentType::from(content_type);
9653
9654 if !status.is_client_error() && !status.is_server_error() {
9655 let content = resp.text().await?;
9656 match content_type {
9657 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9658 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiPage`"))),
9659 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::WikiPage`")))),
9660 }
9661 } else {
9662 let content = resp.text().await?;
9663 let entity: Option<RepoEditWikiPageError> = serde_json::from_str(&content).ok();
9664 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9665 }
9666}
9667
9668pub async fn repo_get(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::Repository, Error<RepoGetError>> {
9669 let p_path_owner = owner;
9671 let p_path_repo = repo;
9672
9673 let uri_str = format!("{}/repos/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
9674 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9675
9676 if let Some(ref apikey) = configuration.api_key {
9677 let key = apikey.key.clone();
9678 let value = match apikey.prefix {
9679 Some(ref prefix) => format!("{} {}", prefix, key),
9680 None => key,
9681 };
9682 req_builder = req_builder.query(&[("access_token", value)]);
9683 }
9684 if let Some(ref apikey) = configuration.api_key {
9685 let key = apikey.key.clone();
9686 let value = match apikey.prefix {
9687 Some(ref prefix) => format!("{} {}", prefix, key),
9688 None => key,
9689 };
9690 req_builder = req_builder.query(&[("sudo", value)]);
9691 }
9692 if let Some(ref apikey) = configuration.api_key {
9693 let key = apikey.key.clone();
9694 let value = match apikey.prefix {
9695 Some(ref prefix) => format!("{} {}", prefix, key),
9696 None => key,
9697 };
9698 req_builder = req_builder.query(&[("token", value)]);
9699 }
9700 if let Some(ref user_agent) = configuration.user_agent {
9701 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9702 }
9703 if let Some(ref apikey) = configuration.api_key {
9704 let key = apikey.key.clone();
9705 let value = match apikey.prefix {
9706 Some(ref prefix) => format!("{} {}", prefix, key),
9707 None => key,
9708 };
9709 req_builder = req_builder.header("X-GITEA-OTP", value);
9710 };
9711 if let Some(ref apikey) = configuration.api_key {
9712 let key = apikey.key.clone();
9713 let value = match apikey.prefix {
9714 Some(ref prefix) => format!("{} {}", prefix, key),
9715 None => key,
9716 };
9717 req_builder = req_builder.header("Authorization", value);
9718 };
9719 if let Some(ref apikey) = configuration.api_key {
9720 let key = apikey.key.clone();
9721 let value = match apikey.prefix {
9722 Some(ref prefix) => format!("{} {}", prefix, key),
9723 None => key,
9724 };
9725 req_builder = req_builder.header("Sudo", value);
9726 };
9727 if let Some(ref auth_conf) = configuration.basic_auth {
9728 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9729 };
9730
9731 let req = req_builder.build()?;
9732 let resp = configuration.client.execute(req).await?;
9733
9734 let status = resp.status();
9735 let content_type = resp
9736 .headers()
9737 .get("content-type")
9738 .and_then(|v| v.to_str().ok())
9739 .unwrap_or("application/octet-stream");
9740 let content_type = super::ContentType::from(content_type);
9741
9742 if !status.is_client_error() && !status.is_server_error() {
9743 let content = resp.text().await?;
9744 match content_type {
9745 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9746 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
9747 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`")))),
9748 }
9749 } else {
9750 let content = resp.text().await?;
9751 let entity: Option<RepoGetError> = serde_json::from_str(&content).ok();
9752 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9753 }
9754}
9755
9756pub async fn repo_get_all_commits(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: Option<&str>, path: Option<&str>, since: Option<String>, until: Option<String>, stat: Option<bool>, verification: Option<bool>, files: Option<bool>, page: Option<i32>, limit: Option<i32>, not: Option<&str>) -> Result<Vec<models::Commit>, Error<RepoGetAllCommitsError>> {
9757 let p_path_owner = owner;
9759 let p_path_repo = repo;
9760 let p_query_sha = sha;
9761 let p_query_path = path;
9762 let p_query_since = since;
9763 let p_query_until = until;
9764 let p_query_stat = stat;
9765 let p_query_verification = verification;
9766 let p_query_files = files;
9767 let p_query_page = page;
9768 let p_query_limit = limit;
9769 let p_query_not = not;
9770
9771 let uri_str = format!("{}/repos/{owner}/{repo}/commits", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
9772 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9773
9774 if let Some(ref param_value) = p_query_sha {
9775 req_builder = req_builder.query(&[("sha", ¶m_value.to_string())]);
9776 }
9777 if let Some(ref param_value) = p_query_path {
9778 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
9779 }
9780 if let Some(ref param_value) = p_query_since {
9781 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
9782 }
9783 if let Some(ref param_value) = p_query_until {
9784 req_builder = req_builder.query(&[("until", ¶m_value.to_string())]);
9785 }
9786 if let Some(ref param_value) = p_query_stat {
9787 req_builder = req_builder.query(&[("stat", ¶m_value.to_string())]);
9788 }
9789 if let Some(ref param_value) = p_query_verification {
9790 req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]);
9791 }
9792 if let Some(ref param_value) = p_query_files {
9793 req_builder = req_builder.query(&[("files", ¶m_value.to_string())]);
9794 }
9795 if let Some(ref param_value) = p_query_page {
9796 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
9797 }
9798 if let Some(ref param_value) = p_query_limit {
9799 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
9800 }
9801 if let Some(ref param_value) = p_query_not {
9802 req_builder = req_builder.query(&[("not", ¶m_value.to_string())]);
9803 }
9804 if let Some(ref apikey) = configuration.api_key {
9805 let key = apikey.key.clone();
9806 let value = match apikey.prefix {
9807 Some(ref prefix) => format!("{} {}", prefix, key),
9808 None => key,
9809 };
9810 req_builder = req_builder.query(&[("access_token", value)]);
9811 }
9812 if let Some(ref apikey) = configuration.api_key {
9813 let key = apikey.key.clone();
9814 let value = match apikey.prefix {
9815 Some(ref prefix) => format!("{} {}", prefix, key),
9816 None => key,
9817 };
9818 req_builder = req_builder.query(&[("sudo", value)]);
9819 }
9820 if let Some(ref apikey) = configuration.api_key {
9821 let key = apikey.key.clone();
9822 let value = match apikey.prefix {
9823 Some(ref prefix) => format!("{} {}", prefix, key),
9824 None => key,
9825 };
9826 req_builder = req_builder.query(&[("token", value)]);
9827 }
9828 if let Some(ref user_agent) = configuration.user_agent {
9829 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9830 }
9831 if let Some(ref apikey) = configuration.api_key {
9832 let key = apikey.key.clone();
9833 let value = match apikey.prefix {
9834 Some(ref prefix) => format!("{} {}", prefix, key),
9835 None => key,
9836 };
9837 req_builder = req_builder.header("X-GITEA-OTP", value);
9838 };
9839 if let Some(ref apikey) = configuration.api_key {
9840 let key = apikey.key.clone();
9841 let value = match apikey.prefix {
9842 Some(ref prefix) => format!("{} {}", prefix, key),
9843 None => key,
9844 };
9845 req_builder = req_builder.header("Authorization", value);
9846 };
9847 if let Some(ref apikey) = configuration.api_key {
9848 let key = apikey.key.clone();
9849 let value = match apikey.prefix {
9850 Some(ref prefix) => format!("{} {}", prefix, key),
9851 None => key,
9852 };
9853 req_builder = req_builder.header("Sudo", value);
9854 };
9855 if let Some(ref auth_conf) = configuration.basic_auth {
9856 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9857 };
9858
9859 let req = req_builder.build()?;
9860 let resp = configuration.client.execute(req).await?;
9861
9862 let status = resp.status();
9863 let content_type = resp
9864 .headers()
9865 .get("content-type")
9866 .and_then(|v| v.to_str().ok())
9867 .unwrap_or("application/octet-stream");
9868 let content_type = super::ContentType::from(content_type);
9869
9870 if !status.is_client_error() && !status.is_server_error() {
9871 let content = resp.text().await?;
9872 match content_type {
9873 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
9874 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Commit>`"))),
9875 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::Commit>`")))),
9876 }
9877 } else {
9878 let content = resp.text().await?;
9879 let entity: Option<RepoGetAllCommitsError> = serde_json::from_str(&content).ok();
9880 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9881 }
9882}
9883
9884pub async fn repo_get_archive(configuration: &configuration::Configuration, owner: &str, repo: &str, archive: &str) -> Result<(), Error<RepoGetArchiveError>> {
9885 let p_path_owner = owner;
9887 let p_path_repo = repo;
9888 let p_path_archive = archive;
9889
9890 let uri_str = format!("{}/repos/{owner}/{repo}/archive/{archive}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), archive=crate::apis::urlencode(p_path_archive));
9891 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9892
9893 if let Some(ref apikey) = configuration.api_key {
9894 let key = apikey.key.clone();
9895 let value = match apikey.prefix {
9896 Some(ref prefix) => format!("{} {}", prefix, key),
9897 None => key,
9898 };
9899 req_builder = req_builder.query(&[("access_token", value)]);
9900 }
9901 if let Some(ref apikey) = configuration.api_key {
9902 let key = apikey.key.clone();
9903 let value = match apikey.prefix {
9904 Some(ref prefix) => format!("{} {}", prefix, key),
9905 None => key,
9906 };
9907 req_builder = req_builder.query(&[("sudo", value)]);
9908 }
9909 if let Some(ref apikey) = configuration.api_key {
9910 let key = apikey.key.clone();
9911 let value = match apikey.prefix {
9912 Some(ref prefix) => format!("{} {}", prefix, key),
9913 None => key,
9914 };
9915 req_builder = req_builder.query(&[("token", value)]);
9916 }
9917 if let Some(ref user_agent) = configuration.user_agent {
9918 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9919 }
9920 if let Some(ref apikey) = configuration.api_key {
9921 let key = apikey.key.clone();
9922 let value = match apikey.prefix {
9923 Some(ref prefix) => format!("{} {}", prefix, key),
9924 None => key,
9925 };
9926 req_builder = req_builder.header("X-GITEA-OTP", value);
9927 };
9928 if let Some(ref apikey) = configuration.api_key {
9929 let key = apikey.key.clone();
9930 let value = match apikey.prefix {
9931 Some(ref prefix) => format!("{} {}", prefix, key),
9932 None => key,
9933 };
9934 req_builder = req_builder.header("Authorization", value);
9935 };
9936 if let Some(ref apikey) = configuration.api_key {
9937 let key = apikey.key.clone();
9938 let value = match apikey.prefix {
9939 Some(ref prefix) => format!("{} {}", prefix, key),
9940 None => key,
9941 };
9942 req_builder = req_builder.header("Sudo", value);
9943 };
9944 if let Some(ref auth_conf) = configuration.basic_auth {
9945 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
9946 };
9947
9948 let req = req_builder.build()?;
9949 let resp = configuration.client.execute(req).await?;
9950
9951 let status = resp.status();
9952
9953 if !status.is_client_error() && !status.is_server_error() {
9954 Ok(())
9955 } else {
9956 let content = resp.text().await?;
9957 let entity: Option<RepoGetArchiveError> = serde_json::from_str(&content).ok();
9958 Err(Error::ResponseError(ResponseContent { status, content, entity }))
9959 }
9960}
9961
9962pub async fn repo_get_assignees(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::User>, Error<RepoGetAssigneesError>> {
9963 let p_path_owner = owner;
9965 let p_path_repo = repo;
9966
9967 let uri_str = format!("{}/repos/{owner}/{repo}/assignees", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
9968 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
9969
9970 if let Some(ref apikey) = configuration.api_key {
9971 let key = apikey.key.clone();
9972 let value = match apikey.prefix {
9973 Some(ref prefix) => format!("{} {}", prefix, key),
9974 None => key,
9975 };
9976 req_builder = req_builder.query(&[("access_token", value)]);
9977 }
9978 if let Some(ref apikey) = configuration.api_key {
9979 let key = apikey.key.clone();
9980 let value = match apikey.prefix {
9981 Some(ref prefix) => format!("{} {}", prefix, key),
9982 None => key,
9983 };
9984 req_builder = req_builder.query(&[("sudo", value)]);
9985 }
9986 if let Some(ref apikey) = configuration.api_key {
9987 let key = apikey.key.clone();
9988 let value = match apikey.prefix {
9989 Some(ref prefix) => format!("{} {}", prefix, key),
9990 None => key,
9991 };
9992 req_builder = req_builder.query(&[("token", value)]);
9993 }
9994 if let Some(ref user_agent) = configuration.user_agent {
9995 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
9996 }
9997 if let Some(ref apikey) = configuration.api_key {
9998 let key = apikey.key.clone();
9999 let value = match apikey.prefix {
10000 Some(ref prefix) => format!("{} {}", prefix, key),
10001 None => key,
10002 };
10003 req_builder = req_builder.header("X-GITEA-OTP", value);
10004 };
10005 if let Some(ref apikey) = configuration.api_key {
10006 let key = apikey.key.clone();
10007 let value = match apikey.prefix {
10008 Some(ref prefix) => format!("{} {}", prefix, key),
10009 None => key,
10010 };
10011 req_builder = req_builder.header("Authorization", value);
10012 };
10013 if let Some(ref apikey) = configuration.api_key {
10014 let key = apikey.key.clone();
10015 let value = match apikey.prefix {
10016 Some(ref prefix) => format!("{} {}", prefix, key),
10017 None => key,
10018 };
10019 req_builder = req_builder.header("Sudo", value);
10020 };
10021 if let Some(ref auth_conf) = configuration.basic_auth {
10022 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10023 };
10024
10025 let req = req_builder.build()?;
10026 let resp = configuration.client.execute(req).await?;
10027
10028 let status = resp.status();
10029 let content_type = resp
10030 .headers()
10031 .get("content-type")
10032 .and_then(|v| v.to_str().ok())
10033 .unwrap_or("application/octet-stream");
10034 let content_type = super::ContentType::from(content_type);
10035
10036 if !status.is_client_error() && !status.is_server_error() {
10037 let content = resp.text().await?;
10038 match content_type {
10039 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10040 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
10041 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>`")))),
10042 }
10043 } else {
10044 let content = resp.text().await?;
10045 let entity: Option<RepoGetAssigneesError> = serde_json::from_str(&content).ok();
10046 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10047 }
10048}
10049
10050pub async fn repo_get_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, branch: &str) -> Result<models::Branch, Error<RepoGetBranchError>> {
10051 let p_path_owner = owner;
10053 let p_path_repo = repo;
10054 let p_path_branch = branch;
10055
10056 let uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), branch=crate::apis::urlencode(p_path_branch));
10057 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10058
10059 if let Some(ref apikey) = configuration.api_key {
10060 let key = apikey.key.clone();
10061 let value = match apikey.prefix {
10062 Some(ref prefix) => format!("{} {}", prefix, key),
10063 None => key,
10064 };
10065 req_builder = req_builder.query(&[("access_token", value)]);
10066 }
10067 if let Some(ref apikey) = configuration.api_key {
10068 let key = apikey.key.clone();
10069 let value = match apikey.prefix {
10070 Some(ref prefix) => format!("{} {}", prefix, key),
10071 None => key,
10072 };
10073 req_builder = req_builder.query(&[("sudo", value)]);
10074 }
10075 if let Some(ref apikey) = configuration.api_key {
10076 let key = apikey.key.clone();
10077 let value = match apikey.prefix {
10078 Some(ref prefix) => format!("{} {}", prefix, key),
10079 None => key,
10080 };
10081 req_builder = req_builder.query(&[("token", value)]);
10082 }
10083 if let Some(ref user_agent) = configuration.user_agent {
10084 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10085 }
10086 if let Some(ref apikey) = configuration.api_key {
10087 let key = apikey.key.clone();
10088 let value = match apikey.prefix {
10089 Some(ref prefix) => format!("{} {}", prefix, key),
10090 None => key,
10091 };
10092 req_builder = req_builder.header("X-GITEA-OTP", value);
10093 };
10094 if let Some(ref apikey) = configuration.api_key {
10095 let key = apikey.key.clone();
10096 let value = match apikey.prefix {
10097 Some(ref prefix) => format!("{} {}", prefix, key),
10098 None => key,
10099 };
10100 req_builder = req_builder.header("Authorization", value);
10101 };
10102 if let Some(ref apikey) = configuration.api_key {
10103 let key = apikey.key.clone();
10104 let value = match apikey.prefix {
10105 Some(ref prefix) => format!("{} {}", prefix, key),
10106 None => key,
10107 };
10108 req_builder = req_builder.header("Sudo", value);
10109 };
10110 if let Some(ref auth_conf) = configuration.basic_auth {
10111 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10112 };
10113
10114 let req = req_builder.build()?;
10115 let resp = configuration.client.execute(req).await?;
10116
10117 let status = resp.status();
10118 let content_type = resp
10119 .headers()
10120 .get("content-type")
10121 .and_then(|v| v.to_str().ok())
10122 .unwrap_or("application/octet-stream");
10123 let content_type = super::ContentType::from(content_type);
10124
10125 if !status.is_client_error() && !status.is_server_error() {
10126 let content = resp.text().await?;
10127 match content_type {
10128 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10129 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Branch`"))),
10130 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::Branch`")))),
10131 }
10132 } else {
10133 let content = resp.text().await?;
10134 let entity: Option<RepoGetBranchError> = serde_json::from_str(&content).ok();
10135 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10136 }
10137}
10138
10139pub async fn repo_get_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result<models::BranchProtection, Error<RepoGetBranchProtectionError>> {
10140 let p_path_owner = owner;
10142 let p_path_repo = repo;
10143 let p_path_name = name;
10144
10145 let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name));
10146 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10147
10148 if let Some(ref apikey) = configuration.api_key {
10149 let key = apikey.key.clone();
10150 let value = match apikey.prefix {
10151 Some(ref prefix) => format!("{} {}", prefix, key),
10152 None => key,
10153 };
10154 req_builder = req_builder.query(&[("access_token", value)]);
10155 }
10156 if let Some(ref apikey) = configuration.api_key {
10157 let key = apikey.key.clone();
10158 let value = match apikey.prefix {
10159 Some(ref prefix) => format!("{} {}", prefix, key),
10160 None => key,
10161 };
10162 req_builder = req_builder.query(&[("sudo", value)]);
10163 }
10164 if let Some(ref apikey) = configuration.api_key {
10165 let key = apikey.key.clone();
10166 let value = match apikey.prefix {
10167 Some(ref prefix) => format!("{} {}", prefix, key),
10168 None => key,
10169 };
10170 req_builder = req_builder.query(&[("token", value)]);
10171 }
10172 if let Some(ref user_agent) = configuration.user_agent {
10173 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10174 }
10175 if let Some(ref apikey) = configuration.api_key {
10176 let key = apikey.key.clone();
10177 let value = match apikey.prefix {
10178 Some(ref prefix) => format!("{} {}", prefix, key),
10179 None => key,
10180 };
10181 req_builder = req_builder.header("X-GITEA-OTP", value);
10182 };
10183 if let Some(ref apikey) = configuration.api_key {
10184 let key = apikey.key.clone();
10185 let value = match apikey.prefix {
10186 Some(ref prefix) => format!("{} {}", prefix, key),
10187 None => key,
10188 };
10189 req_builder = req_builder.header("Authorization", value);
10190 };
10191 if let Some(ref apikey) = configuration.api_key {
10192 let key = apikey.key.clone();
10193 let value = match apikey.prefix {
10194 Some(ref prefix) => format!("{} {}", prefix, key),
10195 None => key,
10196 };
10197 req_builder = req_builder.header("Sudo", value);
10198 };
10199 if let Some(ref auth_conf) = configuration.basic_auth {
10200 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10201 };
10202
10203 let req = req_builder.build()?;
10204 let resp = configuration.client.execute(req).await?;
10205
10206 let status = resp.status();
10207 let content_type = resp
10208 .headers()
10209 .get("content-type")
10210 .and_then(|v| v.to_str().ok())
10211 .unwrap_or("application/octet-stream");
10212 let content_type = super::ContentType::from(content_type);
10213
10214 if !status.is_client_error() && !status.is_server_error() {
10215 let content = resp.text().await?;
10216 match content_type {
10217 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10218 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BranchProtection`"))),
10219 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::BranchProtection`")))),
10220 }
10221 } else {
10222 let content = resp.text().await?;
10223 let entity: Option<RepoGetBranchProtectionError> = serde_json::from_str(&content).ok();
10224 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10225 }
10226}
10227
10228pub async fn repo_get_by_id(configuration: &configuration::Configuration, id: i64) -> Result<models::Repository, Error<RepoGetByIdError>> {
10229 let p_path_id = id;
10231
10232 let uri_str = format!("{}/repositories/{id}", configuration.base_path, id=p_path_id);
10233 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10234
10235 if let Some(ref apikey) = configuration.api_key {
10236 let key = apikey.key.clone();
10237 let value = match apikey.prefix {
10238 Some(ref prefix) => format!("{} {}", prefix, key),
10239 None => key,
10240 };
10241 req_builder = req_builder.query(&[("access_token", value)]);
10242 }
10243 if let Some(ref apikey) = configuration.api_key {
10244 let key = apikey.key.clone();
10245 let value = match apikey.prefix {
10246 Some(ref prefix) => format!("{} {}", prefix, key),
10247 None => key,
10248 };
10249 req_builder = req_builder.query(&[("sudo", value)]);
10250 }
10251 if let Some(ref apikey) = configuration.api_key {
10252 let key = apikey.key.clone();
10253 let value = match apikey.prefix {
10254 Some(ref prefix) => format!("{} {}", prefix, key),
10255 None => key,
10256 };
10257 req_builder = req_builder.query(&[("token", value)]);
10258 }
10259 if let Some(ref user_agent) = configuration.user_agent {
10260 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10261 }
10262 if let Some(ref apikey) = configuration.api_key {
10263 let key = apikey.key.clone();
10264 let value = match apikey.prefix {
10265 Some(ref prefix) => format!("{} {}", prefix, key),
10266 None => key,
10267 };
10268 req_builder = req_builder.header("X-GITEA-OTP", value);
10269 };
10270 if let Some(ref apikey) = configuration.api_key {
10271 let key = apikey.key.clone();
10272 let value = match apikey.prefix {
10273 Some(ref prefix) => format!("{} {}", prefix, key),
10274 None => key,
10275 };
10276 req_builder = req_builder.header("Authorization", value);
10277 };
10278 if let Some(ref apikey) = configuration.api_key {
10279 let key = apikey.key.clone();
10280 let value = match apikey.prefix {
10281 Some(ref prefix) => format!("{} {}", prefix, key),
10282 None => key,
10283 };
10284 req_builder = req_builder.header("Sudo", value);
10285 };
10286 if let Some(ref auth_conf) = configuration.basic_auth {
10287 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10288 };
10289
10290 let req = req_builder.build()?;
10291 let resp = configuration.client.execute(req).await?;
10292
10293 let status = resp.status();
10294 let content_type = resp
10295 .headers()
10296 .get("content-type")
10297 .and_then(|v| v.to_str().ok())
10298 .unwrap_or("application/octet-stream");
10299 let content_type = super::ContentType::from(content_type);
10300
10301 if !status.is_client_error() && !status.is_server_error() {
10302 let content = resp.text().await?;
10303 match content_type {
10304 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10305 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
10306 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`")))),
10307 }
10308 } else {
10309 let content = resp.text().await?;
10310 let entity: Option<RepoGetByIdError> = serde_json::from_str(&content).ok();
10311 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10312 }
10313}
10314
10315pub async fn repo_get_combined_status_by_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str, page: Option<i32>, limit: Option<i32>) -> Result<models::CombinedStatus, Error<RepoGetCombinedStatusByRefError>> {
10316 let p_path_owner = owner;
10318 let p_path_repo = repo;
10319 let p_path_ref = r#ref;
10320 let p_query_page = page;
10321 let p_query_limit = limit;
10322
10323 let uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/status", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), ref=crate::apis::urlencode(p_path_ref));
10324 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10325
10326 if let Some(ref param_value) = p_query_page {
10327 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
10328 }
10329 if let Some(ref param_value) = p_query_limit {
10330 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
10331 }
10332 if let Some(ref apikey) = configuration.api_key {
10333 let key = apikey.key.clone();
10334 let value = match apikey.prefix {
10335 Some(ref prefix) => format!("{} {}", prefix, key),
10336 None => key,
10337 };
10338 req_builder = req_builder.query(&[("access_token", value)]);
10339 }
10340 if let Some(ref apikey) = configuration.api_key {
10341 let key = apikey.key.clone();
10342 let value = match apikey.prefix {
10343 Some(ref prefix) => format!("{} {}", prefix, key),
10344 None => key,
10345 };
10346 req_builder = req_builder.query(&[("sudo", value)]);
10347 }
10348 if let Some(ref apikey) = configuration.api_key {
10349 let key = apikey.key.clone();
10350 let value = match apikey.prefix {
10351 Some(ref prefix) => format!("{} {}", prefix, key),
10352 None => key,
10353 };
10354 req_builder = req_builder.query(&[("token", value)]);
10355 }
10356 if let Some(ref user_agent) = configuration.user_agent {
10357 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10358 }
10359 if let Some(ref apikey) = configuration.api_key {
10360 let key = apikey.key.clone();
10361 let value = match apikey.prefix {
10362 Some(ref prefix) => format!("{} {}", prefix, key),
10363 None => key,
10364 };
10365 req_builder = req_builder.header("X-GITEA-OTP", value);
10366 };
10367 if let Some(ref apikey) = configuration.api_key {
10368 let key = apikey.key.clone();
10369 let value = match apikey.prefix {
10370 Some(ref prefix) => format!("{} {}", prefix, key),
10371 None => key,
10372 };
10373 req_builder = req_builder.header("Authorization", value);
10374 };
10375 if let Some(ref apikey) = configuration.api_key {
10376 let key = apikey.key.clone();
10377 let value = match apikey.prefix {
10378 Some(ref prefix) => format!("{} {}", prefix, key),
10379 None => key,
10380 };
10381 req_builder = req_builder.header("Sudo", value);
10382 };
10383 if let Some(ref auth_conf) = configuration.basic_auth {
10384 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10385 };
10386
10387 let req = req_builder.build()?;
10388 let resp = configuration.client.execute(req).await?;
10389
10390 let status = resp.status();
10391 let content_type = resp
10392 .headers()
10393 .get("content-type")
10394 .and_then(|v| v.to_str().ok())
10395 .unwrap_or("application/octet-stream");
10396 let content_type = super::ContentType::from(content_type);
10397
10398 if !status.is_client_error() && !status.is_server_error() {
10399 let content = resp.text().await?;
10400 match content_type {
10401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CombinedStatus`"))),
10403 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::CombinedStatus`")))),
10404 }
10405 } else {
10406 let content = resp.text().await?;
10407 let entity: Option<RepoGetCombinedStatusByRefError> = serde_json::from_str(&content).ok();
10408 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10409 }
10410}
10411
10412pub async fn repo_get_commit_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str) -> Result<models::PullRequest, Error<RepoGetCommitPullRequestError>> {
10413 let p_path_owner = owner;
10415 let p_path_repo = repo;
10416 let p_path_sha = sha;
10417
10418 let uri_str = format!("{}/repos/{owner}/{repo}/commits/{sha}/pull", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
10419 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10420
10421 if let Some(ref apikey) = configuration.api_key {
10422 let key = apikey.key.clone();
10423 let value = match apikey.prefix {
10424 Some(ref prefix) => format!("{} {}", prefix, key),
10425 None => key,
10426 };
10427 req_builder = req_builder.query(&[("access_token", value)]);
10428 }
10429 if let Some(ref apikey) = configuration.api_key {
10430 let key = apikey.key.clone();
10431 let value = match apikey.prefix {
10432 Some(ref prefix) => format!("{} {}", prefix, key),
10433 None => key,
10434 };
10435 req_builder = req_builder.query(&[("sudo", value)]);
10436 }
10437 if let Some(ref apikey) = configuration.api_key {
10438 let key = apikey.key.clone();
10439 let value = match apikey.prefix {
10440 Some(ref prefix) => format!("{} {}", prefix, key),
10441 None => key,
10442 };
10443 req_builder = req_builder.query(&[("token", value)]);
10444 }
10445 if let Some(ref user_agent) = configuration.user_agent {
10446 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10447 }
10448 if let Some(ref apikey) = configuration.api_key {
10449 let key = apikey.key.clone();
10450 let value = match apikey.prefix {
10451 Some(ref prefix) => format!("{} {}", prefix, key),
10452 None => key,
10453 };
10454 req_builder = req_builder.header("X-GITEA-OTP", value);
10455 };
10456 if let Some(ref apikey) = configuration.api_key {
10457 let key = apikey.key.clone();
10458 let value = match apikey.prefix {
10459 Some(ref prefix) => format!("{} {}", prefix, key),
10460 None => key,
10461 };
10462 req_builder = req_builder.header("Authorization", value);
10463 };
10464 if let Some(ref apikey) = configuration.api_key {
10465 let key = apikey.key.clone();
10466 let value = match apikey.prefix {
10467 Some(ref prefix) => format!("{} {}", prefix, key),
10468 None => key,
10469 };
10470 req_builder = req_builder.header("Sudo", value);
10471 };
10472 if let Some(ref auth_conf) = configuration.basic_auth {
10473 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10474 };
10475
10476 let req = req_builder.build()?;
10477 let resp = configuration.client.execute(req).await?;
10478
10479 let status = resp.status();
10480 let content_type = resp
10481 .headers()
10482 .get("content-type")
10483 .and_then(|v| v.to_str().ok())
10484 .unwrap_or("application/octet-stream");
10485 let content_type = super::ContentType::from(content_type);
10486
10487 if !status.is_client_error() && !status.is_server_error() {
10488 let content = resp.text().await?;
10489 match content_type {
10490 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10491 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))),
10492 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::PullRequest`")))),
10493 }
10494 } else {
10495 let content = resp.text().await?;
10496 let entity: Option<RepoGetCommitPullRequestError> = serde_json::from_str(&content).ok();
10497 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10498 }
10499}
10500
10501pub async fn repo_get_contents(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result<models::ContentsResponse, Error<RepoGetContentsError>> {
10503 let p_path_owner = owner;
10505 let p_path_repo = repo;
10506 let p_path_filepath = filepath;
10507 let p_query_ref = r#ref;
10508
10509 let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
10510 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10511
10512 if let Some(ref param_value) = p_query_ref {
10513 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
10514 }
10515 if let Some(ref apikey) = configuration.api_key {
10516 let key = apikey.key.clone();
10517 let value = match apikey.prefix {
10518 Some(ref prefix) => format!("{} {}", prefix, key),
10519 None => key,
10520 };
10521 req_builder = req_builder.query(&[("access_token", value)]);
10522 }
10523 if let Some(ref apikey) = configuration.api_key {
10524 let key = apikey.key.clone();
10525 let value = match apikey.prefix {
10526 Some(ref prefix) => format!("{} {}", prefix, key),
10527 None => key,
10528 };
10529 req_builder = req_builder.query(&[("sudo", value)]);
10530 }
10531 if let Some(ref apikey) = configuration.api_key {
10532 let key = apikey.key.clone();
10533 let value = match apikey.prefix {
10534 Some(ref prefix) => format!("{} {}", prefix, key),
10535 None => key,
10536 };
10537 req_builder = req_builder.query(&[("token", value)]);
10538 }
10539 if let Some(ref user_agent) = configuration.user_agent {
10540 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10541 }
10542 if let Some(ref apikey) = configuration.api_key {
10543 let key = apikey.key.clone();
10544 let value = match apikey.prefix {
10545 Some(ref prefix) => format!("{} {}", prefix, key),
10546 None => key,
10547 };
10548 req_builder = req_builder.header("X-GITEA-OTP", value);
10549 };
10550 if let Some(ref apikey) = configuration.api_key {
10551 let key = apikey.key.clone();
10552 let value = match apikey.prefix {
10553 Some(ref prefix) => format!("{} {}", prefix, key),
10554 None => key,
10555 };
10556 req_builder = req_builder.header("Authorization", value);
10557 };
10558 if let Some(ref apikey) = configuration.api_key {
10559 let key = apikey.key.clone();
10560 let value = match apikey.prefix {
10561 Some(ref prefix) => format!("{} {}", prefix, key),
10562 None => key,
10563 };
10564 req_builder = req_builder.header("Sudo", value);
10565 };
10566 if let Some(ref auth_conf) = configuration.basic_auth {
10567 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10568 };
10569
10570 let req = req_builder.build()?;
10571 let resp = configuration.client.execute(req).await?;
10572
10573 let status = resp.status();
10574 let content_type = resp
10575 .headers()
10576 .get("content-type")
10577 .and_then(|v| v.to_str().ok())
10578 .unwrap_or("application/octet-stream");
10579 let content_type = super::ContentType::from(content_type);
10580
10581 if !status.is_client_error() && !status.is_server_error() {
10582 let content = resp.text().await?;
10583 match content_type {
10584 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10585 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ContentsResponse`"))),
10586 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::ContentsResponse`")))),
10587 }
10588 } else {
10589 let content = resp.text().await?;
10590 let entity: Option<RepoGetContentsError> = serde_json::from_str(&content).ok();
10591 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10592 }
10593}
10594
10595pub async fn repo_get_contents_ext(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>, includes: Option<&str>) -> Result<models::ContentsExtResponse, Error<RepoGetContentsExtError>> {
10597 let p_path_owner = owner;
10599 let p_path_repo = repo;
10600 let p_path_filepath = filepath;
10601 let p_query_ref = r#ref;
10602 let p_query_includes = includes;
10603
10604 let uri_str = format!("{}/repos/{owner}/{repo}/contents-ext/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
10605 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10606
10607 if let Some(ref param_value) = p_query_ref {
10608 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
10609 }
10610 if let Some(ref param_value) = p_query_includes {
10611 req_builder = req_builder.query(&[("includes", ¶m_value.to_string())]);
10612 }
10613 if let Some(ref apikey) = configuration.api_key {
10614 let key = apikey.key.clone();
10615 let value = match apikey.prefix {
10616 Some(ref prefix) => format!("{} {}", prefix, key),
10617 None => key,
10618 };
10619 req_builder = req_builder.query(&[("access_token", value)]);
10620 }
10621 if let Some(ref apikey) = configuration.api_key {
10622 let key = apikey.key.clone();
10623 let value = match apikey.prefix {
10624 Some(ref prefix) => format!("{} {}", prefix, key),
10625 None => key,
10626 };
10627 req_builder = req_builder.query(&[("sudo", value)]);
10628 }
10629 if let Some(ref apikey) = configuration.api_key {
10630 let key = apikey.key.clone();
10631 let value = match apikey.prefix {
10632 Some(ref prefix) => format!("{} {}", prefix, key),
10633 None => key,
10634 };
10635 req_builder = req_builder.query(&[("token", value)]);
10636 }
10637 if let Some(ref user_agent) = configuration.user_agent {
10638 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10639 }
10640 if let Some(ref apikey) = configuration.api_key {
10641 let key = apikey.key.clone();
10642 let value = match apikey.prefix {
10643 Some(ref prefix) => format!("{} {}", prefix, key),
10644 None => key,
10645 };
10646 req_builder = req_builder.header("X-GITEA-OTP", value);
10647 };
10648 if let Some(ref apikey) = configuration.api_key {
10649 let key = apikey.key.clone();
10650 let value = match apikey.prefix {
10651 Some(ref prefix) => format!("{} {}", prefix, key),
10652 None => key,
10653 };
10654 req_builder = req_builder.header("Authorization", value);
10655 };
10656 if let Some(ref apikey) = configuration.api_key {
10657 let key = apikey.key.clone();
10658 let value = match apikey.prefix {
10659 Some(ref prefix) => format!("{} {}", prefix, key),
10660 None => key,
10661 };
10662 req_builder = req_builder.header("Sudo", value);
10663 };
10664 if let Some(ref auth_conf) = configuration.basic_auth {
10665 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10666 };
10667
10668 let req = req_builder.build()?;
10669 let resp = configuration.client.execute(req).await?;
10670
10671 let status = resp.status();
10672 let content_type = resp
10673 .headers()
10674 .get("content-type")
10675 .and_then(|v| v.to_str().ok())
10676 .unwrap_or("application/octet-stream");
10677 let content_type = super::ContentType::from(content_type);
10678
10679 if !status.is_client_error() && !status.is_server_error() {
10680 let content = resp.text().await?;
10681 match content_type {
10682 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10683 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ContentsExtResponse`"))),
10684 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::ContentsExtResponse`")))),
10685 }
10686 } else {
10687 let content = resp.text().await?;
10688 let entity: Option<RepoGetContentsExtError> = serde_json::from_str(&content).ok();
10689 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10690 }
10691}
10692
10693pub async fn repo_get_contents_list(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: Option<&str>) -> Result<Vec<models::ContentsResponse>, Error<RepoGetContentsListError>> {
10695 let p_path_owner = owner;
10697 let p_path_repo = repo;
10698 let p_query_ref = r#ref;
10699
10700 let uri_str = format!("{}/repos/{owner}/{repo}/contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
10701 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10702
10703 if let Some(ref param_value) = p_query_ref {
10704 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
10705 }
10706 if let Some(ref apikey) = configuration.api_key {
10707 let key = apikey.key.clone();
10708 let value = match apikey.prefix {
10709 Some(ref prefix) => format!("{} {}", prefix, key),
10710 None => key,
10711 };
10712 req_builder = req_builder.query(&[("access_token", value)]);
10713 }
10714 if let Some(ref apikey) = configuration.api_key {
10715 let key = apikey.key.clone();
10716 let value = match apikey.prefix {
10717 Some(ref prefix) => format!("{} {}", prefix, key),
10718 None => key,
10719 };
10720 req_builder = req_builder.query(&[("sudo", value)]);
10721 }
10722 if let Some(ref apikey) = configuration.api_key {
10723 let key = apikey.key.clone();
10724 let value = match apikey.prefix {
10725 Some(ref prefix) => format!("{} {}", prefix, key),
10726 None => key,
10727 };
10728 req_builder = req_builder.query(&[("token", value)]);
10729 }
10730 if let Some(ref user_agent) = configuration.user_agent {
10731 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10732 }
10733 if let Some(ref apikey) = configuration.api_key {
10734 let key = apikey.key.clone();
10735 let value = match apikey.prefix {
10736 Some(ref prefix) => format!("{} {}", prefix, key),
10737 None => key,
10738 };
10739 req_builder = req_builder.header("X-GITEA-OTP", value);
10740 };
10741 if let Some(ref apikey) = configuration.api_key {
10742 let key = apikey.key.clone();
10743 let value = match apikey.prefix {
10744 Some(ref prefix) => format!("{} {}", prefix, key),
10745 None => key,
10746 };
10747 req_builder = req_builder.header("Authorization", value);
10748 };
10749 if let Some(ref apikey) = configuration.api_key {
10750 let key = apikey.key.clone();
10751 let value = match apikey.prefix {
10752 Some(ref prefix) => format!("{} {}", prefix, key),
10753 None => key,
10754 };
10755 req_builder = req_builder.header("Sudo", value);
10756 };
10757 if let Some(ref auth_conf) = configuration.basic_auth {
10758 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10759 };
10760
10761 let req = req_builder.build()?;
10762 let resp = configuration.client.execute(req).await?;
10763
10764 let status = resp.status();
10765 let content_type = resp
10766 .headers()
10767 .get("content-type")
10768 .and_then(|v| v.to_str().ok())
10769 .unwrap_or("application/octet-stream");
10770 let content_type = super::ContentType::from(content_type);
10771
10772 if !status.is_client_error() && !status.is_server_error() {
10773 let content = resp.text().await?;
10774 match content_type {
10775 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10776 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ContentsResponse>`"))),
10777 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::ContentsResponse>`")))),
10778 }
10779 } else {
10780 let content = resp.text().await?;
10781 let entity: Option<RepoGetContentsListError> = serde_json::from_str(&content).ok();
10782 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10783 }
10784}
10785
10786pub async fn repo_get_editor_config(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result<(), Error<RepoGetEditorConfigError>> {
10787 let p_path_owner = owner;
10789 let p_path_repo = repo;
10790 let p_path_filepath = filepath;
10791 let p_query_ref = r#ref;
10792
10793 let uri_str = format!("{}/repos/{owner}/{repo}/editorconfig/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
10794 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10795
10796 if let Some(ref param_value) = p_query_ref {
10797 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
10798 }
10799 if let Some(ref apikey) = configuration.api_key {
10800 let key = apikey.key.clone();
10801 let value = match apikey.prefix {
10802 Some(ref prefix) => format!("{} {}", prefix, key),
10803 None => key,
10804 };
10805 req_builder = req_builder.query(&[("access_token", value)]);
10806 }
10807 if let Some(ref apikey) = configuration.api_key {
10808 let key = apikey.key.clone();
10809 let value = match apikey.prefix {
10810 Some(ref prefix) => format!("{} {}", prefix, key),
10811 None => key,
10812 };
10813 req_builder = req_builder.query(&[("sudo", value)]);
10814 }
10815 if let Some(ref apikey) = configuration.api_key {
10816 let key = apikey.key.clone();
10817 let value = match apikey.prefix {
10818 Some(ref prefix) => format!("{} {}", prefix, key),
10819 None => key,
10820 };
10821 req_builder = req_builder.query(&[("token", value)]);
10822 }
10823 if let Some(ref user_agent) = configuration.user_agent {
10824 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10825 }
10826 if let Some(ref apikey) = configuration.api_key {
10827 let key = apikey.key.clone();
10828 let value = match apikey.prefix {
10829 Some(ref prefix) => format!("{} {}", prefix, key),
10830 None => key,
10831 };
10832 req_builder = req_builder.header("X-GITEA-OTP", value);
10833 };
10834 if let Some(ref apikey) = configuration.api_key {
10835 let key = apikey.key.clone();
10836 let value = match apikey.prefix {
10837 Some(ref prefix) => format!("{} {}", prefix, key),
10838 None => key,
10839 };
10840 req_builder = req_builder.header("Authorization", value);
10841 };
10842 if let Some(ref apikey) = configuration.api_key {
10843 let key = apikey.key.clone();
10844 let value = match apikey.prefix {
10845 Some(ref prefix) => format!("{} {}", prefix, key),
10846 None => key,
10847 };
10848 req_builder = req_builder.header("Sudo", value);
10849 };
10850 if let Some(ref auth_conf) = configuration.basic_auth {
10851 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10852 };
10853
10854 let req = req_builder.build()?;
10855 let resp = configuration.client.execute(req).await?;
10856
10857 let status = resp.status();
10858
10859 if !status.is_client_error() && !status.is_server_error() {
10860 Ok(())
10861 } else {
10862 let content = resp.text().await?;
10863 let entity: Option<RepoGetEditorConfigError> = serde_json::from_str(&content).ok();
10864 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10865 }
10866}
10867
10868pub async fn repo_get_file_contents(configuration: &configuration::Configuration, owner: &str, repo: &str, body: &str, r#ref: Option<&str>) -> Result<Vec<models::ContentsResponse>, Error<RepoGetFileContentsError>> {
10870 let p_path_owner = owner;
10872 let p_path_repo = repo;
10873 let p_query_body = body;
10874 let p_query_ref = r#ref;
10875
10876 let uri_str = format!("{}/repos/{owner}/{repo}/file-contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
10877 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
10878
10879 if let Some(ref param_value) = p_query_ref {
10880 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
10881 }
10882 req_builder = req_builder.query(&[("body", &p_query_body.to_string())]);
10883 if let Some(ref apikey) = configuration.api_key {
10884 let key = apikey.key.clone();
10885 let value = match apikey.prefix {
10886 Some(ref prefix) => format!("{} {}", prefix, key),
10887 None => key,
10888 };
10889 req_builder = req_builder.query(&[("access_token", value)]);
10890 }
10891 if let Some(ref apikey) = configuration.api_key {
10892 let key = apikey.key.clone();
10893 let value = match apikey.prefix {
10894 Some(ref prefix) => format!("{} {}", prefix, key),
10895 None => key,
10896 };
10897 req_builder = req_builder.query(&[("sudo", value)]);
10898 }
10899 if let Some(ref apikey) = configuration.api_key {
10900 let key = apikey.key.clone();
10901 let value = match apikey.prefix {
10902 Some(ref prefix) => format!("{} {}", prefix, key),
10903 None => key,
10904 };
10905 req_builder = req_builder.query(&[("token", value)]);
10906 }
10907 if let Some(ref user_agent) = configuration.user_agent {
10908 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
10909 }
10910 if let Some(ref apikey) = configuration.api_key {
10911 let key = apikey.key.clone();
10912 let value = match apikey.prefix {
10913 Some(ref prefix) => format!("{} {}", prefix, key),
10914 None => key,
10915 };
10916 req_builder = req_builder.header("X-GITEA-OTP", value);
10917 };
10918 if let Some(ref apikey) = configuration.api_key {
10919 let key = apikey.key.clone();
10920 let value = match apikey.prefix {
10921 Some(ref prefix) => format!("{} {}", prefix, key),
10922 None => key,
10923 };
10924 req_builder = req_builder.header("Authorization", value);
10925 };
10926 if let Some(ref apikey) = configuration.api_key {
10927 let key = apikey.key.clone();
10928 let value = match apikey.prefix {
10929 Some(ref prefix) => format!("{} {}", prefix, key),
10930 None => key,
10931 };
10932 req_builder = req_builder.header("Sudo", value);
10933 };
10934 if let Some(ref auth_conf) = configuration.basic_auth {
10935 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
10936 };
10937
10938 let req = req_builder.build()?;
10939 let resp = configuration.client.execute(req).await?;
10940
10941 let status = resp.status();
10942 let content_type = resp
10943 .headers()
10944 .get("content-type")
10945 .and_then(|v| v.to_str().ok())
10946 .unwrap_or("application/octet-stream");
10947 let content_type = super::ContentType::from(content_type);
10948
10949 if !status.is_client_error() && !status.is_server_error() {
10950 let content = resp.text().await?;
10951 match content_type {
10952 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
10953 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ContentsResponse>`"))),
10954 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::ContentsResponse>`")))),
10955 }
10956 } else {
10957 let content = resp.text().await?;
10958 let entity: Option<RepoGetFileContentsError> = serde_json::from_str(&content).ok();
10959 Err(Error::ResponseError(ResponseContent { status, content, entity }))
10960 }
10961}
10962
10963pub async fn repo_get_file_contents_post(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::GetFilesOptions, r#ref: Option<&str>) -> Result<Vec<models::ContentsResponse>, Error<RepoGetFileContentsPostError>> {
10965 let p_path_owner = owner;
10967 let p_path_repo = repo;
10968 let p_body_body = body;
10969 let p_query_ref = r#ref;
10970
10971 let uri_str = format!("{}/repos/{owner}/{repo}/file-contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
10972 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
10973
10974 if let Some(ref param_value) = p_query_ref {
10975 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
10976 }
10977 if let Some(ref apikey) = configuration.api_key {
10978 let key = apikey.key.clone();
10979 let value = match apikey.prefix {
10980 Some(ref prefix) => format!("{} {}", prefix, key),
10981 None => key,
10982 };
10983 req_builder = req_builder.query(&[("access_token", value)]);
10984 }
10985 if let Some(ref apikey) = configuration.api_key {
10986 let key = apikey.key.clone();
10987 let value = match apikey.prefix {
10988 Some(ref prefix) => format!("{} {}", prefix, key),
10989 None => key,
10990 };
10991 req_builder = req_builder.query(&[("sudo", value)]);
10992 }
10993 if let Some(ref apikey) = configuration.api_key {
10994 let key = apikey.key.clone();
10995 let value = match apikey.prefix {
10996 Some(ref prefix) => format!("{} {}", prefix, key),
10997 None => key,
10998 };
10999 req_builder = req_builder.query(&[("token", value)]);
11000 }
11001 if let Some(ref user_agent) = configuration.user_agent {
11002 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11003 }
11004 if let Some(ref apikey) = configuration.api_key {
11005 let key = apikey.key.clone();
11006 let value = match apikey.prefix {
11007 Some(ref prefix) => format!("{} {}", prefix, key),
11008 None => key,
11009 };
11010 req_builder = req_builder.header("X-GITEA-OTP", value);
11011 };
11012 if let Some(ref apikey) = configuration.api_key {
11013 let key = apikey.key.clone();
11014 let value = match apikey.prefix {
11015 Some(ref prefix) => format!("{} {}", prefix, key),
11016 None => key,
11017 };
11018 req_builder = req_builder.header("Authorization", value);
11019 };
11020 if let Some(ref apikey) = configuration.api_key {
11021 let key = apikey.key.clone();
11022 let value = match apikey.prefix {
11023 Some(ref prefix) => format!("{} {}", prefix, key),
11024 None => key,
11025 };
11026 req_builder = req_builder.header("Sudo", value);
11027 };
11028 if let Some(ref auth_conf) = configuration.basic_auth {
11029 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11030 };
11031 req_builder = req_builder.json(&p_body_body);
11032
11033 let req = req_builder.build()?;
11034 let resp = configuration.client.execute(req).await?;
11035
11036 let status = resp.status();
11037 let content_type = resp
11038 .headers()
11039 .get("content-type")
11040 .and_then(|v| v.to_str().ok())
11041 .unwrap_or("application/octet-stream");
11042 let content_type = super::ContentType::from(content_type);
11043
11044 if !status.is_client_error() && !status.is_server_error() {
11045 let content = resp.text().await?;
11046 match content_type {
11047 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11048 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ContentsResponse>`"))),
11049 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::ContentsResponse>`")))),
11050 }
11051 } else {
11052 let content = resp.text().await?;
11053 let entity: Option<RepoGetFileContentsPostError> = serde_json::from_str(&content).ok();
11054 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11055 }
11056}
11057
11058pub async fn repo_get_git_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result<models::GitHook, Error<RepoGetGitHookError>> {
11059 let p_path_owner = owner;
11061 let p_path_repo = repo;
11062 let p_path_id = id;
11063
11064 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id));
11065 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11066
11067 if let Some(ref apikey) = configuration.api_key {
11068 let key = apikey.key.clone();
11069 let value = match apikey.prefix {
11070 Some(ref prefix) => format!("{} {}", prefix, key),
11071 None => key,
11072 };
11073 req_builder = req_builder.query(&[("access_token", value)]);
11074 }
11075 if let Some(ref apikey) = configuration.api_key {
11076 let key = apikey.key.clone();
11077 let value = match apikey.prefix {
11078 Some(ref prefix) => format!("{} {}", prefix, key),
11079 None => key,
11080 };
11081 req_builder = req_builder.query(&[("sudo", value)]);
11082 }
11083 if let Some(ref apikey) = configuration.api_key {
11084 let key = apikey.key.clone();
11085 let value = match apikey.prefix {
11086 Some(ref prefix) => format!("{} {}", prefix, key),
11087 None => key,
11088 };
11089 req_builder = req_builder.query(&[("token", value)]);
11090 }
11091 if let Some(ref user_agent) = configuration.user_agent {
11092 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11093 }
11094 if let Some(ref apikey) = configuration.api_key {
11095 let key = apikey.key.clone();
11096 let value = match apikey.prefix {
11097 Some(ref prefix) => format!("{} {}", prefix, key),
11098 None => key,
11099 };
11100 req_builder = req_builder.header("X-GITEA-OTP", value);
11101 };
11102 if let Some(ref apikey) = configuration.api_key {
11103 let key = apikey.key.clone();
11104 let value = match apikey.prefix {
11105 Some(ref prefix) => format!("{} {}", prefix, key),
11106 None => key,
11107 };
11108 req_builder = req_builder.header("Authorization", value);
11109 };
11110 if let Some(ref apikey) = configuration.api_key {
11111 let key = apikey.key.clone();
11112 let value = match apikey.prefix {
11113 Some(ref prefix) => format!("{} {}", prefix, key),
11114 None => key,
11115 };
11116 req_builder = req_builder.header("Sudo", value);
11117 };
11118 if let Some(ref auth_conf) = configuration.basic_auth {
11119 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11120 };
11121
11122 let req = req_builder.build()?;
11123 let resp = configuration.client.execute(req).await?;
11124
11125 let status = resp.status();
11126 let content_type = resp
11127 .headers()
11128 .get("content-type")
11129 .and_then(|v| v.to_str().ok())
11130 .unwrap_or("application/octet-stream");
11131 let content_type = super::ContentType::from(content_type);
11132
11133 if !status.is_client_error() && !status.is_server_error() {
11134 let content = resp.text().await?;
11135 match content_type {
11136 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11137 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitHook`"))),
11138 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::GitHook`")))),
11139 }
11140 } else {
11141 let content = resp.text().await?;
11142 let entity: Option<RepoGetGitHookError> = serde_json::from_str(&content).ok();
11143 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11144 }
11145}
11146
11147pub async fn repo_get_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<models::Hook, Error<RepoGetHookError>> {
11148 let p_path_owner = owner;
11150 let p_path_repo = repo;
11151 let p_path_id = id;
11152
11153 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
11154 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11155
11156 if let Some(ref apikey) = configuration.api_key {
11157 let key = apikey.key.clone();
11158 let value = match apikey.prefix {
11159 Some(ref prefix) => format!("{} {}", prefix, key),
11160 None => key,
11161 };
11162 req_builder = req_builder.query(&[("access_token", value)]);
11163 }
11164 if let Some(ref apikey) = configuration.api_key {
11165 let key = apikey.key.clone();
11166 let value = match apikey.prefix {
11167 Some(ref prefix) => format!("{} {}", prefix, key),
11168 None => key,
11169 };
11170 req_builder = req_builder.query(&[("sudo", value)]);
11171 }
11172 if let Some(ref apikey) = configuration.api_key {
11173 let key = apikey.key.clone();
11174 let value = match apikey.prefix {
11175 Some(ref prefix) => format!("{} {}", prefix, key),
11176 None => key,
11177 };
11178 req_builder = req_builder.query(&[("token", value)]);
11179 }
11180 if let Some(ref user_agent) = configuration.user_agent {
11181 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11182 }
11183 if let Some(ref apikey) = configuration.api_key {
11184 let key = apikey.key.clone();
11185 let value = match apikey.prefix {
11186 Some(ref prefix) => format!("{} {}", prefix, key),
11187 None => key,
11188 };
11189 req_builder = req_builder.header("X-GITEA-OTP", value);
11190 };
11191 if let Some(ref apikey) = configuration.api_key {
11192 let key = apikey.key.clone();
11193 let value = match apikey.prefix {
11194 Some(ref prefix) => format!("{} {}", prefix, key),
11195 None => key,
11196 };
11197 req_builder = req_builder.header("Authorization", value);
11198 };
11199 if let Some(ref apikey) = configuration.api_key {
11200 let key = apikey.key.clone();
11201 let value = match apikey.prefix {
11202 Some(ref prefix) => format!("{} {}", prefix, key),
11203 None => key,
11204 };
11205 req_builder = req_builder.header("Sudo", value);
11206 };
11207 if let Some(ref auth_conf) = configuration.basic_auth {
11208 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11209 };
11210
11211 let req = req_builder.build()?;
11212 let resp = configuration.client.execute(req).await?;
11213
11214 let status = resp.status();
11215 let content_type = resp
11216 .headers()
11217 .get("content-type")
11218 .and_then(|v| v.to_str().ok())
11219 .unwrap_or("application/octet-stream");
11220 let content_type = super::ContentType::from(content_type);
11221
11222 if !status.is_client_error() && !status.is_server_error() {
11223 let content = resp.text().await?;
11224 match content_type {
11225 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11226 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))),
11227 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`")))),
11228 }
11229 } else {
11230 let content = resp.text().await?;
11231 let entity: Option<RepoGetHookError> = serde_json::from_str(&content).ok();
11232 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11233 }
11234}
11235
11236pub async fn repo_get_issue_config(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::IssueConfig, Error<RepoGetIssueConfigError>> {
11237 let p_path_owner = owner;
11239 let p_path_repo = repo;
11240
11241 let uri_str = format!("{}/repos/{owner}/{repo}/issue_config", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
11242 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11243
11244 if let Some(ref apikey) = configuration.api_key {
11245 let key = apikey.key.clone();
11246 let value = match apikey.prefix {
11247 Some(ref prefix) => format!("{} {}", prefix, key),
11248 None => key,
11249 };
11250 req_builder = req_builder.query(&[("access_token", value)]);
11251 }
11252 if let Some(ref apikey) = configuration.api_key {
11253 let key = apikey.key.clone();
11254 let value = match apikey.prefix {
11255 Some(ref prefix) => format!("{} {}", prefix, key),
11256 None => key,
11257 };
11258 req_builder = req_builder.query(&[("sudo", value)]);
11259 }
11260 if let Some(ref apikey) = configuration.api_key {
11261 let key = apikey.key.clone();
11262 let value = match apikey.prefix {
11263 Some(ref prefix) => format!("{} {}", prefix, key),
11264 None => key,
11265 };
11266 req_builder = req_builder.query(&[("token", value)]);
11267 }
11268 if let Some(ref user_agent) = configuration.user_agent {
11269 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11270 }
11271 if let Some(ref apikey) = configuration.api_key {
11272 let key = apikey.key.clone();
11273 let value = match apikey.prefix {
11274 Some(ref prefix) => format!("{} {}", prefix, key),
11275 None => key,
11276 };
11277 req_builder = req_builder.header("X-GITEA-OTP", value);
11278 };
11279 if let Some(ref apikey) = configuration.api_key {
11280 let key = apikey.key.clone();
11281 let value = match apikey.prefix {
11282 Some(ref prefix) => format!("{} {}", prefix, key),
11283 None => key,
11284 };
11285 req_builder = req_builder.header("Authorization", value);
11286 };
11287 if let Some(ref apikey) = configuration.api_key {
11288 let key = apikey.key.clone();
11289 let value = match apikey.prefix {
11290 Some(ref prefix) => format!("{} {}", prefix, key),
11291 None => key,
11292 };
11293 req_builder = req_builder.header("Sudo", value);
11294 };
11295 if let Some(ref auth_conf) = configuration.basic_auth {
11296 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11297 };
11298
11299 let req = req_builder.build()?;
11300 let resp = configuration.client.execute(req).await?;
11301
11302 let status = resp.status();
11303 let content_type = resp
11304 .headers()
11305 .get("content-type")
11306 .and_then(|v| v.to_str().ok())
11307 .unwrap_or("application/octet-stream");
11308 let content_type = super::ContentType::from(content_type);
11309
11310 if !status.is_client_error() && !status.is_server_error() {
11311 let content = resp.text().await?;
11312 match content_type {
11313 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11314 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueConfig`"))),
11315 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::IssueConfig`")))),
11316 }
11317 } else {
11318 let content = resp.text().await?;
11319 let entity: Option<RepoGetIssueConfigError> = serde_json::from_str(&content).ok();
11320 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11321 }
11322}
11323
11324pub async fn repo_get_issue_templates(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::IssueTemplate>, Error<RepoGetIssueTemplatesError>> {
11325 let p_path_owner = owner;
11327 let p_path_repo = repo;
11328
11329 let uri_str = format!("{}/repos/{owner}/{repo}/issue_templates", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
11330 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11331
11332 if let Some(ref apikey) = configuration.api_key {
11333 let key = apikey.key.clone();
11334 let value = match apikey.prefix {
11335 Some(ref prefix) => format!("{} {}", prefix, key),
11336 None => key,
11337 };
11338 req_builder = req_builder.query(&[("access_token", value)]);
11339 }
11340 if let Some(ref apikey) = configuration.api_key {
11341 let key = apikey.key.clone();
11342 let value = match apikey.prefix {
11343 Some(ref prefix) => format!("{} {}", prefix, key),
11344 None => key,
11345 };
11346 req_builder = req_builder.query(&[("sudo", value)]);
11347 }
11348 if let Some(ref apikey) = configuration.api_key {
11349 let key = apikey.key.clone();
11350 let value = match apikey.prefix {
11351 Some(ref prefix) => format!("{} {}", prefix, key),
11352 None => key,
11353 };
11354 req_builder = req_builder.query(&[("token", value)]);
11355 }
11356 if let Some(ref user_agent) = configuration.user_agent {
11357 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11358 }
11359 if let Some(ref apikey) = configuration.api_key {
11360 let key = apikey.key.clone();
11361 let value = match apikey.prefix {
11362 Some(ref prefix) => format!("{} {}", prefix, key),
11363 None => key,
11364 };
11365 req_builder = req_builder.header("X-GITEA-OTP", value);
11366 };
11367 if let Some(ref apikey) = configuration.api_key {
11368 let key = apikey.key.clone();
11369 let value = match apikey.prefix {
11370 Some(ref prefix) => format!("{} {}", prefix, key),
11371 None => key,
11372 };
11373 req_builder = req_builder.header("Authorization", value);
11374 };
11375 if let Some(ref apikey) = configuration.api_key {
11376 let key = apikey.key.clone();
11377 let value = match apikey.prefix {
11378 Some(ref prefix) => format!("{} {}", prefix, key),
11379 None => key,
11380 };
11381 req_builder = req_builder.header("Sudo", value);
11382 };
11383 if let Some(ref auth_conf) = configuration.basic_auth {
11384 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11385 };
11386
11387 let req = req_builder.build()?;
11388 let resp = configuration.client.execute(req).await?;
11389
11390 let status = resp.status();
11391 let content_type = resp
11392 .headers()
11393 .get("content-type")
11394 .and_then(|v| v.to_str().ok())
11395 .unwrap_or("application/octet-stream");
11396 let content_type = super::ContentType::from(content_type);
11397
11398 if !status.is_client_error() && !status.is_server_error() {
11399 let content = resp.text().await?;
11400 match content_type {
11401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IssueTemplate>`"))),
11403 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::IssueTemplate>`")))),
11404 }
11405 } else {
11406 let content = resp.text().await?;
11407 let entity: Option<RepoGetIssueTemplatesError> = serde_json::from_str(&content).ok();
11408 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11409 }
11410}
11411
11412pub async fn repo_get_key(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<models::DeployKey, Error<RepoGetKeyError>> {
11413 let p_path_owner = owner;
11415 let p_path_repo = repo;
11416 let p_path_id = id;
11417
11418 let uri_str = format!("{}/repos/{owner}/{repo}/keys/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
11419 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11420
11421 if let Some(ref apikey) = configuration.api_key {
11422 let key = apikey.key.clone();
11423 let value = match apikey.prefix {
11424 Some(ref prefix) => format!("{} {}", prefix, key),
11425 None => key,
11426 };
11427 req_builder = req_builder.query(&[("access_token", value)]);
11428 }
11429 if let Some(ref apikey) = configuration.api_key {
11430 let key = apikey.key.clone();
11431 let value = match apikey.prefix {
11432 Some(ref prefix) => format!("{} {}", prefix, key),
11433 None => key,
11434 };
11435 req_builder = req_builder.query(&[("sudo", value)]);
11436 }
11437 if let Some(ref apikey) = configuration.api_key {
11438 let key = apikey.key.clone();
11439 let value = match apikey.prefix {
11440 Some(ref prefix) => format!("{} {}", prefix, key),
11441 None => key,
11442 };
11443 req_builder = req_builder.query(&[("token", value)]);
11444 }
11445 if let Some(ref user_agent) = configuration.user_agent {
11446 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11447 }
11448 if let Some(ref apikey) = configuration.api_key {
11449 let key = apikey.key.clone();
11450 let value = match apikey.prefix {
11451 Some(ref prefix) => format!("{} {}", prefix, key),
11452 None => key,
11453 };
11454 req_builder = req_builder.header("X-GITEA-OTP", value);
11455 };
11456 if let Some(ref apikey) = configuration.api_key {
11457 let key = apikey.key.clone();
11458 let value = match apikey.prefix {
11459 Some(ref prefix) => format!("{} {}", prefix, key),
11460 None => key,
11461 };
11462 req_builder = req_builder.header("Authorization", value);
11463 };
11464 if let Some(ref apikey) = configuration.api_key {
11465 let key = apikey.key.clone();
11466 let value = match apikey.prefix {
11467 Some(ref prefix) => format!("{} {}", prefix, key),
11468 None => key,
11469 };
11470 req_builder = req_builder.header("Sudo", value);
11471 };
11472 if let Some(ref auth_conf) = configuration.basic_auth {
11473 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11474 };
11475
11476 let req = req_builder.build()?;
11477 let resp = configuration.client.execute(req).await?;
11478
11479 let status = resp.status();
11480 let content_type = resp
11481 .headers()
11482 .get("content-type")
11483 .and_then(|v| v.to_str().ok())
11484 .unwrap_or("application/octet-stream");
11485 let content_type = super::ContentType::from(content_type);
11486
11487 if !status.is_client_error() && !status.is_server_error() {
11488 let content = resp.text().await?;
11489 match content_type {
11490 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11491 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployKey`"))),
11492 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::DeployKey`")))),
11493 }
11494 } else {
11495 let content = resp.text().await?;
11496 let entity: Option<RepoGetKeyError> = serde_json::from_str(&content).ok();
11497 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11498 }
11499}
11500
11501pub async fn repo_get_languages(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, i64>, Error<RepoGetLanguagesError>> {
11502 let p_path_owner = owner;
11504 let p_path_repo = repo;
11505
11506 let uri_str = format!("{}/repos/{owner}/{repo}/languages", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
11507 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11508
11509 if let Some(ref apikey) = configuration.api_key {
11510 let key = apikey.key.clone();
11511 let value = match apikey.prefix {
11512 Some(ref prefix) => format!("{} {}", prefix, key),
11513 None => key,
11514 };
11515 req_builder = req_builder.query(&[("access_token", value)]);
11516 }
11517 if let Some(ref apikey) = configuration.api_key {
11518 let key = apikey.key.clone();
11519 let value = match apikey.prefix {
11520 Some(ref prefix) => format!("{} {}", prefix, key),
11521 None => key,
11522 };
11523 req_builder = req_builder.query(&[("sudo", value)]);
11524 }
11525 if let Some(ref apikey) = configuration.api_key {
11526 let key = apikey.key.clone();
11527 let value = match apikey.prefix {
11528 Some(ref prefix) => format!("{} {}", prefix, key),
11529 None => key,
11530 };
11531 req_builder = req_builder.query(&[("token", value)]);
11532 }
11533 if let Some(ref user_agent) = configuration.user_agent {
11534 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11535 }
11536 if let Some(ref apikey) = configuration.api_key {
11537 let key = apikey.key.clone();
11538 let value = match apikey.prefix {
11539 Some(ref prefix) => format!("{} {}", prefix, key),
11540 None => key,
11541 };
11542 req_builder = req_builder.header("X-GITEA-OTP", value);
11543 };
11544 if let Some(ref apikey) = configuration.api_key {
11545 let key = apikey.key.clone();
11546 let value = match apikey.prefix {
11547 Some(ref prefix) => format!("{} {}", prefix, key),
11548 None => key,
11549 };
11550 req_builder = req_builder.header("Authorization", value);
11551 };
11552 if let Some(ref apikey) = configuration.api_key {
11553 let key = apikey.key.clone();
11554 let value = match apikey.prefix {
11555 Some(ref prefix) => format!("{} {}", prefix, key),
11556 None => key,
11557 };
11558 req_builder = req_builder.header("Sudo", value);
11559 };
11560 if let Some(ref auth_conf) = configuration.basic_auth {
11561 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11562 };
11563
11564 let req = req_builder.build()?;
11565 let resp = configuration.client.execute(req).await?;
11566
11567 let status = resp.status();
11568 let content_type = resp
11569 .headers()
11570 .get("content-type")
11571 .and_then(|v| v.to_str().ok())
11572 .unwrap_or("application/octet-stream");
11573 let content_type = super::ContentType::from(content_type);
11574
11575 if !status.is_client_error() && !status.is_server_error() {
11576 let content = resp.text().await?;
11577 match content_type {
11578 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11579 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, i64>`"))),
11580 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, i64>`")))),
11581 }
11582 } else {
11583 let content = resp.text().await?;
11584 let entity: Option<RepoGetLanguagesError> = serde_json::from_str(&content).ok();
11585 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11586 }
11587}
11588
11589pub async fn repo_get_latest_release(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::Release, Error<RepoGetLatestReleaseError>> {
11590 let p_path_owner = owner;
11592 let p_path_repo = repo;
11593
11594 let uri_str = format!("{}/repos/{owner}/{repo}/releases/latest", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
11595 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11596
11597 if let Some(ref apikey) = configuration.api_key {
11598 let key = apikey.key.clone();
11599 let value = match apikey.prefix {
11600 Some(ref prefix) => format!("{} {}", prefix, key),
11601 None => key,
11602 };
11603 req_builder = req_builder.query(&[("access_token", value)]);
11604 }
11605 if let Some(ref apikey) = configuration.api_key {
11606 let key = apikey.key.clone();
11607 let value = match apikey.prefix {
11608 Some(ref prefix) => format!("{} {}", prefix, key),
11609 None => key,
11610 };
11611 req_builder = req_builder.query(&[("sudo", value)]);
11612 }
11613 if let Some(ref apikey) = configuration.api_key {
11614 let key = apikey.key.clone();
11615 let value = match apikey.prefix {
11616 Some(ref prefix) => format!("{} {}", prefix, key),
11617 None => key,
11618 };
11619 req_builder = req_builder.query(&[("token", value)]);
11620 }
11621 if let Some(ref user_agent) = configuration.user_agent {
11622 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11623 }
11624 if let Some(ref apikey) = configuration.api_key {
11625 let key = apikey.key.clone();
11626 let value = match apikey.prefix {
11627 Some(ref prefix) => format!("{} {}", prefix, key),
11628 None => key,
11629 };
11630 req_builder = req_builder.header("X-GITEA-OTP", value);
11631 };
11632 if let Some(ref apikey) = configuration.api_key {
11633 let key = apikey.key.clone();
11634 let value = match apikey.prefix {
11635 Some(ref prefix) => format!("{} {}", prefix, key),
11636 None => key,
11637 };
11638 req_builder = req_builder.header("Authorization", value);
11639 };
11640 if let Some(ref apikey) = configuration.api_key {
11641 let key = apikey.key.clone();
11642 let value = match apikey.prefix {
11643 Some(ref prefix) => format!("{} {}", prefix, key),
11644 None => key,
11645 };
11646 req_builder = req_builder.header("Sudo", value);
11647 };
11648 if let Some(ref auth_conf) = configuration.basic_auth {
11649 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11650 };
11651
11652 let req = req_builder.build()?;
11653 let resp = configuration.client.execute(req).await?;
11654
11655 let status = resp.status();
11656 let content_type = resp
11657 .headers()
11658 .get("content-type")
11659 .and_then(|v| v.to_str().ok())
11660 .unwrap_or("application/octet-stream");
11661 let content_type = super::ContentType::from(content_type);
11662
11663 if !status.is_client_error() && !status.is_server_error() {
11664 let content = resp.text().await?;
11665 match content_type {
11666 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11667 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))),
11668 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::Release`")))),
11669 }
11670 } else {
11671 let content = resp.text().await?;
11672 let entity: Option<RepoGetLatestReleaseError> = serde_json::from_str(&content).ok();
11673 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11674 }
11675}
11676
11677pub async fn repo_get_licenses(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<String>, Error<RepoGetLicensesError>> {
11678 let p_path_owner = owner;
11680 let p_path_repo = repo;
11681
11682 let uri_str = format!("{}/repos/{owner}/{repo}/licenses", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
11683 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11684
11685 if let Some(ref apikey) = configuration.api_key {
11686 let key = apikey.key.clone();
11687 let value = match apikey.prefix {
11688 Some(ref prefix) => format!("{} {}", prefix, key),
11689 None => key,
11690 };
11691 req_builder = req_builder.query(&[("access_token", value)]);
11692 }
11693 if let Some(ref apikey) = configuration.api_key {
11694 let key = apikey.key.clone();
11695 let value = match apikey.prefix {
11696 Some(ref prefix) => format!("{} {}", prefix, key),
11697 None => key,
11698 };
11699 req_builder = req_builder.query(&[("sudo", value)]);
11700 }
11701 if let Some(ref apikey) = configuration.api_key {
11702 let key = apikey.key.clone();
11703 let value = match apikey.prefix {
11704 Some(ref prefix) => format!("{} {}", prefix, key),
11705 None => key,
11706 };
11707 req_builder = req_builder.query(&[("token", value)]);
11708 }
11709 if let Some(ref user_agent) = configuration.user_agent {
11710 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11711 }
11712 if let Some(ref apikey) = configuration.api_key {
11713 let key = apikey.key.clone();
11714 let value = match apikey.prefix {
11715 Some(ref prefix) => format!("{} {}", prefix, key),
11716 None => key,
11717 };
11718 req_builder = req_builder.header("X-GITEA-OTP", value);
11719 };
11720 if let Some(ref apikey) = configuration.api_key {
11721 let key = apikey.key.clone();
11722 let value = match apikey.prefix {
11723 Some(ref prefix) => format!("{} {}", prefix, key),
11724 None => key,
11725 };
11726 req_builder = req_builder.header("Authorization", value);
11727 };
11728 if let Some(ref apikey) = configuration.api_key {
11729 let key = apikey.key.clone();
11730 let value = match apikey.prefix {
11731 Some(ref prefix) => format!("{} {}", prefix, key),
11732 None => key,
11733 };
11734 req_builder = req_builder.header("Sudo", value);
11735 };
11736 if let Some(ref auth_conf) = configuration.basic_auth {
11737 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11738 };
11739
11740 let req = req_builder.build()?;
11741 let resp = configuration.client.execute(req).await?;
11742
11743 let status = resp.status();
11744 let content_type = resp
11745 .headers()
11746 .get("content-type")
11747 .and_then(|v| v.to_str().ok())
11748 .unwrap_or("application/octet-stream");
11749 let content_type = super::ContentType::from(content_type);
11750
11751 if !status.is_client_error() && !status.is_server_error() {
11752 let content = resp.text().await?;
11753 match content_type {
11754 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11755 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
11756 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<String>`")))),
11757 }
11758 } else {
11759 let content = resp.text().await?;
11760 let entity: Option<RepoGetLicensesError> = serde_json::from_str(&content).ok();
11761 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11762 }
11763}
11764
11765pub async fn repo_get_note(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, verification: Option<bool>, files: Option<bool>) -> Result<models::Note, Error<RepoGetNoteError>> {
11766 let p_path_owner = owner;
11768 let p_path_repo = repo;
11769 let p_path_sha = sha;
11770 let p_query_verification = verification;
11771 let p_query_files = files;
11772
11773 let uri_str = format!("{}/repos/{owner}/{repo}/git/notes/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
11774 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11775
11776 if let Some(ref param_value) = p_query_verification {
11777 req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]);
11778 }
11779 if let Some(ref param_value) = p_query_files {
11780 req_builder = req_builder.query(&[("files", ¶m_value.to_string())]);
11781 }
11782 if let Some(ref apikey) = configuration.api_key {
11783 let key = apikey.key.clone();
11784 let value = match apikey.prefix {
11785 Some(ref prefix) => format!("{} {}", prefix, key),
11786 None => key,
11787 };
11788 req_builder = req_builder.query(&[("access_token", value)]);
11789 }
11790 if let Some(ref apikey) = configuration.api_key {
11791 let key = apikey.key.clone();
11792 let value = match apikey.prefix {
11793 Some(ref prefix) => format!("{} {}", prefix, key),
11794 None => key,
11795 };
11796 req_builder = req_builder.query(&[("sudo", value)]);
11797 }
11798 if let Some(ref apikey) = configuration.api_key {
11799 let key = apikey.key.clone();
11800 let value = match apikey.prefix {
11801 Some(ref prefix) => format!("{} {}", prefix, key),
11802 None => key,
11803 };
11804 req_builder = req_builder.query(&[("token", value)]);
11805 }
11806 if let Some(ref user_agent) = configuration.user_agent {
11807 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11808 }
11809 if let Some(ref apikey) = configuration.api_key {
11810 let key = apikey.key.clone();
11811 let value = match apikey.prefix {
11812 Some(ref prefix) => format!("{} {}", prefix, key),
11813 None => key,
11814 };
11815 req_builder = req_builder.header("X-GITEA-OTP", value);
11816 };
11817 if let Some(ref apikey) = configuration.api_key {
11818 let key = apikey.key.clone();
11819 let value = match apikey.prefix {
11820 Some(ref prefix) => format!("{} {}", prefix, key),
11821 None => key,
11822 };
11823 req_builder = req_builder.header("Authorization", value);
11824 };
11825 if let Some(ref apikey) = configuration.api_key {
11826 let key = apikey.key.clone();
11827 let value = match apikey.prefix {
11828 Some(ref prefix) => format!("{} {}", prefix, key),
11829 None => key,
11830 };
11831 req_builder = req_builder.header("Sudo", value);
11832 };
11833 if let Some(ref auth_conf) = configuration.basic_auth {
11834 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11835 };
11836
11837 let req = req_builder.build()?;
11838 let resp = configuration.client.execute(req).await?;
11839
11840 let status = resp.status();
11841 let content_type = resp
11842 .headers()
11843 .get("content-type")
11844 .and_then(|v| v.to_str().ok())
11845 .unwrap_or("application/octet-stream");
11846 let content_type = super::ContentType::from(content_type);
11847
11848 if !status.is_client_error() && !status.is_server_error() {
11849 let content = resp.text().await?;
11850 match content_type {
11851 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11852 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Note`"))),
11853 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::Note`")))),
11854 }
11855 } else {
11856 let content = resp.text().await?;
11857 let entity: Option<RepoGetNoteError> = serde_json::from_str(&content).ok();
11858 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11859 }
11860}
11861
11862pub async fn repo_get_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<models::PullRequest, Error<RepoGetPullRequestError>> {
11863 let p_path_owner = owner;
11865 let p_path_repo = repo;
11866 let p_path_index = index;
11867
11868 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
11869 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11870
11871 if let Some(ref apikey) = configuration.api_key {
11872 let key = apikey.key.clone();
11873 let value = match apikey.prefix {
11874 Some(ref prefix) => format!("{} {}", prefix, key),
11875 None => key,
11876 };
11877 req_builder = req_builder.query(&[("access_token", value)]);
11878 }
11879 if let Some(ref apikey) = configuration.api_key {
11880 let key = apikey.key.clone();
11881 let value = match apikey.prefix {
11882 Some(ref prefix) => format!("{} {}", prefix, key),
11883 None => key,
11884 };
11885 req_builder = req_builder.query(&[("sudo", value)]);
11886 }
11887 if let Some(ref apikey) = configuration.api_key {
11888 let key = apikey.key.clone();
11889 let value = match apikey.prefix {
11890 Some(ref prefix) => format!("{} {}", prefix, key),
11891 None => key,
11892 };
11893 req_builder = req_builder.query(&[("token", value)]);
11894 }
11895 if let Some(ref user_agent) = configuration.user_agent {
11896 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11897 }
11898 if let Some(ref apikey) = configuration.api_key {
11899 let key = apikey.key.clone();
11900 let value = match apikey.prefix {
11901 Some(ref prefix) => format!("{} {}", prefix, key),
11902 None => key,
11903 };
11904 req_builder = req_builder.header("X-GITEA-OTP", value);
11905 };
11906 if let Some(ref apikey) = configuration.api_key {
11907 let key = apikey.key.clone();
11908 let value = match apikey.prefix {
11909 Some(ref prefix) => format!("{} {}", prefix, key),
11910 None => key,
11911 };
11912 req_builder = req_builder.header("Authorization", value);
11913 };
11914 if let Some(ref apikey) = configuration.api_key {
11915 let key = apikey.key.clone();
11916 let value = match apikey.prefix {
11917 Some(ref prefix) => format!("{} {}", prefix, key),
11918 None => key,
11919 };
11920 req_builder = req_builder.header("Sudo", value);
11921 };
11922 if let Some(ref auth_conf) = configuration.basic_auth {
11923 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
11924 };
11925
11926 let req = req_builder.build()?;
11927 let resp = configuration.client.execute(req).await?;
11928
11929 let status = resp.status();
11930 let content_type = resp
11931 .headers()
11932 .get("content-type")
11933 .and_then(|v| v.to_str().ok())
11934 .unwrap_or("application/octet-stream");
11935 let content_type = super::ContentType::from(content_type);
11936
11937 if !status.is_client_error() && !status.is_server_error() {
11938 let content = resp.text().await?;
11939 match content_type {
11940 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
11941 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))),
11942 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::PullRequest`")))),
11943 }
11944 } else {
11945 let content = resp.text().await?;
11946 let entity: Option<RepoGetPullRequestError> = serde_json::from_str(&content).ok();
11947 Err(Error::ResponseError(ResponseContent { status, content, entity }))
11948 }
11949}
11950
11951pub async fn repo_get_pull_request_by_base_head(configuration: &configuration::Configuration, owner: &str, repo: &str, base: &str, head: &str) -> Result<models::PullRequest, Error<RepoGetPullRequestByBaseHeadError>> {
11952 let p_path_owner = owner;
11954 let p_path_repo = repo;
11955 let p_path_base = base;
11956 let p_path_head = head;
11957
11958 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{base}/{head}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), base=crate::apis::urlencode(p_path_base), head=crate::apis::urlencode(p_path_head));
11959 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
11960
11961 if let Some(ref apikey) = configuration.api_key {
11962 let key = apikey.key.clone();
11963 let value = match apikey.prefix {
11964 Some(ref prefix) => format!("{} {}", prefix, key),
11965 None => key,
11966 };
11967 req_builder = req_builder.query(&[("access_token", value)]);
11968 }
11969 if let Some(ref apikey) = configuration.api_key {
11970 let key = apikey.key.clone();
11971 let value = match apikey.prefix {
11972 Some(ref prefix) => format!("{} {}", prefix, key),
11973 None => key,
11974 };
11975 req_builder = req_builder.query(&[("sudo", value)]);
11976 }
11977 if let Some(ref apikey) = configuration.api_key {
11978 let key = apikey.key.clone();
11979 let value = match apikey.prefix {
11980 Some(ref prefix) => format!("{} {}", prefix, key),
11981 None => key,
11982 };
11983 req_builder = req_builder.query(&[("token", value)]);
11984 }
11985 if let Some(ref user_agent) = configuration.user_agent {
11986 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
11987 }
11988 if let Some(ref apikey) = configuration.api_key {
11989 let key = apikey.key.clone();
11990 let value = match apikey.prefix {
11991 Some(ref prefix) => format!("{} {}", prefix, key),
11992 None => key,
11993 };
11994 req_builder = req_builder.header("X-GITEA-OTP", value);
11995 };
11996 if let Some(ref apikey) = configuration.api_key {
11997 let key = apikey.key.clone();
11998 let value = match apikey.prefix {
11999 Some(ref prefix) => format!("{} {}", prefix, key),
12000 None => key,
12001 };
12002 req_builder = req_builder.header("Authorization", value);
12003 };
12004 if let Some(ref apikey) = configuration.api_key {
12005 let key = apikey.key.clone();
12006 let value = match apikey.prefix {
12007 Some(ref prefix) => format!("{} {}", prefix, key),
12008 None => key,
12009 };
12010 req_builder = req_builder.header("Sudo", value);
12011 };
12012 if let Some(ref auth_conf) = configuration.basic_auth {
12013 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12014 };
12015
12016 let req = req_builder.build()?;
12017 let resp = configuration.client.execute(req).await?;
12018
12019 let status = resp.status();
12020 let content_type = resp
12021 .headers()
12022 .get("content-type")
12023 .and_then(|v| v.to_str().ok())
12024 .unwrap_or("application/octet-stream");
12025 let content_type = super::ContentType::from(content_type);
12026
12027 if !status.is_client_error() && !status.is_server_error() {
12028 let content = resp.text().await?;
12029 match content_type {
12030 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12031 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))),
12032 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::PullRequest`")))),
12033 }
12034 } else {
12035 let content = resp.text().await?;
12036 let entity: Option<RepoGetPullRequestByBaseHeadError> = serde_json::from_str(&content).ok();
12037 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12038 }
12039}
12040
12041pub async fn repo_get_pull_request_commits(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option<i32>, limit: Option<i32>, verification: Option<bool>, files: Option<bool>) -> Result<Vec<models::Commit>, Error<RepoGetPullRequestCommitsError>> {
12042 let p_path_owner = owner;
12044 let p_path_repo = repo;
12045 let p_path_index = index;
12046 let p_query_page = page;
12047 let p_query_limit = limit;
12048 let p_query_verification = verification;
12049 let p_query_files = files;
12050
12051 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/commits", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
12052 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12053
12054 if let Some(ref param_value) = p_query_page {
12055 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
12056 }
12057 if let Some(ref param_value) = p_query_limit {
12058 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
12059 }
12060 if let Some(ref param_value) = p_query_verification {
12061 req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]);
12062 }
12063 if let Some(ref param_value) = p_query_files {
12064 req_builder = req_builder.query(&[("files", ¶m_value.to_string())]);
12065 }
12066 if let Some(ref apikey) = configuration.api_key {
12067 let key = apikey.key.clone();
12068 let value = match apikey.prefix {
12069 Some(ref prefix) => format!("{} {}", prefix, key),
12070 None => key,
12071 };
12072 req_builder = req_builder.query(&[("access_token", value)]);
12073 }
12074 if let Some(ref apikey) = configuration.api_key {
12075 let key = apikey.key.clone();
12076 let value = match apikey.prefix {
12077 Some(ref prefix) => format!("{} {}", prefix, key),
12078 None => key,
12079 };
12080 req_builder = req_builder.query(&[("sudo", value)]);
12081 }
12082 if let Some(ref apikey) = configuration.api_key {
12083 let key = apikey.key.clone();
12084 let value = match apikey.prefix {
12085 Some(ref prefix) => format!("{} {}", prefix, key),
12086 None => key,
12087 };
12088 req_builder = req_builder.query(&[("token", value)]);
12089 }
12090 if let Some(ref user_agent) = configuration.user_agent {
12091 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12092 }
12093 if let Some(ref apikey) = configuration.api_key {
12094 let key = apikey.key.clone();
12095 let value = match apikey.prefix {
12096 Some(ref prefix) => format!("{} {}", prefix, key),
12097 None => key,
12098 };
12099 req_builder = req_builder.header("X-GITEA-OTP", value);
12100 };
12101 if let Some(ref apikey) = configuration.api_key {
12102 let key = apikey.key.clone();
12103 let value = match apikey.prefix {
12104 Some(ref prefix) => format!("{} {}", prefix, key),
12105 None => key,
12106 };
12107 req_builder = req_builder.header("Authorization", value);
12108 };
12109 if let Some(ref apikey) = configuration.api_key {
12110 let key = apikey.key.clone();
12111 let value = match apikey.prefix {
12112 Some(ref prefix) => format!("{} {}", prefix, key),
12113 None => key,
12114 };
12115 req_builder = req_builder.header("Sudo", value);
12116 };
12117 if let Some(ref auth_conf) = configuration.basic_auth {
12118 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12119 };
12120
12121 let req = req_builder.build()?;
12122 let resp = configuration.client.execute(req).await?;
12123
12124 let status = resp.status();
12125 let content_type = resp
12126 .headers()
12127 .get("content-type")
12128 .and_then(|v| v.to_str().ok())
12129 .unwrap_or("application/octet-stream");
12130 let content_type = super::ContentType::from(content_type);
12131
12132 if !status.is_client_error() && !status.is_server_error() {
12133 let content = resp.text().await?;
12134 match content_type {
12135 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12136 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Commit>`"))),
12137 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::Commit>`")))),
12138 }
12139 } else {
12140 let content = resp.text().await?;
12141 let entity: Option<RepoGetPullRequestCommitsError> = serde_json::from_str(&content).ok();
12142 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12143 }
12144}
12145
12146pub async fn repo_get_pull_request_files(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, skip_to: Option<&str>, whitespace: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::ChangedFile>, Error<RepoGetPullRequestFilesError>> {
12147 let p_path_owner = owner;
12149 let p_path_repo = repo;
12150 let p_path_index = index;
12151 let p_query_skip_to = skip_to;
12152 let p_query_whitespace = whitespace;
12153 let p_query_page = page;
12154 let p_query_limit = limit;
12155
12156 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/files", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
12157 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12158
12159 if let Some(ref param_value) = p_query_skip_to {
12160 req_builder = req_builder.query(&[("skip-to", ¶m_value.to_string())]);
12161 }
12162 if let Some(ref param_value) = p_query_whitespace {
12163 req_builder = req_builder.query(&[("whitespace", ¶m_value.to_string())]);
12164 }
12165 if let Some(ref param_value) = p_query_page {
12166 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
12167 }
12168 if let Some(ref param_value) = p_query_limit {
12169 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
12170 }
12171 if let Some(ref apikey) = configuration.api_key {
12172 let key = apikey.key.clone();
12173 let value = match apikey.prefix {
12174 Some(ref prefix) => format!("{} {}", prefix, key),
12175 None => key,
12176 };
12177 req_builder = req_builder.query(&[("access_token", value)]);
12178 }
12179 if let Some(ref apikey) = configuration.api_key {
12180 let key = apikey.key.clone();
12181 let value = match apikey.prefix {
12182 Some(ref prefix) => format!("{} {}", prefix, key),
12183 None => key,
12184 };
12185 req_builder = req_builder.query(&[("sudo", value)]);
12186 }
12187 if let Some(ref apikey) = configuration.api_key {
12188 let key = apikey.key.clone();
12189 let value = match apikey.prefix {
12190 Some(ref prefix) => format!("{} {}", prefix, key),
12191 None => key,
12192 };
12193 req_builder = req_builder.query(&[("token", value)]);
12194 }
12195 if let Some(ref user_agent) = configuration.user_agent {
12196 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12197 }
12198 if let Some(ref apikey) = configuration.api_key {
12199 let key = apikey.key.clone();
12200 let value = match apikey.prefix {
12201 Some(ref prefix) => format!("{} {}", prefix, key),
12202 None => key,
12203 };
12204 req_builder = req_builder.header("X-GITEA-OTP", value);
12205 };
12206 if let Some(ref apikey) = configuration.api_key {
12207 let key = apikey.key.clone();
12208 let value = match apikey.prefix {
12209 Some(ref prefix) => format!("{} {}", prefix, key),
12210 None => key,
12211 };
12212 req_builder = req_builder.header("Authorization", value);
12213 };
12214 if let Some(ref apikey) = configuration.api_key {
12215 let key = apikey.key.clone();
12216 let value = match apikey.prefix {
12217 Some(ref prefix) => format!("{} {}", prefix, key),
12218 None => key,
12219 };
12220 req_builder = req_builder.header("Sudo", value);
12221 };
12222 if let Some(ref auth_conf) = configuration.basic_auth {
12223 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12224 };
12225
12226 let req = req_builder.build()?;
12227 let resp = configuration.client.execute(req).await?;
12228
12229 let status = resp.status();
12230 let content_type = resp
12231 .headers()
12232 .get("content-type")
12233 .and_then(|v| v.to_str().ok())
12234 .unwrap_or("application/octet-stream");
12235 let content_type = super::ContentType::from(content_type);
12236
12237 if !status.is_client_error() && !status.is_server_error() {
12238 let content = resp.text().await?;
12239 match content_type {
12240 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12241 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ChangedFile>`"))),
12242 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::ChangedFile>`")))),
12243 }
12244 } else {
12245 let content = resp.text().await?;
12246 let entity: Option<RepoGetPullRequestFilesError> = serde_json::from_str(&content).ok();
12247 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12248 }
12249}
12250
12251pub async fn repo_get_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<models::PullReview, Error<RepoGetPullReviewError>> {
12252 let p_path_owner = owner;
12254 let p_path_repo = repo;
12255 let p_path_index = index;
12256 let p_path_id = id;
12257
12258 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id);
12259 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12260
12261 if let Some(ref apikey) = configuration.api_key {
12262 let key = apikey.key.clone();
12263 let value = match apikey.prefix {
12264 Some(ref prefix) => format!("{} {}", prefix, key),
12265 None => key,
12266 };
12267 req_builder = req_builder.query(&[("access_token", value)]);
12268 }
12269 if let Some(ref apikey) = configuration.api_key {
12270 let key = apikey.key.clone();
12271 let value = match apikey.prefix {
12272 Some(ref prefix) => format!("{} {}", prefix, key),
12273 None => key,
12274 };
12275 req_builder = req_builder.query(&[("sudo", value)]);
12276 }
12277 if let Some(ref apikey) = configuration.api_key {
12278 let key = apikey.key.clone();
12279 let value = match apikey.prefix {
12280 Some(ref prefix) => format!("{} {}", prefix, key),
12281 None => key,
12282 };
12283 req_builder = req_builder.query(&[("token", value)]);
12284 }
12285 if let Some(ref user_agent) = configuration.user_agent {
12286 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12287 }
12288 if let Some(ref apikey) = configuration.api_key {
12289 let key = apikey.key.clone();
12290 let value = match apikey.prefix {
12291 Some(ref prefix) => format!("{} {}", prefix, key),
12292 None => key,
12293 };
12294 req_builder = req_builder.header("X-GITEA-OTP", value);
12295 };
12296 if let Some(ref apikey) = configuration.api_key {
12297 let key = apikey.key.clone();
12298 let value = match apikey.prefix {
12299 Some(ref prefix) => format!("{} {}", prefix, key),
12300 None => key,
12301 };
12302 req_builder = req_builder.header("Authorization", value);
12303 };
12304 if let Some(ref apikey) = configuration.api_key {
12305 let key = apikey.key.clone();
12306 let value = match apikey.prefix {
12307 Some(ref prefix) => format!("{} {}", prefix, key),
12308 None => key,
12309 };
12310 req_builder = req_builder.header("Sudo", value);
12311 };
12312 if let Some(ref auth_conf) = configuration.basic_auth {
12313 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12314 };
12315
12316 let req = req_builder.build()?;
12317 let resp = configuration.client.execute(req).await?;
12318
12319 let status = resp.status();
12320 let content_type = resp
12321 .headers()
12322 .get("content-type")
12323 .and_then(|v| v.to_str().ok())
12324 .unwrap_or("application/octet-stream");
12325 let content_type = super::ContentType::from(content_type);
12326
12327 if !status.is_client_error() && !status.is_server_error() {
12328 let content = resp.text().await?;
12329 match content_type {
12330 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12331 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))),
12332 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::PullReview`")))),
12333 }
12334 } else {
12335 let content = resp.text().await?;
12336 let entity: Option<RepoGetPullReviewError> = serde_json::from_str(&content).ok();
12337 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12338 }
12339}
12340
12341pub async fn repo_get_pull_review_comments(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<Vec<models::PullReviewComment>, Error<RepoGetPullReviewCommentsError>> {
12342 let p_path_owner = owner;
12344 let p_path_repo = repo;
12345 let p_path_index = index;
12346 let p_path_id = id;
12347
12348 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id);
12349 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12350
12351 if let Some(ref apikey) = configuration.api_key {
12352 let key = apikey.key.clone();
12353 let value = match apikey.prefix {
12354 Some(ref prefix) => format!("{} {}", prefix, key),
12355 None => key,
12356 };
12357 req_builder = req_builder.query(&[("access_token", value)]);
12358 }
12359 if let Some(ref apikey) = configuration.api_key {
12360 let key = apikey.key.clone();
12361 let value = match apikey.prefix {
12362 Some(ref prefix) => format!("{} {}", prefix, key),
12363 None => key,
12364 };
12365 req_builder = req_builder.query(&[("sudo", value)]);
12366 }
12367 if let Some(ref apikey) = configuration.api_key {
12368 let key = apikey.key.clone();
12369 let value = match apikey.prefix {
12370 Some(ref prefix) => format!("{} {}", prefix, key),
12371 None => key,
12372 };
12373 req_builder = req_builder.query(&[("token", value)]);
12374 }
12375 if let Some(ref user_agent) = configuration.user_agent {
12376 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12377 }
12378 if let Some(ref apikey) = configuration.api_key {
12379 let key = apikey.key.clone();
12380 let value = match apikey.prefix {
12381 Some(ref prefix) => format!("{} {}", prefix, key),
12382 None => key,
12383 };
12384 req_builder = req_builder.header("X-GITEA-OTP", value);
12385 };
12386 if let Some(ref apikey) = configuration.api_key {
12387 let key = apikey.key.clone();
12388 let value = match apikey.prefix {
12389 Some(ref prefix) => format!("{} {}", prefix, key),
12390 None => key,
12391 };
12392 req_builder = req_builder.header("Authorization", value);
12393 };
12394 if let Some(ref apikey) = configuration.api_key {
12395 let key = apikey.key.clone();
12396 let value = match apikey.prefix {
12397 Some(ref prefix) => format!("{} {}", prefix, key),
12398 None => key,
12399 };
12400 req_builder = req_builder.header("Sudo", value);
12401 };
12402 if let Some(ref auth_conf) = configuration.basic_auth {
12403 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12404 };
12405
12406 let req = req_builder.build()?;
12407 let resp = configuration.client.execute(req).await?;
12408
12409 let status = resp.status();
12410 let content_type = resp
12411 .headers()
12412 .get("content-type")
12413 .and_then(|v| v.to_str().ok())
12414 .unwrap_or("application/octet-stream");
12415 let content_type = super::ContentType::from(content_type);
12416
12417 if !status.is_client_error() && !status.is_server_error() {
12418 let content = resp.text().await?;
12419 match content_type {
12420 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12421 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullReviewComment>`"))),
12422 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::PullReviewComment>`")))),
12423 }
12424 } else {
12425 let content = resp.text().await?;
12426 let entity: Option<RepoGetPullReviewCommentsError> = serde_json::from_str(&content).ok();
12427 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12428 }
12429}
12430
12431pub async fn repo_get_push_mirror_by_remote_name(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result<models::PushMirror, Error<RepoGetPushMirrorByRemoteNameError>> {
12432 let p_path_owner = owner;
12434 let p_path_repo = repo;
12435 let p_path_name = name;
12436
12437 let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name));
12438 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12439
12440 if let Some(ref apikey) = configuration.api_key {
12441 let key = apikey.key.clone();
12442 let value = match apikey.prefix {
12443 Some(ref prefix) => format!("{} {}", prefix, key),
12444 None => key,
12445 };
12446 req_builder = req_builder.query(&[("access_token", value)]);
12447 }
12448 if let Some(ref apikey) = configuration.api_key {
12449 let key = apikey.key.clone();
12450 let value = match apikey.prefix {
12451 Some(ref prefix) => format!("{} {}", prefix, key),
12452 None => key,
12453 };
12454 req_builder = req_builder.query(&[("sudo", value)]);
12455 }
12456 if let Some(ref apikey) = configuration.api_key {
12457 let key = apikey.key.clone();
12458 let value = match apikey.prefix {
12459 Some(ref prefix) => format!("{} {}", prefix, key),
12460 None => key,
12461 };
12462 req_builder = req_builder.query(&[("token", value)]);
12463 }
12464 if let Some(ref user_agent) = configuration.user_agent {
12465 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12466 }
12467 if let Some(ref apikey) = configuration.api_key {
12468 let key = apikey.key.clone();
12469 let value = match apikey.prefix {
12470 Some(ref prefix) => format!("{} {}", prefix, key),
12471 None => key,
12472 };
12473 req_builder = req_builder.header("X-GITEA-OTP", value);
12474 };
12475 if let Some(ref apikey) = configuration.api_key {
12476 let key = apikey.key.clone();
12477 let value = match apikey.prefix {
12478 Some(ref prefix) => format!("{} {}", prefix, key),
12479 None => key,
12480 };
12481 req_builder = req_builder.header("Authorization", value);
12482 };
12483 if let Some(ref apikey) = configuration.api_key {
12484 let key = apikey.key.clone();
12485 let value = match apikey.prefix {
12486 Some(ref prefix) => format!("{} {}", prefix, key),
12487 None => key,
12488 };
12489 req_builder = req_builder.header("Sudo", value);
12490 };
12491 if let Some(ref auth_conf) = configuration.basic_auth {
12492 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12493 };
12494
12495 let req = req_builder.build()?;
12496 let resp = configuration.client.execute(req).await?;
12497
12498 let status = resp.status();
12499 let content_type = resp
12500 .headers()
12501 .get("content-type")
12502 .and_then(|v| v.to_str().ok())
12503 .unwrap_or("application/octet-stream");
12504 let content_type = super::ContentType::from(content_type);
12505
12506 if !status.is_client_error() && !status.is_server_error() {
12507 let content = resp.text().await?;
12508 match content_type {
12509 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12510 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PushMirror`"))),
12511 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::PushMirror`")))),
12512 }
12513 } else {
12514 let content = resp.text().await?;
12515 let entity: Option<RepoGetPushMirrorByRemoteNameError> = serde_json::from_str(&content).ok();
12516 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12517 }
12518}
12519
12520pub async fn repo_get_raw_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result<reqwest::Response, Error<RepoGetRawFileError>> {
12521 let p_path_owner = owner;
12523 let p_path_repo = repo;
12524 let p_path_filepath = filepath;
12525 let p_query_ref = r#ref;
12526
12527 let uri_str = format!("{}/repos/{owner}/{repo}/raw/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
12528 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12529
12530 if let Some(ref param_value) = p_query_ref {
12531 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
12532 }
12533 if let Some(ref apikey) = configuration.api_key {
12534 let key = apikey.key.clone();
12535 let value = match apikey.prefix {
12536 Some(ref prefix) => format!("{} {}", prefix, key),
12537 None => key,
12538 };
12539 req_builder = req_builder.query(&[("access_token", value)]);
12540 }
12541 if let Some(ref apikey) = configuration.api_key {
12542 let key = apikey.key.clone();
12543 let value = match apikey.prefix {
12544 Some(ref prefix) => format!("{} {}", prefix, key),
12545 None => key,
12546 };
12547 req_builder = req_builder.query(&[("sudo", value)]);
12548 }
12549 if let Some(ref apikey) = configuration.api_key {
12550 let key = apikey.key.clone();
12551 let value = match apikey.prefix {
12552 Some(ref prefix) => format!("{} {}", prefix, key),
12553 None => key,
12554 };
12555 req_builder = req_builder.query(&[("token", value)]);
12556 }
12557 if let Some(ref user_agent) = configuration.user_agent {
12558 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12559 }
12560 if let Some(ref apikey) = configuration.api_key {
12561 let key = apikey.key.clone();
12562 let value = match apikey.prefix {
12563 Some(ref prefix) => format!("{} {}", prefix, key),
12564 None => key,
12565 };
12566 req_builder = req_builder.header("X-GITEA-OTP", value);
12567 };
12568 if let Some(ref apikey) = configuration.api_key {
12569 let key = apikey.key.clone();
12570 let value = match apikey.prefix {
12571 Some(ref prefix) => format!("{} {}", prefix, key),
12572 None => key,
12573 };
12574 req_builder = req_builder.header("Authorization", value);
12575 };
12576 if let Some(ref apikey) = configuration.api_key {
12577 let key = apikey.key.clone();
12578 let value = match apikey.prefix {
12579 Some(ref prefix) => format!("{} {}", prefix, key),
12580 None => key,
12581 };
12582 req_builder = req_builder.header("Sudo", value);
12583 };
12584 if let Some(ref auth_conf) = configuration.basic_auth {
12585 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12586 };
12587
12588 let req = req_builder.build()?;
12589 let resp = configuration.client.execute(req).await?;
12590
12591 let status = resp.status();
12592
12593 if !status.is_client_error() && !status.is_server_error() {
12594 Ok(resp)
12595 } else {
12596 let content = resp.text().await?;
12597 let entity: Option<RepoGetRawFileError> = serde_json::from_str(&content).ok();
12598 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12599 }
12600}
12601
12602pub async fn repo_get_raw_file_or_lfs(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result<reqwest::Response, Error<RepoGetRawFileOrLfsError>> {
12603 let p_path_owner = owner;
12605 let p_path_repo = repo;
12606 let p_path_filepath = filepath;
12607 let p_query_ref = r#ref;
12608
12609 let uri_str = format!("{}/repos/{owner}/{repo}/media/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
12610 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12611
12612 if let Some(ref param_value) = p_query_ref {
12613 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
12614 }
12615 if let Some(ref apikey) = configuration.api_key {
12616 let key = apikey.key.clone();
12617 let value = match apikey.prefix {
12618 Some(ref prefix) => format!("{} {}", prefix, key),
12619 None => key,
12620 };
12621 req_builder = req_builder.query(&[("access_token", value)]);
12622 }
12623 if let Some(ref apikey) = configuration.api_key {
12624 let key = apikey.key.clone();
12625 let value = match apikey.prefix {
12626 Some(ref prefix) => format!("{} {}", prefix, key),
12627 None => key,
12628 };
12629 req_builder = req_builder.query(&[("sudo", value)]);
12630 }
12631 if let Some(ref apikey) = configuration.api_key {
12632 let key = apikey.key.clone();
12633 let value = match apikey.prefix {
12634 Some(ref prefix) => format!("{} {}", prefix, key),
12635 None => key,
12636 };
12637 req_builder = req_builder.query(&[("token", value)]);
12638 }
12639 if let Some(ref user_agent) = configuration.user_agent {
12640 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12641 }
12642 if let Some(ref apikey) = configuration.api_key {
12643 let key = apikey.key.clone();
12644 let value = match apikey.prefix {
12645 Some(ref prefix) => format!("{} {}", prefix, key),
12646 None => key,
12647 };
12648 req_builder = req_builder.header("X-GITEA-OTP", value);
12649 };
12650 if let Some(ref apikey) = configuration.api_key {
12651 let key = apikey.key.clone();
12652 let value = match apikey.prefix {
12653 Some(ref prefix) => format!("{} {}", prefix, key),
12654 None => key,
12655 };
12656 req_builder = req_builder.header("Authorization", value);
12657 };
12658 if let Some(ref apikey) = configuration.api_key {
12659 let key = apikey.key.clone();
12660 let value = match apikey.prefix {
12661 Some(ref prefix) => format!("{} {}", prefix, key),
12662 None => key,
12663 };
12664 req_builder = req_builder.header("Sudo", value);
12665 };
12666 if let Some(ref auth_conf) = configuration.basic_auth {
12667 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12668 };
12669
12670 let req = req_builder.build()?;
12671 let resp = configuration.client.execute(req).await?;
12672
12673 let status = resp.status();
12674
12675 if !status.is_client_error() && !status.is_server_error() {
12676 Ok(resp)
12677 } else {
12678 let content = resp.text().await?;
12679 let entity: Option<RepoGetRawFileOrLfsError> = serde_json::from_str(&content).ok();
12680 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12681 }
12682}
12683
12684pub async fn repo_get_release(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<models::Release, Error<RepoGetReleaseError>> {
12685 let p_path_owner = owner;
12687 let p_path_repo = repo;
12688 let p_path_id = id;
12689
12690 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
12691 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12692
12693 if let Some(ref apikey) = configuration.api_key {
12694 let key = apikey.key.clone();
12695 let value = match apikey.prefix {
12696 Some(ref prefix) => format!("{} {}", prefix, key),
12697 None => key,
12698 };
12699 req_builder = req_builder.query(&[("access_token", value)]);
12700 }
12701 if let Some(ref apikey) = configuration.api_key {
12702 let key = apikey.key.clone();
12703 let value = match apikey.prefix {
12704 Some(ref prefix) => format!("{} {}", prefix, key),
12705 None => key,
12706 };
12707 req_builder = req_builder.query(&[("sudo", value)]);
12708 }
12709 if let Some(ref apikey) = configuration.api_key {
12710 let key = apikey.key.clone();
12711 let value = match apikey.prefix {
12712 Some(ref prefix) => format!("{} {}", prefix, key),
12713 None => key,
12714 };
12715 req_builder = req_builder.query(&[("token", value)]);
12716 }
12717 if let Some(ref user_agent) = configuration.user_agent {
12718 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12719 }
12720 if let Some(ref apikey) = configuration.api_key {
12721 let key = apikey.key.clone();
12722 let value = match apikey.prefix {
12723 Some(ref prefix) => format!("{} {}", prefix, key),
12724 None => key,
12725 };
12726 req_builder = req_builder.header("X-GITEA-OTP", value);
12727 };
12728 if let Some(ref apikey) = configuration.api_key {
12729 let key = apikey.key.clone();
12730 let value = match apikey.prefix {
12731 Some(ref prefix) => format!("{} {}", prefix, key),
12732 None => key,
12733 };
12734 req_builder = req_builder.header("Authorization", value);
12735 };
12736 if let Some(ref apikey) = configuration.api_key {
12737 let key = apikey.key.clone();
12738 let value = match apikey.prefix {
12739 Some(ref prefix) => format!("{} {}", prefix, key),
12740 None => key,
12741 };
12742 req_builder = req_builder.header("Sudo", value);
12743 };
12744 if let Some(ref auth_conf) = configuration.basic_auth {
12745 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12746 };
12747
12748 let req = req_builder.build()?;
12749 let resp = configuration.client.execute(req).await?;
12750
12751 let status = resp.status();
12752 let content_type = resp
12753 .headers()
12754 .get("content-type")
12755 .and_then(|v| v.to_str().ok())
12756 .unwrap_or("application/octet-stream");
12757 let content_type = super::ContentType::from(content_type);
12758
12759 if !status.is_client_error() && !status.is_server_error() {
12760 let content = resp.text().await?;
12761 match content_type {
12762 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12763 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))),
12764 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::Release`")))),
12765 }
12766 } else {
12767 let content = resp.text().await?;
12768 let entity: Option<RepoGetReleaseError> = serde_json::from_str(&content).ok();
12769 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12770 }
12771}
12772
12773pub async fn repo_get_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result<models::Attachment, Error<RepoGetReleaseAttachmentError>> {
12774 let p_path_owner = owner;
12776 let p_path_repo = repo;
12777 let p_path_id = id;
12778 let p_path_attachment_id = attachment_id;
12779
12780 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id);
12781 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12782
12783 if let Some(ref apikey) = configuration.api_key {
12784 let key = apikey.key.clone();
12785 let value = match apikey.prefix {
12786 Some(ref prefix) => format!("{} {}", prefix, key),
12787 None => key,
12788 };
12789 req_builder = req_builder.query(&[("access_token", value)]);
12790 }
12791 if let Some(ref apikey) = configuration.api_key {
12792 let key = apikey.key.clone();
12793 let value = match apikey.prefix {
12794 Some(ref prefix) => format!("{} {}", prefix, key),
12795 None => key,
12796 };
12797 req_builder = req_builder.query(&[("sudo", value)]);
12798 }
12799 if let Some(ref apikey) = configuration.api_key {
12800 let key = apikey.key.clone();
12801 let value = match apikey.prefix {
12802 Some(ref prefix) => format!("{} {}", prefix, key),
12803 None => key,
12804 };
12805 req_builder = req_builder.query(&[("token", value)]);
12806 }
12807 if let Some(ref user_agent) = configuration.user_agent {
12808 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12809 }
12810 if let Some(ref apikey) = configuration.api_key {
12811 let key = apikey.key.clone();
12812 let value = match apikey.prefix {
12813 Some(ref prefix) => format!("{} {}", prefix, key),
12814 None => key,
12815 };
12816 req_builder = req_builder.header("X-GITEA-OTP", value);
12817 };
12818 if let Some(ref apikey) = configuration.api_key {
12819 let key = apikey.key.clone();
12820 let value = match apikey.prefix {
12821 Some(ref prefix) => format!("{} {}", prefix, key),
12822 None => key,
12823 };
12824 req_builder = req_builder.header("Authorization", value);
12825 };
12826 if let Some(ref apikey) = configuration.api_key {
12827 let key = apikey.key.clone();
12828 let value = match apikey.prefix {
12829 Some(ref prefix) => format!("{} {}", prefix, key),
12830 None => key,
12831 };
12832 req_builder = req_builder.header("Sudo", value);
12833 };
12834 if let Some(ref auth_conf) = configuration.basic_auth {
12835 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12836 };
12837
12838 let req = req_builder.build()?;
12839 let resp = configuration.client.execute(req).await?;
12840
12841 let status = resp.status();
12842 let content_type = resp
12843 .headers()
12844 .get("content-type")
12845 .and_then(|v| v.to_str().ok())
12846 .unwrap_or("application/octet-stream");
12847 let content_type = super::ContentType::from(content_type);
12848
12849 if !status.is_client_error() && !status.is_server_error() {
12850 let content = resp.text().await?;
12851 match content_type {
12852 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12853 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
12854 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::Attachment`")))),
12855 }
12856 } else {
12857 let content = resp.text().await?;
12858 let entity: Option<RepoGetReleaseAttachmentError> = serde_json::from_str(&content).ok();
12859 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12860 }
12861}
12862
12863pub async fn repo_get_release_by_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result<models::Release, Error<RepoGetReleaseByTagError>> {
12864 let p_path_owner = owner;
12866 let p_path_repo = repo;
12867 let p_path_tag = tag;
12868
12869 let uri_str = format!("{}/repos/{owner}/{repo}/releases/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag));
12870 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12871
12872 if let Some(ref apikey) = configuration.api_key {
12873 let key = apikey.key.clone();
12874 let value = match apikey.prefix {
12875 Some(ref prefix) => format!("{} {}", prefix, key),
12876 None => key,
12877 };
12878 req_builder = req_builder.query(&[("access_token", value)]);
12879 }
12880 if let Some(ref apikey) = configuration.api_key {
12881 let key = apikey.key.clone();
12882 let value = match apikey.prefix {
12883 Some(ref prefix) => format!("{} {}", prefix, key),
12884 None => key,
12885 };
12886 req_builder = req_builder.query(&[("sudo", value)]);
12887 }
12888 if let Some(ref apikey) = configuration.api_key {
12889 let key = apikey.key.clone();
12890 let value = match apikey.prefix {
12891 Some(ref prefix) => format!("{} {}", prefix, key),
12892 None => key,
12893 };
12894 req_builder = req_builder.query(&[("token", value)]);
12895 }
12896 if let Some(ref user_agent) = configuration.user_agent {
12897 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12898 }
12899 if let Some(ref apikey) = configuration.api_key {
12900 let key = apikey.key.clone();
12901 let value = match apikey.prefix {
12902 Some(ref prefix) => format!("{} {}", prefix, key),
12903 None => key,
12904 };
12905 req_builder = req_builder.header("X-GITEA-OTP", value);
12906 };
12907 if let Some(ref apikey) = configuration.api_key {
12908 let key = apikey.key.clone();
12909 let value = match apikey.prefix {
12910 Some(ref prefix) => format!("{} {}", prefix, key),
12911 None => key,
12912 };
12913 req_builder = req_builder.header("Authorization", value);
12914 };
12915 if let Some(ref apikey) = configuration.api_key {
12916 let key = apikey.key.clone();
12917 let value = match apikey.prefix {
12918 Some(ref prefix) => format!("{} {}", prefix, key),
12919 None => key,
12920 };
12921 req_builder = req_builder.header("Sudo", value);
12922 };
12923 if let Some(ref auth_conf) = configuration.basic_auth {
12924 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
12925 };
12926
12927 let req = req_builder.build()?;
12928 let resp = configuration.client.execute(req).await?;
12929
12930 let status = resp.status();
12931 let content_type = resp
12932 .headers()
12933 .get("content-type")
12934 .and_then(|v| v.to_str().ok())
12935 .unwrap_or("application/octet-stream");
12936 let content_type = super::ContentType::from(content_type);
12937
12938 if !status.is_client_error() && !status.is_server_error() {
12939 let content = resp.text().await?;
12940 match content_type {
12941 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
12942 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))),
12943 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::Release`")))),
12944 }
12945 } else {
12946 let content = resp.text().await?;
12947 let entity: Option<RepoGetReleaseByTagError> = serde_json::from_str(&content).ok();
12948 Err(Error::ResponseError(ResponseContent { status, content, entity }))
12949 }
12950}
12951
12952pub async fn repo_get_repo_permissions(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str) -> Result<models::RepoCollaboratorPermission, Error<RepoGetRepoPermissionsError>> {
12953 let p_path_owner = owner;
12955 let p_path_repo = repo;
12956 let p_path_collaborator = collaborator;
12957
12958 let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}/permission", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator));
12959 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
12960
12961 if let Some(ref apikey) = configuration.api_key {
12962 let key = apikey.key.clone();
12963 let value = match apikey.prefix {
12964 Some(ref prefix) => format!("{} {}", prefix, key),
12965 None => key,
12966 };
12967 req_builder = req_builder.query(&[("access_token", value)]);
12968 }
12969 if let Some(ref apikey) = configuration.api_key {
12970 let key = apikey.key.clone();
12971 let value = match apikey.prefix {
12972 Some(ref prefix) => format!("{} {}", prefix, key),
12973 None => key,
12974 };
12975 req_builder = req_builder.query(&[("sudo", value)]);
12976 }
12977 if let Some(ref apikey) = configuration.api_key {
12978 let key = apikey.key.clone();
12979 let value = match apikey.prefix {
12980 Some(ref prefix) => format!("{} {}", prefix, key),
12981 None => key,
12982 };
12983 req_builder = req_builder.query(&[("token", value)]);
12984 }
12985 if let Some(ref user_agent) = configuration.user_agent {
12986 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
12987 }
12988 if let Some(ref apikey) = configuration.api_key {
12989 let key = apikey.key.clone();
12990 let value = match apikey.prefix {
12991 Some(ref prefix) => format!("{} {}", prefix, key),
12992 None => key,
12993 };
12994 req_builder = req_builder.header("X-GITEA-OTP", value);
12995 };
12996 if let Some(ref apikey) = configuration.api_key {
12997 let key = apikey.key.clone();
12998 let value = match apikey.prefix {
12999 Some(ref prefix) => format!("{} {}", prefix, key),
13000 None => key,
13001 };
13002 req_builder = req_builder.header("Authorization", value);
13003 };
13004 if let Some(ref apikey) = configuration.api_key {
13005 let key = apikey.key.clone();
13006 let value = match apikey.prefix {
13007 Some(ref prefix) => format!("{} {}", prefix, key),
13008 None => key,
13009 };
13010 req_builder = req_builder.header("Sudo", value);
13011 };
13012 if let Some(ref auth_conf) = configuration.basic_auth {
13013 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13014 };
13015
13016 let req = req_builder.build()?;
13017 let resp = configuration.client.execute(req).await?;
13018
13019 let status = resp.status();
13020 let content_type = resp
13021 .headers()
13022 .get("content-type")
13023 .and_then(|v| v.to_str().ok())
13024 .unwrap_or("application/octet-stream");
13025 let content_type = super::ContentType::from(content_type);
13026
13027 if !status.is_client_error() && !status.is_server_error() {
13028 let content = resp.text().await?;
13029 match content_type {
13030 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13031 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RepoCollaboratorPermission`"))),
13032 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::RepoCollaboratorPermission`")))),
13033 }
13034 } else {
13035 let content = resp.text().await?;
13036 let entity: Option<RepoGetRepoPermissionsError> = serde_json::from_str(&content).ok();
13037 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13038 }
13039}
13040
13041pub async fn repo_get_reviewers(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::User>, Error<RepoGetReviewersError>> {
13042 let p_path_owner = owner;
13044 let p_path_repo = repo;
13045
13046 let uri_str = format!("{}/repos/{owner}/{repo}/reviewers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
13047 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13048
13049 if let Some(ref apikey) = configuration.api_key {
13050 let key = apikey.key.clone();
13051 let value = match apikey.prefix {
13052 Some(ref prefix) => format!("{} {}", prefix, key),
13053 None => key,
13054 };
13055 req_builder = req_builder.query(&[("access_token", value)]);
13056 }
13057 if let Some(ref apikey) = configuration.api_key {
13058 let key = apikey.key.clone();
13059 let value = match apikey.prefix {
13060 Some(ref prefix) => format!("{} {}", prefix, key),
13061 None => key,
13062 };
13063 req_builder = req_builder.query(&[("sudo", value)]);
13064 }
13065 if let Some(ref apikey) = configuration.api_key {
13066 let key = apikey.key.clone();
13067 let value = match apikey.prefix {
13068 Some(ref prefix) => format!("{} {}", prefix, key),
13069 None => key,
13070 };
13071 req_builder = req_builder.query(&[("token", value)]);
13072 }
13073 if let Some(ref user_agent) = configuration.user_agent {
13074 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13075 }
13076 if let Some(ref apikey) = configuration.api_key {
13077 let key = apikey.key.clone();
13078 let value = match apikey.prefix {
13079 Some(ref prefix) => format!("{} {}", prefix, key),
13080 None => key,
13081 };
13082 req_builder = req_builder.header("X-GITEA-OTP", value);
13083 };
13084 if let Some(ref apikey) = configuration.api_key {
13085 let key = apikey.key.clone();
13086 let value = match apikey.prefix {
13087 Some(ref prefix) => format!("{} {}", prefix, key),
13088 None => key,
13089 };
13090 req_builder = req_builder.header("Authorization", value);
13091 };
13092 if let Some(ref apikey) = configuration.api_key {
13093 let key = apikey.key.clone();
13094 let value = match apikey.prefix {
13095 Some(ref prefix) => format!("{} {}", prefix, key),
13096 None => key,
13097 };
13098 req_builder = req_builder.header("Sudo", value);
13099 };
13100 if let Some(ref auth_conf) = configuration.basic_auth {
13101 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13102 };
13103
13104 let req = req_builder.build()?;
13105 let resp = configuration.client.execute(req).await?;
13106
13107 let status = resp.status();
13108 let content_type = resp
13109 .headers()
13110 .get("content-type")
13111 .and_then(|v| v.to_str().ok())
13112 .unwrap_or("application/octet-stream");
13113 let content_type = super::ContentType::from(content_type);
13114
13115 if !status.is_client_error() && !status.is_server_error() {
13116 let content = resp.text().await?;
13117 match content_type {
13118 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13119 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
13120 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>`")))),
13121 }
13122 } else {
13123 let content = resp.text().await?;
13124 let entity: Option<RepoGetReviewersError> = serde_json::from_str(&content).ok();
13125 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13126 }
13127}
13128
13129pub async fn repo_get_runner_registration_token(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<RepoGetRunnerRegistrationTokenError>> {
13130 let p_path_owner = owner;
13132 let p_path_repo = repo;
13133
13134 let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/registration-token", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
13135 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13136
13137 if let Some(ref apikey) = configuration.api_key {
13138 let key = apikey.key.clone();
13139 let value = match apikey.prefix {
13140 Some(ref prefix) => format!("{} {}", prefix, key),
13141 None => key,
13142 };
13143 req_builder = req_builder.query(&[("access_token", value)]);
13144 }
13145 if let Some(ref apikey) = configuration.api_key {
13146 let key = apikey.key.clone();
13147 let value = match apikey.prefix {
13148 Some(ref prefix) => format!("{} {}", prefix, key),
13149 None => key,
13150 };
13151 req_builder = req_builder.query(&[("sudo", value)]);
13152 }
13153 if let Some(ref apikey) = configuration.api_key {
13154 let key = apikey.key.clone();
13155 let value = match apikey.prefix {
13156 Some(ref prefix) => format!("{} {}", prefix, key),
13157 None => key,
13158 };
13159 req_builder = req_builder.query(&[("token", value)]);
13160 }
13161 if let Some(ref user_agent) = configuration.user_agent {
13162 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13163 }
13164 if let Some(ref apikey) = configuration.api_key {
13165 let key = apikey.key.clone();
13166 let value = match apikey.prefix {
13167 Some(ref prefix) => format!("{} {}", prefix, key),
13168 None => key,
13169 };
13170 req_builder = req_builder.header("X-GITEA-OTP", value);
13171 };
13172 if let Some(ref apikey) = configuration.api_key {
13173 let key = apikey.key.clone();
13174 let value = match apikey.prefix {
13175 Some(ref prefix) => format!("{} {}", prefix, key),
13176 None => key,
13177 };
13178 req_builder = req_builder.header("Authorization", value);
13179 };
13180 if let Some(ref apikey) = configuration.api_key {
13181 let key = apikey.key.clone();
13182 let value = match apikey.prefix {
13183 Some(ref prefix) => format!("{} {}", prefix, key),
13184 None => key,
13185 };
13186 req_builder = req_builder.header("Sudo", value);
13187 };
13188 if let Some(ref auth_conf) = configuration.basic_auth {
13189 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13190 };
13191
13192 let req = req_builder.build()?;
13193 let resp = configuration.client.execute(req).await?;
13194
13195 let status = resp.status();
13196
13197 if !status.is_client_error() && !status.is_server_error() {
13198 Ok(())
13199 } else {
13200 let content = resp.text().await?;
13201 let entity: Option<RepoGetRunnerRegistrationTokenError> = serde_json::from_str(&content).ok();
13202 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13203 }
13204}
13205
13206pub async fn repo_get_single_commit(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, stat: Option<bool>, verification: Option<bool>, files: Option<bool>) -> Result<models::Commit, Error<RepoGetSingleCommitError>> {
13207 let p_path_owner = owner;
13209 let p_path_repo = repo;
13210 let p_path_sha = sha;
13211 let p_query_stat = stat;
13212 let p_query_verification = verification;
13213 let p_query_files = files;
13214
13215 let uri_str = format!("{}/repos/{owner}/{repo}/git/commits/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
13216 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13217
13218 if let Some(ref param_value) = p_query_stat {
13219 req_builder = req_builder.query(&[("stat", ¶m_value.to_string())]);
13220 }
13221 if let Some(ref param_value) = p_query_verification {
13222 req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]);
13223 }
13224 if let Some(ref param_value) = p_query_files {
13225 req_builder = req_builder.query(&[("files", ¶m_value.to_string())]);
13226 }
13227 if let Some(ref apikey) = configuration.api_key {
13228 let key = apikey.key.clone();
13229 let value = match apikey.prefix {
13230 Some(ref prefix) => format!("{} {}", prefix, key),
13231 None => key,
13232 };
13233 req_builder = req_builder.query(&[("access_token", value)]);
13234 }
13235 if let Some(ref apikey) = configuration.api_key {
13236 let key = apikey.key.clone();
13237 let value = match apikey.prefix {
13238 Some(ref prefix) => format!("{} {}", prefix, key),
13239 None => key,
13240 };
13241 req_builder = req_builder.query(&[("sudo", value)]);
13242 }
13243 if let Some(ref apikey) = configuration.api_key {
13244 let key = apikey.key.clone();
13245 let value = match apikey.prefix {
13246 Some(ref prefix) => format!("{} {}", prefix, key),
13247 None => key,
13248 };
13249 req_builder = req_builder.query(&[("token", value)]);
13250 }
13251 if let Some(ref user_agent) = configuration.user_agent {
13252 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13253 }
13254 if let Some(ref apikey) = configuration.api_key {
13255 let key = apikey.key.clone();
13256 let value = match apikey.prefix {
13257 Some(ref prefix) => format!("{} {}", prefix, key),
13258 None => key,
13259 };
13260 req_builder = req_builder.header("X-GITEA-OTP", value);
13261 };
13262 if let Some(ref apikey) = configuration.api_key {
13263 let key = apikey.key.clone();
13264 let value = match apikey.prefix {
13265 Some(ref prefix) => format!("{} {}", prefix, key),
13266 None => key,
13267 };
13268 req_builder = req_builder.header("Authorization", value);
13269 };
13270 if let Some(ref apikey) = configuration.api_key {
13271 let key = apikey.key.clone();
13272 let value = match apikey.prefix {
13273 Some(ref prefix) => format!("{} {}", prefix, key),
13274 None => key,
13275 };
13276 req_builder = req_builder.header("Sudo", value);
13277 };
13278 if let Some(ref auth_conf) = configuration.basic_auth {
13279 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13280 };
13281
13282 let req = req_builder.build()?;
13283 let resp = configuration.client.execute(req).await?;
13284
13285 let status = resp.status();
13286 let content_type = resp
13287 .headers()
13288 .get("content-type")
13289 .and_then(|v| v.to_str().ok())
13290 .unwrap_or("application/octet-stream");
13291 let content_type = super::ContentType::from(content_type);
13292
13293 if !status.is_client_error() && !status.is_server_error() {
13294 let content = resp.text().await?;
13295 match content_type {
13296 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13297 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Commit`"))),
13298 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::Commit`")))),
13299 }
13300 } else {
13301 let content = resp.text().await?;
13302 let entity: Option<RepoGetSingleCommitError> = serde_json::from_str(&content).ok();
13303 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13304 }
13305}
13306
13307pub async fn repo_get_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result<models::Tag, Error<RepoGetTagError>> {
13308 let p_path_owner = owner;
13310 let p_path_repo = repo;
13311 let p_path_tag = tag;
13312
13313 let uri_str = format!("{}/repos/{owner}/{repo}/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag));
13314 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13315
13316 if let Some(ref apikey) = configuration.api_key {
13317 let key = apikey.key.clone();
13318 let value = match apikey.prefix {
13319 Some(ref prefix) => format!("{} {}", prefix, key),
13320 None => key,
13321 };
13322 req_builder = req_builder.query(&[("access_token", value)]);
13323 }
13324 if let Some(ref apikey) = configuration.api_key {
13325 let key = apikey.key.clone();
13326 let value = match apikey.prefix {
13327 Some(ref prefix) => format!("{} {}", prefix, key),
13328 None => key,
13329 };
13330 req_builder = req_builder.query(&[("sudo", value)]);
13331 }
13332 if let Some(ref apikey) = configuration.api_key {
13333 let key = apikey.key.clone();
13334 let value = match apikey.prefix {
13335 Some(ref prefix) => format!("{} {}", prefix, key),
13336 None => key,
13337 };
13338 req_builder = req_builder.query(&[("token", value)]);
13339 }
13340 if let Some(ref user_agent) = configuration.user_agent {
13341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13342 }
13343 if let Some(ref apikey) = configuration.api_key {
13344 let key = apikey.key.clone();
13345 let value = match apikey.prefix {
13346 Some(ref prefix) => format!("{} {}", prefix, key),
13347 None => key,
13348 };
13349 req_builder = req_builder.header("X-GITEA-OTP", value);
13350 };
13351 if let Some(ref apikey) = configuration.api_key {
13352 let key = apikey.key.clone();
13353 let value = match apikey.prefix {
13354 Some(ref prefix) => format!("{} {}", prefix, key),
13355 None => key,
13356 };
13357 req_builder = req_builder.header("Authorization", value);
13358 };
13359 if let Some(ref apikey) = configuration.api_key {
13360 let key = apikey.key.clone();
13361 let value = match apikey.prefix {
13362 Some(ref prefix) => format!("{} {}", prefix, key),
13363 None => key,
13364 };
13365 req_builder = req_builder.header("Sudo", value);
13366 };
13367 if let Some(ref auth_conf) = configuration.basic_auth {
13368 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13369 };
13370
13371 let req = req_builder.build()?;
13372 let resp = configuration.client.execute(req).await?;
13373
13374 let status = resp.status();
13375 let content_type = resp
13376 .headers()
13377 .get("content-type")
13378 .and_then(|v| v.to_str().ok())
13379 .unwrap_or("application/octet-stream");
13380 let content_type = super::ContentType::from(content_type);
13381
13382 if !status.is_client_error() && !status.is_server_error() {
13383 let content = resp.text().await?;
13384 match content_type {
13385 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13386 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Tag`"))),
13387 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::Tag`")))),
13388 }
13389 } else {
13390 let content = resp.text().await?;
13391 let entity: Option<RepoGetTagError> = serde_json::from_str(&content).ok();
13392 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13393 }
13394}
13395
13396pub async fn repo_get_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i32) -> Result<models::TagProtection, Error<RepoGetTagProtectionError>> {
13397 let p_path_owner = owner;
13399 let p_path_repo = repo;
13400 let p_path_id = id;
13401
13402 let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
13403 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13404
13405 if let Some(ref apikey) = configuration.api_key {
13406 let key = apikey.key.clone();
13407 let value = match apikey.prefix {
13408 Some(ref prefix) => format!("{} {}", prefix, key),
13409 None => key,
13410 };
13411 req_builder = req_builder.query(&[("access_token", value)]);
13412 }
13413 if let Some(ref apikey) = configuration.api_key {
13414 let key = apikey.key.clone();
13415 let value = match apikey.prefix {
13416 Some(ref prefix) => format!("{} {}", prefix, key),
13417 None => key,
13418 };
13419 req_builder = req_builder.query(&[("sudo", value)]);
13420 }
13421 if let Some(ref apikey) = configuration.api_key {
13422 let key = apikey.key.clone();
13423 let value = match apikey.prefix {
13424 Some(ref prefix) => format!("{} {}", prefix, key),
13425 None => key,
13426 };
13427 req_builder = req_builder.query(&[("token", value)]);
13428 }
13429 if let Some(ref user_agent) = configuration.user_agent {
13430 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13431 }
13432 if let Some(ref apikey) = configuration.api_key {
13433 let key = apikey.key.clone();
13434 let value = match apikey.prefix {
13435 Some(ref prefix) => format!("{} {}", prefix, key),
13436 None => key,
13437 };
13438 req_builder = req_builder.header("X-GITEA-OTP", value);
13439 };
13440 if let Some(ref apikey) = configuration.api_key {
13441 let key = apikey.key.clone();
13442 let value = match apikey.prefix {
13443 Some(ref prefix) => format!("{} {}", prefix, key),
13444 None => key,
13445 };
13446 req_builder = req_builder.header("Authorization", value);
13447 };
13448 if let Some(ref apikey) = configuration.api_key {
13449 let key = apikey.key.clone();
13450 let value = match apikey.prefix {
13451 Some(ref prefix) => format!("{} {}", prefix, key),
13452 None => key,
13453 };
13454 req_builder = req_builder.header("Sudo", value);
13455 };
13456 if let Some(ref auth_conf) = configuration.basic_auth {
13457 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13458 };
13459
13460 let req = req_builder.build()?;
13461 let resp = configuration.client.execute(req).await?;
13462
13463 let status = resp.status();
13464 let content_type = resp
13465 .headers()
13466 .get("content-type")
13467 .and_then(|v| v.to_str().ok())
13468 .unwrap_or("application/octet-stream");
13469 let content_type = super::ContentType::from(content_type);
13470
13471 if !status.is_client_error() && !status.is_server_error() {
13472 let content = resp.text().await?;
13473 match content_type {
13474 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13475 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TagProtection`"))),
13476 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::TagProtection`")))),
13477 }
13478 } else {
13479 let content = resp.text().await?;
13480 let entity: Option<RepoGetTagProtectionError> = serde_json::from_str(&content).ok();
13481 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13482 }
13483}
13484
13485pub async fn repo_get_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str) -> Result<models::WikiPage, Error<RepoGetWikiPageError>> {
13486 let p_path_owner = owner;
13488 let p_path_repo = repo;
13489 let p_path_page_name = page_name;
13490
13491 let uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name));
13492 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13493
13494 if let Some(ref apikey) = configuration.api_key {
13495 let key = apikey.key.clone();
13496 let value = match apikey.prefix {
13497 Some(ref prefix) => format!("{} {}", prefix, key),
13498 None => key,
13499 };
13500 req_builder = req_builder.query(&[("access_token", value)]);
13501 }
13502 if let Some(ref apikey) = configuration.api_key {
13503 let key = apikey.key.clone();
13504 let value = match apikey.prefix {
13505 Some(ref prefix) => format!("{} {}", prefix, key),
13506 None => key,
13507 };
13508 req_builder = req_builder.query(&[("sudo", value)]);
13509 }
13510 if let Some(ref apikey) = configuration.api_key {
13511 let key = apikey.key.clone();
13512 let value = match apikey.prefix {
13513 Some(ref prefix) => format!("{} {}", prefix, key),
13514 None => key,
13515 };
13516 req_builder = req_builder.query(&[("token", value)]);
13517 }
13518 if let Some(ref user_agent) = configuration.user_agent {
13519 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13520 }
13521 if let Some(ref apikey) = configuration.api_key {
13522 let key = apikey.key.clone();
13523 let value = match apikey.prefix {
13524 Some(ref prefix) => format!("{} {}", prefix, key),
13525 None => key,
13526 };
13527 req_builder = req_builder.header("X-GITEA-OTP", value);
13528 };
13529 if let Some(ref apikey) = configuration.api_key {
13530 let key = apikey.key.clone();
13531 let value = match apikey.prefix {
13532 Some(ref prefix) => format!("{} {}", prefix, key),
13533 None => key,
13534 };
13535 req_builder = req_builder.header("Authorization", value);
13536 };
13537 if let Some(ref apikey) = configuration.api_key {
13538 let key = apikey.key.clone();
13539 let value = match apikey.prefix {
13540 Some(ref prefix) => format!("{} {}", prefix, key),
13541 None => key,
13542 };
13543 req_builder = req_builder.header("Sudo", value);
13544 };
13545 if let Some(ref auth_conf) = configuration.basic_auth {
13546 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13547 };
13548
13549 let req = req_builder.build()?;
13550 let resp = configuration.client.execute(req).await?;
13551
13552 let status = resp.status();
13553 let content_type = resp
13554 .headers()
13555 .get("content-type")
13556 .and_then(|v| v.to_str().ok())
13557 .unwrap_or("application/octet-stream");
13558 let content_type = super::ContentType::from(content_type);
13559
13560 if !status.is_client_error() && !status.is_server_error() {
13561 let content = resp.text().await?;
13562 match content_type {
13563 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13564 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiPage`"))),
13565 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::WikiPage`")))),
13566 }
13567 } else {
13568 let content = resp.text().await?;
13569 let entity: Option<RepoGetWikiPageError> = serde_json::from_str(&content).ok();
13570 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13571 }
13572}
13573
13574pub async fn repo_get_wiki_page_revisions(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str, page: Option<i32>) -> Result<models::WikiCommitList, Error<RepoGetWikiPageRevisionsError>> {
13575 let p_path_owner = owner;
13577 let p_path_repo = repo;
13578 let p_path_page_name = page_name;
13579 let p_query_page = page;
13580
13581 let uri_str = format!("{}/repos/{owner}/{repo}/wiki/revisions/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name));
13582 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13583
13584 if let Some(ref param_value) = p_query_page {
13585 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
13586 }
13587 if let Some(ref apikey) = configuration.api_key {
13588 let key = apikey.key.clone();
13589 let value = match apikey.prefix {
13590 Some(ref prefix) => format!("{} {}", prefix, key),
13591 None => key,
13592 };
13593 req_builder = req_builder.query(&[("access_token", value)]);
13594 }
13595 if let Some(ref apikey) = configuration.api_key {
13596 let key = apikey.key.clone();
13597 let value = match apikey.prefix {
13598 Some(ref prefix) => format!("{} {}", prefix, key),
13599 None => key,
13600 };
13601 req_builder = req_builder.query(&[("sudo", value)]);
13602 }
13603 if let Some(ref apikey) = configuration.api_key {
13604 let key = apikey.key.clone();
13605 let value = match apikey.prefix {
13606 Some(ref prefix) => format!("{} {}", prefix, key),
13607 None => key,
13608 };
13609 req_builder = req_builder.query(&[("token", value)]);
13610 }
13611 if let Some(ref user_agent) = configuration.user_agent {
13612 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13613 }
13614 if let Some(ref apikey) = configuration.api_key {
13615 let key = apikey.key.clone();
13616 let value = match apikey.prefix {
13617 Some(ref prefix) => format!("{} {}", prefix, key),
13618 None => key,
13619 };
13620 req_builder = req_builder.header("X-GITEA-OTP", value);
13621 };
13622 if let Some(ref apikey) = configuration.api_key {
13623 let key = apikey.key.clone();
13624 let value = match apikey.prefix {
13625 Some(ref prefix) => format!("{} {}", prefix, key),
13626 None => key,
13627 };
13628 req_builder = req_builder.header("Authorization", value);
13629 };
13630 if let Some(ref apikey) = configuration.api_key {
13631 let key = apikey.key.clone();
13632 let value = match apikey.prefix {
13633 Some(ref prefix) => format!("{} {}", prefix, key),
13634 None => key,
13635 };
13636 req_builder = req_builder.header("Sudo", value);
13637 };
13638 if let Some(ref auth_conf) = configuration.basic_auth {
13639 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13640 };
13641
13642 let req = req_builder.build()?;
13643 let resp = configuration.client.execute(req).await?;
13644
13645 let status = resp.status();
13646 let content_type = resp
13647 .headers()
13648 .get("content-type")
13649 .and_then(|v| v.to_str().ok())
13650 .unwrap_or("application/octet-stream");
13651 let content_type = super::ContentType::from(content_type);
13652
13653 if !status.is_client_error() && !status.is_server_error() {
13654 let content = resp.text().await?;
13655 match content_type {
13656 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13657 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiCommitList`"))),
13658 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::WikiCommitList`")))),
13659 }
13660 } else {
13661 let content = resp.text().await?;
13662 let entity: Option<RepoGetWikiPageRevisionsError> = serde_json::from_str(&content).ok();
13663 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13664 }
13665}
13666
13667pub async fn repo_get_wiki_pages(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::WikiPageMetaData>, Error<RepoGetWikiPagesError>> {
13668 let p_path_owner = owner;
13670 let p_path_repo = repo;
13671 let p_query_page = page;
13672 let p_query_limit = limit;
13673
13674 let uri_str = format!("{}/repos/{owner}/{repo}/wiki/pages", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
13675 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13676
13677 if let Some(ref param_value) = p_query_page {
13678 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
13679 }
13680 if let Some(ref param_value) = p_query_limit {
13681 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
13682 }
13683 if let Some(ref apikey) = configuration.api_key {
13684 let key = apikey.key.clone();
13685 let value = match apikey.prefix {
13686 Some(ref prefix) => format!("{} {}", prefix, key),
13687 None => key,
13688 };
13689 req_builder = req_builder.query(&[("access_token", value)]);
13690 }
13691 if let Some(ref apikey) = configuration.api_key {
13692 let key = apikey.key.clone();
13693 let value = match apikey.prefix {
13694 Some(ref prefix) => format!("{} {}", prefix, key),
13695 None => key,
13696 };
13697 req_builder = req_builder.query(&[("sudo", value)]);
13698 }
13699 if let Some(ref apikey) = configuration.api_key {
13700 let key = apikey.key.clone();
13701 let value = match apikey.prefix {
13702 Some(ref prefix) => format!("{} {}", prefix, key),
13703 None => key,
13704 };
13705 req_builder = req_builder.query(&[("token", value)]);
13706 }
13707 if let Some(ref user_agent) = configuration.user_agent {
13708 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13709 }
13710 if let Some(ref apikey) = configuration.api_key {
13711 let key = apikey.key.clone();
13712 let value = match apikey.prefix {
13713 Some(ref prefix) => format!("{} {}", prefix, key),
13714 None => key,
13715 };
13716 req_builder = req_builder.header("X-GITEA-OTP", value);
13717 };
13718 if let Some(ref apikey) = configuration.api_key {
13719 let key = apikey.key.clone();
13720 let value = match apikey.prefix {
13721 Some(ref prefix) => format!("{} {}", prefix, key),
13722 None => key,
13723 };
13724 req_builder = req_builder.header("Authorization", value);
13725 };
13726 if let Some(ref apikey) = configuration.api_key {
13727 let key = apikey.key.clone();
13728 let value = match apikey.prefix {
13729 Some(ref prefix) => format!("{} {}", prefix, key),
13730 None => key,
13731 };
13732 req_builder = req_builder.header("Sudo", value);
13733 };
13734 if let Some(ref auth_conf) = configuration.basic_auth {
13735 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13736 };
13737
13738 let req = req_builder.build()?;
13739 let resp = configuration.client.execute(req).await?;
13740
13741 let status = resp.status();
13742 let content_type = resp
13743 .headers()
13744 .get("content-type")
13745 .and_then(|v| v.to_str().ok())
13746 .unwrap_or("application/octet-stream");
13747 let content_type = super::ContentType::from(content_type);
13748
13749 if !status.is_client_error() && !status.is_server_error() {
13750 let content = resp.text().await?;
13751 match content_type {
13752 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13753 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WikiPageMetaData>`"))),
13754 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::WikiPageMetaData>`")))),
13755 }
13756 } else {
13757 let content = resp.text().await?;
13758 let entity: Option<RepoGetWikiPagesError> = serde_json::from_str(&content).ok();
13759 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13760 }
13761}
13762
13763pub async fn repo_list_actions_secrets(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Secret>, Error<RepoListActionsSecretsError>> {
13764 let p_path_owner = owner;
13766 let p_path_repo = repo;
13767 let p_query_page = page;
13768 let p_query_limit = limit;
13769
13770 let uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
13771 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13772
13773 if let Some(ref param_value) = p_query_page {
13774 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
13775 }
13776 if let Some(ref param_value) = p_query_limit {
13777 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
13778 }
13779 if let Some(ref apikey) = configuration.api_key {
13780 let key = apikey.key.clone();
13781 let value = match apikey.prefix {
13782 Some(ref prefix) => format!("{} {}", prefix, key),
13783 None => key,
13784 };
13785 req_builder = req_builder.query(&[("access_token", value)]);
13786 }
13787 if let Some(ref apikey) = configuration.api_key {
13788 let key = apikey.key.clone();
13789 let value = match apikey.prefix {
13790 Some(ref prefix) => format!("{} {}", prefix, key),
13791 None => key,
13792 };
13793 req_builder = req_builder.query(&[("sudo", value)]);
13794 }
13795 if let Some(ref apikey) = configuration.api_key {
13796 let key = apikey.key.clone();
13797 let value = match apikey.prefix {
13798 Some(ref prefix) => format!("{} {}", prefix, key),
13799 None => key,
13800 };
13801 req_builder = req_builder.query(&[("token", value)]);
13802 }
13803 if let Some(ref user_agent) = configuration.user_agent {
13804 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13805 }
13806 if let Some(ref apikey) = configuration.api_key {
13807 let key = apikey.key.clone();
13808 let value = match apikey.prefix {
13809 Some(ref prefix) => format!("{} {}", prefix, key),
13810 None => key,
13811 };
13812 req_builder = req_builder.header("X-GITEA-OTP", value);
13813 };
13814 if let Some(ref apikey) = configuration.api_key {
13815 let key = apikey.key.clone();
13816 let value = match apikey.prefix {
13817 Some(ref prefix) => format!("{} {}", prefix, key),
13818 None => key,
13819 };
13820 req_builder = req_builder.header("Authorization", value);
13821 };
13822 if let Some(ref apikey) = configuration.api_key {
13823 let key = apikey.key.clone();
13824 let value = match apikey.prefix {
13825 Some(ref prefix) => format!("{} {}", prefix, key),
13826 None => key,
13827 };
13828 req_builder = req_builder.header("Sudo", value);
13829 };
13830 if let Some(ref auth_conf) = configuration.basic_auth {
13831 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13832 };
13833
13834 let req = req_builder.build()?;
13835 let resp = configuration.client.execute(req).await?;
13836
13837 let status = resp.status();
13838 let content_type = resp
13839 .headers()
13840 .get("content-type")
13841 .and_then(|v| v.to_str().ok())
13842 .unwrap_or("application/octet-stream");
13843 let content_type = super::ContentType::from(content_type);
13844
13845 if !status.is_client_error() && !status.is_server_error() {
13846 let content = resp.text().await?;
13847 match content_type {
13848 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13849 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Secret>`"))),
13850 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>`")))),
13851 }
13852 } else {
13853 let content = resp.text().await?;
13854 let entity: Option<RepoListActionsSecretsError> = serde_json::from_str(&content).ok();
13855 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13856 }
13857}
13858
13859pub async fn repo_list_activity_feeds(configuration: &configuration::Configuration, owner: &str, repo: &str, date: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Activity>, Error<RepoListActivityFeedsError>> {
13860 let p_path_owner = owner;
13862 let p_path_repo = repo;
13863 let p_query_date = date;
13864 let p_query_page = page;
13865 let p_query_limit = limit;
13866
13867 let uri_str = format!("{}/repos/{owner}/{repo}/activities/feeds", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
13868 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13869
13870 if let Some(ref param_value) = p_query_date {
13871 req_builder = req_builder.query(&[("date", ¶m_value.to_string())]);
13872 }
13873 if let Some(ref param_value) = p_query_page {
13874 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
13875 }
13876 if let Some(ref param_value) = p_query_limit {
13877 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
13878 }
13879 if let Some(ref apikey) = configuration.api_key {
13880 let key = apikey.key.clone();
13881 let value = match apikey.prefix {
13882 Some(ref prefix) => format!("{} {}", prefix, key),
13883 None => key,
13884 };
13885 req_builder = req_builder.query(&[("access_token", value)]);
13886 }
13887 if let Some(ref apikey) = configuration.api_key {
13888 let key = apikey.key.clone();
13889 let value = match apikey.prefix {
13890 Some(ref prefix) => format!("{} {}", prefix, key),
13891 None => key,
13892 };
13893 req_builder = req_builder.query(&[("sudo", value)]);
13894 }
13895 if let Some(ref apikey) = configuration.api_key {
13896 let key = apikey.key.clone();
13897 let value = match apikey.prefix {
13898 Some(ref prefix) => format!("{} {}", prefix, key),
13899 None => key,
13900 };
13901 req_builder = req_builder.query(&[("token", value)]);
13902 }
13903 if let Some(ref user_agent) = configuration.user_agent {
13904 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13905 }
13906 if let Some(ref apikey) = configuration.api_key {
13907 let key = apikey.key.clone();
13908 let value = match apikey.prefix {
13909 Some(ref prefix) => format!("{} {}", prefix, key),
13910 None => key,
13911 };
13912 req_builder = req_builder.header("X-GITEA-OTP", value);
13913 };
13914 if let Some(ref apikey) = configuration.api_key {
13915 let key = apikey.key.clone();
13916 let value = match apikey.prefix {
13917 Some(ref prefix) => format!("{} {}", prefix, key),
13918 None => key,
13919 };
13920 req_builder = req_builder.header("Authorization", value);
13921 };
13922 if let Some(ref apikey) = configuration.api_key {
13923 let key = apikey.key.clone();
13924 let value = match apikey.prefix {
13925 Some(ref prefix) => format!("{} {}", prefix, key),
13926 None => key,
13927 };
13928 req_builder = req_builder.header("Sudo", value);
13929 };
13930 if let Some(ref auth_conf) = configuration.basic_auth {
13931 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
13932 };
13933
13934 let req = req_builder.build()?;
13935 let resp = configuration.client.execute(req).await?;
13936
13937 let status = resp.status();
13938 let content_type = resp
13939 .headers()
13940 .get("content-type")
13941 .and_then(|v| v.to_str().ok())
13942 .unwrap_or("application/octet-stream");
13943 let content_type = super::ContentType::from(content_type);
13944
13945 if !status.is_client_error() && !status.is_server_error() {
13946 let content = resp.text().await?;
13947 match content_type {
13948 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
13949 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Activity>`"))),
13950 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>`")))),
13951 }
13952 } else {
13953 let content = resp.text().await?;
13954 let entity: Option<RepoListActivityFeedsError> = serde_json::from_str(&content).ok();
13955 Err(Error::ResponseError(ResponseContent { status, content, entity }))
13956 }
13957}
13958
13959pub async fn repo_list_all_git_refs(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::Reference>, Error<RepoListAllGitRefsError>> {
13960 let p_path_owner = owner;
13962 let p_path_repo = repo;
13963
13964 let uri_str = format!("{}/repos/{owner}/{repo}/git/refs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
13965 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
13966
13967 if let Some(ref apikey) = configuration.api_key {
13968 let key = apikey.key.clone();
13969 let value = match apikey.prefix {
13970 Some(ref prefix) => format!("{} {}", prefix, key),
13971 None => key,
13972 };
13973 req_builder = req_builder.query(&[("access_token", value)]);
13974 }
13975 if let Some(ref apikey) = configuration.api_key {
13976 let key = apikey.key.clone();
13977 let value = match apikey.prefix {
13978 Some(ref prefix) => format!("{} {}", prefix, key),
13979 None => key,
13980 };
13981 req_builder = req_builder.query(&[("sudo", value)]);
13982 }
13983 if let Some(ref apikey) = configuration.api_key {
13984 let key = apikey.key.clone();
13985 let value = match apikey.prefix {
13986 Some(ref prefix) => format!("{} {}", prefix, key),
13987 None => key,
13988 };
13989 req_builder = req_builder.query(&[("token", value)]);
13990 }
13991 if let Some(ref user_agent) = configuration.user_agent {
13992 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
13993 }
13994 if let Some(ref apikey) = configuration.api_key {
13995 let key = apikey.key.clone();
13996 let value = match apikey.prefix {
13997 Some(ref prefix) => format!("{} {}", prefix, key),
13998 None => key,
13999 };
14000 req_builder = req_builder.header("X-GITEA-OTP", value);
14001 };
14002 if let Some(ref apikey) = configuration.api_key {
14003 let key = apikey.key.clone();
14004 let value = match apikey.prefix {
14005 Some(ref prefix) => format!("{} {}", prefix, key),
14006 None => key,
14007 };
14008 req_builder = req_builder.header("Authorization", value);
14009 };
14010 if let Some(ref apikey) = configuration.api_key {
14011 let key = apikey.key.clone();
14012 let value = match apikey.prefix {
14013 Some(ref prefix) => format!("{} {}", prefix, key),
14014 None => key,
14015 };
14016 req_builder = req_builder.header("Sudo", value);
14017 };
14018 if let Some(ref auth_conf) = configuration.basic_auth {
14019 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14020 };
14021
14022 let req = req_builder.build()?;
14023 let resp = configuration.client.execute(req).await?;
14024
14025 let status = resp.status();
14026 let content_type = resp
14027 .headers()
14028 .get("content-type")
14029 .and_then(|v| v.to_str().ok())
14030 .unwrap_or("application/octet-stream");
14031 let content_type = super::ContentType::from(content_type);
14032
14033 if !status.is_client_error() && !status.is_server_error() {
14034 let content = resp.text().await?;
14035 match content_type {
14036 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14037 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reference>`"))),
14038 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::Reference>`")))),
14039 }
14040 } else {
14041 let content = resp.text().await?;
14042 let entity: Option<RepoListAllGitRefsError> = serde_json::from_str(&content).ok();
14043 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14044 }
14045}
14046
14047pub async fn repo_list_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::BranchProtection>, Error<RepoListBranchProtectionError>> {
14048 let p_path_owner = owner;
14050 let p_path_repo = repo;
14051
14052 let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14053 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14054
14055 if let Some(ref apikey) = configuration.api_key {
14056 let key = apikey.key.clone();
14057 let value = match apikey.prefix {
14058 Some(ref prefix) => format!("{} {}", prefix, key),
14059 None => key,
14060 };
14061 req_builder = req_builder.query(&[("access_token", value)]);
14062 }
14063 if let Some(ref apikey) = configuration.api_key {
14064 let key = apikey.key.clone();
14065 let value = match apikey.prefix {
14066 Some(ref prefix) => format!("{} {}", prefix, key),
14067 None => key,
14068 };
14069 req_builder = req_builder.query(&[("sudo", value)]);
14070 }
14071 if let Some(ref apikey) = configuration.api_key {
14072 let key = apikey.key.clone();
14073 let value = match apikey.prefix {
14074 Some(ref prefix) => format!("{} {}", prefix, key),
14075 None => key,
14076 };
14077 req_builder = req_builder.query(&[("token", value)]);
14078 }
14079 if let Some(ref user_agent) = configuration.user_agent {
14080 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14081 }
14082 if let Some(ref apikey) = configuration.api_key {
14083 let key = apikey.key.clone();
14084 let value = match apikey.prefix {
14085 Some(ref prefix) => format!("{} {}", prefix, key),
14086 None => key,
14087 };
14088 req_builder = req_builder.header("X-GITEA-OTP", value);
14089 };
14090 if let Some(ref apikey) = configuration.api_key {
14091 let key = apikey.key.clone();
14092 let value = match apikey.prefix {
14093 Some(ref prefix) => format!("{} {}", prefix, key),
14094 None => key,
14095 };
14096 req_builder = req_builder.header("Authorization", value);
14097 };
14098 if let Some(ref apikey) = configuration.api_key {
14099 let key = apikey.key.clone();
14100 let value = match apikey.prefix {
14101 Some(ref prefix) => format!("{} {}", prefix, key),
14102 None => key,
14103 };
14104 req_builder = req_builder.header("Sudo", value);
14105 };
14106 if let Some(ref auth_conf) = configuration.basic_auth {
14107 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14108 };
14109
14110 let req = req_builder.build()?;
14111 let resp = configuration.client.execute(req).await?;
14112
14113 let status = resp.status();
14114 let content_type = resp
14115 .headers()
14116 .get("content-type")
14117 .and_then(|v| v.to_str().ok())
14118 .unwrap_or("application/octet-stream");
14119 let content_type = super::ContentType::from(content_type);
14120
14121 if !status.is_client_error() && !status.is_server_error() {
14122 let content = resp.text().await?;
14123 match content_type {
14124 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14125 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::BranchProtection>`"))),
14126 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::BranchProtection>`")))),
14127 }
14128 } else {
14129 let content = resp.text().await?;
14130 let entity: Option<RepoListBranchProtectionError> = serde_json::from_str(&content).ok();
14131 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14132 }
14133}
14134
14135pub async fn repo_list_branches(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Branch>, Error<RepoListBranchesError>> {
14136 let p_path_owner = owner;
14138 let p_path_repo = repo;
14139 let p_query_page = page;
14140 let p_query_limit = limit;
14141
14142 let uri_str = format!("{}/repos/{owner}/{repo}/branches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14143 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14144
14145 if let Some(ref param_value) = p_query_page {
14146 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
14147 }
14148 if let Some(ref param_value) = p_query_limit {
14149 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
14150 }
14151 if let Some(ref apikey) = configuration.api_key {
14152 let key = apikey.key.clone();
14153 let value = match apikey.prefix {
14154 Some(ref prefix) => format!("{} {}", prefix, key),
14155 None => key,
14156 };
14157 req_builder = req_builder.query(&[("access_token", value)]);
14158 }
14159 if let Some(ref apikey) = configuration.api_key {
14160 let key = apikey.key.clone();
14161 let value = match apikey.prefix {
14162 Some(ref prefix) => format!("{} {}", prefix, key),
14163 None => key,
14164 };
14165 req_builder = req_builder.query(&[("sudo", value)]);
14166 }
14167 if let Some(ref apikey) = configuration.api_key {
14168 let key = apikey.key.clone();
14169 let value = match apikey.prefix {
14170 Some(ref prefix) => format!("{} {}", prefix, key),
14171 None => key,
14172 };
14173 req_builder = req_builder.query(&[("token", value)]);
14174 }
14175 if let Some(ref user_agent) = configuration.user_agent {
14176 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14177 }
14178 if let Some(ref apikey) = configuration.api_key {
14179 let key = apikey.key.clone();
14180 let value = match apikey.prefix {
14181 Some(ref prefix) => format!("{} {}", prefix, key),
14182 None => key,
14183 };
14184 req_builder = req_builder.header("X-GITEA-OTP", value);
14185 };
14186 if let Some(ref apikey) = configuration.api_key {
14187 let key = apikey.key.clone();
14188 let value = match apikey.prefix {
14189 Some(ref prefix) => format!("{} {}", prefix, key),
14190 None => key,
14191 };
14192 req_builder = req_builder.header("Authorization", value);
14193 };
14194 if let Some(ref apikey) = configuration.api_key {
14195 let key = apikey.key.clone();
14196 let value = match apikey.prefix {
14197 Some(ref prefix) => format!("{} {}", prefix, key),
14198 None => key,
14199 };
14200 req_builder = req_builder.header("Sudo", value);
14201 };
14202 if let Some(ref auth_conf) = configuration.basic_auth {
14203 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14204 };
14205
14206 let req = req_builder.build()?;
14207 let resp = configuration.client.execute(req).await?;
14208
14209 let status = resp.status();
14210 let content_type = resp
14211 .headers()
14212 .get("content-type")
14213 .and_then(|v| v.to_str().ok())
14214 .unwrap_or("application/octet-stream");
14215 let content_type = super::ContentType::from(content_type);
14216
14217 if !status.is_client_error() && !status.is_server_error() {
14218 let content = resp.text().await?;
14219 match content_type {
14220 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14221 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Branch>`"))),
14222 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::Branch>`")))),
14223 }
14224 } else {
14225 let content = resp.text().await?;
14226 let entity: Option<RepoListBranchesError> = serde_json::from_str(&content).ok();
14227 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14228 }
14229}
14230
14231pub async fn repo_list_collaborators(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<RepoListCollaboratorsError>> {
14232 let p_path_owner = owner;
14234 let p_path_repo = repo;
14235 let p_query_page = page;
14236 let p_query_limit = limit;
14237
14238 let uri_str = format!("{}/repos/{owner}/{repo}/collaborators", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14239 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14240
14241 if let Some(ref param_value) = p_query_page {
14242 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
14243 }
14244 if let Some(ref param_value) = p_query_limit {
14245 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
14246 }
14247 if let Some(ref apikey) = configuration.api_key {
14248 let key = apikey.key.clone();
14249 let value = match apikey.prefix {
14250 Some(ref prefix) => format!("{} {}", prefix, key),
14251 None => key,
14252 };
14253 req_builder = req_builder.query(&[("access_token", value)]);
14254 }
14255 if let Some(ref apikey) = configuration.api_key {
14256 let key = apikey.key.clone();
14257 let value = match apikey.prefix {
14258 Some(ref prefix) => format!("{} {}", prefix, key),
14259 None => key,
14260 };
14261 req_builder = req_builder.query(&[("sudo", value)]);
14262 }
14263 if let Some(ref apikey) = configuration.api_key {
14264 let key = apikey.key.clone();
14265 let value = match apikey.prefix {
14266 Some(ref prefix) => format!("{} {}", prefix, key),
14267 None => key,
14268 };
14269 req_builder = req_builder.query(&[("token", value)]);
14270 }
14271 if let Some(ref user_agent) = configuration.user_agent {
14272 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14273 }
14274 if let Some(ref apikey) = configuration.api_key {
14275 let key = apikey.key.clone();
14276 let value = match apikey.prefix {
14277 Some(ref prefix) => format!("{} {}", prefix, key),
14278 None => key,
14279 };
14280 req_builder = req_builder.header("X-GITEA-OTP", value);
14281 };
14282 if let Some(ref apikey) = configuration.api_key {
14283 let key = apikey.key.clone();
14284 let value = match apikey.prefix {
14285 Some(ref prefix) => format!("{} {}", prefix, key),
14286 None => key,
14287 };
14288 req_builder = req_builder.header("Authorization", value);
14289 };
14290 if let Some(ref apikey) = configuration.api_key {
14291 let key = apikey.key.clone();
14292 let value = match apikey.prefix {
14293 Some(ref prefix) => format!("{} {}", prefix, key),
14294 None => key,
14295 };
14296 req_builder = req_builder.header("Sudo", value);
14297 };
14298 if let Some(ref auth_conf) = configuration.basic_auth {
14299 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14300 };
14301
14302 let req = req_builder.build()?;
14303 let resp = configuration.client.execute(req).await?;
14304
14305 let status = resp.status();
14306 let content_type = resp
14307 .headers()
14308 .get("content-type")
14309 .and_then(|v| v.to_str().ok())
14310 .unwrap_or("application/octet-stream");
14311 let content_type = super::ContentType::from(content_type);
14312
14313 if !status.is_client_error() && !status.is_server_error() {
14314 let content = resp.text().await?;
14315 match content_type {
14316 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14317 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
14318 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>`")))),
14319 }
14320 } else {
14321 let content = resp.text().await?;
14322 let entity: Option<RepoListCollaboratorsError> = serde_json::from_str(&content).ok();
14323 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14324 }
14325}
14326
14327pub async fn repo_list_git_hooks(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::GitHook>, Error<RepoListGitHooksError>> {
14328 let p_path_owner = owner;
14330 let p_path_repo = repo;
14331
14332 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14333 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14334
14335 if let Some(ref apikey) = configuration.api_key {
14336 let key = apikey.key.clone();
14337 let value = match apikey.prefix {
14338 Some(ref prefix) => format!("{} {}", prefix, key),
14339 None => key,
14340 };
14341 req_builder = req_builder.query(&[("access_token", value)]);
14342 }
14343 if let Some(ref apikey) = configuration.api_key {
14344 let key = apikey.key.clone();
14345 let value = match apikey.prefix {
14346 Some(ref prefix) => format!("{} {}", prefix, key),
14347 None => key,
14348 };
14349 req_builder = req_builder.query(&[("sudo", value)]);
14350 }
14351 if let Some(ref apikey) = configuration.api_key {
14352 let key = apikey.key.clone();
14353 let value = match apikey.prefix {
14354 Some(ref prefix) => format!("{} {}", prefix, key),
14355 None => key,
14356 };
14357 req_builder = req_builder.query(&[("token", value)]);
14358 }
14359 if let Some(ref user_agent) = configuration.user_agent {
14360 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14361 }
14362 if let Some(ref apikey) = configuration.api_key {
14363 let key = apikey.key.clone();
14364 let value = match apikey.prefix {
14365 Some(ref prefix) => format!("{} {}", prefix, key),
14366 None => key,
14367 };
14368 req_builder = req_builder.header("X-GITEA-OTP", value);
14369 };
14370 if let Some(ref apikey) = configuration.api_key {
14371 let key = apikey.key.clone();
14372 let value = match apikey.prefix {
14373 Some(ref prefix) => format!("{} {}", prefix, key),
14374 None => key,
14375 };
14376 req_builder = req_builder.header("Authorization", value);
14377 };
14378 if let Some(ref apikey) = configuration.api_key {
14379 let key = apikey.key.clone();
14380 let value = match apikey.prefix {
14381 Some(ref prefix) => format!("{} {}", prefix, key),
14382 None => key,
14383 };
14384 req_builder = req_builder.header("Sudo", value);
14385 };
14386 if let Some(ref auth_conf) = configuration.basic_auth {
14387 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14388 };
14389
14390 let req = req_builder.build()?;
14391 let resp = configuration.client.execute(req).await?;
14392
14393 let status = resp.status();
14394 let content_type = resp
14395 .headers()
14396 .get("content-type")
14397 .and_then(|v| v.to_str().ok())
14398 .unwrap_or("application/octet-stream");
14399 let content_type = super::ContentType::from(content_type);
14400
14401 if !status.is_client_error() && !status.is_server_error() {
14402 let content = resp.text().await?;
14403 match content_type {
14404 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14405 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GitHook>`"))),
14406 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::GitHook>`")))),
14407 }
14408 } else {
14409 let content = resp.text().await?;
14410 let entity: Option<RepoListGitHooksError> = serde_json::from_str(&content).ok();
14411 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14412 }
14413}
14414
14415pub async fn repo_list_git_refs(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str) -> Result<Vec<models::Reference>, Error<RepoListGitRefsError>> {
14416 let p_path_owner = owner;
14418 let p_path_repo = repo;
14419 let p_path_ref = r#ref;
14420
14421 let uri_str = format!("{}/repos/{owner}/{repo}/git/refs/{ref}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), ref=crate::apis::urlencode(p_path_ref));
14422 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14423
14424 if let Some(ref apikey) = configuration.api_key {
14425 let key = apikey.key.clone();
14426 let value = match apikey.prefix {
14427 Some(ref prefix) => format!("{} {}", prefix, key),
14428 None => key,
14429 };
14430 req_builder = req_builder.query(&[("access_token", value)]);
14431 }
14432 if let Some(ref apikey) = configuration.api_key {
14433 let key = apikey.key.clone();
14434 let value = match apikey.prefix {
14435 Some(ref prefix) => format!("{} {}", prefix, key),
14436 None => key,
14437 };
14438 req_builder = req_builder.query(&[("sudo", value)]);
14439 }
14440 if let Some(ref apikey) = configuration.api_key {
14441 let key = apikey.key.clone();
14442 let value = match apikey.prefix {
14443 Some(ref prefix) => format!("{} {}", prefix, key),
14444 None => key,
14445 };
14446 req_builder = req_builder.query(&[("token", value)]);
14447 }
14448 if let Some(ref user_agent) = configuration.user_agent {
14449 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14450 }
14451 if let Some(ref apikey) = configuration.api_key {
14452 let key = apikey.key.clone();
14453 let value = match apikey.prefix {
14454 Some(ref prefix) => format!("{} {}", prefix, key),
14455 None => key,
14456 };
14457 req_builder = req_builder.header("X-GITEA-OTP", value);
14458 };
14459 if let Some(ref apikey) = configuration.api_key {
14460 let key = apikey.key.clone();
14461 let value = match apikey.prefix {
14462 Some(ref prefix) => format!("{} {}", prefix, key),
14463 None => key,
14464 };
14465 req_builder = req_builder.header("Authorization", value);
14466 };
14467 if let Some(ref apikey) = configuration.api_key {
14468 let key = apikey.key.clone();
14469 let value = match apikey.prefix {
14470 Some(ref prefix) => format!("{} {}", prefix, key),
14471 None => key,
14472 };
14473 req_builder = req_builder.header("Sudo", value);
14474 };
14475 if let Some(ref auth_conf) = configuration.basic_auth {
14476 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14477 };
14478
14479 let req = req_builder.build()?;
14480 let resp = configuration.client.execute(req).await?;
14481
14482 let status = resp.status();
14483 let content_type = resp
14484 .headers()
14485 .get("content-type")
14486 .and_then(|v| v.to_str().ok())
14487 .unwrap_or("application/octet-stream");
14488 let content_type = super::ContentType::from(content_type);
14489
14490 if !status.is_client_error() && !status.is_server_error() {
14491 let content = resp.text().await?;
14492 match content_type {
14493 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14494 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reference>`"))),
14495 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::Reference>`")))),
14496 }
14497 } else {
14498 let content = resp.text().await?;
14499 let entity: Option<RepoListGitRefsError> = serde_json::from_str(&content).ok();
14500 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14501 }
14502}
14503
14504pub async fn repo_list_hooks(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Hook>, Error<RepoListHooksError>> {
14505 let p_path_owner = owner;
14507 let p_path_repo = repo;
14508 let p_query_page = page;
14509 let p_query_limit = limit;
14510
14511 let uri_str = format!("{}/repos/{owner}/{repo}/hooks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14512 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14513
14514 if let Some(ref param_value) = p_query_page {
14515 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
14516 }
14517 if let Some(ref param_value) = p_query_limit {
14518 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
14519 }
14520 if let Some(ref apikey) = configuration.api_key {
14521 let key = apikey.key.clone();
14522 let value = match apikey.prefix {
14523 Some(ref prefix) => format!("{} {}", prefix, key),
14524 None => key,
14525 };
14526 req_builder = req_builder.query(&[("access_token", value)]);
14527 }
14528 if let Some(ref apikey) = configuration.api_key {
14529 let key = apikey.key.clone();
14530 let value = match apikey.prefix {
14531 Some(ref prefix) => format!("{} {}", prefix, key),
14532 None => key,
14533 };
14534 req_builder = req_builder.query(&[("sudo", value)]);
14535 }
14536 if let Some(ref apikey) = configuration.api_key {
14537 let key = apikey.key.clone();
14538 let value = match apikey.prefix {
14539 Some(ref prefix) => format!("{} {}", prefix, key),
14540 None => key,
14541 };
14542 req_builder = req_builder.query(&[("token", value)]);
14543 }
14544 if let Some(ref user_agent) = configuration.user_agent {
14545 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14546 }
14547 if let Some(ref apikey) = configuration.api_key {
14548 let key = apikey.key.clone();
14549 let value = match apikey.prefix {
14550 Some(ref prefix) => format!("{} {}", prefix, key),
14551 None => key,
14552 };
14553 req_builder = req_builder.header("X-GITEA-OTP", value);
14554 };
14555 if let Some(ref apikey) = configuration.api_key {
14556 let key = apikey.key.clone();
14557 let value = match apikey.prefix {
14558 Some(ref prefix) => format!("{} {}", prefix, key),
14559 None => key,
14560 };
14561 req_builder = req_builder.header("Authorization", value);
14562 };
14563 if let Some(ref apikey) = configuration.api_key {
14564 let key = apikey.key.clone();
14565 let value = match apikey.prefix {
14566 Some(ref prefix) => format!("{} {}", prefix, key),
14567 None => key,
14568 };
14569 req_builder = req_builder.header("Sudo", value);
14570 };
14571 if let Some(ref auth_conf) = configuration.basic_auth {
14572 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14573 };
14574
14575 let req = req_builder.build()?;
14576 let resp = configuration.client.execute(req).await?;
14577
14578 let status = resp.status();
14579 let content_type = resp
14580 .headers()
14581 .get("content-type")
14582 .and_then(|v| v.to_str().ok())
14583 .unwrap_or("application/octet-stream");
14584 let content_type = super::ContentType::from(content_type);
14585
14586 if !status.is_client_error() && !status.is_server_error() {
14587 let content = resp.text().await?;
14588 match content_type {
14589 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14590 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Hook>`"))),
14591 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>`")))),
14592 }
14593 } else {
14594 let content = resp.text().await?;
14595 let entity: Option<RepoListHooksError> = serde_json::from_str(&content).ok();
14596 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14597 }
14598}
14599
14600pub async fn repo_list_keys(configuration: &configuration::Configuration, owner: &str, repo: &str, key_id: Option<i32>, fingerprint: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::DeployKey>, Error<RepoListKeysError>> {
14601 let p_path_owner = owner;
14603 let p_path_repo = repo;
14604 let p_query_key_id = key_id;
14605 let p_query_fingerprint = fingerprint;
14606 let p_query_page = page;
14607 let p_query_limit = limit;
14608
14609 let uri_str = format!("{}/repos/{owner}/{repo}/keys", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14610 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14611
14612 if let Some(ref param_value) = p_query_key_id {
14613 req_builder = req_builder.query(&[("key_id", ¶m_value.to_string())]);
14614 }
14615 if let Some(ref param_value) = p_query_fingerprint {
14616 req_builder = req_builder.query(&[("fingerprint", ¶m_value.to_string())]);
14617 }
14618 if let Some(ref param_value) = p_query_page {
14619 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
14620 }
14621 if let Some(ref param_value) = p_query_limit {
14622 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
14623 }
14624 if let Some(ref apikey) = configuration.api_key {
14625 let key = apikey.key.clone();
14626 let value = match apikey.prefix {
14627 Some(ref prefix) => format!("{} {}", prefix, key),
14628 None => key,
14629 };
14630 req_builder = req_builder.query(&[("access_token", value)]);
14631 }
14632 if let Some(ref apikey) = configuration.api_key {
14633 let key = apikey.key.clone();
14634 let value = match apikey.prefix {
14635 Some(ref prefix) => format!("{} {}", prefix, key),
14636 None => key,
14637 };
14638 req_builder = req_builder.query(&[("sudo", value)]);
14639 }
14640 if let Some(ref apikey) = configuration.api_key {
14641 let key = apikey.key.clone();
14642 let value = match apikey.prefix {
14643 Some(ref prefix) => format!("{} {}", prefix, key),
14644 None => key,
14645 };
14646 req_builder = req_builder.query(&[("token", value)]);
14647 }
14648 if let Some(ref user_agent) = configuration.user_agent {
14649 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14650 }
14651 if let Some(ref apikey) = configuration.api_key {
14652 let key = apikey.key.clone();
14653 let value = match apikey.prefix {
14654 Some(ref prefix) => format!("{} {}", prefix, key),
14655 None => key,
14656 };
14657 req_builder = req_builder.header("X-GITEA-OTP", value);
14658 };
14659 if let Some(ref apikey) = configuration.api_key {
14660 let key = apikey.key.clone();
14661 let value = match apikey.prefix {
14662 Some(ref prefix) => format!("{} {}", prefix, key),
14663 None => key,
14664 };
14665 req_builder = req_builder.header("Authorization", value);
14666 };
14667 if let Some(ref apikey) = configuration.api_key {
14668 let key = apikey.key.clone();
14669 let value = match apikey.prefix {
14670 Some(ref prefix) => format!("{} {}", prefix, key),
14671 None => key,
14672 };
14673 req_builder = req_builder.header("Sudo", value);
14674 };
14675 if let Some(ref auth_conf) = configuration.basic_auth {
14676 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14677 };
14678
14679 let req = req_builder.build()?;
14680 let resp = configuration.client.execute(req).await?;
14681
14682 let status = resp.status();
14683 let content_type = resp
14684 .headers()
14685 .get("content-type")
14686 .and_then(|v| v.to_str().ok())
14687 .unwrap_or("application/octet-stream");
14688 let content_type = super::ContentType::from(content_type);
14689
14690 if !status.is_client_error() && !status.is_server_error() {
14691 let content = resp.text().await?;
14692 match content_type {
14693 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14694 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::DeployKey>`"))),
14695 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::DeployKey>`")))),
14696 }
14697 } else {
14698 let content = resp.text().await?;
14699 let entity: Option<RepoListKeysError> = serde_json::from_str(&content).ok();
14700 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14701 }
14702}
14703
14704pub async fn repo_list_pinned_issues(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::Issue>, Error<RepoListPinnedIssuesError>> {
14705 let p_path_owner = owner;
14707 let p_path_repo = repo;
14708
14709 let uri_str = format!("{}/repos/{owner}/{repo}/issues/pinned", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14710 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14711
14712 if let Some(ref apikey) = configuration.api_key {
14713 let key = apikey.key.clone();
14714 let value = match apikey.prefix {
14715 Some(ref prefix) => format!("{} {}", prefix, key),
14716 None => key,
14717 };
14718 req_builder = req_builder.query(&[("access_token", value)]);
14719 }
14720 if let Some(ref apikey) = configuration.api_key {
14721 let key = apikey.key.clone();
14722 let value = match apikey.prefix {
14723 Some(ref prefix) => format!("{} {}", prefix, key),
14724 None => key,
14725 };
14726 req_builder = req_builder.query(&[("sudo", value)]);
14727 }
14728 if let Some(ref apikey) = configuration.api_key {
14729 let key = apikey.key.clone();
14730 let value = match apikey.prefix {
14731 Some(ref prefix) => format!("{} {}", prefix, key),
14732 None => key,
14733 };
14734 req_builder = req_builder.query(&[("token", value)]);
14735 }
14736 if let Some(ref user_agent) = configuration.user_agent {
14737 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14738 }
14739 if let Some(ref apikey) = configuration.api_key {
14740 let key = apikey.key.clone();
14741 let value = match apikey.prefix {
14742 Some(ref prefix) => format!("{} {}", prefix, key),
14743 None => key,
14744 };
14745 req_builder = req_builder.header("X-GITEA-OTP", value);
14746 };
14747 if let Some(ref apikey) = configuration.api_key {
14748 let key = apikey.key.clone();
14749 let value = match apikey.prefix {
14750 Some(ref prefix) => format!("{} {}", prefix, key),
14751 None => key,
14752 };
14753 req_builder = req_builder.header("Authorization", value);
14754 };
14755 if let Some(ref apikey) = configuration.api_key {
14756 let key = apikey.key.clone();
14757 let value = match apikey.prefix {
14758 Some(ref prefix) => format!("{} {}", prefix, key),
14759 None => key,
14760 };
14761 req_builder = req_builder.header("Sudo", value);
14762 };
14763 if let Some(ref auth_conf) = configuration.basic_auth {
14764 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14765 };
14766
14767 let req = req_builder.build()?;
14768 let resp = configuration.client.execute(req).await?;
14769
14770 let status = resp.status();
14771 let content_type = resp
14772 .headers()
14773 .get("content-type")
14774 .and_then(|v| v.to_str().ok())
14775 .unwrap_or("application/octet-stream");
14776 let content_type = super::ContentType::from(content_type);
14777
14778 if !status.is_client_error() && !status.is_server_error() {
14779 let content = resp.text().await?;
14780 match content_type {
14781 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14782 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))),
14783 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::Issue>`")))),
14784 }
14785 } else {
14786 let content = resp.text().await?;
14787 let entity: Option<RepoListPinnedIssuesError> = serde_json::from_str(&content).ok();
14788 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14789 }
14790}
14791
14792pub async fn repo_list_pinned_pull_requests(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::PullRequest>, Error<RepoListPinnedPullRequestsError>> {
14793 let p_path_owner = owner;
14795 let p_path_repo = repo;
14796
14797 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/pinned", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14798 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14799
14800 if let Some(ref apikey) = configuration.api_key {
14801 let key = apikey.key.clone();
14802 let value = match apikey.prefix {
14803 Some(ref prefix) => format!("{} {}", prefix, key),
14804 None => key,
14805 };
14806 req_builder = req_builder.query(&[("access_token", value)]);
14807 }
14808 if let Some(ref apikey) = configuration.api_key {
14809 let key = apikey.key.clone();
14810 let value = match apikey.prefix {
14811 Some(ref prefix) => format!("{} {}", prefix, key),
14812 None => key,
14813 };
14814 req_builder = req_builder.query(&[("sudo", value)]);
14815 }
14816 if let Some(ref apikey) = configuration.api_key {
14817 let key = apikey.key.clone();
14818 let value = match apikey.prefix {
14819 Some(ref prefix) => format!("{} {}", prefix, key),
14820 None => key,
14821 };
14822 req_builder = req_builder.query(&[("token", value)]);
14823 }
14824 if let Some(ref user_agent) = configuration.user_agent {
14825 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14826 }
14827 if let Some(ref apikey) = configuration.api_key {
14828 let key = apikey.key.clone();
14829 let value = match apikey.prefix {
14830 Some(ref prefix) => format!("{} {}", prefix, key),
14831 None => key,
14832 };
14833 req_builder = req_builder.header("X-GITEA-OTP", value);
14834 };
14835 if let Some(ref apikey) = configuration.api_key {
14836 let key = apikey.key.clone();
14837 let value = match apikey.prefix {
14838 Some(ref prefix) => format!("{} {}", prefix, key),
14839 None => key,
14840 };
14841 req_builder = req_builder.header("Authorization", value);
14842 };
14843 if let Some(ref apikey) = configuration.api_key {
14844 let key = apikey.key.clone();
14845 let value = match apikey.prefix {
14846 Some(ref prefix) => format!("{} {}", prefix, key),
14847 None => key,
14848 };
14849 req_builder = req_builder.header("Sudo", value);
14850 };
14851 if let Some(ref auth_conf) = configuration.basic_auth {
14852 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14853 };
14854
14855 let req = req_builder.build()?;
14856 let resp = configuration.client.execute(req).await?;
14857
14858 let status = resp.status();
14859 let content_type = resp
14860 .headers()
14861 .get("content-type")
14862 .and_then(|v| v.to_str().ok())
14863 .unwrap_or("application/octet-stream");
14864 let content_type = super::ContentType::from(content_type);
14865
14866 if !status.is_client_error() && !status.is_server_error() {
14867 let content = resp.text().await?;
14868 match content_type {
14869 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14870 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullRequest>`"))),
14871 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::PullRequest>`")))),
14872 }
14873 } else {
14874 let content = resp.text().await?;
14875 let entity: Option<RepoListPinnedPullRequestsError> = serde_json::from_str(&content).ok();
14876 Err(Error::ResponseError(ResponseContent { status, content, entity }))
14877 }
14878}
14879
14880pub async fn repo_list_pull_requests(configuration: &configuration::Configuration, owner: &str, repo: &str, base_branch: Option<&str>, state: Option<&str>, sort: Option<&str>, milestone: Option<i64>, labels: Option<Vec<i64>>, poster: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::PullRequest>, Error<RepoListPullRequestsError>> {
14881 let p_path_owner = owner;
14883 let p_path_repo = repo;
14884 let p_query_base_branch = base_branch;
14885 let p_query_state = state;
14886 let p_query_sort = sort;
14887 let p_query_milestone = milestone;
14888 let p_query_labels = labels;
14889 let p_query_poster = poster;
14890 let p_query_page = page;
14891 let p_query_limit = limit;
14892
14893 let uri_str = format!("{}/repos/{owner}/{repo}/pulls", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
14894 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
14895
14896 if let Some(ref param_value) = p_query_base_branch {
14897 req_builder = req_builder.query(&[("base_branch", ¶m_value.to_string())]);
14898 }
14899 if let Some(ref param_value) = p_query_state {
14900 req_builder = req_builder.query(&[("state", ¶m_value.to_string())]);
14901 }
14902 if let Some(ref param_value) = p_query_sort {
14903 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
14904 }
14905 if let Some(ref param_value) = p_query_milestone {
14906 req_builder = req_builder.query(&[("milestone", ¶m_value.to_string())]);
14907 }
14908 if let Some(ref param_value) = p_query_labels {
14909 req_builder = match "multi" {
14910 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("labels".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
14911 _ => req_builder.query(&[("labels", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
14912 };
14913 }
14914 if let Some(ref param_value) = p_query_poster {
14915 req_builder = req_builder.query(&[("poster", ¶m_value.to_string())]);
14916 }
14917 if let Some(ref param_value) = p_query_page {
14918 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
14919 }
14920 if let Some(ref param_value) = p_query_limit {
14921 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
14922 }
14923 if let Some(ref apikey) = configuration.api_key {
14924 let key = apikey.key.clone();
14925 let value = match apikey.prefix {
14926 Some(ref prefix) => format!("{} {}", prefix, key),
14927 None => key,
14928 };
14929 req_builder = req_builder.query(&[("access_token", value)]);
14930 }
14931 if let Some(ref apikey) = configuration.api_key {
14932 let key = apikey.key.clone();
14933 let value = match apikey.prefix {
14934 Some(ref prefix) => format!("{} {}", prefix, key),
14935 None => key,
14936 };
14937 req_builder = req_builder.query(&[("sudo", value)]);
14938 }
14939 if let Some(ref apikey) = configuration.api_key {
14940 let key = apikey.key.clone();
14941 let value = match apikey.prefix {
14942 Some(ref prefix) => format!("{} {}", prefix, key),
14943 None => key,
14944 };
14945 req_builder = req_builder.query(&[("token", value)]);
14946 }
14947 if let Some(ref user_agent) = configuration.user_agent {
14948 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
14949 }
14950 if let Some(ref apikey) = configuration.api_key {
14951 let key = apikey.key.clone();
14952 let value = match apikey.prefix {
14953 Some(ref prefix) => format!("{} {}", prefix, key),
14954 None => key,
14955 };
14956 req_builder = req_builder.header("X-GITEA-OTP", value);
14957 };
14958 if let Some(ref apikey) = configuration.api_key {
14959 let key = apikey.key.clone();
14960 let value = match apikey.prefix {
14961 Some(ref prefix) => format!("{} {}", prefix, key),
14962 None => key,
14963 };
14964 req_builder = req_builder.header("Authorization", value);
14965 };
14966 if let Some(ref apikey) = configuration.api_key {
14967 let key = apikey.key.clone();
14968 let value = match apikey.prefix {
14969 Some(ref prefix) => format!("{} {}", prefix, key),
14970 None => key,
14971 };
14972 req_builder = req_builder.header("Sudo", value);
14973 };
14974 if let Some(ref auth_conf) = configuration.basic_auth {
14975 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
14976 };
14977
14978 let req = req_builder.build()?;
14979 let resp = configuration.client.execute(req).await?;
14980
14981 let status = resp.status();
14982 let content_type = resp
14983 .headers()
14984 .get("content-type")
14985 .and_then(|v| v.to_str().ok())
14986 .unwrap_or("application/octet-stream");
14987 let content_type = super::ContentType::from(content_type);
14988
14989 if !status.is_client_error() && !status.is_server_error() {
14990 let content = resp.text().await?;
14991 match content_type {
14992 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
14993 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullRequest>`"))),
14994 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::PullRequest>`")))),
14995 }
14996 } else {
14997 let content = resp.text().await?;
14998 let entity: Option<RepoListPullRequestsError> = serde_json::from_str(&content).ok();
14999 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15000 }
15001}
15002
15003pub async fn repo_list_pull_reviews(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::PullReview>, Error<RepoListPullReviewsError>> {
15004 let p_path_owner = owner;
15006 let p_path_repo = repo;
15007 let p_path_index = index;
15008 let p_query_page = page;
15009 let p_query_limit = limit;
15010
15011 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
15012 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15013
15014 if let Some(ref param_value) = p_query_page {
15015 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15016 }
15017 if let Some(ref param_value) = p_query_limit {
15018 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15019 }
15020 if let Some(ref apikey) = configuration.api_key {
15021 let key = apikey.key.clone();
15022 let value = match apikey.prefix {
15023 Some(ref prefix) => format!("{} {}", prefix, key),
15024 None => key,
15025 };
15026 req_builder = req_builder.query(&[("access_token", value)]);
15027 }
15028 if let Some(ref apikey) = configuration.api_key {
15029 let key = apikey.key.clone();
15030 let value = match apikey.prefix {
15031 Some(ref prefix) => format!("{} {}", prefix, key),
15032 None => key,
15033 };
15034 req_builder = req_builder.query(&[("sudo", value)]);
15035 }
15036 if let Some(ref apikey) = configuration.api_key {
15037 let key = apikey.key.clone();
15038 let value = match apikey.prefix {
15039 Some(ref prefix) => format!("{} {}", prefix, key),
15040 None => key,
15041 };
15042 req_builder = req_builder.query(&[("token", value)]);
15043 }
15044 if let Some(ref user_agent) = configuration.user_agent {
15045 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15046 }
15047 if let Some(ref apikey) = configuration.api_key {
15048 let key = apikey.key.clone();
15049 let value = match apikey.prefix {
15050 Some(ref prefix) => format!("{} {}", prefix, key),
15051 None => key,
15052 };
15053 req_builder = req_builder.header("X-GITEA-OTP", value);
15054 };
15055 if let Some(ref apikey) = configuration.api_key {
15056 let key = apikey.key.clone();
15057 let value = match apikey.prefix {
15058 Some(ref prefix) => format!("{} {}", prefix, key),
15059 None => key,
15060 };
15061 req_builder = req_builder.header("Authorization", value);
15062 };
15063 if let Some(ref apikey) = configuration.api_key {
15064 let key = apikey.key.clone();
15065 let value = match apikey.prefix {
15066 Some(ref prefix) => format!("{} {}", prefix, key),
15067 None => key,
15068 };
15069 req_builder = req_builder.header("Sudo", value);
15070 };
15071 if let Some(ref auth_conf) = configuration.basic_auth {
15072 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15073 };
15074
15075 let req = req_builder.build()?;
15076 let resp = configuration.client.execute(req).await?;
15077
15078 let status = resp.status();
15079 let content_type = resp
15080 .headers()
15081 .get("content-type")
15082 .and_then(|v| v.to_str().ok())
15083 .unwrap_or("application/octet-stream");
15084 let content_type = super::ContentType::from(content_type);
15085
15086 if !status.is_client_error() && !status.is_server_error() {
15087 let content = resp.text().await?;
15088 match content_type {
15089 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15090 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullReview>`"))),
15091 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::PullReview>`")))),
15092 }
15093 } else {
15094 let content = resp.text().await?;
15095 let entity: Option<RepoListPullReviewsError> = serde_json::from_str(&content).ok();
15096 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15097 }
15098}
15099
15100pub async fn repo_list_push_mirrors(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::PushMirror>, Error<RepoListPushMirrorsError>> {
15101 let p_path_owner = owner;
15103 let p_path_repo = repo;
15104 let p_query_page = page;
15105 let p_query_limit = limit;
15106
15107 let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
15108 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15109
15110 if let Some(ref param_value) = p_query_page {
15111 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15112 }
15113 if let Some(ref param_value) = p_query_limit {
15114 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15115 }
15116 if let Some(ref apikey) = configuration.api_key {
15117 let key = apikey.key.clone();
15118 let value = match apikey.prefix {
15119 Some(ref prefix) => format!("{} {}", prefix, key),
15120 None => key,
15121 };
15122 req_builder = req_builder.query(&[("access_token", value)]);
15123 }
15124 if let Some(ref apikey) = configuration.api_key {
15125 let key = apikey.key.clone();
15126 let value = match apikey.prefix {
15127 Some(ref prefix) => format!("{} {}", prefix, key),
15128 None => key,
15129 };
15130 req_builder = req_builder.query(&[("sudo", value)]);
15131 }
15132 if let Some(ref apikey) = configuration.api_key {
15133 let key = apikey.key.clone();
15134 let value = match apikey.prefix {
15135 Some(ref prefix) => format!("{} {}", prefix, key),
15136 None => key,
15137 };
15138 req_builder = req_builder.query(&[("token", value)]);
15139 }
15140 if let Some(ref user_agent) = configuration.user_agent {
15141 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15142 }
15143 if let Some(ref apikey) = configuration.api_key {
15144 let key = apikey.key.clone();
15145 let value = match apikey.prefix {
15146 Some(ref prefix) => format!("{} {}", prefix, key),
15147 None => key,
15148 };
15149 req_builder = req_builder.header("X-GITEA-OTP", value);
15150 };
15151 if let Some(ref apikey) = configuration.api_key {
15152 let key = apikey.key.clone();
15153 let value = match apikey.prefix {
15154 Some(ref prefix) => format!("{} {}", prefix, key),
15155 None => key,
15156 };
15157 req_builder = req_builder.header("Authorization", value);
15158 };
15159 if let Some(ref apikey) = configuration.api_key {
15160 let key = apikey.key.clone();
15161 let value = match apikey.prefix {
15162 Some(ref prefix) => format!("{} {}", prefix, key),
15163 None => key,
15164 };
15165 req_builder = req_builder.header("Sudo", value);
15166 };
15167 if let Some(ref auth_conf) = configuration.basic_auth {
15168 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15169 };
15170
15171 let req = req_builder.build()?;
15172 let resp = configuration.client.execute(req).await?;
15173
15174 let status = resp.status();
15175 let content_type = resp
15176 .headers()
15177 .get("content-type")
15178 .and_then(|v| v.to_str().ok())
15179 .unwrap_or("application/octet-stream");
15180 let content_type = super::ContentType::from(content_type);
15181
15182 if !status.is_client_error() && !status.is_server_error() {
15183 let content = resp.text().await?;
15184 match content_type {
15185 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15186 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PushMirror>`"))),
15187 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::PushMirror>`")))),
15188 }
15189 } else {
15190 let content = resp.text().await?;
15191 let entity: Option<RepoListPushMirrorsError> = serde_json::from_str(&content).ok();
15192 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15193 }
15194}
15195
15196pub async fn repo_list_release_attachments(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<Vec<models::Attachment>, Error<RepoListReleaseAttachmentsError>> {
15197 let p_path_owner = owner;
15199 let p_path_repo = repo;
15200 let p_path_id = id;
15201
15202 let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
15203 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15204
15205 if let Some(ref apikey) = configuration.api_key {
15206 let key = apikey.key.clone();
15207 let value = match apikey.prefix {
15208 Some(ref prefix) => format!("{} {}", prefix, key),
15209 None => key,
15210 };
15211 req_builder = req_builder.query(&[("access_token", value)]);
15212 }
15213 if let Some(ref apikey) = configuration.api_key {
15214 let key = apikey.key.clone();
15215 let value = match apikey.prefix {
15216 Some(ref prefix) => format!("{} {}", prefix, key),
15217 None => key,
15218 };
15219 req_builder = req_builder.query(&[("sudo", value)]);
15220 }
15221 if let Some(ref apikey) = configuration.api_key {
15222 let key = apikey.key.clone();
15223 let value = match apikey.prefix {
15224 Some(ref prefix) => format!("{} {}", prefix, key),
15225 None => key,
15226 };
15227 req_builder = req_builder.query(&[("token", value)]);
15228 }
15229 if let Some(ref user_agent) = configuration.user_agent {
15230 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15231 }
15232 if let Some(ref apikey) = configuration.api_key {
15233 let key = apikey.key.clone();
15234 let value = match apikey.prefix {
15235 Some(ref prefix) => format!("{} {}", prefix, key),
15236 None => key,
15237 };
15238 req_builder = req_builder.header("X-GITEA-OTP", value);
15239 };
15240 if let Some(ref apikey) = configuration.api_key {
15241 let key = apikey.key.clone();
15242 let value = match apikey.prefix {
15243 Some(ref prefix) => format!("{} {}", prefix, key),
15244 None => key,
15245 };
15246 req_builder = req_builder.header("Authorization", value);
15247 };
15248 if let Some(ref apikey) = configuration.api_key {
15249 let key = apikey.key.clone();
15250 let value = match apikey.prefix {
15251 Some(ref prefix) => format!("{} {}", prefix, key),
15252 None => key,
15253 };
15254 req_builder = req_builder.header("Sudo", value);
15255 };
15256 if let Some(ref auth_conf) = configuration.basic_auth {
15257 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15258 };
15259
15260 let req = req_builder.build()?;
15261 let resp = configuration.client.execute(req).await?;
15262
15263 let status = resp.status();
15264 let content_type = resp
15265 .headers()
15266 .get("content-type")
15267 .and_then(|v| v.to_str().ok())
15268 .unwrap_or("application/octet-stream");
15269 let content_type = super::ContentType::from(content_type);
15270
15271 if !status.is_client_error() && !status.is_server_error() {
15272 let content = resp.text().await?;
15273 match content_type {
15274 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15275 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Attachment>`"))),
15276 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::Attachment>`")))),
15277 }
15278 } else {
15279 let content = resp.text().await?;
15280 let entity: Option<RepoListReleaseAttachmentsError> = serde_json::from_str(&content).ok();
15281 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15282 }
15283}
15284
15285pub async fn repo_list_releases(configuration: &configuration::Configuration, owner: &str, repo: &str, draft: Option<bool>, pre_release: Option<bool>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Release>, Error<RepoListReleasesError>> {
15286 let p_path_owner = owner;
15288 let p_path_repo = repo;
15289 let p_query_draft = draft;
15290 let p_query_pre_release = pre_release;
15291 let p_query_page = page;
15292 let p_query_limit = limit;
15293
15294 let uri_str = format!("{}/repos/{owner}/{repo}/releases", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
15295 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15296
15297 if let Some(ref param_value) = p_query_draft {
15298 req_builder = req_builder.query(&[("draft", ¶m_value.to_string())]);
15299 }
15300 if let Some(ref param_value) = p_query_pre_release {
15301 req_builder = req_builder.query(&[("pre-release", ¶m_value.to_string())]);
15302 }
15303 if let Some(ref param_value) = p_query_page {
15304 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15305 }
15306 if let Some(ref param_value) = p_query_limit {
15307 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15308 }
15309 if let Some(ref apikey) = configuration.api_key {
15310 let key = apikey.key.clone();
15311 let value = match apikey.prefix {
15312 Some(ref prefix) => format!("{} {}", prefix, key),
15313 None => key,
15314 };
15315 req_builder = req_builder.query(&[("access_token", value)]);
15316 }
15317 if let Some(ref apikey) = configuration.api_key {
15318 let key = apikey.key.clone();
15319 let value = match apikey.prefix {
15320 Some(ref prefix) => format!("{} {}", prefix, key),
15321 None => key,
15322 };
15323 req_builder = req_builder.query(&[("sudo", value)]);
15324 }
15325 if let Some(ref apikey) = configuration.api_key {
15326 let key = apikey.key.clone();
15327 let value = match apikey.prefix {
15328 Some(ref prefix) => format!("{} {}", prefix, key),
15329 None => key,
15330 };
15331 req_builder = req_builder.query(&[("token", value)]);
15332 }
15333 if let Some(ref user_agent) = configuration.user_agent {
15334 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15335 }
15336 if let Some(ref apikey) = configuration.api_key {
15337 let key = apikey.key.clone();
15338 let value = match apikey.prefix {
15339 Some(ref prefix) => format!("{} {}", prefix, key),
15340 None => key,
15341 };
15342 req_builder = req_builder.header("X-GITEA-OTP", value);
15343 };
15344 if let Some(ref apikey) = configuration.api_key {
15345 let key = apikey.key.clone();
15346 let value = match apikey.prefix {
15347 Some(ref prefix) => format!("{} {}", prefix, key),
15348 None => key,
15349 };
15350 req_builder = req_builder.header("Authorization", value);
15351 };
15352 if let Some(ref apikey) = configuration.api_key {
15353 let key = apikey.key.clone();
15354 let value = match apikey.prefix {
15355 Some(ref prefix) => format!("{} {}", prefix, key),
15356 None => key,
15357 };
15358 req_builder = req_builder.header("Sudo", value);
15359 };
15360 if let Some(ref auth_conf) = configuration.basic_auth {
15361 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15362 };
15363
15364 let req = req_builder.build()?;
15365 let resp = configuration.client.execute(req).await?;
15366
15367 let status = resp.status();
15368 let content_type = resp
15369 .headers()
15370 .get("content-type")
15371 .and_then(|v| v.to_str().ok())
15372 .unwrap_or("application/octet-stream");
15373 let content_type = super::ContentType::from(content_type);
15374
15375 if !status.is_client_error() && !status.is_server_error() {
15376 let content = resp.text().await?;
15377 match content_type {
15378 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15379 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Release>`"))),
15380 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::Release>`")))),
15381 }
15382 } else {
15383 let content = resp.text().await?;
15384 let entity: Option<RepoListReleasesError> = serde_json::from_str(&content).ok();
15385 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15386 }
15387}
15388
15389pub async fn repo_list_stargazers(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<RepoListStargazersError>> {
15390 let p_path_owner = owner;
15392 let p_path_repo = repo;
15393 let p_query_page = page;
15394 let p_query_limit = limit;
15395
15396 let uri_str = format!("{}/repos/{owner}/{repo}/stargazers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
15397 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15398
15399 if let Some(ref param_value) = p_query_page {
15400 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15401 }
15402 if let Some(ref param_value) = p_query_limit {
15403 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15404 }
15405 if let Some(ref apikey) = configuration.api_key {
15406 let key = apikey.key.clone();
15407 let value = match apikey.prefix {
15408 Some(ref prefix) => format!("{} {}", prefix, key),
15409 None => key,
15410 };
15411 req_builder = req_builder.query(&[("access_token", value)]);
15412 }
15413 if let Some(ref apikey) = configuration.api_key {
15414 let key = apikey.key.clone();
15415 let value = match apikey.prefix {
15416 Some(ref prefix) => format!("{} {}", prefix, key),
15417 None => key,
15418 };
15419 req_builder = req_builder.query(&[("sudo", value)]);
15420 }
15421 if let Some(ref apikey) = configuration.api_key {
15422 let key = apikey.key.clone();
15423 let value = match apikey.prefix {
15424 Some(ref prefix) => format!("{} {}", prefix, key),
15425 None => key,
15426 };
15427 req_builder = req_builder.query(&[("token", value)]);
15428 }
15429 if let Some(ref user_agent) = configuration.user_agent {
15430 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15431 }
15432 if let Some(ref apikey) = configuration.api_key {
15433 let key = apikey.key.clone();
15434 let value = match apikey.prefix {
15435 Some(ref prefix) => format!("{} {}", prefix, key),
15436 None => key,
15437 };
15438 req_builder = req_builder.header("X-GITEA-OTP", value);
15439 };
15440 if let Some(ref apikey) = configuration.api_key {
15441 let key = apikey.key.clone();
15442 let value = match apikey.prefix {
15443 Some(ref prefix) => format!("{} {}", prefix, key),
15444 None => key,
15445 };
15446 req_builder = req_builder.header("Authorization", value);
15447 };
15448 if let Some(ref apikey) = configuration.api_key {
15449 let key = apikey.key.clone();
15450 let value = match apikey.prefix {
15451 Some(ref prefix) => format!("{} {}", prefix, key),
15452 None => key,
15453 };
15454 req_builder = req_builder.header("Sudo", value);
15455 };
15456 if let Some(ref auth_conf) = configuration.basic_auth {
15457 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15458 };
15459
15460 let req = req_builder.build()?;
15461 let resp = configuration.client.execute(req).await?;
15462
15463 let status = resp.status();
15464 let content_type = resp
15465 .headers()
15466 .get("content-type")
15467 .and_then(|v| v.to_str().ok())
15468 .unwrap_or("application/octet-stream");
15469 let content_type = super::ContentType::from(content_type);
15470
15471 if !status.is_client_error() && !status.is_server_error() {
15472 let content = resp.text().await?;
15473 match content_type {
15474 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15475 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
15476 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>`")))),
15477 }
15478 } else {
15479 let content = resp.text().await?;
15480 let entity: Option<RepoListStargazersError> = serde_json::from_str(&content).ok();
15481 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15482 }
15483}
15484
15485pub async fn repo_list_statuses(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, sort: Option<&str>, state: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::CommitStatus>, Error<RepoListStatusesError>> {
15486 let p_path_owner = owner;
15488 let p_path_repo = repo;
15489 let p_path_sha = sha;
15490 let p_query_sort = sort;
15491 let p_query_state = state;
15492 let p_query_page = page;
15493 let p_query_limit = limit;
15494
15495 let uri_str = format!("{}/repos/{owner}/{repo}/statuses/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
15496 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15497
15498 if let Some(ref param_value) = p_query_sort {
15499 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
15500 }
15501 if let Some(ref param_value) = p_query_state {
15502 req_builder = req_builder.query(&[("state", ¶m_value.to_string())]);
15503 }
15504 if let Some(ref param_value) = p_query_page {
15505 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15506 }
15507 if let Some(ref param_value) = p_query_limit {
15508 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15509 }
15510 if let Some(ref apikey) = configuration.api_key {
15511 let key = apikey.key.clone();
15512 let value = match apikey.prefix {
15513 Some(ref prefix) => format!("{} {}", prefix, key),
15514 None => key,
15515 };
15516 req_builder = req_builder.query(&[("access_token", value)]);
15517 }
15518 if let Some(ref apikey) = configuration.api_key {
15519 let key = apikey.key.clone();
15520 let value = match apikey.prefix {
15521 Some(ref prefix) => format!("{} {}", prefix, key),
15522 None => key,
15523 };
15524 req_builder = req_builder.query(&[("sudo", value)]);
15525 }
15526 if let Some(ref apikey) = configuration.api_key {
15527 let key = apikey.key.clone();
15528 let value = match apikey.prefix {
15529 Some(ref prefix) => format!("{} {}", prefix, key),
15530 None => key,
15531 };
15532 req_builder = req_builder.query(&[("token", value)]);
15533 }
15534 if let Some(ref user_agent) = configuration.user_agent {
15535 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15536 }
15537 if let Some(ref apikey) = configuration.api_key {
15538 let key = apikey.key.clone();
15539 let value = match apikey.prefix {
15540 Some(ref prefix) => format!("{} {}", prefix, key),
15541 None => key,
15542 };
15543 req_builder = req_builder.header("X-GITEA-OTP", value);
15544 };
15545 if let Some(ref apikey) = configuration.api_key {
15546 let key = apikey.key.clone();
15547 let value = match apikey.prefix {
15548 Some(ref prefix) => format!("{} {}", prefix, key),
15549 None => key,
15550 };
15551 req_builder = req_builder.header("Authorization", value);
15552 };
15553 if let Some(ref apikey) = configuration.api_key {
15554 let key = apikey.key.clone();
15555 let value = match apikey.prefix {
15556 Some(ref prefix) => format!("{} {}", prefix, key),
15557 None => key,
15558 };
15559 req_builder = req_builder.header("Sudo", value);
15560 };
15561 if let Some(ref auth_conf) = configuration.basic_auth {
15562 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15563 };
15564
15565 let req = req_builder.build()?;
15566 let resp = configuration.client.execute(req).await?;
15567
15568 let status = resp.status();
15569 let content_type = resp
15570 .headers()
15571 .get("content-type")
15572 .and_then(|v| v.to_str().ok())
15573 .unwrap_or("application/octet-stream");
15574 let content_type = super::ContentType::from(content_type);
15575
15576 if !status.is_client_error() && !status.is_server_error() {
15577 let content = resp.text().await?;
15578 match content_type {
15579 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15580 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::CommitStatus>`"))),
15581 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::CommitStatus>`")))),
15582 }
15583 } else {
15584 let content = resp.text().await?;
15585 let entity: Option<RepoListStatusesError> = serde_json::from_str(&content).ok();
15586 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15587 }
15588}
15589
15590pub async fn repo_list_statuses_by_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str, sort: Option<&str>, state: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::CommitStatus>, Error<RepoListStatusesByRefError>> {
15591 let p_path_owner = owner;
15593 let p_path_repo = repo;
15594 let p_path_ref = r#ref;
15595 let p_query_sort = sort;
15596 let p_query_state = state;
15597 let p_query_page = page;
15598 let p_query_limit = limit;
15599
15600 let uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/statuses", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), ref=crate::apis::urlencode(p_path_ref));
15601 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15602
15603 if let Some(ref param_value) = p_query_sort {
15604 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
15605 }
15606 if let Some(ref param_value) = p_query_state {
15607 req_builder = req_builder.query(&[("state", ¶m_value.to_string())]);
15608 }
15609 if let Some(ref param_value) = p_query_page {
15610 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15611 }
15612 if let Some(ref param_value) = p_query_limit {
15613 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15614 }
15615 if let Some(ref apikey) = configuration.api_key {
15616 let key = apikey.key.clone();
15617 let value = match apikey.prefix {
15618 Some(ref prefix) => format!("{} {}", prefix, key),
15619 None => key,
15620 };
15621 req_builder = req_builder.query(&[("access_token", value)]);
15622 }
15623 if let Some(ref apikey) = configuration.api_key {
15624 let key = apikey.key.clone();
15625 let value = match apikey.prefix {
15626 Some(ref prefix) => format!("{} {}", prefix, key),
15627 None => key,
15628 };
15629 req_builder = req_builder.query(&[("sudo", value)]);
15630 }
15631 if let Some(ref apikey) = configuration.api_key {
15632 let key = apikey.key.clone();
15633 let value = match apikey.prefix {
15634 Some(ref prefix) => format!("{} {}", prefix, key),
15635 None => key,
15636 };
15637 req_builder = req_builder.query(&[("token", value)]);
15638 }
15639 if let Some(ref user_agent) = configuration.user_agent {
15640 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15641 }
15642 if let Some(ref apikey) = configuration.api_key {
15643 let key = apikey.key.clone();
15644 let value = match apikey.prefix {
15645 Some(ref prefix) => format!("{} {}", prefix, key),
15646 None => key,
15647 };
15648 req_builder = req_builder.header("X-GITEA-OTP", value);
15649 };
15650 if let Some(ref apikey) = configuration.api_key {
15651 let key = apikey.key.clone();
15652 let value = match apikey.prefix {
15653 Some(ref prefix) => format!("{} {}", prefix, key),
15654 None => key,
15655 };
15656 req_builder = req_builder.header("Authorization", value);
15657 };
15658 if let Some(ref apikey) = configuration.api_key {
15659 let key = apikey.key.clone();
15660 let value = match apikey.prefix {
15661 Some(ref prefix) => format!("{} {}", prefix, key),
15662 None => key,
15663 };
15664 req_builder = req_builder.header("Sudo", value);
15665 };
15666 if let Some(ref auth_conf) = configuration.basic_auth {
15667 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15668 };
15669
15670 let req = req_builder.build()?;
15671 let resp = configuration.client.execute(req).await?;
15672
15673 let status = resp.status();
15674 let content_type = resp
15675 .headers()
15676 .get("content-type")
15677 .and_then(|v| v.to_str().ok())
15678 .unwrap_or("application/octet-stream");
15679 let content_type = super::ContentType::from(content_type);
15680
15681 if !status.is_client_error() && !status.is_server_error() {
15682 let content = resp.text().await?;
15683 match content_type {
15684 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15685 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::CommitStatus>`"))),
15686 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::CommitStatus>`")))),
15687 }
15688 } else {
15689 let content = resp.text().await?;
15690 let entity: Option<RepoListStatusesByRefError> = serde_json::from_str(&content).ok();
15691 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15692 }
15693}
15694
15695pub async fn repo_list_subscribers(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<RepoListSubscribersError>> {
15696 let p_path_owner = owner;
15698 let p_path_repo = repo;
15699 let p_query_page = page;
15700 let p_query_limit = limit;
15701
15702 let uri_str = format!("{}/repos/{owner}/{repo}/subscribers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
15703 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15704
15705 if let Some(ref param_value) = p_query_page {
15706 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15707 }
15708 if let Some(ref param_value) = p_query_limit {
15709 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15710 }
15711 if let Some(ref apikey) = configuration.api_key {
15712 let key = apikey.key.clone();
15713 let value = match apikey.prefix {
15714 Some(ref prefix) => format!("{} {}", prefix, key),
15715 None => key,
15716 };
15717 req_builder = req_builder.query(&[("access_token", value)]);
15718 }
15719 if let Some(ref apikey) = configuration.api_key {
15720 let key = apikey.key.clone();
15721 let value = match apikey.prefix {
15722 Some(ref prefix) => format!("{} {}", prefix, key),
15723 None => key,
15724 };
15725 req_builder = req_builder.query(&[("sudo", value)]);
15726 }
15727 if let Some(ref apikey) = configuration.api_key {
15728 let key = apikey.key.clone();
15729 let value = match apikey.prefix {
15730 Some(ref prefix) => format!("{} {}", prefix, key),
15731 None => key,
15732 };
15733 req_builder = req_builder.query(&[("token", value)]);
15734 }
15735 if let Some(ref user_agent) = configuration.user_agent {
15736 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15737 }
15738 if let Some(ref apikey) = configuration.api_key {
15739 let key = apikey.key.clone();
15740 let value = match apikey.prefix {
15741 Some(ref prefix) => format!("{} {}", prefix, key),
15742 None => key,
15743 };
15744 req_builder = req_builder.header("X-GITEA-OTP", value);
15745 };
15746 if let Some(ref apikey) = configuration.api_key {
15747 let key = apikey.key.clone();
15748 let value = match apikey.prefix {
15749 Some(ref prefix) => format!("{} {}", prefix, key),
15750 None => key,
15751 };
15752 req_builder = req_builder.header("Authorization", value);
15753 };
15754 if let Some(ref apikey) = configuration.api_key {
15755 let key = apikey.key.clone();
15756 let value = match apikey.prefix {
15757 Some(ref prefix) => format!("{} {}", prefix, key),
15758 None => key,
15759 };
15760 req_builder = req_builder.header("Sudo", value);
15761 };
15762 if let Some(ref auth_conf) = configuration.basic_auth {
15763 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15764 };
15765
15766 let req = req_builder.build()?;
15767 let resp = configuration.client.execute(req).await?;
15768
15769 let status = resp.status();
15770 let content_type = resp
15771 .headers()
15772 .get("content-type")
15773 .and_then(|v| v.to_str().ok())
15774 .unwrap_or("application/octet-stream");
15775 let content_type = super::ContentType::from(content_type);
15776
15777 if !status.is_client_error() && !status.is_server_error() {
15778 let content = resp.text().await?;
15779 match content_type {
15780 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15781 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
15782 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>`")))),
15783 }
15784 } else {
15785 let content = resp.text().await?;
15786 let entity: Option<RepoListSubscribersError> = serde_json::from_str(&content).ok();
15787 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15788 }
15789}
15790
15791pub async fn repo_list_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::TagProtection>, Error<RepoListTagProtectionError>> {
15792 let p_path_owner = owner;
15794 let p_path_repo = repo;
15795
15796 let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
15797 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15798
15799 if let Some(ref apikey) = configuration.api_key {
15800 let key = apikey.key.clone();
15801 let value = match apikey.prefix {
15802 Some(ref prefix) => format!("{} {}", prefix, key),
15803 None => key,
15804 };
15805 req_builder = req_builder.query(&[("access_token", value)]);
15806 }
15807 if let Some(ref apikey) = configuration.api_key {
15808 let key = apikey.key.clone();
15809 let value = match apikey.prefix {
15810 Some(ref prefix) => format!("{} {}", prefix, key),
15811 None => key,
15812 };
15813 req_builder = req_builder.query(&[("sudo", value)]);
15814 }
15815 if let Some(ref apikey) = configuration.api_key {
15816 let key = apikey.key.clone();
15817 let value = match apikey.prefix {
15818 Some(ref prefix) => format!("{} {}", prefix, key),
15819 None => key,
15820 };
15821 req_builder = req_builder.query(&[("token", value)]);
15822 }
15823 if let Some(ref user_agent) = configuration.user_agent {
15824 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15825 }
15826 if let Some(ref apikey) = configuration.api_key {
15827 let key = apikey.key.clone();
15828 let value = match apikey.prefix {
15829 Some(ref prefix) => format!("{} {}", prefix, key),
15830 None => key,
15831 };
15832 req_builder = req_builder.header("X-GITEA-OTP", value);
15833 };
15834 if let Some(ref apikey) = configuration.api_key {
15835 let key = apikey.key.clone();
15836 let value = match apikey.prefix {
15837 Some(ref prefix) => format!("{} {}", prefix, key),
15838 None => key,
15839 };
15840 req_builder = req_builder.header("Authorization", value);
15841 };
15842 if let Some(ref apikey) = configuration.api_key {
15843 let key = apikey.key.clone();
15844 let value = match apikey.prefix {
15845 Some(ref prefix) => format!("{} {}", prefix, key),
15846 None => key,
15847 };
15848 req_builder = req_builder.header("Sudo", value);
15849 };
15850 if let Some(ref auth_conf) = configuration.basic_auth {
15851 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15852 };
15853
15854 let req = req_builder.build()?;
15855 let resp = configuration.client.execute(req).await?;
15856
15857 let status = resp.status();
15858 let content_type = resp
15859 .headers()
15860 .get("content-type")
15861 .and_then(|v| v.to_str().ok())
15862 .unwrap_or("application/octet-stream");
15863 let content_type = super::ContentType::from(content_type);
15864
15865 if !status.is_client_error() && !status.is_server_error() {
15866 let content = resp.text().await?;
15867 match content_type {
15868 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15869 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TagProtection>`"))),
15870 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::TagProtection>`")))),
15871 }
15872 } else {
15873 let content = resp.text().await?;
15874 let entity: Option<RepoListTagProtectionError> = serde_json::from_str(&content).ok();
15875 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15876 }
15877}
15878
15879pub async fn repo_list_tags(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Tag>, Error<RepoListTagsError>> {
15880 let p_path_owner = owner;
15882 let p_path_repo = repo;
15883 let p_query_page = page;
15884 let p_query_limit = limit;
15885
15886 let uri_str = format!("{}/repos/{owner}/{repo}/tags", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
15887 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15888
15889 if let Some(ref param_value) = p_query_page {
15890 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
15891 }
15892 if let Some(ref param_value) = p_query_limit {
15893 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
15894 }
15895 if let Some(ref apikey) = configuration.api_key {
15896 let key = apikey.key.clone();
15897 let value = match apikey.prefix {
15898 Some(ref prefix) => format!("{} {}", prefix, key),
15899 None => key,
15900 };
15901 req_builder = req_builder.query(&[("access_token", value)]);
15902 }
15903 if let Some(ref apikey) = configuration.api_key {
15904 let key = apikey.key.clone();
15905 let value = match apikey.prefix {
15906 Some(ref prefix) => format!("{} {}", prefix, key),
15907 None => key,
15908 };
15909 req_builder = req_builder.query(&[("sudo", value)]);
15910 }
15911 if let Some(ref apikey) = configuration.api_key {
15912 let key = apikey.key.clone();
15913 let value = match apikey.prefix {
15914 Some(ref prefix) => format!("{} {}", prefix, key),
15915 None => key,
15916 };
15917 req_builder = req_builder.query(&[("token", value)]);
15918 }
15919 if let Some(ref user_agent) = configuration.user_agent {
15920 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
15921 }
15922 if let Some(ref apikey) = configuration.api_key {
15923 let key = apikey.key.clone();
15924 let value = match apikey.prefix {
15925 Some(ref prefix) => format!("{} {}", prefix, key),
15926 None => key,
15927 };
15928 req_builder = req_builder.header("X-GITEA-OTP", value);
15929 };
15930 if let Some(ref apikey) = configuration.api_key {
15931 let key = apikey.key.clone();
15932 let value = match apikey.prefix {
15933 Some(ref prefix) => format!("{} {}", prefix, key),
15934 None => key,
15935 };
15936 req_builder = req_builder.header("Authorization", value);
15937 };
15938 if let Some(ref apikey) = configuration.api_key {
15939 let key = apikey.key.clone();
15940 let value = match apikey.prefix {
15941 Some(ref prefix) => format!("{} {}", prefix, key),
15942 None => key,
15943 };
15944 req_builder = req_builder.header("Sudo", value);
15945 };
15946 if let Some(ref auth_conf) = configuration.basic_auth {
15947 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
15948 };
15949
15950 let req = req_builder.build()?;
15951 let resp = configuration.client.execute(req).await?;
15952
15953 let status = resp.status();
15954 let content_type = resp
15955 .headers()
15956 .get("content-type")
15957 .and_then(|v| v.to_str().ok())
15958 .unwrap_or("application/octet-stream");
15959 let content_type = super::ContentType::from(content_type);
15960
15961 if !status.is_client_error() && !status.is_server_error() {
15962 let content = resp.text().await?;
15963 match content_type {
15964 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
15965 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Tag>`"))),
15966 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::Tag>`")))),
15967 }
15968 } else {
15969 let content = resp.text().await?;
15970 let entity: Option<RepoListTagsError> = serde_json::from_str(&content).ok();
15971 Err(Error::ResponseError(ResponseContent { status, content, entity }))
15972 }
15973}
15974
15975pub async fn repo_list_teams(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::Team>, Error<RepoListTeamsError>> {
15976 let p_path_owner = owner;
15978 let p_path_repo = repo;
15979
15980 let uri_str = format!("{}/repos/{owner}/{repo}/teams", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
15981 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
15982
15983 if let Some(ref apikey) = configuration.api_key {
15984 let key = apikey.key.clone();
15985 let value = match apikey.prefix {
15986 Some(ref prefix) => format!("{} {}", prefix, key),
15987 None => key,
15988 };
15989 req_builder = req_builder.query(&[("access_token", value)]);
15990 }
15991 if let Some(ref apikey) = configuration.api_key {
15992 let key = apikey.key.clone();
15993 let value = match apikey.prefix {
15994 Some(ref prefix) => format!("{} {}", prefix, key),
15995 None => key,
15996 };
15997 req_builder = req_builder.query(&[("sudo", value)]);
15998 }
15999 if let Some(ref apikey) = configuration.api_key {
16000 let key = apikey.key.clone();
16001 let value = match apikey.prefix {
16002 Some(ref prefix) => format!("{} {}", prefix, key),
16003 None => key,
16004 };
16005 req_builder = req_builder.query(&[("token", value)]);
16006 }
16007 if let Some(ref user_agent) = configuration.user_agent {
16008 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16009 }
16010 if let Some(ref apikey) = configuration.api_key {
16011 let key = apikey.key.clone();
16012 let value = match apikey.prefix {
16013 Some(ref prefix) => format!("{} {}", prefix, key),
16014 None => key,
16015 };
16016 req_builder = req_builder.header("X-GITEA-OTP", value);
16017 };
16018 if let Some(ref apikey) = configuration.api_key {
16019 let key = apikey.key.clone();
16020 let value = match apikey.prefix {
16021 Some(ref prefix) => format!("{} {}", prefix, key),
16022 None => key,
16023 };
16024 req_builder = req_builder.header("Authorization", value);
16025 };
16026 if let Some(ref apikey) = configuration.api_key {
16027 let key = apikey.key.clone();
16028 let value = match apikey.prefix {
16029 Some(ref prefix) => format!("{} {}", prefix, key),
16030 None => key,
16031 };
16032 req_builder = req_builder.header("Sudo", value);
16033 };
16034 if let Some(ref auth_conf) = configuration.basic_auth {
16035 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16036 };
16037
16038 let req = req_builder.build()?;
16039 let resp = configuration.client.execute(req).await?;
16040
16041 let status = resp.status();
16042 let content_type = resp
16043 .headers()
16044 .get("content-type")
16045 .and_then(|v| v.to_str().ok())
16046 .unwrap_or("application/octet-stream");
16047 let content_type = super::ContentType::from(content_type);
16048
16049 if !status.is_client_error() && !status.is_server_error() {
16050 let content = resp.text().await?;
16051 match content_type {
16052 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
16053 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Team>`"))),
16054 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>`")))),
16055 }
16056 } else {
16057 let content = resp.text().await?;
16058 let entity: Option<RepoListTeamsError> = serde_json::from_str(&content).ok();
16059 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16060 }
16061}
16062
16063pub async fn repo_list_topics(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<models::TopicName, Error<RepoListTopicsError>> {
16064 let p_path_owner = owner;
16066 let p_path_repo = repo;
16067 let p_query_page = page;
16068 let p_query_limit = limit;
16069
16070 let uri_str = format!("{}/repos/{owner}/{repo}/topics", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
16071 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
16072
16073 if let Some(ref param_value) = p_query_page {
16074 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
16075 }
16076 if let Some(ref param_value) = p_query_limit {
16077 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
16078 }
16079 if let Some(ref apikey) = configuration.api_key {
16080 let key = apikey.key.clone();
16081 let value = match apikey.prefix {
16082 Some(ref prefix) => format!("{} {}", prefix, key),
16083 None => key,
16084 };
16085 req_builder = req_builder.query(&[("access_token", value)]);
16086 }
16087 if let Some(ref apikey) = configuration.api_key {
16088 let key = apikey.key.clone();
16089 let value = match apikey.prefix {
16090 Some(ref prefix) => format!("{} {}", prefix, key),
16091 None => key,
16092 };
16093 req_builder = req_builder.query(&[("sudo", value)]);
16094 }
16095 if let Some(ref apikey) = configuration.api_key {
16096 let key = apikey.key.clone();
16097 let value = match apikey.prefix {
16098 Some(ref prefix) => format!("{} {}", prefix, key),
16099 None => key,
16100 };
16101 req_builder = req_builder.query(&[("token", value)]);
16102 }
16103 if let Some(ref user_agent) = configuration.user_agent {
16104 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16105 }
16106 if let Some(ref apikey) = configuration.api_key {
16107 let key = apikey.key.clone();
16108 let value = match apikey.prefix {
16109 Some(ref prefix) => format!("{} {}", prefix, key),
16110 None => key,
16111 };
16112 req_builder = req_builder.header("X-GITEA-OTP", value);
16113 };
16114 if let Some(ref apikey) = configuration.api_key {
16115 let key = apikey.key.clone();
16116 let value = match apikey.prefix {
16117 Some(ref prefix) => format!("{} {}", prefix, key),
16118 None => key,
16119 };
16120 req_builder = req_builder.header("Authorization", value);
16121 };
16122 if let Some(ref apikey) = configuration.api_key {
16123 let key = apikey.key.clone();
16124 let value = match apikey.prefix {
16125 Some(ref prefix) => format!("{} {}", prefix, key),
16126 None => key,
16127 };
16128 req_builder = req_builder.header("Sudo", value);
16129 };
16130 if let Some(ref auth_conf) = configuration.basic_auth {
16131 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16132 };
16133
16134 let req = req_builder.build()?;
16135 let resp = configuration.client.execute(req).await?;
16136
16137 let status = resp.status();
16138 let content_type = resp
16139 .headers()
16140 .get("content-type")
16141 .and_then(|v| v.to_str().ok())
16142 .unwrap_or("application/octet-stream");
16143 let content_type = super::ContentType::from(content_type);
16144
16145 if !status.is_client_error() && !status.is_server_error() {
16146 let content = resp.text().await?;
16147 match content_type {
16148 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
16149 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TopicName`"))),
16150 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::TopicName`")))),
16151 }
16152 } else {
16153 let content = resp.text().await?;
16154 let entity: Option<RepoListTopicsError> = serde_json::from_str(&content).ok();
16155 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16156 }
16157}
16158
16159pub async fn repo_merge_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::MergePullRequestOption>) -> Result<(), Error<RepoMergePullRequestError>> {
16160 let p_path_owner = owner;
16162 let p_path_repo = repo;
16163 let p_path_index = index;
16164 let p_body_body = body;
16165
16166 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
16167 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
16168
16169 if let Some(ref apikey) = configuration.api_key {
16170 let key = apikey.key.clone();
16171 let value = match apikey.prefix {
16172 Some(ref prefix) => format!("{} {}", prefix, key),
16173 None => key,
16174 };
16175 req_builder = req_builder.query(&[("access_token", value)]);
16176 }
16177 if let Some(ref apikey) = configuration.api_key {
16178 let key = apikey.key.clone();
16179 let value = match apikey.prefix {
16180 Some(ref prefix) => format!("{} {}", prefix, key),
16181 None => key,
16182 };
16183 req_builder = req_builder.query(&[("sudo", value)]);
16184 }
16185 if let Some(ref apikey) = configuration.api_key {
16186 let key = apikey.key.clone();
16187 let value = match apikey.prefix {
16188 Some(ref prefix) => format!("{} {}", prefix, key),
16189 None => key,
16190 };
16191 req_builder = req_builder.query(&[("token", value)]);
16192 }
16193 if let Some(ref user_agent) = configuration.user_agent {
16194 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16195 }
16196 if let Some(ref apikey) = configuration.api_key {
16197 let key = apikey.key.clone();
16198 let value = match apikey.prefix {
16199 Some(ref prefix) => format!("{} {}", prefix, key),
16200 None => key,
16201 };
16202 req_builder = req_builder.header("X-GITEA-OTP", value);
16203 };
16204 if let Some(ref apikey) = configuration.api_key {
16205 let key = apikey.key.clone();
16206 let value = match apikey.prefix {
16207 Some(ref prefix) => format!("{} {}", prefix, key),
16208 None => key,
16209 };
16210 req_builder = req_builder.header("Authorization", value);
16211 };
16212 if let Some(ref apikey) = configuration.api_key {
16213 let key = apikey.key.clone();
16214 let value = match apikey.prefix {
16215 Some(ref prefix) => format!("{} {}", prefix, key),
16216 None => key,
16217 };
16218 req_builder = req_builder.header("Sudo", value);
16219 };
16220 if let Some(ref auth_conf) = configuration.basic_auth {
16221 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16222 };
16223 req_builder = req_builder.json(&p_body_body);
16224
16225 let req = req_builder.build()?;
16226 let resp = configuration.client.execute(req).await?;
16227
16228 let status = resp.status();
16229
16230 if !status.is_client_error() && !status.is_server_error() {
16231 Ok(())
16232 } else {
16233 let content = resp.text().await?;
16234 let entity: Option<RepoMergePullRequestError> = serde_json::from_str(&content).ok();
16235 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16236 }
16237}
16238
16239pub async fn repo_merge_upstream(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::MergeUpstreamRequest>) -> Result<models::MergeUpstreamResponse, Error<RepoMergeUpstreamError>> {
16240 let p_path_owner = owner;
16242 let p_path_repo = repo;
16243 let p_body_body = body;
16244
16245 let uri_str = format!("{}/repos/{owner}/{repo}/merge-upstream", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
16246 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
16247
16248 if let Some(ref apikey) = configuration.api_key {
16249 let key = apikey.key.clone();
16250 let value = match apikey.prefix {
16251 Some(ref prefix) => format!("{} {}", prefix, key),
16252 None => key,
16253 };
16254 req_builder = req_builder.query(&[("access_token", value)]);
16255 }
16256 if let Some(ref apikey) = configuration.api_key {
16257 let key = apikey.key.clone();
16258 let value = match apikey.prefix {
16259 Some(ref prefix) => format!("{} {}", prefix, key),
16260 None => key,
16261 };
16262 req_builder = req_builder.query(&[("sudo", value)]);
16263 }
16264 if let Some(ref apikey) = configuration.api_key {
16265 let key = apikey.key.clone();
16266 let value = match apikey.prefix {
16267 Some(ref prefix) => format!("{} {}", prefix, key),
16268 None => key,
16269 };
16270 req_builder = req_builder.query(&[("token", value)]);
16271 }
16272 if let Some(ref user_agent) = configuration.user_agent {
16273 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16274 }
16275 if let Some(ref apikey) = configuration.api_key {
16276 let key = apikey.key.clone();
16277 let value = match apikey.prefix {
16278 Some(ref prefix) => format!("{} {}", prefix, key),
16279 None => key,
16280 };
16281 req_builder = req_builder.header("X-GITEA-OTP", value);
16282 };
16283 if let Some(ref apikey) = configuration.api_key {
16284 let key = apikey.key.clone();
16285 let value = match apikey.prefix {
16286 Some(ref prefix) => format!("{} {}", prefix, key),
16287 None => key,
16288 };
16289 req_builder = req_builder.header("Authorization", value);
16290 };
16291 if let Some(ref apikey) = configuration.api_key {
16292 let key = apikey.key.clone();
16293 let value = match apikey.prefix {
16294 Some(ref prefix) => format!("{} {}", prefix, key),
16295 None => key,
16296 };
16297 req_builder = req_builder.header("Sudo", value);
16298 };
16299 if let Some(ref auth_conf) = configuration.basic_auth {
16300 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16301 };
16302 req_builder = req_builder.json(&p_body_body);
16303
16304 let req = req_builder.build()?;
16305 let resp = configuration.client.execute(req).await?;
16306
16307 let status = resp.status();
16308 let content_type = resp
16309 .headers()
16310 .get("content-type")
16311 .and_then(|v| v.to_str().ok())
16312 .unwrap_or("application/octet-stream");
16313 let content_type = super::ContentType::from(content_type);
16314
16315 if !status.is_client_error() && !status.is_server_error() {
16316 let content = resp.text().await?;
16317 match content_type {
16318 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
16319 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MergeUpstreamResponse`"))),
16320 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::MergeUpstreamResponse`")))),
16321 }
16322 } else {
16323 let content = resp.text().await?;
16324 let entity: Option<RepoMergeUpstreamError> = serde_json::from_str(&content).ok();
16325 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16326 }
16327}
16328
16329pub async fn repo_migrate(configuration: &configuration::Configuration, body: Option<models::MigrateRepoOptions>) -> Result<models::Repository, Error<RepoMigrateError>> {
16330 let p_body_body = body;
16332
16333 let uri_str = format!("{}/repos/migrate", configuration.base_path);
16334 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
16335
16336 if let Some(ref apikey) = configuration.api_key {
16337 let key = apikey.key.clone();
16338 let value = match apikey.prefix {
16339 Some(ref prefix) => format!("{} {}", prefix, key),
16340 None => key,
16341 };
16342 req_builder = req_builder.query(&[("access_token", value)]);
16343 }
16344 if let Some(ref apikey) = configuration.api_key {
16345 let key = apikey.key.clone();
16346 let value = match apikey.prefix {
16347 Some(ref prefix) => format!("{} {}", prefix, key),
16348 None => key,
16349 };
16350 req_builder = req_builder.query(&[("sudo", value)]);
16351 }
16352 if let Some(ref apikey) = configuration.api_key {
16353 let key = apikey.key.clone();
16354 let value = match apikey.prefix {
16355 Some(ref prefix) => format!("{} {}", prefix, key),
16356 None => key,
16357 };
16358 req_builder = req_builder.query(&[("token", value)]);
16359 }
16360 if let Some(ref user_agent) = configuration.user_agent {
16361 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16362 }
16363 if let Some(ref apikey) = configuration.api_key {
16364 let key = apikey.key.clone();
16365 let value = match apikey.prefix {
16366 Some(ref prefix) => format!("{} {}", prefix, key),
16367 None => key,
16368 };
16369 req_builder = req_builder.header("X-GITEA-OTP", value);
16370 };
16371 if let Some(ref apikey) = configuration.api_key {
16372 let key = apikey.key.clone();
16373 let value = match apikey.prefix {
16374 Some(ref prefix) => format!("{} {}", prefix, key),
16375 None => key,
16376 };
16377 req_builder = req_builder.header("Authorization", value);
16378 };
16379 if let Some(ref apikey) = configuration.api_key {
16380 let key = apikey.key.clone();
16381 let value = match apikey.prefix {
16382 Some(ref prefix) => format!("{} {}", prefix, key),
16383 None => key,
16384 };
16385 req_builder = req_builder.header("Sudo", value);
16386 };
16387 if let Some(ref auth_conf) = configuration.basic_auth {
16388 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16389 };
16390 req_builder = req_builder.json(&p_body_body);
16391
16392 let req = req_builder.build()?;
16393 let resp = configuration.client.execute(req).await?;
16394
16395 let status = resp.status();
16396 let content_type = resp
16397 .headers()
16398 .get("content-type")
16399 .and_then(|v| v.to_str().ok())
16400 .unwrap_or("application/octet-stream");
16401 let content_type = super::ContentType::from(content_type);
16402
16403 if !status.is_client_error() && !status.is_server_error() {
16404 let content = resp.text().await?;
16405 match content_type {
16406 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
16407 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
16408 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`")))),
16409 }
16410 } else {
16411 let content = resp.text().await?;
16412 let entity: Option<RepoMigrateError> = serde_json::from_str(&content).ok();
16413 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16414 }
16415}
16416
16417pub async fn repo_mirror_sync(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<RepoMirrorSyncError>> {
16418 let p_path_owner = owner;
16420 let p_path_repo = repo;
16421
16422 let uri_str = format!("{}/repos/{owner}/{repo}/mirror-sync", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
16423 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
16424
16425 if let Some(ref apikey) = configuration.api_key {
16426 let key = apikey.key.clone();
16427 let value = match apikey.prefix {
16428 Some(ref prefix) => format!("{} {}", prefix, key),
16429 None => key,
16430 };
16431 req_builder = req_builder.query(&[("access_token", value)]);
16432 }
16433 if let Some(ref apikey) = configuration.api_key {
16434 let key = apikey.key.clone();
16435 let value = match apikey.prefix {
16436 Some(ref prefix) => format!("{} {}", prefix, key),
16437 None => key,
16438 };
16439 req_builder = req_builder.query(&[("sudo", value)]);
16440 }
16441 if let Some(ref apikey) = configuration.api_key {
16442 let key = apikey.key.clone();
16443 let value = match apikey.prefix {
16444 Some(ref prefix) => format!("{} {}", prefix, key),
16445 None => key,
16446 };
16447 req_builder = req_builder.query(&[("token", value)]);
16448 }
16449 if let Some(ref user_agent) = configuration.user_agent {
16450 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16451 }
16452 if let Some(ref apikey) = configuration.api_key {
16453 let key = apikey.key.clone();
16454 let value = match apikey.prefix {
16455 Some(ref prefix) => format!("{} {}", prefix, key),
16456 None => key,
16457 };
16458 req_builder = req_builder.header("X-GITEA-OTP", value);
16459 };
16460 if let Some(ref apikey) = configuration.api_key {
16461 let key = apikey.key.clone();
16462 let value = match apikey.prefix {
16463 Some(ref prefix) => format!("{} {}", prefix, key),
16464 None => key,
16465 };
16466 req_builder = req_builder.header("Authorization", value);
16467 };
16468 if let Some(ref apikey) = configuration.api_key {
16469 let key = apikey.key.clone();
16470 let value = match apikey.prefix {
16471 Some(ref prefix) => format!("{} {}", prefix, key),
16472 None => key,
16473 };
16474 req_builder = req_builder.header("Sudo", value);
16475 };
16476 if let Some(ref auth_conf) = configuration.basic_auth {
16477 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16478 };
16479
16480 let req = req_builder.build()?;
16481 let resp = configuration.client.execute(req).await?;
16482
16483 let status = resp.status();
16484
16485 if !status.is_client_error() && !status.is_server_error() {
16486 Ok(())
16487 } else {
16488 let content = resp.text().await?;
16489 let entity: Option<RepoMirrorSyncError> = serde_json::from_str(&content).ok();
16490 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16491 }
16492}
16493
16494pub async fn repo_new_pin_allowed(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::NewIssuePinsAllowed, Error<RepoNewPinAllowedError>> {
16495 let p_path_owner = owner;
16497 let p_path_repo = repo;
16498
16499 let uri_str = format!("{}/repos/{owner}/{repo}/new_pin_allowed", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
16500 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
16501
16502 if let Some(ref apikey) = configuration.api_key {
16503 let key = apikey.key.clone();
16504 let value = match apikey.prefix {
16505 Some(ref prefix) => format!("{} {}", prefix, key),
16506 None => key,
16507 };
16508 req_builder = req_builder.query(&[("access_token", value)]);
16509 }
16510 if let Some(ref apikey) = configuration.api_key {
16511 let key = apikey.key.clone();
16512 let value = match apikey.prefix {
16513 Some(ref prefix) => format!("{} {}", prefix, key),
16514 None => key,
16515 };
16516 req_builder = req_builder.query(&[("sudo", value)]);
16517 }
16518 if let Some(ref apikey) = configuration.api_key {
16519 let key = apikey.key.clone();
16520 let value = match apikey.prefix {
16521 Some(ref prefix) => format!("{} {}", prefix, key),
16522 None => key,
16523 };
16524 req_builder = req_builder.query(&[("token", value)]);
16525 }
16526 if let Some(ref user_agent) = configuration.user_agent {
16527 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16528 }
16529 if let Some(ref apikey) = configuration.api_key {
16530 let key = apikey.key.clone();
16531 let value = match apikey.prefix {
16532 Some(ref prefix) => format!("{} {}", prefix, key),
16533 None => key,
16534 };
16535 req_builder = req_builder.header("X-GITEA-OTP", value);
16536 };
16537 if let Some(ref apikey) = configuration.api_key {
16538 let key = apikey.key.clone();
16539 let value = match apikey.prefix {
16540 Some(ref prefix) => format!("{} {}", prefix, key),
16541 None => key,
16542 };
16543 req_builder = req_builder.header("Authorization", value);
16544 };
16545 if let Some(ref apikey) = configuration.api_key {
16546 let key = apikey.key.clone();
16547 let value = match apikey.prefix {
16548 Some(ref prefix) => format!("{} {}", prefix, key),
16549 None => key,
16550 };
16551 req_builder = req_builder.header("Sudo", value);
16552 };
16553 if let Some(ref auth_conf) = configuration.basic_auth {
16554 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16555 };
16556
16557 let req = req_builder.build()?;
16558 let resp = configuration.client.execute(req).await?;
16559
16560 let status = resp.status();
16561 let content_type = resp
16562 .headers()
16563 .get("content-type")
16564 .and_then(|v| v.to_str().ok())
16565 .unwrap_or("application/octet-stream");
16566 let content_type = super::ContentType::from(content_type);
16567
16568 if !status.is_client_error() && !status.is_server_error() {
16569 let content = resp.text().await?;
16570 match content_type {
16571 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
16572 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NewIssuePinsAllowed`"))),
16573 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::NewIssuePinsAllowed`")))),
16574 }
16575 } else {
16576 let content = resp.text().await?;
16577 let entity: Option<RepoNewPinAllowedError> = serde_json::from_str(&content).ok();
16578 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16579 }
16580}
16581
16582pub async fn repo_pull_request_is_merged(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<RepoPullRequestIsMergedError>> {
16583 let p_path_owner = owner;
16585 let p_path_repo = repo;
16586 let p_path_index = index;
16587
16588 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
16589 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
16590
16591 if let Some(ref apikey) = configuration.api_key {
16592 let key = apikey.key.clone();
16593 let value = match apikey.prefix {
16594 Some(ref prefix) => format!("{} {}", prefix, key),
16595 None => key,
16596 };
16597 req_builder = req_builder.query(&[("access_token", value)]);
16598 }
16599 if let Some(ref apikey) = configuration.api_key {
16600 let key = apikey.key.clone();
16601 let value = match apikey.prefix {
16602 Some(ref prefix) => format!("{} {}", prefix, key),
16603 None => key,
16604 };
16605 req_builder = req_builder.query(&[("sudo", value)]);
16606 }
16607 if let Some(ref apikey) = configuration.api_key {
16608 let key = apikey.key.clone();
16609 let value = match apikey.prefix {
16610 Some(ref prefix) => format!("{} {}", prefix, key),
16611 None => key,
16612 };
16613 req_builder = req_builder.query(&[("token", value)]);
16614 }
16615 if let Some(ref user_agent) = configuration.user_agent {
16616 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16617 }
16618 if let Some(ref apikey) = configuration.api_key {
16619 let key = apikey.key.clone();
16620 let value = match apikey.prefix {
16621 Some(ref prefix) => format!("{} {}", prefix, key),
16622 None => key,
16623 };
16624 req_builder = req_builder.header("X-GITEA-OTP", value);
16625 };
16626 if let Some(ref apikey) = configuration.api_key {
16627 let key = apikey.key.clone();
16628 let value = match apikey.prefix {
16629 Some(ref prefix) => format!("{} {}", prefix, key),
16630 None => key,
16631 };
16632 req_builder = req_builder.header("Authorization", value);
16633 };
16634 if let Some(ref apikey) = configuration.api_key {
16635 let key = apikey.key.clone();
16636 let value = match apikey.prefix {
16637 Some(ref prefix) => format!("{} {}", prefix, key),
16638 None => key,
16639 };
16640 req_builder = req_builder.header("Sudo", value);
16641 };
16642 if let Some(ref auth_conf) = configuration.basic_auth {
16643 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16644 };
16645
16646 let req = req_builder.build()?;
16647 let resp = configuration.client.execute(req).await?;
16648
16649 let status = resp.status();
16650
16651 if !status.is_client_error() && !status.is_server_error() {
16652 Ok(())
16653 } else {
16654 let content = resp.text().await?;
16655 let entity: Option<RepoPullRequestIsMergedError> = serde_json::from_str(&content).ok();
16656 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16657 }
16658}
16659
16660pub async fn repo_push_mirror_sync(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<RepoPushMirrorSyncError>> {
16661 let p_path_owner = owner;
16663 let p_path_repo = repo;
16664
16665 let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors-sync", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
16666 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
16667
16668 if let Some(ref apikey) = configuration.api_key {
16669 let key = apikey.key.clone();
16670 let value = match apikey.prefix {
16671 Some(ref prefix) => format!("{} {}", prefix, key),
16672 None => key,
16673 };
16674 req_builder = req_builder.query(&[("access_token", value)]);
16675 }
16676 if let Some(ref apikey) = configuration.api_key {
16677 let key = apikey.key.clone();
16678 let value = match apikey.prefix {
16679 Some(ref prefix) => format!("{} {}", prefix, key),
16680 None => key,
16681 };
16682 req_builder = req_builder.query(&[("sudo", value)]);
16683 }
16684 if let Some(ref apikey) = configuration.api_key {
16685 let key = apikey.key.clone();
16686 let value = match apikey.prefix {
16687 Some(ref prefix) => format!("{} {}", prefix, key),
16688 None => key,
16689 };
16690 req_builder = req_builder.query(&[("token", value)]);
16691 }
16692 if let Some(ref user_agent) = configuration.user_agent {
16693 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16694 }
16695 if let Some(ref apikey) = configuration.api_key {
16696 let key = apikey.key.clone();
16697 let value = match apikey.prefix {
16698 Some(ref prefix) => format!("{} {}", prefix, key),
16699 None => key,
16700 };
16701 req_builder = req_builder.header("X-GITEA-OTP", value);
16702 };
16703 if let Some(ref apikey) = configuration.api_key {
16704 let key = apikey.key.clone();
16705 let value = match apikey.prefix {
16706 Some(ref prefix) => format!("{} {}", prefix, key),
16707 None => key,
16708 };
16709 req_builder = req_builder.header("Authorization", value);
16710 };
16711 if let Some(ref apikey) = configuration.api_key {
16712 let key = apikey.key.clone();
16713 let value = match apikey.prefix {
16714 Some(ref prefix) => format!("{} {}", prefix, key),
16715 None => key,
16716 };
16717 req_builder = req_builder.header("Sudo", value);
16718 };
16719 if let Some(ref auth_conf) = configuration.basic_auth {
16720 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16721 };
16722
16723 let req = req_builder.build()?;
16724 let resp = configuration.client.execute(req).await?;
16725
16726 let status = resp.status();
16727
16728 if !status.is_client_error() && !status.is_server_error() {
16729 Ok(())
16730 } else {
16731 let content = resp.text().await?;
16732 let entity: Option<RepoPushMirrorSyncError> = serde_json::from_str(&content).ok();
16733 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16734 }
16735}
16736
16737pub async fn repo_rename_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, branch: &str, body: Option<models::RenameBranchRepoOption>) -> Result<(), Error<RepoRenameBranchError>> {
16738 let p_path_owner = owner;
16740 let p_path_repo = repo;
16741 let p_path_branch = branch;
16742 let p_body_body = body;
16743
16744 let uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), branch=crate::apis::urlencode(p_path_branch));
16745 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
16746
16747 if let Some(ref apikey) = configuration.api_key {
16748 let key = apikey.key.clone();
16749 let value = match apikey.prefix {
16750 Some(ref prefix) => format!("{} {}", prefix, key),
16751 None => key,
16752 };
16753 req_builder = req_builder.query(&[("access_token", value)]);
16754 }
16755 if let Some(ref apikey) = configuration.api_key {
16756 let key = apikey.key.clone();
16757 let value = match apikey.prefix {
16758 Some(ref prefix) => format!("{} {}", prefix, key),
16759 None => key,
16760 };
16761 req_builder = req_builder.query(&[("sudo", value)]);
16762 }
16763 if let Some(ref apikey) = configuration.api_key {
16764 let key = apikey.key.clone();
16765 let value = match apikey.prefix {
16766 Some(ref prefix) => format!("{} {}", prefix, key),
16767 None => key,
16768 };
16769 req_builder = req_builder.query(&[("token", value)]);
16770 }
16771 if let Some(ref user_agent) = configuration.user_agent {
16772 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16773 }
16774 if let Some(ref apikey) = configuration.api_key {
16775 let key = apikey.key.clone();
16776 let value = match apikey.prefix {
16777 Some(ref prefix) => format!("{} {}", prefix, key),
16778 None => key,
16779 };
16780 req_builder = req_builder.header("X-GITEA-OTP", value);
16781 };
16782 if let Some(ref apikey) = configuration.api_key {
16783 let key = apikey.key.clone();
16784 let value = match apikey.prefix {
16785 Some(ref prefix) => format!("{} {}", prefix, key),
16786 None => key,
16787 };
16788 req_builder = req_builder.header("Authorization", value);
16789 };
16790 if let Some(ref apikey) = configuration.api_key {
16791 let key = apikey.key.clone();
16792 let value = match apikey.prefix {
16793 Some(ref prefix) => format!("{} {}", prefix, key),
16794 None => key,
16795 };
16796 req_builder = req_builder.header("Sudo", value);
16797 };
16798 if let Some(ref auth_conf) = configuration.basic_auth {
16799 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16800 };
16801 req_builder = req_builder.json(&p_body_body);
16802
16803 let req = req_builder.build()?;
16804 let resp = configuration.client.execute(req).await?;
16805
16806 let status = resp.status();
16807
16808 if !status.is_client_error() && !status.is_server_error() {
16809 Ok(())
16810 } else {
16811 let content = resp.text().await?;
16812 let entity: Option<RepoRenameBranchError> = serde_json::from_str(&content).ok();
16813 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16814 }
16815}
16816
16817pub async fn repo_search(configuration: &configuration::Configuration, q: Option<&str>, topic: Option<bool>, include_desc: Option<bool>, uid: Option<i64>, priority_owner_id: Option<i64>, team_id: Option<i64>, starred_by: Option<i64>, private: Option<bool>, is_private: Option<bool>, template: Option<bool>, archived: Option<bool>, mode: Option<&str>, exclusive: Option<bool>, sort: Option<&str>, order: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<models::SearchResults, Error<RepoSearchError>> {
16818 let p_query_q = q;
16820 let p_query_topic = topic;
16821 let p_query_include_desc = include_desc;
16822 let p_query_uid = uid;
16823 let p_query_priority_owner_id = priority_owner_id;
16824 let p_query_team_id = team_id;
16825 let p_query_starred_by = starred_by;
16826 let p_query_private = private;
16827 let p_query_is_private = is_private;
16828 let p_query_template = template;
16829 let p_query_archived = archived;
16830 let p_query_mode = mode;
16831 let p_query_exclusive = exclusive;
16832 let p_query_sort = sort;
16833 let p_query_order = order;
16834 let p_query_page = page;
16835 let p_query_limit = limit;
16836
16837 let uri_str = format!("{}/repos/search", configuration.base_path);
16838 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
16839
16840 if let Some(ref param_value) = p_query_q {
16841 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
16842 }
16843 if let Some(ref param_value) = p_query_topic {
16844 req_builder = req_builder.query(&[("topic", ¶m_value.to_string())]);
16845 }
16846 if let Some(ref param_value) = p_query_include_desc {
16847 req_builder = req_builder.query(&[("includeDesc", ¶m_value.to_string())]);
16848 }
16849 if let Some(ref param_value) = p_query_uid {
16850 req_builder = req_builder.query(&[("uid", ¶m_value.to_string())]);
16851 }
16852 if let Some(ref param_value) = p_query_priority_owner_id {
16853 req_builder = req_builder.query(&[("priority_owner_id", ¶m_value.to_string())]);
16854 }
16855 if let Some(ref param_value) = p_query_team_id {
16856 req_builder = req_builder.query(&[("team_id", ¶m_value.to_string())]);
16857 }
16858 if let Some(ref param_value) = p_query_starred_by {
16859 req_builder = req_builder.query(&[("starredBy", ¶m_value.to_string())]);
16860 }
16861 if let Some(ref param_value) = p_query_private {
16862 req_builder = req_builder.query(&[("private", ¶m_value.to_string())]);
16863 }
16864 if let Some(ref param_value) = p_query_is_private {
16865 req_builder = req_builder.query(&[("is_private", ¶m_value.to_string())]);
16866 }
16867 if let Some(ref param_value) = p_query_template {
16868 req_builder = req_builder.query(&[("template", ¶m_value.to_string())]);
16869 }
16870 if let Some(ref param_value) = p_query_archived {
16871 req_builder = req_builder.query(&[("archived", ¶m_value.to_string())]);
16872 }
16873 if let Some(ref param_value) = p_query_mode {
16874 req_builder = req_builder.query(&[("mode", ¶m_value.to_string())]);
16875 }
16876 if let Some(ref param_value) = p_query_exclusive {
16877 req_builder = req_builder.query(&[("exclusive", ¶m_value.to_string())]);
16878 }
16879 if let Some(ref param_value) = p_query_sort {
16880 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
16881 }
16882 if let Some(ref param_value) = p_query_order {
16883 req_builder = req_builder.query(&[("order", ¶m_value.to_string())]);
16884 }
16885 if let Some(ref param_value) = p_query_page {
16886 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
16887 }
16888 if let Some(ref param_value) = p_query_limit {
16889 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
16890 }
16891 if let Some(ref apikey) = configuration.api_key {
16892 let key = apikey.key.clone();
16893 let value = match apikey.prefix {
16894 Some(ref prefix) => format!("{} {}", prefix, key),
16895 None => key,
16896 };
16897 req_builder = req_builder.query(&[("access_token", value)]);
16898 }
16899 if let Some(ref apikey) = configuration.api_key {
16900 let key = apikey.key.clone();
16901 let value = match apikey.prefix {
16902 Some(ref prefix) => format!("{} {}", prefix, key),
16903 None => key,
16904 };
16905 req_builder = req_builder.query(&[("sudo", value)]);
16906 }
16907 if let Some(ref apikey) = configuration.api_key {
16908 let key = apikey.key.clone();
16909 let value = match apikey.prefix {
16910 Some(ref prefix) => format!("{} {}", prefix, key),
16911 None => key,
16912 };
16913 req_builder = req_builder.query(&[("token", value)]);
16914 }
16915 if let Some(ref user_agent) = configuration.user_agent {
16916 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
16917 }
16918 if let Some(ref apikey) = configuration.api_key {
16919 let key = apikey.key.clone();
16920 let value = match apikey.prefix {
16921 Some(ref prefix) => format!("{} {}", prefix, key),
16922 None => key,
16923 };
16924 req_builder = req_builder.header("X-GITEA-OTP", value);
16925 };
16926 if let Some(ref apikey) = configuration.api_key {
16927 let key = apikey.key.clone();
16928 let value = match apikey.prefix {
16929 Some(ref prefix) => format!("{} {}", prefix, key),
16930 None => key,
16931 };
16932 req_builder = req_builder.header("Authorization", value);
16933 };
16934 if let Some(ref apikey) = configuration.api_key {
16935 let key = apikey.key.clone();
16936 let value = match apikey.prefix {
16937 Some(ref prefix) => format!("{} {}", prefix, key),
16938 None => key,
16939 };
16940 req_builder = req_builder.header("Sudo", value);
16941 };
16942 if let Some(ref auth_conf) = configuration.basic_auth {
16943 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
16944 };
16945
16946 let req = req_builder.build()?;
16947 let resp = configuration.client.execute(req).await?;
16948
16949 let status = resp.status();
16950 let content_type = resp
16951 .headers()
16952 .get("content-type")
16953 .and_then(|v| v.to_str().ok())
16954 .unwrap_or("application/octet-stream");
16955 let content_type = super::ContentType::from(content_type);
16956
16957 if !status.is_client_error() && !status.is_server_error() {
16958 let content = resp.text().await?;
16959 match content_type {
16960 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
16961 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SearchResults`"))),
16962 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::SearchResults`")))),
16963 }
16964 } else {
16965 let content = resp.text().await?;
16966 let entity: Option<RepoSearchError> = serde_json::from_str(&content).ok();
16967 Err(Error::ResponseError(ResponseContent { status, content, entity }))
16968 }
16969}
16970
16971pub async fn repo_signing_key(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<String, Error<RepoSigningKeyError>> {
16972 let p_path_owner = owner;
16974 let p_path_repo = repo;
16975
16976 let uri_str = format!("{}/repos/{owner}/{repo}/signing-key.gpg", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
16977 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
16978
16979 if let Some(ref apikey) = configuration.api_key {
16980 let key = apikey.key.clone();
16981 let value = match apikey.prefix {
16982 Some(ref prefix) => format!("{} {}", prefix, key),
16983 None => key,
16984 };
16985 req_builder = req_builder.query(&[("access_token", value)]);
16986 }
16987 if let Some(ref apikey) = configuration.api_key {
16988 let key = apikey.key.clone();
16989 let value = match apikey.prefix {
16990 Some(ref prefix) => format!("{} {}", prefix, key),
16991 None => key,
16992 };
16993 req_builder = req_builder.query(&[("sudo", value)]);
16994 }
16995 if let Some(ref apikey) = configuration.api_key {
16996 let key = apikey.key.clone();
16997 let value = match apikey.prefix {
16998 Some(ref prefix) => format!("{} {}", prefix, key),
16999 None => key,
17000 };
17001 req_builder = req_builder.query(&[("token", value)]);
17002 }
17003 if let Some(ref user_agent) = configuration.user_agent {
17004 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17005 }
17006 if let Some(ref apikey) = configuration.api_key {
17007 let key = apikey.key.clone();
17008 let value = match apikey.prefix {
17009 Some(ref prefix) => format!("{} {}", prefix, key),
17010 None => key,
17011 };
17012 req_builder = req_builder.header("X-GITEA-OTP", value);
17013 };
17014 if let Some(ref apikey) = configuration.api_key {
17015 let key = apikey.key.clone();
17016 let value = match apikey.prefix {
17017 Some(ref prefix) => format!("{} {}", prefix, key),
17018 None => key,
17019 };
17020 req_builder = req_builder.header("Authorization", value);
17021 };
17022 if let Some(ref apikey) = configuration.api_key {
17023 let key = apikey.key.clone();
17024 let value = match apikey.prefix {
17025 Some(ref prefix) => format!("{} {}", prefix, key),
17026 None => key,
17027 };
17028 req_builder = req_builder.header("Sudo", value);
17029 };
17030 if let Some(ref auth_conf) = configuration.basic_auth {
17031 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17032 };
17033
17034 let req = req_builder.build()?;
17035 let resp = configuration.client.execute(req).await?;
17036
17037 let status = resp.status();
17038 let content_type = resp
17039 .headers()
17040 .get("content-type")
17041 .and_then(|v| v.to_str().ok())
17042 .unwrap_or("application/octet-stream");
17043 let content_type = super::ContentType::from(content_type);
17044
17045 if !status.is_client_error() && !status.is_server_error() {
17046 let content = resp.text().await?;
17047 match content_type {
17048 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
17049 ContentType::Text => return Ok(content),
17050 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
17051 }
17052 } else {
17053 let content = resp.text().await?;
17054 let entity: Option<RepoSigningKeyError> = serde_json::from_str(&content).ok();
17055 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17056 }
17057}
17058
17059pub async fn repo_signing_key_ssh(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<String, Error<RepoSigningKeySshError>> {
17060 let p_path_owner = owner;
17062 let p_path_repo = repo;
17063
17064 let uri_str = format!("{}/repos/{owner}/{repo}/signing-key.pub", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
17065 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
17066
17067 if let Some(ref apikey) = configuration.api_key {
17068 let key = apikey.key.clone();
17069 let value = match apikey.prefix {
17070 Some(ref prefix) => format!("{} {}", prefix, key),
17071 None => key,
17072 };
17073 req_builder = req_builder.query(&[("access_token", value)]);
17074 }
17075 if let Some(ref apikey) = configuration.api_key {
17076 let key = apikey.key.clone();
17077 let value = match apikey.prefix {
17078 Some(ref prefix) => format!("{} {}", prefix, key),
17079 None => key,
17080 };
17081 req_builder = req_builder.query(&[("sudo", value)]);
17082 }
17083 if let Some(ref apikey) = configuration.api_key {
17084 let key = apikey.key.clone();
17085 let value = match apikey.prefix {
17086 Some(ref prefix) => format!("{} {}", prefix, key),
17087 None => key,
17088 };
17089 req_builder = req_builder.query(&[("token", value)]);
17090 }
17091 if let Some(ref user_agent) = configuration.user_agent {
17092 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17093 }
17094 if let Some(ref apikey) = configuration.api_key {
17095 let key = apikey.key.clone();
17096 let value = match apikey.prefix {
17097 Some(ref prefix) => format!("{} {}", prefix, key),
17098 None => key,
17099 };
17100 req_builder = req_builder.header("X-GITEA-OTP", value);
17101 };
17102 if let Some(ref apikey) = configuration.api_key {
17103 let key = apikey.key.clone();
17104 let value = match apikey.prefix {
17105 Some(ref prefix) => format!("{} {}", prefix, key),
17106 None => key,
17107 };
17108 req_builder = req_builder.header("Authorization", value);
17109 };
17110 if let Some(ref apikey) = configuration.api_key {
17111 let key = apikey.key.clone();
17112 let value = match apikey.prefix {
17113 Some(ref prefix) => format!("{} {}", prefix, key),
17114 None => key,
17115 };
17116 req_builder = req_builder.header("Sudo", value);
17117 };
17118 if let Some(ref auth_conf) = configuration.basic_auth {
17119 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17120 };
17121
17122 let req = req_builder.build()?;
17123 let resp = configuration.client.execute(req).await?;
17124
17125 let status = resp.status();
17126 let content_type = resp
17127 .headers()
17128 .get("content-type")
17129 .and_then(|v| v.to_str().ok())
17130 .unwrap_or("application/octet-stream");
17131 let content_type = super::ContentType::from(content_type);
17132
17133 if !status.is_client_error() && !status.is_server_error() {
17134 let content = resp.text().await?;
17135 match content_type {
17136 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
17137 ContentType::Text => return Ok(content),
17138 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
17139 }
17140 } else {
17141 let content = resp.text().await?;
17142 let entity: Option<RepoSigningKeySshError> = serde_json::from_str(&content).ok();
17143 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17144 }
17145}
17146
17147pub async fn repo_submit_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64, body: models::SubmitPullReviewOptions) -> Result<models::PullReview, Error<RepoSubmitPullReviewError>> {
17148 let p_path_owner = owner;
17150 let p_path_repo = repo;
17151 let p_path_index = index;
17152 let p_path_id = id;
17153 let p_body_body = body;
17154
17155 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id);
17156 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
17157
17158 if let Some(ref apikey) = configuration.api_key {
17159 let key = apikey.key.clone();
17160 let value = match apikey.prefix {
17161 Some(ref prefix) => format!("{} {}", prefix, key),
17162 None => key,
17163 };
17164 req_builder = req_builder.query(&[("access_token", value)]);
17165 }
17166 if let Some(ref apikey) = configuration.api_key {
17167 let key = apikey.key.clone();
17168 let value = match apikey.prefix {
17169 Some(ref prefix) => format!("{} {}", prefix, key),
17170 None => key,
17171 };
17172 req_builder = req_builder.query(&[("sudo", value)]);
17173 }
17174 if let Some(ref apikey) = configuration.api_key {
17175 let key = apikey.key.clone();
17176 let value = match apikey.prefix {
17177 Some(ref prefix) => format!("{} {}", prefix, key),
17178 None => key,
17179 };
17180 req_builder = req_builder.query(&[("token", value)]);
17181 }
17182 if let Some(ref user_agent) = configuration.user_agent {
17183 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17184 }
17185 if let Some(ref apikey) = configuration.api_key {
17186 let key = apikey.key.clone();
17187 let value = match apikey.prefix {
17188 Some(ref prefix) => format!("{} {}", prefix, key),
17189 None => key,
17190 };
17191 req_builder = req_builder.header("X-GITEA-OTP", value);
17192 };
17193 if let Some(ref apikey) = configuration.api_key {
17194 let key = apikey.key.clone();
17195 let value = match apikey.prefix {
17196 Some(ref prefix) => format!("{} {}", prefix, key),
17197 None => key,
17198 };
17199 req_builder = req_builder.header("Authorization", value);
17200 };
17201 if let Some(ref apikey) = configuration.api_key {
17202 let key = apikey.key.clone();
17203 let value = match apikey.prefix {
17204 Some(ref prefix) => format!("{} {}", prefix, key),
17205 None => key,
17206 };
17207 req_builder = req_builder.header("Sudo", value);
17208 };
17209 if let Some(ref auth_conf) = configuration.basic_auth {
17210 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17211 };
17212 req_builder = req_builder.json(&p_body_body);
17213
17214 let req = req_builder.build()?;
17215 let resp = configuration.client.execute(req).await?;
17216
17217 let status = resp.status();
17218 let content_type = resp
17219 .headers()
17220 .get("content-type")
17221 .and_then(|v| v.to_str().ok())
17222 .unwrap_or("application/octet-stream");
17223 let content_type = super::ContentType::from(content_type);
17224
17225 if !status.is_client_error() && !status.is_server_error() {
17226 let content = resp.text().await?;
17227 match content_type {
17228 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
17229 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))),
17230 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::PullReview`")))),
17231 }
17232 } else {
17233 let content = resp.text().await?;
17234 let entity: Option<RepoSubmitPullReviewError> = serde_json::from_str(&content).ok();
17235 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17236 }
17237}
17238
17239pub async fn repo_test_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, r#ref: Option<&str>) -> Result<(), Error<RepoTestHookError>> {
17240 let p_path_owner = owner;
17242 let p_path_repo = repo;
17243 let p_path_id = id;
17244 let p_query_ref = r#ref;
17245
17246 let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}/tests", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
17247 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
17248
17249 if let Some(ref param_value) = p_query_ref {
17250 req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]);
17251 }
17252 if let Some(ref apikey) = configuration.api_key {
17253 let key = apikey.key.clone();
17254 let value = match apikey.prefix {
17255 Some(ref prefix) => format!("{} {}", prefix, key),
17256 None => key,
17257 };
17258 req_builder = req_builder.query(&[("access_token", value)]);
17259 }
17260 if let Some(ref apikey) = configuration.api_key {
17261 let key = apikey.key.clone();
17262 let value = match apikey.prefix {
17263 Some(ref prefix) => format!("{} {}", prefix, key),
17264 None => key,
17265 };
17266 req_builder = req_builder.query(&[("sudo", value)]);
17267 }
17268 if let Some(ref apikey) = configuration.api_key {
17269 let key = apikey.key.clone();
17270 let value = match apikey.prefix {
17271 Some(ref prefix) => format!("{} {}", prefix, key),
17272 None => key,
17273 };
17274 req_builder = req_builder.query(&[("token", value)]);
17275 }
17276 if let Some(ref user_agent) = configuration.user_agent {
17277 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17278 }
17279 if let Some(ref apikey) = configuration.api_key {
17280 let key = apikey.key.clone();
17281 let value = match apikey.prefix {
17282 Some(ref prefix) => format!("{} {}", prefix, key),
17283 None => key,
17284 };
17285 req_builder = req_builder.header("X-GITEA-OTP", value);
17286 };
17287 if let Some(ref apikey) = configuration.api_key {
17288 let key = apikey.key.clone();
17289 let value = match apikey.prefix {
17290 Some(ref prefix) => format!("{} {}", prefix, key),
17291 None => key,
17292 };
17293 req_builder = req_builder.header("Authorization", value);
17294 };
17295 if let Some(ref apikey) = configuration.api_key {
17296 let key = apikey.key.clone();
17297 let value = match apikey.prefix {
17298 Some(ref prefix) => format!("{} {}", prefix, key),
17299 None => key,
17300 };
17301 req_builder = req_builder.header("Sudo", value);
17302 };
17303 if let Some(ref auth_conf) = configuration.basic_auth {
17304 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17305 };
17306
17307 let req = req_builder.build()?;
17308 let resp = configuration.client.execute(req).await?;
17309
17310 let status = resp.status();
17311
17312 if !status.is_client_error() && !status.is_server_error() {
17313 Ok(())
17314 } else {
17315 let content = resp.text().await?;
17316 let entity: Option<RepoTestHookError> = serde_json::from_str(&content).ok();
17317 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17318 }
17319}
17320
17321pub async fn repo_tracked_times(configuration: &configuration::Configuration, owner: &str, repo: &str, user: Option<&str>, since: Option<String>, before: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::TrackedTime>, Error<RepoTrackedTimesError>> {
17322 let p_path_owner = owner;
17324 let p_path_repo = repo;
17325 let p_query_user = user;
17326 let p_query_since = since;
17327 let p_query_before = before;
17328 let p_query_page = page;
17329 let p_query_limit = limit;
17330
17331 let uri_str = format!("{}/repos/{owner}/{repo}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
17332 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
17333
17334 if let Some(ref param_value) = p_query_user {
17335 req_builder = req_builder.query(&[("user", ¶m_value.to_string())]);
17336 }
17337 if let Some(ref param_value) = p_query_since {
17338 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
17339 }
17340 if let Some(ref param_value) = p_query_before {
17341 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
17342 }
17343 if let Some(ref param_value) = p_query_page {
17344 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
17345 }
17346 if let Some(ref param_value) = p_query_limit {
17347 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
17348 }
17349 if let Some(ref apikey) = configuration.api_key {
17350 let key = apikey.key.clone();
17351 let value = match apikey.prefix {
17352 Some(ref prefix) => format!("{} {}", prefix, key),
17353 None => key,
17354 };
17355 req_builder = req_builder.query(&[("access_token", value)]);
17356 }
17357 if let Some(ref apikey) = configuration.api_key {
17358 let key = apikey.key.clone();
17359 let value = match apikey.prefix {
17360 Some(ref prefix) => format!("{} {}", prefix, key),
17361 None => key,
17362 };
17363 req_builder = req_builder.query(&[("sudo", value)]);
17364 }
17365 if let Some(ref apikey) = configuration.api_key {
17366 let key = apikey.key.clone();
17367 let value = match apikey.prefix {
17368 Some(ref prefix) => format!("{} {}", prefix, key),
17369 None => key,
17370 };
17371 req_builder = req_builder.query(&[("token", value)]);
17372 }
17373 if let Some(ref user_agent) = configuration.user_agent {
17374 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17375 }
17376 if let Some(ref apikey) = configuration.api_key {
17377 let key = apikey.key.clone();
17378 let value = match apikey.prefix {
17379 Some(ref prefix) => format!("{} {}", prefix, key),
17380 None => key,
17381 };
17382 req_builder = req_builder.header("X-GITEA-OTP", value);
17383 };
17384 if let Some(ref apikey) = configuration.api_key {
17385 let key = apikey.key.clone();
17386 let value = match apikey.prefix {
17387 Some(ref prefix) => format!("{} {}", prefix, key),
17388 None => key,
17389 };
17390 req_builder = req_builder.header("Authorization", value);
17391 };
17392 if let Some(ref apikey) = configuration.api_key {
17393 let key = apikey.key.clone();
17394 let value = match apikey.prefix {
17395 Some(ref prefix) => format!("{} {}", prefix, key),
17396 None => key,
17397 };
17398 req_builder = req_builder.header("Sudo", value);
17399 };
17400 if let Some(ref auth_conf) = configuration.basic_auth {
17401 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17402 };
17403
17404 let req = req_builder.build()?;
17405 let resp = configuration.client.execute(req).await?;
17406
17407 let status = resp.status();
17408 let content_type = resp
17409 .headers()
17410 .get("content-type")
17411 .and_then(|v| v.to_str().ok())
17412 .unwrap_or("application/octet-stream");
17413 let content_type = super::ContentType::from(content_type);
17414
17415 if !status.is_client_error() && !status.is_server_error() {
17416 let content = resp.text().await?;
17417 match content_type {
17418 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
17419 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrackedTime>`"))),
17420 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::TrackedTime>`")))),
17421 }
17422 } else {
17423 let content = resp.text().await?;
17424 let entity: Option<RepoTrackedTimesError> = serde_json::from_str(&content).ok();
17425 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17426 }
17427}
17428
17429pub async fn repo_transfer(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::TransferRepoOption) -> Result<models::Repository, Error<RepoTransferError>> {
17430 let p_path_owner = owner;
17432 let p_path_repo = repo;
17433 let p_body_body = body;
17434
17435 let uri_str = format!("{}/repos/{owner}/{repo}/transfer", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
17436 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
17437
17438 if let Some(ref apikey) = configuration.api_key {
17439 let key = apikey.key.clone();
17440 let value = match apikey.prefix {
17441 Some(ref prefix) => format!("{} {}", prefix, key),
17442 None => key,
17443 };
17444 req_builder = req_builder.query(&[("access_token", value)]);
17445 }
17446 if let Some(ref apikey) = configuration.api_key {
17447 let key = apikey.key.clone();
17448 let value = match apikey.prefix {
17449 Some(ref prefix) => format!("{} {}", prefix, key),
17450 None => key,
17451 };
17452 req_builder = req_builder.query(&[("sudo", value)]);
17453 }
17454 if let Some(ref apikey) = configuration.api_key {
17455 let key = apikey.key.clone();
17456 let value = match apikey.prefix {
17457 Some(ref prefix) => format!("{} {}", prefix, key),
17458 None => key,
17459 };
17460 req_builder = req_builder.query(&[("token", value)]);
17461 }
17462 if let Some(ref user_agent) = configuration.user_agent {
17463 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17464 }
17465 if let Some(ref apikey) = configuration.api_key {
17466 let key = apikey.key.clone();
17467 let value = match apikey.prefix {
17468 Some(ref prefix) => format!("{} {}", prefix, key),
17469 None => key,
17470 };
17471 req_builder = req_builder.header("X-GITEA-OTP", value);
17472 };
17473 if let Some(ref apikey) = configuration.api_key {
17474 let key = apikey.key.clone();
17475 let value = match apikey.prefix {
17476 Some(ref prefix) => format!("{} {}", prefix, key),
17477 None => key,
17478 };
17479 req_builder = req_builder.header("Authorization", value);
17480 };
17481 if let Some(ref apikey) = configuration.api_key {
17482 let key = apikey.key.clone();
17483 let value = match apikey.prefix {
17484 Some(ref prefix) => format!("{} {}", prefix, key),
17485 None => key,
17486 };
17487 req_builder = req_builder.header("Sudo", value);
17488 };
17489 if let Some(ref auth_conf) = configuration.basic_auth {
17490 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17491 };
17492 req_builder = req_builder.json(&p_body_body);
17493
17494 let req = req_builder.build()?;
17495 let resp = configuration.client.execute(req).await?;
17496
17497 let status = resp.status();
17498 let content_type = resp
17499 .headers()
17500 .get("content-type")
17501 .and_then(|v| v.to_str().ok())
17502 .unwrap_or("application/octet-stream");
17503 let content_type = super::ContentType::from(content_type);
17504
17505 if !status.is_client_error() && !status.is_server_error() {
17506 let content = resp.text().await?;
17507 match content_type {
17508 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
17509 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))),
17510 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`")))),
17511 }
17512 } else {
17513 let content = resp.text().await?;
17514 let entity: Option<RepoTransferError> = serde_json::from_str(&content).ok();
17515 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17516 }
17517}
17518
17519pub async fn repo_un_dismiss_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<models::PullReview, Error<RepoUnDismissPullReviewError>> {
17520 let p_path_owner = owner;
17522 let p_path_repo = repo;
17523 let p_path_index = index;
17524 let p_path_id = id;
17525
17526 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/undismissals", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id);
17527 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
17528
17529 if let Some(ref apikey) = configuration.api_key {
17530 let key = apikey.key.clone();
17531 let value = match apikey.prefix {
17532 Some(ref prefix) => format!("{} {}", prefix, key),
17533 None => key,
17534 };
17535 req_builder = req_builder.query(&[("access_token", value)]);
17536 }
17537 if let Some(ref apikey) = configuration.api_key {
17538 let key = apikey.key.clone();
17539 let value = match apikey.prefix {
17540 Some(ref prefix) => format!("{} {}", prefix, key),
17541 None => key,
17542 };
17543 req_builder = req_builder.query(&[("sudo", value)]);
17544 }
17545 if let Some(ref apikey) = configuration.api_key {
17546 let key = apikey.key.clone();
17547 let value = match apikey.prefix {
17548 Some(ref prefix) => format!("{} {}", prefix, key),
17549 None => key,
17550 };
17551 req_builder = req_builder.query(&[("token", value)]);
17552 }
17553 if let Some(ref user_agent) = configuration.user_agent {
17554 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17555 }
17556 if let Some(ref apikey) = configuration.api_key {
17557 let key = apikey.key.clone();
17558 let value = match apikey.prefix {
17559 Some(ref prefix) => format!("{} {}", prefix, key),
17560 None => key,
17561 };
17562 req_builder = req_builder.header("X-GITEA-OTP", value);
17563 };
17564 if let Some(ref apikey) = configuration.api_key {
17565 let key = apikey.key.clone();
17566 let value = match apikey.prefix {
17567 Some(ref prefix) => format!("{} {}", prefix, key),
17568 None => key,
17569 };
17570 req_builder = req_builder.header("Authorization", value);
17571 };
17572 if let Some(ref apikey) = configuration.api_key {
17573 let key = apikey.key.clone();
17574 let value = match apikey.prefix {
17575 Some(ref prefix) => format!("{} {}", prefix, key),
17576 None => key,
17577 };
17578 req_builder = req_builder.header("Sudo", value);
17579 };
17580 if let Some(ref auth_conf) = configuration.basic_auth {
17581 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17582 };
17583
17584 let req = req_builder.build()?;
17585 let resp = configuration.client.execute(req).await?;
17586
17587 let status = resp.status();
17588 let content_type = resp
17589 .headers()
17590 .get("content-type")
17591 .and_then(|v| v.to_str().ok())
17592 .unwrap_or("application/octet-stream");
17593 let content_type = super::ContentType::from(content_type);
17594
17595 if !status.is_client_error() && !status.is_server_error() {
17596 let content = resp.text().await?;
17597 match content_type {
17598 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
17599 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))),
17600 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::PullReview`")))),
17601 }
17602 } else {
17603 let content = resp.text().await?;
17604 let entity: Option<RepoUnDismissPullReviewError> = serde_json::from_str(&content).ok();
17605 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17606 }
17607}
17608
17609pub async fn repo_update_avatar(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::UpdateRepoAvatarOption>) -> Result<(), Error<RepoUpdateAvatarError>> {
17610 let p_path_owner = owner;
17612 let p_path_repo = repo;
17613 let p_body_body = body;
17614
17615 let uri_str = format!("{}/repos/{owner}/{repo}/avatar", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
17616 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
17617
17618 if let Some(ref apikey) = configuration.api_key {
17619 let key = apikey.key.clone();
17620 let value = match apikey.prefix {
17621 Some(ref prefix) => format!("{} {}", prefix, key),
17622 None => key,
17623 };
17624 req_builder = req_builder.query(&[("access_token", value)]);
17625 }
17626 if let Some(ref apikey) = configuration.api_key {
17627 let key = apikey.key.clone();
17628 let value = match apikey.prefix {
17629 Some(ref prefix) => format!("{} {}", prefix, key),
17630 None => key,
17631 };
17632 req_builder = req_builder.query(&[("sudo", value)]);
17633 }
17634 if let Some(ref apikey) = configuration.api_key {
17635 let key = apikey.key.clone();
17636 let value = match apikey.prefix {
17637 Some(ref prefix) => format!("{} {}", prefix, key),
17638 None => key,
17639 };
17640 req_builder = req_builder.query(&[("token", value)]);
17641 }
17642 if let Some(ref user_agent) = configuration.user_agent {
17643 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17644 }
17645 if let Some(ref apikey) = configuration.api_key {
17646 let key = apikey.key.clone();
17647 let value = match apikey.prefix {
17648 Some(ref prefix) => format!("{} {}", prefix, key),
17649 None => key,
17650 };
17651 req_builder = req_builder.header("X-GITEA-OTP", value);
17652 };
17653 if let Some(ref apikey) = configuration.api_key {
17654 let key = apikey.key.clone();
17655 let value = match apikey.prefix {
17656 Some(ref prefix) => format!("{} {}", prefix, key),
17657 None => key,
17658 };
17659 req_builder = req_builder.header("Authorization", value);
17660 };
17661 if let Some(ref apikey) = configuration.api_key {
17662 let key = apikey.key.clone();
17663 let value = match apikey.prefix {
17664 Some(ref prefix) => format!("{} {}", prefix, key),
17665 None => key,
17666 };
17667 req_builder = req_builder.header("Sudo", value);
17668 };
17669 if let Some(ref auth_conf) = configuration.basic_auth {
17670 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17671 };
17672 req_builder = req_builder.json(&p_body_body);
17673
17674 let req = req_builder.build()?;
17675 let resp = configuration.client.execute(req).await?;
17676
17677 let status = resp.status();
17678
17679 if !status.is_client_error() && !status.is_server_error() {
17680 Ok(())
17681 } else {
17682 let content = resp.text().await?;
17683 let entity: Option<RepoUpdateAvatarError> = serde_json::from_str(&content).ok();
17684 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17685 }
17686}
17687
17688pub async fn repo_update_branch_protection_priories(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::UpdateBranchProtectionPriories>) -> Result<(), Error<RepoUpdateBranchProtectionPrioriesError>> {
17689 let p_path_owner = owner;
17691 let p_path_repo = repo;
17692 let p_body_body = body;
17693
17694 let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/priority", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
17695 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
17696
17697 if let Some(ref apikey) = configuration.api_key {
17698 let key = apikey.key.clone();
17699 let value = match apikey.prefix {
17700 Some(ref prefix) => format!("{} {}", prefix, key),
17701 None => key,
17702 };
17703 req_builder = req_builder.query(&[("access_token", value)]);
17704 }
17705 if let Some(ref apikey) = configuration.api_key {
17706 let key = apikey.key.clone();
17707 let value = match apikey.prefix {
17708 Some(ref prefix) => format!("{} {}", prefix, key),
17709 None => key,
17710 };
17711 req_builder = req_builder.query(&[("sudo", value)]);
17712 }
17713 if let Some(ref apikey) = configuration.api_key {
17714 let key = apikey.key.clone();
17715 let value = match apikey.prefix {
17716 Some(ref prefix) => format!("{} {}", prefix, key),
17717 None => key,
17718 };
17719 req_builder = req_builder.query(&[("token", value)]);
17720 }
17721 if let Some(ref user_agent) = configuration.user_agent {
17722 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17723 }
17724 if let Some(ref apikey) = configuration.api_key {
17725 let key = apikey.key.clone();
17726 let value = match apikey.prefix {
17727 Some(ref prefix) => format!("{} {}", prefix, key),
17728 None => key,
17729 };
17730 req_builder = req_builder.header("X-GITEA-OTP", value);
17731 };
17732 if let Some(ref apikey) = configuration.api_key {
17733 let key = apikey.key.clone();
17734 let value = match apikey.prefix {
17735 Some(ref prefix) => format!("{} {}", prefix, key),
17736 None => key,
17737 };
17738 req_builder = req_builder.header("Authorization", value);
17739 };
17740 if let Some(ref apikey) = configuration.api_key {
17741 let key = apikey.key.clone();
17742 let value = match apikey.prefix {
17743 Some(ref prefix) => format!("{} {}", prefix, key),
17744 None => key,
17745 };
17746 req_builder = req_builder.header("Sudo", value);
17747 };
17748 if let Some(ref auth_conf) = configuration.basic_auth {
17749 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17750 };
17751 req_builder = req_builder.json(&p_body_body);
17752
17753 let req = req_builder.build()?;
17754 let resp = configuration.client.execute(req).await?;
17755
17756 let status = resp.status();
17757
17758 if !status.is_client_error() && !status.is_server_error() {
17759 Ok(())
17760 } else {
17761 let content = resp.text().await?;
17762 let entity: Option<RepoUpdateBranchProtectionPrioriesError> = serde_json::from_str(&content).ok();
17763 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17764 }
17765}
17766
17767pub async fn repo_update_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, body: models::UpdateFileOptions) -> Result<models::FileResponse, Error<RepoUpdateFileError>> {
17768 let p_path_owner = owner;
17770 let p_path_repo = repo;
17771 let p_path_filepath = filepath;
17772 let p_body_body = body;
17773
17774 let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath));
17775 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
17776
17777 if let Some(ref apikey) = configuration.api_key {
17778 let key = apikey.key.clone();
17779 let value = match apikey.prefix {
17780 Some(ref prefix) => format!("{} {}", prefix, key),
17781 None => key,
17782 };
17783 req_builder = req_builder.query(&[("access_token", value)]);
17784 }
17785 if let Some(ref apikey) = configuration.api_key {
17786 let key = apikey.key.clone();
17787 let value = match apikey.prefix {
17788 Some(ref prefix) => format!("{} {}", prefix, key),
17789 None => key,
17790 };
17791 req_builder = req_builder.query(&[("sudo", value)]);
17792 }
17793 if let Some(ref apikey) = configuration.api_key {
17794 let key = apikey.key.clone();
17795 let value = match apikey.prefix {
17796 Some(ref prefix) => format!("{} {}", prefix, key),
17797 None => key,
17798 };
17799 req_builder = req_builder.query(&[("token", value)]);
17800 }
17801 if let Some(ref user_agent) = configuration.user_agent {
17802 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17803 }
17804 if let Some(ref apikey) = configuration.api_key {
17805 let key = apikey.key.clone();
17806 let value = match apikey.prefix {
17807 Some(ref prefix) => format!("{} {}", prefix, key),
17808 None => key,
17809 };
17810 req_builder = req_builder.header("X-GITEA-OTP", value);
17811 };
17812 if let Some(ref apikey) = configuration.api_key {
17813 let key = apikey.key.clone();
17814 let value = match apikey.prefix {
17815 Some(ref prefix) => format!("{} {}", prefix, key),
17816 None => key,
17817 };
17818 req_builder = req_builder.header("Authorization", value);
17819 };
17820 if let Some(ref apikey) = configuration.api_key {
17821 let key = apikey.key.clone();
17822 let value = match apikey.prefix {
17823 Some(ref prefix) => format!("{} {}", prefix, key),
17824 None => key,
17825 };
17826 req_builder = req_builder.header("Sudo", value);
17827 };
17828 if let Some(ref auth_conf) = configuration.basic_auth {
17829 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17830 };
17831 req_builder = req_builder.json(&p_body_body);
17832
17833 let req = req_builder.build()?;
17834 let resp = configuration.client.execute(req).await?;
17835
17836 let status = resp.status();
17837 let content_type = resp
17838 .headers()
17839 .get("content-type")
17840 .and_then(|v| v.to_str().ok())
17841 .unwrap_or("application/octet-stream");
17842 let content_type = super::ContentType::from(content_type);
17843
17844 if !status.is_client_error() && !status.is_server_error() {
17845 let content = resp.text().await?;
17846 match content_type {
17847 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
17848 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileResponse`"))),
17849 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::FileResponse`")))),
17850 }
17851 } else {
17852 let content = resp.text().await?;
17853 let entity: Option<RepoUpdateFileError> = serde_json::from_str(&content).ok();
17854 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17855 }
17856}
17857
17858pub async fn repo_update_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, style: Option<&str>) -> Result<(), Error<RepoUpdatePullRequestError>> {
17859 let p_path_owner = owner;
17861 let p_path_repo = repo;
17862 let p_path_index = index;
17863 let p_query_style = style;
17864
17865 let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/update", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
17866 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
17867
17868 if let Some(ref param_value) = p_query_style {
17869 req_builder = req_builder.query(&[("style", ¶m_value.to_string())]);
17870 }
17871 if let Some(ref apikey) = configuration.api_key {
17872 let key = apikey.key.clone();
17873 let value = match apikey.prefix {
17874 Some(ref prefix) => format!("{} {}", prefix, key),
17875 None => key,
17876 };
17877 req_builder = req_builder.query(&[("access_token", value)]);
17878 }
17879 if let Some(ref apikey) = configuration.api_key {
17880 let key = apikey.key.clone();
17881 let value = match apikey.prefix {
17882 Some(ref prefix) => format!("{} {}", prefix, key),
17883 None => key,
17884 };
17885 req_builder = req_builder.query(&[("sudo", value)]);
17886 }
17887 if let Some(ref apikey) = configuration.api_key {
17888 let key = apikey.key.clone();
17889 let value = match apikey.prefix {
17890 Some(ref prefix) => format!("{} {}", prefix, key),
17891 None => key,
17892 };
17893 req_builder = req_builder.query(&[("token", value)]);
17894 }
17895 if let Some(ref user_agent) = configuration.user_agent {
17896 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17897 }
17898 if let Some(ref apikey) = configuration.api_key {
17899 let key = apikey.key.clone();
17900 let value = match apikey.prefix {
17901 Some(ref prefix) => format!("{} {}", prefix, key),
17902 None => key,
17903 };
17904 req_builder = req_builder.header("X-GITEA-OTP", value);
17905 };
17906 if let Some(ref apikey) = configuration.api_key {
17907 let key = apikey.key.clone();
17908 let value = match apikey.prefix {
17909 Some(ref prefix) => format!("{} {}", prefix, key),
17910 None => key,
17911 };
17912 req_builder = req_builder.header("Authorization", value);
17913 };
17914 if let Some(ref apikey) = configuration.api_key {
17915 let key = apikey.key.clone();
17916 let value = match apikey.prefix {
17917 Some(ref prefix) => format!("{} {}", prefix, key),
17918 None => key,
17919 };
17920 req_builder = req_builder.header("Sudo", value);
17921 };
17922 if let Some(ref auth_conf) = configuration.basic_auth {
17923 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
17924 };
17925
17926 let req = req_builder.build()?;
17927 let resp = configuration.client.execute(req).await?;
17928
17929 let status = resp.status();
17930
17931 if !status.is_client_error() && !status.is_server_error() {
17932 Ok(())
17933 } else {
17934 let content = resp.text().await?;
17935 let entity: Option<RepoUpdatePullRequestError> = serde_json::from_str(&content).ok();
17936 Err(Error::ResponseError(ResponseContent { status, content, entity }))
17937 }
17938}
17939
17940pub async fn repo_update_topics(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::RepoTopicOptions>) -> Result<(), Error<RepoUpdateTopicsError>> {
17941 let p_path_owner = owner;
17943 let p_path_repo = repo;
17944 let p_body_body = body;
17945
17946 let uri_str = format!("{}/repos/{owner}/{repo}/topics", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
17947 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
17948
17949 if let Some(ref apikey) = configuration.api_key {
17950 let key = apikey.key.clone();
17951 let value = match apikey.prefix {
17952 Some(ref prefix) => format!("{} {}", prefix, key),
17953 None => key,
17954 };
17955 req_builder = req_builder.query(&[("access_token", value)]);
17956 }
17957 if let Some(ref apikey) = configuration.api_key {
17958 let key = apikey.key.clone();
17959 let value = match apikey.prefix {
17960 Some(ref prefix) => format!("{} {}", prefix, key),
17961 None => key,
17962 };
17963 req_builder = req_builder.query(&[("sudo", value)]);
17964 }
17965 if let Some(ref apikey) = configuration.api_key {
17966 let key = apikey.key.clone();
17967 let value = match apikey.prefix {
17968 Some(ref prefix) => format!("{} {}", prefix, key),
17969 None => key,
17970 };
17971 req_builder = req_builder.query(&[("token", value)]);
17972 }
17973 if let Some(ref user_agent) = configuration.user_agent {
17974 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
17975 }
17976 if let Some(ref apikey) = configuration.api_key {
17977 let key = apikey.key.clone();
17978 let value = match apikey.prefix {
17979 Some(ref prefix) => format!("{} {}", prefix, key),
17980 None => key,
17981 };
17982 req_builder = req_builder.header("X-GITEA-OTP", value);
17983 };
17984 if let Some(ref apikey) = configuration.api_key {
17985 let key = apikey.key.clone();
17986 let value = match apikey.prefix {
17987 Some(ref prefix) => format!("{} {}", prefix, key),
17988 None => key,
17989 };
17990 req_builder = req_builder.header("Authorization", value);
17991 };
17992 if let Some(ref apikey) = configuration.api_key {
17993 let key = apikey.key.clone();
17994 let value = match apikey.prefix {
17995 Some(ref prefix) => format!("{} {}", prefix, key),
17996 None => key,
17997 };
17998 req_builder = req_builder.header("Sudo", value);
17999 };
18000 if let Some(ref auth_conf) = configuration.basic_auth {
18001 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18002 };
18003 req_builder = req_builder.json(&p_body_body);
18004
18005 let req = req_builder.build()?;
18006 let resp = configuration.client.execute(req).await?;
18007
18008 let status = resp.status();
18009
18010 if !status.is_client_error() && !status.is_server_error() {
18011 Ok(())
18012 } else {
18013 let content = resp.text().await?;
18014 let entity: Option<RepoUpdateTopicsError> = serde_json::from_str(&content).ok();
18015 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18016 }
18017}
18018
18019pub async fn repo_validate_issue_config(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::IssueConfigValidation, Error<RepoValidateIssueConfigError>> {
18020 let p_path_owner = owner;
18022 let p_path_repo = repo;
18023
18024 let uri_str = format!("{}/repos/{owner}/{repo}/issue_config/validate", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
18025 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
18026
18027 if let Some(ref apikey) = configuration.api_key {
18028 let key = apikey.key.clone();
18029 let value = match apikey.prefix {
18030 Some(ref prefix) => format!("{} {}", prefix, key),
18031 None => key,
18032 };
18033 req_builder = req_builder.query(&[("access_token", value)]);
18034 }
18035 if let Some(ref apikey) = configuration.api_key {
18036 let key = apikey.key.clone();
18037 let value = match apikey.prefix {
18038 Some(ref prefix) => format!("{} {}", prefix, key),
18039 None => key,
18040 };
18041 req_builder = req_builder.query(&[("sudo", value)]);
18042 }
18043 if let Some(ref apikey) = configuration.api_key {
18044 let key = apikey.key.clone();
18045 let value = match apikey.prefix {
18046 Some(ref prefix) => format!("{} {}", prefix, key),
18047 None => key,
18048 };
18049 req_builder = req_builder.query(&[("token", value)]);
18050 }
18051 if let Some(ref user_agent) = configuration.user_agent {
18052 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18053 }
18054 if let Some(ref apikey) = configuration.api_key {
18055 let key = apikey.key.clone();
18056 let value = match apikey.prefix {
18057 Some(ref prefix) => format!("{} {}", prefix, key),
18058 None => key,
18059 };
18060 req_builder = req_builder.header("X-GITEA-OTP", value);
18061 };
18062 if let Some(ref apikey) = configuration.api_key {
18063 let key = apikey.key.clone();
18064 let value = match apikey.prefix {
18065 Some(ref prefix) => format!("{} {}", prefix, key),
18066 None => key,
18067 };
18068 req_builder = req_builder.header("Authorization", value);
18069 };
18070 if let Some(ref apikey) = configuration.api_key {
18071 let key = apikey.key.clone();
18072 let value = match apikey.prefix {
18073 Some(ref prefix) => format!("{} {}", prefix, key),
18074 None => key,
18075 };
18076 req_builder = req_builder.header("Sudo", value);
18077 };
18078 if let Some(ref auth_conf) = configuration.basic_auth {
18079 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18080 };
18081
18082 let req = req_builder.build()?;
18083 let resp = configuration.client.execute(req).await?;
18084
18085 let status = resp.status();
18086 let content_type = resp
18087 .headers()
18088 .get("content-type")
18089 .and_then(|v| v.to_str().ok())
18090 .unwrap_or("application/octet-stream");
18091 let content_type = super::ContentType::from(content_type);
18092
18093 if !status.is_client_error() && !status.is_server_error() {
18094 let content = resp.text().await?;
18095 match content_type {
18096 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
18097 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueConfigValidation`"))),
18098 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::IssueConfigValidation`")))),
18099 }
18100 } else {
18101 let content = resp.text().await?;
18102 let entity: Option<RepoValidateIssueConfigError> = serde_json::from_str(&content).ok();
18103 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18104 }
18105}
18106
18107pub async fn topic_search(configuration: &configuration::Configuration, q: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::TopicResponse>, Error<TopicSearchError>> {
18108 let p_query_q = q;
18110 let p_query_page = page;
18111 let p_query_limit = limit;
18112
18113 let uri_str = format!("{}/topics/search", configuration.base_path);
18114 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
18115
18116 req_builder = req_builder.query(&[("q", &p_query_q.to_string())]);
18117 if let Some(ref param_value) = p_query_page {
18118 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
18119 }
18120 if let Some(ref param_value) = p_query_limit {
18121 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
18122 }
18123 if let Some(ref apikey) = configuration.api_key {
18124 let key = apikey.key.clone();
18125 let value = match apikey.prefix {
18126 Some(ref prefix) => format!("{} {}", prefix, key),
18127 None => key,
18128 };
18129 req_builder = req_builder.query(&[("access_token", value)]);
18130 }
18131 if let Some(ref apikey) = configuration.api_key {
18132 let key = apikey.key.clone();
18133 let value = match apikey.prefix {
18134 Some(ref prefix) => format!("{} {}", prefix, key),
18135 None => key,
18136 };
18137 req_builder = req_builder.query(&[("sudo", value)]);
18138 }
18139 if let Some(ref apikey) = configuration.api_key {
18140 let key = apikey.key.clone();
18141 let value = match apikey.prefix {
18142 Some(ref prefix) => format!("{} {}", prefix, key),
18143 None => key,
18144 };
18145 req_builder = req_builder.query(&[("token", value)]);
18146 }
18147 if let Some(ref user_agent) = configuration.user_agent {
18148 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18149 }
18150 if let Some(ref apikey) = configuration.api_key {
18151 let key = apikey.key.clone();
18152 let value = match apikey.prefix {
18153 Some(ref prefix) => format!("{} {}", prefix, key),
18154 None => key,
18155 };
18156 req_builder = req_builder.header("X-GITEA-OTP", value);
18157 };
18158 if let Some(ref apikey) = configuration.api_key {
18159 let key = apikey.key.clone();
18160 let value = match apikey.prefix {
18161 Some(ref prefix) => format!("{} {}", prefix, key),
18162 None => key,
18163 };
18164 req_builder = req_builder.header("Authorization", value);
18165 };
18166 if let Some(ref apikey) = configuration.api_key {
18167 let key = apikey.key.clone();
18168 let value = match apikey.prefix {
18169 Some(ref prefix) => format!("{} {}", prefix, key),
18170 None => key,
18171 };
18172 req_builder = req_builder.header("Sudo", value);
18173 };
18174 if let Some(ref auth_conf) = configuration.basic_auth {
18175 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18176 };
18177
18178 let req = req_builder.build()?;
18179 let resp = configuration.client.execute(req).await?;
18180
18181 let status = resp.status();
18182 let content_type = resp
18183 .headers()
18184 .get("content-type")
18185 .and_then(|v| v.to_str().ok())
18186 .unwrap_or("application/octet-stream");
18187 let content_type = super::ContentType::from(content_type);
18188
18189 if !status.is_client_error() && !status.is_server_error() {
18190 let content = resp.text().await?;
18191 match content_type {
18192 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
18193 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TopicResponse>`"))),
18194 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::TopicResponse>`")))),
18195 }
18196 } else {
18197 let content = resp.text().await?;
18198 let entity: Option<TopicSearchError> = serde_json::from_str(&content).ok();
18199 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18200 }
18201}
18202
18203pub async fn update_repo_secret(configuration: &configuration::Configuration, owner: &str, repo: &str, secretname: &str, body: Option<models::CreateOrUpdateSecretOption>) -> Result<(), Error<UpdateRepoSecretError>> {
18204 let p_path_owner = owner;
18206 let p_path_repo = repo;
18207 let p_path_secretname = secretname;
18208 let p_body_body = body;
18209
18210 let uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets/{secretname}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), secretname=crate::apis::urlencode(p_path_secretname));
18211 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
18212
18213 if let Some(ref apikey) = configuration.api_key {
18214 let key = apikey.key.clone();
18215 let value = match apikey.prefix {
18216 Some(ref prefix) => format!("{} {}", prefix, key),
18217 None => key,
18218 };
18219 req_builder = req_builder.query(&[("access_token", value)]);
18220 }
18221 if let Some(ref apikey) = configuration.api_key {
18222 let key = apikey.key.clone();
18223 let value = match apikey.prefix {
18224 Some(ref prefix) => format!("{} {}", prefix, key),
18225 None => key,
18226 };
18227 req_builder = req_builder.query(&[("sudo", value)]);
18228 }
18229 if let Some(ref apikey) = configuration.api_key {
18230 let key = apikey.key.clone();
18231 let value = match apikey.prefix {
18232 Some(ref prefix) => format!("{} {}", prefix, key),
18233 None => key,
18234 };
18235 req_builder = req_builder.query(&[("token", value)]);
18236 }
18237 if let Some(ref user_agent) = configuration.user_agent {
18238 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18239 }
18240 if let Some(ref apikey) = configuration.api_key {
18241 let key = apikey.key.clone();
18242 let value = match apikey.prefix {
18243 Some(ref prefix) => format!("{} {}", prefix, key),
18244 None => key,
18245 };
18246 req_builder = req_builder.header("X-GITEA-OTP", value);
18247 };
18248 if let Some(ref apikey) = configuration.api_key {
18249 let key = apikey.key.clone();
18250 let value = match apikey.prefix {
18251 Some(ref prefix) => format!("{} {}", prefix, key),
18252 None => key,
18253 };
18254 req_builder = req_builder.header("Authorization", value);
18255 };
18256 if let Some(ref apikey) = configuration.api_key {
18257 let key = apikey.key.clone();
18258 let value = match apikey.prefix {
18259 Some(ref prefix) => format!("{} {}", prefix, key),
18260 None => key,
18261 };
18262 req_builder = req_builder.header("Sudo", value);
18263 };
18264 if let Some(ref auth_conf) = configuration.basic_auth {
18265 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18266 };
18267 req_builder = req_builder.json(&p_body_body);
18268
18269 let req = req_builder.build()?;
18270 let resp = configuration.client.execute(req).await?;
18271
18272 let status = resp.status();
18273
18274 if !status.is_client_error() && !status.is_server_error() {
18275 Ok(())
18276 } else {
18277 let content = resp.text().await?;
18278 let entity: Option<UpdateRepoSecretError> = serde_json::from_str(&content).ok();
18279 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18280 }
18281}
18282
18283pub async fn update_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str, body: Option<models::UpdateVariableOption>) -> Result<(), Error<UpdateRepoVariableError>> {
18284 let p_path_owner = owner;
18286 let p_path_repo = repo;
18287 let p_path_variablename = variablename;
18288 let p_body_body = body;
18289
18290 let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename));
18291 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
18292
18293 if let Some(ref apikey) = configuration.api_key {
18294 let key = apikey.key.clone();
18295 let value = match apikey.prefix {
18296 Some(ref prefix) => format!("{} {}", prefix, key),
18297 None => key,
18298 };
18299 req_builder = req_builder.query(&[("access_token", value)]);
18300 }
18301 if let Some(ref apikey) = configuration.api_key {
18302 let key = apikey.key.clone();
18303 let value = match apikey.prefix {
18304 Some(ref prefix) => format!("{} {}", prefix, key),
18305 None => key,
18306 };
18307 req_builder = req_builder.query(&[("sudo", value)]);
18308 }
18309 if let Some(ref apikey) = configuration.api_key {
18310 let key = apikey.key.clone();
18311 let value = match apikey.prefix {
18312 Some(ref prefix) => format!("{} {}", prefix, key),
18313 None => key,
18314 };
18315 req_builder = req_builder.query(&[("token", value)]);
18316 }
18317 if let Some(ref user_agent) = configuration.user_agent {
18318 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18319 }
18320 if let Some(ref apikey) = configuration.api_key {
18321 let key = apikey.key.clone();
18322 let value = match apikey.prefix {
18323 Some(ref prefix) => format!("{} {}", prefix, key),
18324 None => key,
18325 };
18326 req_builder = req_builder.header("X-GITEA-OTP", value);
18327 };
18328 if let Some(ref apikey) = configuration.api_key {
18329 let key = apikey.key.clone();
18330 let value = match apikey.prefix {
18331 Some(ref prefix) => format!("{} {}", prefix, key),
18332 None => key,
18333 };
18334 req_builder = req_builder.header("Authorization", value);
18335 };
18336 if let Some(ref apikey) = configuration.api_key {
18337 let key = apikey.key.clone();
18338 let value = match apikey.prefix {
18339 Some(ref prefix) => format!("{} {}", prefix, key),
18340 None => key,
18341 };
18342 req_builder = req_builder.header("Sudo", value);
18343 };
18344 if let Some(ref auth_conf) = configuration.basic_auth {
18345 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18346 };
18347 req_builder = req_builder.json(&p_body_body);
18348
18349 let req = req_builder.build()?;
18350 let resp = configuration.client.execute(req).await?;
18351
18352 let status = resp.status();
18353
18354 if !status.is_client_error() && !status.is_server_error() {
18355 Ok(())
18356 } else {
18357 let content = resp.text().await?;
18358 let entity: Option<UpdateRepoVariableError> = serde_json::from_str(&content).ok();
18359 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18360 }
18361}
18362
18363pub async fn user_current_check_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::WatchInfo, Error<UserCurrentCheckSubscriptionError>> {
18364 let p_path_owner = owner;
18366 let p_path_repo = repo;
18367
18368 let uri_str = format!("{}/repos/{owner}/{repo}/subscription", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
18369 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
18370
18371 if let Some(ref apikey) = configuration.api_key {
18372 let key = apikey.key.clone();
18373 let value = match apikey.prefix {
18374 Some(ref prefix) => format!("{} {}", prefix, key),
18375 None => key,
18376 };
18377 req_builder = req_builder.query(&[("access_token", value)]);
18378 }
18379 if let Some(ref apikey) = configuration.api_key {
18380 let key = apikey.key.clone();
18381 let value = match apikey.prefix {
18382 Some(ref prefix) => format!("{} {}", prefix, key),
18383 None => key,
18384 };
18385 req_builder = req_builder.query(&[("sudo", value)]);
18386 }
18387 if let Some(ref apikey) = configuration.api_key {
18388 let key = apikey.key.clone();
18389 let value = match apikey.prefix {
18390 Some(ref prefix) => format!("{} {}", prefix, key),
18391 None => key,
18392 };
18393 req_builder = req_builder.query(&[("token", value)]);
18394 }
18395 if let Some(ref user_agent) = configuration.user_agent {
18396 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18397 }
18398 if let Some(ref apikey) = configuration.api_key {
18399 let key = apikey.key.clone();
18400 let value = match apikey.prefix {
18401 Some(ref prefix) => format!("{} {}", prefix, key),
18402 None => key,
18403 };
18404 req_builder = req_builder.header("X-GITEA-OTP", value);
18405 };
18406 if let Some(ref apikey) = configuration.api_key {
18407 let key = apikey.key.clone();
18408 let value = match apikey.prefix {
18409 Some(ref prefix) => format!("{} {}", prefix, key),
18410 None => key,
18411 };
18412 req_builder = req_builder.header("Authorization", value);
18413 };
18414 if let Some(ref apikey) = configuration.api_key {
18415 let key = apikey.key.clone();
18416 let value = match apikey.prefix {
18417 Some(ref prefix) => format!("{} {}", prefix, key),
18418 None => key,
18419 };
18420 req_builder = req_builder.header("Sudo", value);
18421 };
18422 if let Some(ref auth_conf) = configuration.basic_auth {
18423 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18424 };
18425
18426 let req = req_builder.build()?;
18427 let resp = configuration.client.execute(req).await?;
18428
18429 let status = resp.status();
18430 let content_type = resp
18431 .headers()
18432 .get("content-type")
18433 .and_then(|v| v.to_str().ok())
18434 .unwrap_or("application/octet-stream");
18435 let content_type = super::ContentType::from(content_type);
18436
18437 if !status.is_client_error() && !status.is_server_error() {
18438 let content = resp.text().await?;
18439 match content_type {
18440 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
18441 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WatchInfo`"))),
18442 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::WatchInfo`")))),
18443 }
18444 } else {
18445 let content = resp.text().await?;
18446 let entity: Option<UserCurrentCheckSubscriptionError> = serde_json::from_str(&content).ok();
18447 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18448 }
18449}
18450
18451pub async fn user_current_delete_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<UserCurrentDeleteSubscriptionError>> {
18452 let p_path_owner = owner;
18454 let p_path_repo = repo;
18455
18456 let uri_str = format!("{}/repos/{owner}/{repo}/subscription", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
18457 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
18458
18459 if let Some(ref apikey) = configuration.api_key {
18460 let key = apikey.key.clone();
18461 let value = match apikey.prefix {
18462 Some(ref prefix) => format!("{} {}", prefix, key),
18463 None => key,
18464 };
18465 req_builder = req_builder.query(&[("access_token", value)]);
18466 }
18467 if let Some(ref apikey) = configuration.api_key {
18468 let key = apikey.key.clone();
18469 let value = match apikey.prefix {
18470 Some(ref prefix) => format!("{} {}", prefix, key),
18471 None => key,
18472 };
18473 req_builder = req_builder.query(&[("sudo", value)]);
18474 }
18475 if let Some(ref apikey) = configuration.api_key {
18476 let key = apikey.key.clone();
18477 let value = match apikey.prefix {
18478 Some(ref prefix) => format!("{} {}", prefix, key),
18479 None => key,
18480 };
18481 req_builder = req_builder.query(&[("token", value)]);
18482 }
18483 if let Some(ref user_agent) = configuration.user_agent {
18484 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18485 }
18486 if let Some(ref apikey) = configuration.api_key {
18487 let key = apikey.key.clone();
18488 let value = match apikey.prefix {
18489 Some(ref prefix) => format!("{} {}", prefix, key),
18490 None => key,
18491 };
18492 req_builder = req_builder.header("X-GITEA-OTP", value);
18493 };
18494 if let Some(ref apikey) = configuration.api_key {
18495 let key = apikey.key.clone();
18496 let value = match apikey.prefix {
18497 Some(ref prefix) => format!("{} {}", prefix, key),
18498 None => key,
18499 };
18500 req_builder = req_builder.header("Authorization", value);
18501 };
18502 if let Some(ref apikey) = configuration.api_key {
18503 let key = apikey.key.clone();
18504 let value = match apikey.prefix {
18505 Some(ref prefix) => format!("{} {}", prefix, key),
18506 None => key,
18507 };
18508 req_builder = req_builder.header("Sudo", value);
18509 };
18510 if let Some(ref auth_conf) = configuration.basic_auth {
18511 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18512 };
18513
18514 let req = req_builder.build()?;
18515 let resp = configuration.client.execute(req).await?;
18516
18517 let status = resp.status();
18518
18519 if !status.is_client_error() && !status.is_server_error() {
18520 Ok(())
18521 } else {
18522 let content = resp.text().await?;
18523 let entity: Option<UserCurrentDeleteSubscriptionError> = serde_json::from_str(&content).ok();
18524 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18525 }
18526}
18527
18528pub async fn user_current_put_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::WatchInfo, Error<UserCurrentPutSubscriptionError>> {
18529 let p_path_owner = owner;
18531 let p_path_repo = repo;
18532
18533 let uri_str = format!("{}/repos/{owner}/{repo}/subscription", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
18534 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
18535
18536 if let Some(ref apikey) = configuration.api_key {
18537 let key = apikey.key.clone();
18538 let value = match apikey.prefix {
18539 Some(ref prefix) => format!("{} {}", prefix, key),
18540 None => key,
18541 };
18542 req_builder = req_builder.query(&[("access_token", value)]);
18543 }
18544 if let Some(ref apikey) = configuration.api_key {
18545 let key = apikey.key.clone();
18546 let value = match apikey.prefix {
18547 Some(ref prefix) => format!("{} {}", prefix, key),
18548 None => key,
18549 };
18550 req_builder = req_builder.query(&[("sudo", value)]);
18551 }
18552 if let Some(ref apikey) = configuration.api_key {
18553 let key = apikey.key.clone();
18554 let value = match apikey.prefix {
18555 Some(ref prefix) => format!("{} {}", prefix, key),
18556 None => key,
18557 };
18558 req_builder = req_builder.query(&[("token", value)]);
18559 }
18560 if let Some(ref user_agent) = configuration.user_agent {
18561 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18562 }
18563 if let Some(ref apikey) = configuration.api_key {
18564 let key = apikey.key.clone();
18565 let value = match apikey.prefix {
18566 Some(ref prefix) => format!("{} {}", prefix, key),
18567 None => key,
18568 };
18569 req_builder = req_builder.header("X-GITEA-OTP", value);
18570 };
18571 if let Some(ref apikey) = configuration.api_key {
18572 let key = apikey.key.clone();
18573 let value = match apikey.prefix {
18574 Some(ref prefix) => format!("{} {}", prefix, key),
18575 None => key,
18576 };
18577 req_builder = req_builder.header("Authorization", value);
18578 };
18579 if let Some(ref apikey) = configuration.api_key {
18580 let key = apikey.key.clone();
18581 let value = match apikey.prefix {
18582 Some(ref prefix) => format!("{} {}", prefix, key),
18583 None => key,
18584 };
18585 req_builder = req_builder.header("Sudo", value);
18586 };
18587 if let Some(ref auth_conf) = configuration.basic_auth {
18588 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18589 };
18590
18591 let req = req_builder.build()?;
18592 let resp = configuration.client.execute(req).await?;
18593
18594 let status = resp.status();
18595 let content_type = resp
18596 .headers()
18597 .get("content-type")
18598 .and_then(|v| v.to_str().ok())
18599 .unwrap_or("application/octet-stream");
18600 let content_type = super::ContentType::from(content_type);
18601
18602 if !status.is_client_error() && !status.is_server_error() {
18603 let content = resp.text().await?;
18604 match content_type {
18605 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
18606 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WatchInfo`"))),
18607 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::WatchInfo`")))),
18608 }
18609 } else {
18610 let content = resp.text().await?;
18611 let entity: Option<UserCurrentPutSubscriptionError> = serde_json::from_str(&content).ok();
18612 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18613 }
18614}
18615
18616#[deprecated]
18617pub async fn user_tracked_times(configuration: &configuration::Configuration, owner: &str, repo: &str, user: &str) -> Result<Vec<models::TrackedTime>, Error<UserTrackedTimesError>> {
18618 let p_path_owner = owner;
18620 let p_path_repo = repo;
18621 let p_path_user = user;
18622
18623 let uri_str = format!("{}/repos/{owner}/{repo}/times/{user}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), user=crate::apis::urlencode(p_path_user));
18624 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
18625
18626 if let Some(ref apikey) = configuration.api_key {
18627 let key = apikey.key.clone();
18628 let value = match apikey.prefix {
18629 Some(ref prefix) => format!("{} {}", prefix, key),
18630 None => key,
18631 };
18632 req_builder = req_builder.query(&[("access_token", value)]);
18633 }
18634 if let Some(ref apikey) = configuration.api_key {
18635 let key = apikey.key.clone();
18636 let value = match apikey.prefix {
18637 Some(ref prefix) => format!("{} {}", prefix, key),
18638 None => key,
18639 };
18640 req_builder = req_builder.query(&[("sudo", value)]);
18641 }
18642 if let Some(ref apikey) = configuration.api_key {
18643 let key = apikey.key.clone();
18644 let value = match apikey.prefix {
18645 Some(ref prefix) => format!("{} {}", prefix, key),
18646 None => key,
18647 };
18648 req_builder = req_builder.query(&[("token", value)]);
18649 }
18650 if let Some(ref user_agent) = configuration.user_agent {
18651 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
18652 }
18653 if let Some(ref apikey) = configuration.api_key {
18654 let key = apikey.key.clone();
18655 let value = match apikey.prefix {
18656 Some(ref prefix) => format!("{} {}", prefix, key),
18657 None => key,
18658 };
18659 req_builder = req_builder.header("X-GITEA-OTP", value);
18660 };
18661 if let Some(ref apikey) = configuration.api_key {
18662 let key = apikey.key.clone();
18663 let value = match apikey.prefix {
18664 Some(ref prefix) => format!("{} {}", prefix, key),
18665 None => key,
18666 };
18667 req_builder = req_builder.header("Authorization", value);
18668 };
18669 if let Some(ref apikey) = configuration.api_key {
18670 let key = apikey.key.clone();
18671 let value = match apikey.prefix {
18672 Some(ref prefix) => format!("{} {}", prefix, key),
18673 None => key,
18674 };
18675 req_builder = req_builder.header("Sudo", value);
18676 };
18677 if let Some(ref auth_conf) = configuration.basic_auth {
18678 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
18679 };
18680
18681 let req = req_builder.build()?;
18682 let resp = configuration.client.execute(req).await?;
18683
18684 let status = resp.status();
18685 let content_type = resp
18686 .headers()
18687 .get("content-type")
18688 .and_then(|v| v.to_str().ok())
18689 .unwrap_or("application/octet-stream");
18690 let content_type = super::ContentType::from(content_type);
18691
18692 if !status.is_client_error() && !status.is_server_error() {
18693 let content = resp.text().await?;
18694 match content_type {
18695 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
18696 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrackedTime>`"))),
18697 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::TrackedTime>`")))),
18698 }
18699 } else {
18700 let content = resp.text().await?;
18701 let entity: Option<UserTrackedTimesError> = serde_json::from_str(&content).ok();
18702 Err(Error::ResponseError(ResponseContent { status, content, entity }))
18703 }
18704}
18705