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 IssueAddLabelError {
24 Status403(),
25 Status404(),
26 UnknownValue(serde_json::Value),
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum IssueAddSubscriptionError {
33 Status404(),
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum IssueAddTimeError {
41 Status400(),
42 Status403(),
43 Status404(),
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum IssueCheckSubscriptionError {
51 Status404(),
52 UnknownValue(serde_json::Value),
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
57#[serde(untagged)]
58pub enum IssueClearLabelsError {
59 Status403(),
60 Status404(),
61 UnknownValue(serde_json::Value),
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum IssueCreateCommentError {
68 Status403(),
69 Status404(),
70 Status423(),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum IssueCreateIssueError {
78 Status403(),
79 Status404(),
80 Status412(),
81 Status422(),
82 Status423(),
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum IssueCreateIssueAttachmentError {
90 Status400(),
91 Status404(),
92 Status413(),
93 Status422(),
94 Status423(),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum IssueCreateIssueBlockingError {
102 Status404(),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum IssueCreateIssueCommentAttachmentError {
110 Status400(),
111 Status403(),
112 Status404(),
113 Status413(),
114 Status422(),
115 Status423(),
116 UnknownValue(serde_json::Value),
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum IssueCreateIssueDependenciesError {
123 Status404(),
124 Status423(),
125 UnknownValue(serde_json::Value),
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum IssueCreateLabelError {
132 Status404(),
133 Status422(),
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum IssueCreateMilestoneError {
141 Status404(),
142 UnknownValue(serde_json::Value),
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum IssueDeleteError {
149 Status403(),
150 Status404(),
151 UnknownValue(serde_json::Value),
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum IssueDeleteCommentError {
158 Status403(),
159 Status404(),
160 UnknownValue(serde_json::Value),
161}
162
163#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum IssueDeleteCommentDeprecatedError {
167 Status403(),
168 Status404(),
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum IssueDeleteCommentReactionError {
176 Status403(),
177 Status404(),
178 UnknownValue(serde_json::Value),
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum IssueDeleteIssueAttachmentError {
185 Status404(),
186 Status423(),
187 UnknownValue(serde_json::Value),
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum IssueDeleteIssueCommentAttachmentError {
194 Status404(),
195 Status423(),
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum IssueDeleteIssueReactionError {
203 Status403(),
204 Status404(),
205 UnknownValue(serde_json::Value),
206}
207
208#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum IssueDeleteLabelError {
212 Status404(),
213 UnknownValue(serde_json::Value),
214}
215
216#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum IssueDeleteMilestoneError {
220 Status404(),
221 UnknownValue(serde_json::Value),
222}
223
224#[derive(Debug, Clone, Serialize, Deserialize)]
226#[serde(untagged)]
227pub enum IssueDeleteStopWatchError {
228 Status403(),
229 Status404(),
230 Status409(),
231 UnknownValue(serde_json::Value),
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum IssueDeleteSubscriptionError {
238 Status404(),
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum IssueDeleteTimeError {
246 Status400(),
247 Status403(),
248 Status404(),
249 UnknownValue(serde_json::Value),
250}
251
252#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum IssueEditCommentError {
256 Status403(),
257 Status404(),
258 Status423(),
259 UnknownValue(serde_json::Value),
260}
261
262#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum IssueEditCommentDeprecatedError {
266 Status403(),
267 Status404(),
268 UnknownValue(serde_json::Value),
269}
270
271#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum IssueEditIssueError {
275 Status403(),
276 Status404(),
277 Status412(),
278 UnknownValue(serde_json::Value),
279}
280
281#[derive(Debug, Clone, Serialize, Deserialize)]
283#[serde(untagged)]
284pub enum IssueEditIssueAttachmentError {
285 Status404(),
286 Status422(),
287 Status423(),
288 UnknownValue(serde_json::Value),
289}
290
291#[derive(Debug, Clone, Serialize, Deserialize)]
293#[serde(untagged)]
294pub enum IssueEditIssueCommentAttachmentError {
295 Status404(),
296 Status422(),
297 Status423(),
298 UnknownValue(serde_json::Value),
299}
300
301#[derive(Debug, Clone, Serialize, Deserialize)]
303#[serde(untagged)]
304pub enum IssueEditIssueDeadlineError {
305 Status403(),
306 Status404(),
307 UnknownValue(serde_json::Value),
308}
309
310#[derive(Debug, Clone, Serialize, Deserialize)]
312#[serde(untagged)]
313pub enum IssueEditLabelError {
314 Status404(),
315 Status422(),
316 UnknownValue(serde_json::Value),
317}
318
319#[derive(Debug, Clone, Serialize, Deserialize)]
321#[serde(untagged)]
322pub enum IssueEditMilestoneError {
323 Status404(),
324 UnknownValue(serde_json::Value),
325}
326
327#[derive(Debug, Clone, Serialize, Deserialize)]
329#[serde(untagged)]
330pub enum IssueGetCommentError {
331 Status403(),
332 Status404(),
333 UnknownValue(serde_json::Value),
334}
335
336#[derive(Debug, Clone, Serialize, Deserialize)]
338#[serde(untagged)]
339pub enum IssueGetCommentReactionsError {
340 Status403(),
341 Status404(),
342 UnknownValue(serde_json::Value),
343}
344
345#[derive(Debug, Clone, Serialize, Deserialize)]
347#[serde(untagged)]
348pub enum IssueGetCommentsError {
349 Status404(),
350 UnknownValue(serde_json::Value),
351}
352
353#[derive(Debug, Clone, Serialize, Deserialize)]
355#[serde(untagged)]
356pub enum IssueGetCommentsAndTimelineError {
357 Status404(),
358 UnknownValue(serde_json::Value),
359}
360
361#[derive(Debug, Clone, Serialize, Deserialize)]
363#[serde(untagged)]
364pub enum IssueGetIssueError {
365 Status404(),
366 UnknownValue(serde_json::Value),
367}
368
369#[derive(Debug, Clone, Serialize, Deserialize)]
371#[serde(untagged)]
372pub enum IssueGetIssueAttachmentError {
373 Status404(),
374 UnknownValue(serde_json::Value),
375}
376
377#[derive(Debug, Clone, Serialize, Deserialize)]
379#[serde(untagged)]
380pub enum IssueGetIssueCommentAttachmentError {
381 Status404(),
382 UnknownValue(serde_json::Value),
383}
384
385#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum IssueGetIssueReactionsError {
389 Status403(),
390 Status404(),
391 UnknownValue(serde_json::Value),
392}
393
394#[derive(Debug, Clone, Serialize, Deserialize)]
396#[serde(untagged)]
397pub enum IssueGetLabelError {
398 Status404(),
399 UnknownValue(serde_json::Value),
400}
401
402#[derive(Debug, Clone, Serialize, Deserialize)]
404#[serde(untagged)]
405pub enum IssueGetLabelsError {
406 Status404(),
407 UnknownValue(serde_json::Value),
408}
409
410#[derive(Debug, Clone, Serialize, Deserialize)]
412#[serde(untagged)]
413pub enum IssueGetMilestoneError {
414 Status404(),
415 UnknownValue(serde_json::Value),
416}
417
418#[derive(Debug, Clone, Serialize, Deserialize)]
420#[serde(untagged)]
421pub enum IssueGetMilestonesListError {
422 Status404(),
423 UnknownValue(serde_json::Value),
424}
425
426#[derive(Debug, Clone, Serialize, Deserialize)]
428#[serde(untagged)]
429pub enum IssueGetRepoCommentsError {
430 Status404(),
431 UnknownValue(serde_json::Value),
432}
433
434#[derive(Debug, Clone, Serialize, Deserialize)]
436#[serde(untagged)]
437pub enum IssueListBlocksError {
438 Status404(),
439 UnknownValue(serde_json::Value),
440}
441
442#[derive(Debug, Clone, Serialize, Deserialize)]
444#[serde(untagged)]
445pub enum IssueListIssueAttachmentsError {
446 Status404(),
447 UnknownValue(serde_json::Value),
448}
449
450#[derive(Debug, Clone, Serialize, Deserialize)]
452#[serde(untagged)]
453pub enum IssueListIssueCommentAttachmentsError {
454 Status404(),
455 UnknownValue(serde_json::Value),
456}
457
458#[derive(Debug, Clone, Serialize, Deserialize)]
460#[serde(untagged)]
461pub enum IssueListIssueDependenciesError {
462 Status404(),
463 UnknownValue(serde_json::Value),
464}
465
466#[derive(Debug, Clone, Serialize, Deserialize)]
468#[serde(untagged)]
469pub enum IssueListIssuesError {
470 Status404(),
471 UnknownValue(serde_json::Value),
472}
473
474#[derive(Debug, Clone, Serialize, Deserialize)]
476#[serde(untagged)]
477pub enum IssueListLabelsError {
478 Status404(),
479 UnknownValue(serde_json::Value),
480}
481
482#[derive(Debug, Clone, Serialize, Deserialize)]
484#[serde(untagged)]
485pub enum IssueLockIssueError {
486 Status403(),
487 Status404(),
488 UnknownValue(serde_json::Value),
489}
490
491#[derive(Debug, Clone, Serialize, Deserialize)]
493#[serde(untagged)]
494pub enum IssuePostCommentReactionError {
495 Status403(),
496 Status404(),
497 UnknownValue(serde_json::Value),
498}
499
500#[derive(Debug, Clone, Serialize, Deserialize)]
502#[serde(untagged)]
503pub enum IssuePostIssueReactionError {
504 Status403(),
505 Status404(),
506 UnknownValue(serde_json::Value),
507}
508
509#[derive(Debug, Clone, Serialize, Deserialize)]
511#[serde(untagged)]
512pub enum IssueRemoveIssueBlockingError {
513 Status404(),
514 UnknownValue(serde_json::Value),
515}
516
517#[derive(Debug, Clone, Serialize, Deserialize)]
519#[serde(untagged)]
520pub enum IssueRemoveIssueDependenciesError {
521 Status404(),
522 Status423(),
523 UnknownValue(serde_json::Value),
524}
525
526#[derive(Debug, Clone, Serialize, Deserialize)]
528#[serde(untagged)]
529pub enum IssueRemoveLabelError {
530 Status403(),
531 Status404(),
532 Status422(),
533 UnknownValue(serde_json::Value),
534}
535
536#[derive(Debug, Clone, Serialize, Deserialize)]
538#[serde(untagged)]
539pub enum IssueReplaceLabelsError {
540 Status403(),
541 Status404(),
542 UnknownValue(serde_json::Value),
543}
544
545#[derive(Debug, Clone, Serialize, Deserialize)]
547#[serde(untagged)]
548pub enum IssueResetTimeError {
549 Status400(),
550 Status403(),
551 Status404(),
552 UnknownValue(serde_json::Value),
553}
554
555#[derive(Debug, Clone, Serialize, Deserialize)]
557#[serde(untagged)]
558pub enum IssueSearchIssuesError {
559 Status400(),
560 Status422(),
561 UnknownValue(serde_json::Value),
562}
563
564#[derive(Debug, Clone, Serialize, Deserialize)]
566#[serde(untagged)]
567pub enum IssueStartStopWatchError {
568 Status403(),
569 Status404(),
570 Status409(),
571 UnknownValue(serde_json::Value),
572}
573
574#[derive(Debug, Clone, Serialize, Deserialize)]
576#[serde(untagged)]
577pub enum IssueStopStopWatchError {
578 Status403(),
579 Status404(),
580 Status409(),
581 UnknownValue(serde_json::Value),
582}
583
584#[derive(Debug, Clone, Serialize, Deserialize)]
586#[serde(untagged)]
587pub enum IssueSubscriptionsError {
588 Status404(),
589 UnknownValue(serde_json::Value),
590}
591
592#[derive(Debug, Clone, Serialize, Deserialize)]
594#[serde(untagged)]
595pub enum IssueTrackedTimesError {
596 Status404(),
597 UnknownValue(serde_json::Value),
598}
599
600#[derive(Debug, Clone, Serialize, Deserialize)]
602#[serde(untagged)]
603pub enum IssueUnlockIssueError {
604 Status403(),
605 Status404(),
606 UnknownValue(serde_json::Value),
607}
608
609#[derive(Debug, Clone, Serialize, Deserialize)]
611#[serde(untagged)]
612pub enum MoveIssuePinError {
613 Status403(),
614 Status404(),
615 UnknownValue(serde_json::Value),
616}
617
618#[derive(Debug, Clone, Serialize, Deserialize)]
620#[serde(untagged)]
621pub enum PinIssueError {
622 Status403(),
623 Status404(),
624 UnknownValue(serde_json::Value),
625}
626
627#[derive(Debug, Clone, Serialize, Deserialize)]
629#[serde(untagged)]
630pub enum UnpinIssueError {
631 Status403(),
632 Status404(),
633 UnknownValue(serde_json::Value),
634}
635
636
637pub async fn issue_add_label(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::IssueLabelsOption>) -> Result<Vec<models::Label>, Error<IssueAddLabelError>> {
638 let p_path_owner = owner;
640 let p_path_repo = repo;
641 let p_path_index = index;
642 let p_body_body = body;
643
644 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
645 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
646
647 if let Some(ref apikey) = configuration.api_key {
648 let key = apikey.key.clone();
649 let value = match apikey.prefix {
650 Some(ref prefix) => format!("{} {}", prefix, key),
651 None => key,
652 };
653 req_builder = req_builder.query(&[("access_token", value)]);
654 }
655 if let Some(ref apikey) = configuration.api_key {
656 let key = apikey.key.clone();
657 let value = match apikey.prefix {
658 Some(ref prefix) => format!("{} {}", prefix, key),
659 None => key,
660 };
661 req_builder = req_builder.query(&[("sudo", value)]);
662 }
663 if let Some(ref apikey) = configuration.api_key {
664 let key = apikey.key.clone();
665 let value = match apikey.prefix {
666 Some(ref prefix) => format!("{} {}", prefix, key),
667 None => key,
668 };
669 req_builder = req_builder.query(&[("token", value)]);
670 }
671 if let Some(ref user_agent) = configuration.user_agent {
672 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
673 }
674 if let Some(ref apikey) = configuration.api_key {
675 let key = apikey.key.clone();
676 let value = match apikey.prefix {
677 Some(ref prefix) => format!("{} {}", prefix, key),
678 None => key,
679 };
680 req_builder = req_builder.header("X-GITEA-OTP", value);
681 };
682 if let Some(ref apikey) = configuration.api_key {
683 let key = apikey.key.clone();
684 let value = match apikey.prefix {
685 Some(ref prefix) => format!("{} {}", prefix, key),
686 None => key,
687 };
688 req_builder = req_builder.header("Authorization", value);
689 };
690 if let Some(ref apikey) = configuration.api_key {
691 let key = apikey.key.clone();
692 let value = match apikey.prefix {
693 Some(ref prefix) => format!("{} {}", prefix, key),
694 None => key,
695 };
696 req_builder = req_builder.header("Sudo", value);
697 };
698 if let Some(ref auth_conf) = configuration.basic_auth {
699 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
700 };
701 req_builder = req_builder.json(&p_body_body);
702
703 let req = req_builder.build()?;
704 let resp = configuration.client.execute(req).await?;
705
706 let status = resp.status();
707 let content_type = resp
708 .headers()
709 .get("content-type")
710 .and_then(|v| v.to_str().ok())
711 .unwrap_or("application/octet-stream");
712 let content_type = super::ContentType::from(content_type);
713
714 if !status.is_client_error() && !status.is_server_error() {
715 let content = resp.text().await?;
716 match content_type {
717 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
718 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))),
719 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))),
720 }
721 } else {
722 let content = resp.text().await?;
723 let entity: Option<IssueAddLabelError> = serde_json::from_str(&content).ok();
724 Err(Error::ResponseError(ResponseContent { status, content, entity }))
725 }
726}
727
728pub async fn issue_add_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, user: &str) -> Result<(), Error<IssueAddSubscriptionError>> {
729 let p_path_owner = owner;
731 let p_path_repo = repo;
732 let p_path_index = index;
733 let p_path_user = user;
734
735 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, user=crate::apis::urlencode(p_path_user));
736 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
737
738 if let Some(ref apikey) = configuration.api_key {
739 let key = apikey.key.clone();
740 let value = match apikey.prefix {
741 Some(ref prefix) => format!("{} {}", prefix, key),
742 None => key,
743 };
744 req_builder = req_builder.query(&[("access_token", value)]);
745 }
746 if let Some(ref apikey) = configuration.api_key {
747 let key = apikey.key.clone();
748 let value = match apikey.prefix {
749 Some(ref prefix) => format!("{} {}", prefix, key),
750 None => key,
751 };
752 req_builder = req_builder.query(&[("sudo", value)]);
753 }
754 if let Some(ref apikey) = configuration.api_key {
755 let key = apikey.key.clone();
756 let value = match apikey.prefix {
757 Some(ref prefix) => format!("{} {}", prefix, key),
758 None => key,
759 };
760 req_builder = req_builder.query(&[("token", value)]);
761 }
762 if let Some(ref user_agent) = configuration.user_agent {
763 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
764 }
765 if let Some(ref apikey) = configuration.api_key {
766 let key = apikey.key.clone();
767 let value = match apikey.prefix {
768 Some(ref prefix) => format!("{} {}", prefix, key),
769 None => key,
770 };
771 req_builder = req_builder.header("X-GITEA-OTP", value);
772 };
773 if let Some(ref apikey) = configuration.api_key {
774 let key = apikey.key.clone();
775 let value = match apikey.prefix {
776 Some(ref prefix) => format!("{} {}", prefix, key),
777 None => key,
778 };
779 req_builder = req_builder.header("Authorization", value);
780 };
781 if let Some(ref apikey) = configuration.api_key {
782 let key = apikey.key.clone();
783 let value = match apikey.prefix {
784 Some(ref prefix) => format!("{} {}", prefix, key),
785 None => key,
786 };
787 req_builder = req_builder.header("Sudo", value);
788 };
789 if let Some(ref auth_conf) = configuration.basic_auth {
790 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
791 };
792
793 let req = req_builder.build()?;
794 let resp = configuration.client.execute(req).await?;
795
796 let status = resp.status();
797
798 if !status.is_client_error() && !status.is_server_error() {
799 Ok(())
800 } else {
801 let content = resp.text().await?;
802 let entity: Option<IssueAddSubscriptionError> = serde_json::from_str(&content).ok();
803 Err(Error::ResponseError(ResponseContent { status, content, entity }))
804 }
805}
806
807pub async fn issue_add_time(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::AddTimeOption>) -> Result<models::TrackedTime, Error<IssueAddTimeError>> {
808 let p_path_owner = owner;
810 let p_path_repo = repo;
811 let p_path_index = index;
812 let p_body_body = body;
813
814 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
815 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
816
817 if let Some(ref apikey) = configuration.api_key {
818 let key = apikey.key.clone();
819 let value = match apikey.prefix {
820 Some(ref prefix) => format!("{} {}", prefix, key),
821 None => key,
822 };
823 req_builder = req_builder.query(&[("access_token", value)]);
824 }
825 if let Some(ref apikey) = configuration.api_key {
826 let key = apikey.key.clone();
827 let value = match apikey.prefix {
828 Some(ref prefix) => format!("{} {}", prefix, key),
829 None => key,
830 };
831 req_builder = req_builder.query(&[("sudo", value)]);
832 }
833 if let Some(ref apikey) = configuration.api_key {
834 let key = apikey.key.clone();
835 let value = match apikey.prefix {
836 Some(ref prefix) => format!("{} {}", prefix, key),
837 None => key,
838 };
839 req_builder = req_builder.query(&[("token", value)]);
840 }
841 if let Some(ref user_agent) = configuration.user_agent {
842 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
843 }
844 if let Some(ref apikey) = configuration.api_key {
845 let key = apikey.key.clone();
846 let value = match apikey.prefix {
847 Some(ref prefix) => format!("{} {}", prefix, key),
848 None => key,
849 };
850 req_builder = req_builder.header("X-GITEA-OTP", value);
851 };
852 if let Some(ref apikey) = configuration.api_key {
853 let key = apikey.key.clone();
854 let value = match apikey.prefix {
855 Some(ref prefix) => format!("{} {}", prefix, key),
856 None => key,
857 };
858 req_builder = req_builder.header("Authorization", value);
859 };
860 if let Some(ref apikey) = configuration.api_key {
861 let key = apikey.key.clone();
862 let value = match apikey.prefix {
863 Some(ref prefix) => format!("{} {}", prefix, key),
864 None => key,
865 };
866 req_builder = req_builder.header("Sudo", value);
867 };
868 if let Some(ref auth_conf) = configuration.basic_auth {
869 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
870 };
871 req_builder = req_builder.json(&p_body_body);
872
873 let req = req_builder.build()?;
874 let resp = configuration.client.execute(req).await?;
875
876 let status = resp.status();
877 let content_type = resp
878 .headers()
879 .get("content-type")
880 .and_then(|v| v.to_str().ok())
881 .unwrap_or("application/octet-stream");
882 let content_type = super::ContentType::from(content_type);
883
884 if !status.is_client_error() && !status.is_server_error() {
885 let content = resp.text().await?;
886 match content_type {
887 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
888 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrackedTime`"))),
889 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::TrackedTime`")))),
890 }
891 } else {
892 let content = resp.text().await?;
893 let entity: Option<IssueAddTimeError> = serde_json::from_str(&content).ok();
894 Err(Error::ResponseError(ResponseContent { status, content, entity }))
895 }
896}
897
898pub async fn issue_check_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<models::WatchInfo, Error<IssueCheckSubscriptionError>> {
899 let p_path_owner = owner;
901 let p_path_repo = repo;
902 let p_path_index = index;
903
904 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/check", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
905 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
906
907 if let Some(ref apikey) = configuration.api_key {
908 let key = apikey.key.clone();
909 let value = match apikey.prefix {
910 Some(ref prefix) => format!("{} {}", prefix, key),
911 None => key,
912 };
913 req_builder = req_builder.query(&[("access_token", value)]);
914 }
915 if let Some(ref apikey) = configuration.api_key {
916 let key = apikey.key.clone();
917 let value = match apikey.prefix {
918 Some(ref prefix) => format!("{} {}", prefix, key),
919 None => key,
920 };
921 req_builder = req_builder.query(&[("sudo", value)]);
922 }
923 if let Some(ref apikey) = configuration.api_key {
924 let key = apikey.key.clone();
925 let value = match apikey.prefix {
926 Some(ref prefix) => format!("{} {}", prefix, key),
927 None => key,
928 };
929 req_builder = req_builder.query(&[("token", value)]);
930 }
931 if let Some(ref user_agent) = configuration.user_agent {
932 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
933 }
934 if let Some(ref apikey) = configuration.api_key {
935 let key = apikey.key.clone();
936 let value = match apikey.prefix {
937 Some(ref prefix) => format!("{} {}", prefix, key),
938 None => key,
939 };
940 req_builder = req_builder.header("X-GITEA-OTP", value);
941 };
942 if let Some(ref apikey) = configuration.api_key {
943 let key = apikey.key.clone();
944 let value = match apikey.prefix {
945 Some(ref prefix) => format!("{} {}", prefix, key),
946 None => key,
947 };
948 req_builder = req_builder.header("Authorization", value);
949 };
950 if let Some(ref apikey) = configuration.api_key {
951 let key = apikey.key.clone();
952 let value = match apikey.prefix {
953 Some(ref prefix) => format!("{} {}", prefix, key),
954 None => key,
955 };
956 req_builder = req_builder.header("Sudo", value);
957 };
958 if let Some(ref auth_conf) = configuration.basic_auth {
959 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
960 };
961
962 let req = req_builder.build()?;
963 let resp = configuration.client.execute(req).await?;
964
965 let status = resp.status();
966 let content_type = resp
967 .headers()
968 .get("content-type")
969 .and_then(|v| v.to_str().ok())
970 .unwrap_or("application/octet-stream");
971 let content_type = super::ContentType::from(content_type);
972
973 if !status.is_client_error() && !status.is_server_error() {
974 let content = resp.text().await?;
975 match content_type {
976 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
977 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WatchInfo`"))),
978 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`")))),
979 }
980 } else {
981 let content = resp.text().await?;
982 let entity: Option<IssueCheckSubscriptionError> = serde_json::from_str(&content).ok();
983 Err(Error::ResponseError(ResponseContent { status, content, entity }))
984 }
985}
986
987pub async fn issue_clear_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<IssueClearLabelsError>> {
988 let p_path_owner = owner;
990 let p_path_repo = repo;
991 let p_path_index = index;
992
993 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
994 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
995
996 if let Some(ref apikey) = configuration.api_key {
997 let key = apikey.key.clone();
998 let value = match apikey.prefix {
999 Some(ref prefix) => format!("{} {}", prefix, key),
1000 None => key,
1001 };
1002 req_builder = req_builder.query(&[("access_token", value)]);
1003 }
1004 if let Some(ref apikey) = configuration.api_key {
1005 let key = apikey.key.clone();
1006 let value = match apikey.prefix {
1007 Some(ref prefix) => format!("{} {}", prefix, key),
1008 None => key,
1009 };
1010 req_builder = req_builder.query(&[("sudo", value)]);
1011 }
1012 if let Some(ref apikey) = configuration.api_key {
1013 let key = apikey.key.clone();
1014 let value = match apikey.prefix {
1015 Some(ref prefix) => format!("{} {}", prefix, key),
1016 None => key,
1017 };
1018 req_builder = req_builder.query(&[("token", value)]);
1019 }
1020 if let Some(ref user_agent) = configuration.user_agent {
1021 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1022 }
1023 if let Some(ref apikey) = configuration.api_key {
1024 let key = apikey.key.clone();
1025 let value = match apikey.prefix {
1026 Some(ref prefix) => format!("{} {}", prefix, key),
1027 None => key,
1028 };
1029 req_builder = req_builder.header("X-GITEA-OTP", value);
1030 };
1031 if let Some(ref apikey) = configuration.api_key {
1032 let key = apikey.key.clone();
1033 let value = match apikey.prefix {
1034 Some(ref prefix) => format!("{} {}", prefix, key),
1035 None => key,
1036 };
1037 req_builder = req_builder.header("Authorization", value);
1038 };
1039 if let Some(ref apikey) = configuration.api_key {
1040 let key = apikey.key.clone();
1041 let value = match apikey.prefix {
1042 Some(ref prefix) => format!("{} {}", prefix, key),
1043 None => key,
1044 };
1045 req_builder = req_builder.header("Sudo", value);
1046 };
1047 if let Some(ref auth_conf) = configuration.basic_auth {
1048 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1049 };
1050
1051 let req = req_builder.build()?;
1052 let resp = configuration.client.execute(req).await?;
1053
1054 let status = resp.status();
1055
1056 if !status.is_client_error() && !status.is_server_error() {
1057 Ok(())
1058 } else {
1059 let content = resp.text().await?;
1060 let entity: Option<IssueClearLabelsError> = serde_json::from_str(&content).ok();
1061 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1062 }
1063}
1064
1065pub async fn issue_create_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::CreateIssueCommentOption>) -> Result<models::Comment, Error<IssueCreateCommentError>> {
1066 let p_path_owner = owner;
1068 let p_path_repo = repo;
1069 let p_path_index = index;
1070 let p_body_body = body;
1071
1072 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
1073 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1074
1075 if let Some(ref apikey) = configuration.api_key {
1076 let key = apikey.key.clone();
1077 let value = match apikey.prefix {
1078 Some(ref prefix) => format!("{} {}", prefix, key),
1079 None => key,
1080 };
1081 req_builder = req_builder.query(&[("access_token", value)]);
1082 }
1083 if let Some(ref apikey) = configuration.api_key {
1084 let key = apikey.key.clone();
1085 let value = match apikey.prefix {
1086 Some(ref prefix) => format!("{} {}", prefix, key),
1087 None => key,
1088 };
1089 req_builder = req_builder.query(&[("sudo", value)]);
1090 }
1091 if let Some(ref apikey) = configuration.api_key {
1092 let key = apikey.key.clone();
1093 let value = match apikey.prefix {
1094 Some(ref prefix) => format!("{} {}", prefix, key),
1095 None => key,
1096 };
1097 req_builder = req_builder.query(&[("token", value)]);
1098 }
1099 if let Some(ref user_agent) = configuration.user_agent {
1100 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1101 }
1102 if let Some(ref apikey) = configuration.api_key {
1103 let key = apikey.key.clone();
1104 let value = match apikey.prefix {
1105 Some(ref prefix) => format!("{} {}", prefix, key),
1106 None => key,
1107 };
1108 req_builder = req_builder.header("X-GITEA-OTP", value);
1109 };
1110 if let Some(ref apikey) = configuration.api_key {
1111 let key = apikey.key.clone();
1112 let value = match apikey.prefix {
1113 Some(ref prefix) => format!("{} {}", prefix, key),
1114 None => key,
1115 };
1116 req_builder = req_builder.header("Authorization", value);
1117 };
1118 if let Some(ref apikey) = configuration.api_key {
1119 let key = apikey.key.clone();
1120 let value = match apikey.prefix {
1121 Some(ref prefix) => format!("{} {}", prefix, key),
1122 None => key,
1123 };
1124 req_builder = req_builder.header("Sudo", value);
1125 };
1126 if let Some(ref auth_conf) = configuration.basic_auth {
1127 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1128 };
1129 req_builder = req_builder.json(&p_body_body);
1130
1131 let req = req_builder.build()?;
1132 let resp = configuration.client.execute(req).await?;
1133
1134 let status = resp.status();
1135 let content_type = resp
1136 .headers()
1137 .get("content-type")
1138 .and_then(|v| v.to_str().ok())
1139 .unwrap_or("application/octet-stream");
1140 let content_type = super::ContentType::from(content_type);
1141
1142 if !status.is_client_error() && !status.is_server_error() {
1143 let content = resp.text().await?;
1144 match content_type {
1145 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1146 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))),
1147 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::Comment`")))),
1148 }
1149 } else {
1150 let content = resp.text().await?;
1151 let entity: Option<IssueCreateCommentError> = serde_json::from_str(&content).ok();
1152 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1153 }
1154}
1155
1156pub async fn issue_create_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateIssueOption>) -> Result<models::Issue, Error<IssueCreateIssueError>> {
1157 let p_path_owner = owner;
1159 let p_path_repo = repo;
1160 let p_body_body = body;
1161
1162 let uri_str = format!("{}/repos/{owner}/{repo}/issues", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1163 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1164
1165 if let Some(ref apikey) = configuration.api_key {
1166 let key = apikey.key.clone();
1167 let value = match apikey.prefix {
1168 Some(ref prefix) => format!("{} {}", prefix, key),
1169 None => key,
1170 };
1171 req_builder = req_builder.query(&[("access_token", value)]);
1172 }
1173 if let Some(ref apikey) = configuration.api_key {
1174 let key = apikey.key.clone();
1175 let value = match apikey.prefix {
1176 Some(ref prefix) => format!("{} {}", prefix, key),
1177 None => key,
1178 };
1179 req_builder = req_builder.query(&[("sudo", value)]);
1180 }
1181 if let Some(ref apikey) = configuration.api_key {
1182 let key = apikey.key.clone();
1183 let value = match apikey.prefix {
1184 Some(ref prefix) => format!("{} {}", prefix, key),
1185 None => key,
1186 };
1187 req_builder = req_builder.query(&[("token", value)]);
1188 }
1189 if let Some(ref user_agent) = configuration.user_agent {
1190 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1191 }
1192 if let Some(ref apikey) = configuration.api_key {
1193 let key = apikey.key.clone();
1194 let value = match apikey.prefix {
1195 Some(ref prefix) => format!("{} {}", prefix, key),
1196 None => key,
1197 };
1198 req_builder = req_builder.header("X-GITEA-OTP", value);
1199 };
1200 if let Some(ref apikey) = configuration.api_key {
1201 let key = apikey.key.clone();
1202 let value = match apikey.prefix {
1203 Some(ref prefix) => format!("{} {}", prefix, key),
1204 None => key,
1205 };
1206 req_builder = req_builder.header("Authorization", value);
1207 };
1208 if let Some(ref apikey) = configuration.api_key {
1209 let key = apikey.key.clone();
1210 let value = match apikey.prefix {
1211 Some(ref prefix) => format!("{} {}", prefix, key),
1212 None => key,
1213 };
1214 req_builder = req_builder.header("Sudo", value);
1215 };
1216 if let Some(ref auth_conf) = configuration.basic_auth {
1217 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1218 };
1219 req_builder = req_builder.json(&p_body_body);
1220
1221 let req = req_builder.build()?;
1222 let resp = configuration.client.execute(req).await?;
1223
1224 let status = resp.status();
1225 let content_type = resp
1226 .headers()
1227 .get("content-type")
1228 .and_then(|v| v.to_str().ok())
1229 .unwrap_or("application/octet-stream");
1230 let content_type = super::ContentType::from(content_type);
1231
1232 if !status.is_client_error() && !status.is_server_error() {
1233 let content = resp.text().await?;
1234 match content_type {
1235 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1236 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))),
1237 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::Issue`")))),
1238 }
1239 } else {
1240 let content = resp.text().await?;
1241 let entity: Option<IssueCreateIssueError> = serde_json::from_str(&content).ok();
1242 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1243 }
1244}
1245
1246pub async fn issue_create_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment: std::path::PathBuf, name: Option<&str>) -> Result<models::Attachment, Error<IssueCreateIssueAttachmentError>> {
1247 let p_path_owner = owner;
1249 let p_path_repo = repo;
1250 let p_path_index = index;
1251 let p_form_attachment = attachment;
1252 let p_query_name = name;
1253
1254 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
1255 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1256
1257 if let Some(ref param_value) = p_query_name {
1258 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
1259 }
1260 if let Some(ref apikey) = configuration.api_key {
1261 let key = apikey.key.clone();
1262 let value = match apikey.prefix {
1263 Some(ref prefix) => format!("{} {}", prefix, key),
1264 None => key,
1265 };
1266 req_builder = req_builder.query(&[("access_token", value)]);
1267 }
1268 if let Some(ref apikey) = configuration.api_key {
1269 let key = apikey.key.clone();
1270 let value = match apikey.prefix {
1271 Some(ref prefix) => format!("{} {}", prefix, key),
1272 None => key,
1273 };
1274 req_builder = req_builder.query(&[("sudo", value)]);
1275 }
1276 if let Some(ref apikey) = configuration.api_key {
1277 let key = apikey.key.clone();
1278 let value = match apikey.prefix {
1279 Some(ref prefix) => format!("{} {}", prefix, key),
1280 None => key,
1281 };
1282 req_builder = req_builder.query(&[("token", value)]);
1283 }
1284 if let Some(ref user_agent) = configuration.user_agent {
1285 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1286 }
1287 if let Some(ref apikey) = configuration.api_key {
1288 let key = apikey.key.clone();
1289 let value = match apikey.prefix {
1290 Some(ref prefix) => format!("{} {}", prefix, key),
1291 None => key,
1292 };
1293 req_builder = req_builder.header("X-GITEA-OTP", value);
1294 };
1295 if let Some(ref apikey) = configuration.api_key {
1296 let key = apikey.key.clone();
1297 let value = match apikey.prefix {
1298 Some(ref prefix) => format!("{} {}", prefix, key),
1299 None => key,
1300 };
1301 req_builder = req_builder.header("Authorization", value);
1302 };
1303 if let Some(ref apikey) = configuration.api_key {
1304 let key = apikey.key.clone();
1305 let value = match apikey.prefix {
1306 Some(ref prefix) => format!("{} {}", prefix, key),
1307 None => key,
1308 };
1309 req_builder = req_builder.header("Sudo", value);
1310 };
1311 if let Some(ref auth_conf) = configuration.basic_auth {
1312 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1313 };
1314 let mut multipart_form = reqwest::multipart::Form::new();
1315 let file = TokioFile::open(&p_form_attachment).await?;
1316 let stream = FramedRead::new(file, BytesCodec::new());
1317 let file_name = p_form_attachment.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default();
1318 let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name);
1319 multipart_form = multipart_form.part("attachment", file_part);
1320 req_builder = req_builder.multipart(multipart_form);
1321
1322 let req = req_builder.build()?;
1323 let resp = configuration.client.execute(req).await?;
1324
1325 let status = resp.status();
1326 let content_type = resp
1327 .headers()
1328 .get("content-type")
1329 .and_then(|v| v.to_str().ok())
1330 .unwrap_or("application/octet-stream");
1331 let content_type = super::ContentType::from(content_type);
1332
1333 if !status.is_client_error() && !status.is_server_error() {
1334 let content = resp.text().await?;
1335 match content_type {
1336 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1337 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
1338 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`")))),
1339 }
1340 } else {
1341 let content = resp.text().await?;
1342 let entity: Option<IssueCreateIssueAttachmentError> = serde_json::from_str(&content).ok();
1343 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1344 }
1345}
1346
1347pub async fn issue_create_issue_blocking(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option<models::IssueMeta>) -> Result<models::Issue, Error<IssueCreateIssueBlockingError>> {
1348 let p_path_owner = owner;
1350 let p_path_repo = repo;
1351 let p_path_index = index;
1352 let p_body_body = body;
1353
1354 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index));
1355 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1356
1357 if let Some(ref apikey) = configuration.api_key {
1358 let key = apikey.key.clone();
1359 let value = match apikey.prefix {
1360 Some(ref prefix) => format!("{} {}", prefix, key),
1361 None => key,
1362 };
1363 req_builder = req_builder.query(&[("access_token", value)]);
1364 }
1365 if let Some(ref apikey) = configuration.api_key {
1366 let key = apikey.key.clone();
1367 let value = match apikey.prefix {
1368 Some(ref prefix) => format!("{} {}", prefix, key),
1369 None => key,
1370 };
1371 req_builder = req_builder.query(&[("sudo", value)]);
1372 }
1373 if let Some(ref apikey) = configuration.api_key {
1374 let key = apikey.key.clone();
1375 let value = match apikey.prefix {
1376 Some(ref prefix) => format!("{} {}", prefix, key),
1377 None => key,
1378 };
1379 req_builder = req_builder.query(&[("token", value)]);
1380 }
1381 if let Some(ref user_agent) = configuration.user_agent {
1382 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1383 }
1384 if let Some(ref apikey) = configuration.api_key {
1385 let key = apikey.key.clone();
1386 let value = match apikey.prefix {
1387 Some(ref prefix) => format!("{} {}", prefix, key),
1388 None => key,
1389 };
1390 req_builder = req_builder.header("X-GITEA-OTP", value);
1391 };
1392 if let Some(ref apikey) = configuration.api_key {
1393 let key = apikey.key.clone();
1394 let value = match apikey.prefix {
1395 Some(ref prefix) => format!("{} {}", prefix, key),
1396 None => key,
1397 };
1398 req_builder = req_builder.header("Authorization", value);
1399 };
1400 if let Some(ref apikey) = configuration.api_key {
1401 let key = apikey.key.clone();
1402 let value = match apikey.prefix {
1403 Some(ref prefix) => format!("{} {}", prefix, key),
1404 None => key,
1405 };
1406 req_builder = req_builder.header("Sudo", value);
1407 };
1408 if let Some(ref auth_conf) = configuration.basic_auth {
1409 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1410 };
1411 req_builder = req_builder.json(&p_body_body);
1412
1413 let req = req_builder.build()?;
1414 let resp = configuration.client.execute(req).await?;
1415
1416 let status = resp.status();
1417 let content_type = resp
1418 .headers()
1419 .get("content-type")
1420 .and_then(|v| v.to_str().ok())
1421 .unwrap_or("application/octet-stream");
1422 let content_type = super::ContentType::from(content_type);
1423
1424 if !status.is_client_error() && !status.is_server_error() {
1425 let content = resp.text().await?;
1426 match content_type {
1427 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1428 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))),
1429 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::Issue`")))),
1430 }
1431 } else {
1432 let content = resp.text().await?;
1433 let entity: Option<IssueCreateIssueBlockingError> = serde_json::from_str(&content).ok();
1434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1435 }
1436}
1437
1438pub async fn issue_create_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment: std::path::PathBuf, name: Option<&str>) -> Result<models::Attachment, Error<IssueCreateIssueCommentAttachmentError>> {
1439 let p_path_owner = owner;
1441 let p_path_repo = repo;
1442 let p_path_id = id;
1443 let p_form_attachment = attachment;
1444 let p_query_name = name;
1445
1446 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
1447 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1448
1449 if let Some(ref param_value) = p_query_name {
1450 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
1451 }
1452 if let Some(ref apikey) = configuration.api_key {
1453 let key = apikey.key.clone();
1454 let value = match apikey.prefix {
1455 Some(ref prefix) => format!("{} {}", prefix, key),
1456 None => key,
1457 };
1458 req_builder = req_builder.query(&[("access_token", value)]);
1459 }
1460 if let Some(ref apikey) = configuration.api_key {
1461 let key = apikey.key.clone();
1462 let value = match apikey.prefix {
1463 Some(ref prefix) => format!("{} {}", prefix, key),
1464 None => key,
1465 };
1466 req_builder = req_builder.query(&[("sudo", value)]);
1467 }
1468 if let Some(ref apikey) = configuration.api_key {
1469 let key = apikey.key.clone();
1470 let value = match apikey.prefix {
1471 Some(ref prefix) => format!("{} {}", prefix, key),
1472 None => key,
1473 };
1474 req_builder = req_builder.query(&[("token", value)]);
1475 }
1476 if let Some(ref user_agent) = configuration.user_agent {
1477 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1478 }
1479 if let Some(ref apikey) = configuration.api_key {
1480 let key = apikey.key.clone();
1481 let value = match apikey.prefix {
1482 Some(ref prefix) => format!("{} {}", prefix, key),
1483 None => key,
1484 };
1485 req_builder = req_builder.header("X-GITEA-OTP", value);
1486 };
1487 if let Some(ref apikey) = configuration.api_key {
1488 let key = apikey.key.clone();
1489 let value = match apikey.prefix {
1490 Some(ref prefix) => format!("{} {}", prefix, key),
1491 None => key,
1492 };
1493 req_builder = req_builder.header("Authorization", value);
1494 };
1495 if let Some(ref apikey) = configuration.api_key {
1496 let key = apikey.key.clone();
1497 let value = match apikey.prefix {
1498 Some(ref prefix) => format!("{} {}", prefix, key),
1499 None => key,
1500 };
1501 req_builder = req_builder.header("Sudo", value);
1502 };
1503 if let Some(ref auth_conf) = configuration.basic_auth {
1504 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1505 };
1506 let mut multipart_form = reqwest::multipart::Form::new();
1507 let file = TokioFile::open(&p_form_attachment).await?;
1508 let stream = FramedRead::new(file, BytesCodec::new());
1509 let file_name = p_form_attachment.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default();
1510 let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name);
1511 multipart_form = multipart_form.part("attachment", file_part);
1512 req_builder = req_builder.multipart(multipart_form);
1513
1514 let req = req_builder.build()?;
1515 let resp = configuration.client.execute(req).await?;
1516
1517 let status = resp.status();
1518 let content_type = resp
1519 .headers()
1520 .get("content-type")
1521 .and_then(|v| v.to_str().ok())
1522 .unwrap_or("application/octet-stream");
1523 let content_type = super::ContentType::from(content_type);
1524
1525 if !status.is_client_error() && !status.is_server_error() {
1526 let content = resp.text().await?;
1527 match content_type {
1528 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1529 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
1530 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`")))),
1531 }
1532 } else {
1533 let content = resp.text().await?;
1534 let entity: Option<IssueCreateIssueCommentAttachmentError> = serde_json::from_str(&content).ok();
1535 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1536 }
1537}
1538
1539pub async fn issue_create_issue_dependencies(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option<models::IssueMeta>) -> Result<models::Issue, Error<IssueCreateIssueDependenciesError>> {
1540 let p_path_owner = owner;
1542 let p_path_repo = repo;
1543 let p_path_index = index;
1544 let p_body_body = body;
1545
1546 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index));
1547 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1548
1549 if let Some(ref apikey) = configuration.api_key {
1550 let key = apikey.key.clone();
1551 let value = match apikey.prefix {
1552 Some(ref prefix) => format!("{} {}", prefix, key),
1553 None => key,
1554 };
1555 req_builder = req_builder.query(&[("access_token", value)]);
1556 }
1557 if let Some(ref apikey) = configuration.api_key {
1558 let key = apikey.key.clone();
1559 let value = match apikey.prefix {
1560 Some(ref prefix) => format!("{} {}", prefix, key),
1561 None => key,
1562 };
1563 req_builder = req_builder.query(&[("sudo", value)]);
1564 }
1565 if let Some(ref apikey) = configuration.api_key {
1566 let key = apikey.key.clone();
1567 let value = match apikey.prefix {
1568 Some(ref prefix) => format!("{} {}", prefix, key),
1569 None => key,
1570 };
1571 req_builder = req_builder.query(&[("token", value)]);
1572 }
1573 if let Some(ref user_agent) = configuration.user_agent {
1574 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1575 }
1576 if let Some(ref apikey) = configuration.api_key {
1577 let key = apikey.key.clone();
1578 let value = match apikey.prefix {
1579 Some(ref prefix) => format!("{} {}", prefix, key),
1580 None => key,
1581 };
1582 req_builder = req_builder.header("X-GITEA-OTP", value);
1583 };
1584 if let Some(ref apikey) = configuration.api_key {
1585 let key = apikey.key.clone();
1586 let value = match apikey.prefix {
1587 Some(ref prefix) => format!("{} {}", prefix, key),
1588 None => key,
1589 };
1590 req_builder = req_builder.header("Authorization", value);
1591 };
1592 if let Some(ref apikey) = configuration.api_key {
1593 let key = apikey.key.clone();
1594 let value = match apikey.prefix {
1595 Some(ref prefix) => format!("{} {}", prefix, key),
1596 None => key,
1597 };
1598 req_builder = req_builder.header("Sudo", value);
1599 };
1600 if let Some(ref auth_conf) = configuration.basic_auth {
1601 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1602 };
1603 req_builder = req_builder.json(&p_body_body);
1604
1605 let req = req_builder.build()?;
1606 let resp = configuration.client.execute(req).await?;
1607
1608 let status = resp.status();
1609 let content_type = resp
1610 .headers()
1611 .get("content-type")
1612 .and_then(|v| v.to_str().ok())
1613 .unwrap_or("application/octet-stream");
1614 let content_type = super::ContentType::from(content_type);
1615
1616 if !status.is_client_error() && !status.is_server_error() {
1617 let content = resp.text().await?;
1618 match content_type {
1619 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1620 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))),
1621 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::Issue`")))),
1622 }
1623 } else {
1624 let content = resp.text().await?;
1625 let entity: Option<IssueCreateIssueDependenciesError> = serde_json::from_str(&content).ok();
1626 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1627 }
1628}
1629
1630pub async fn issue_create_label(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateLabelOption>) -> Result<models::Label, Error<IssueCreateLabelError>> {
1631 let p_path_owner = owner;
1633 let p_path_repo = repo;
1634 let p_body_body = body;
1635
1636 let uri_str = format!("{}/repos/{owner}/{repo}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1637 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1638
1639 if let Some(ref apikey) = configuration.api_key {
1640 let key = apikey.key.clone();
1641 let value = match apikey.prefix {
1642 Some(ref prefix) => format!("{} {}", prefix, key),
1643 None => key,
1644 };
1645 req_builder = req_builder.query(&[("access_token", value)]);
1646 }
1647 if let Some(ref apikey) = configuration.api_key {
1648 let key = apikey.key.clone();
1649 let value = match apikey.prefix {
1650 Some(ref prefix) => format!("{} {}", prefix, key),
1651 None => key,
1652 };
1653 req_builder = req_builder.query(&[("sudo", value)]);
1654 }
1655 if let Some(ref apikey) = configuration.api_key {
1656 let key = apikey.key.clone();
1657 let value = match apikey.prefix {
1658 Some(ref prefix) => format!("{} {}", prefix, key),
1659 None => key,
1660 };
1661 req_builder = req_builder.query(&[("token", value)]);
1662 }
1663 if let Some(ref user_agent) = configuration.user_agent {
1664 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1665 }
1666 if let Some(ref apikey) = configuration.api_key {
1667 let key = apikey.key.clone();
1668 let value = match apikey.prefix {
1669 Some(ref prefix) => format!("{} {}", prefix, key),
1670 None => key,
1671 };
1672 req_builder = req_builder.header("X-GITEA-OTP", value);
1673 };
1674 if let Some(ref apikey) = configuration.api_key {
1675 let key = apikey.key.clone();
1676 let value = match apikey.prefix {
1677 Some(ref prefix) => format!("{} {}", prefix, key),
1678 None => key,
1679 };
1680 req_builder = req_builder.header("Authorization", value);
1681 };
1682 if let Some(ref apikey) = configuration.api_key {
1683 let key = apikey.key.clone();
1684 let value = match apikey.prefix {
1685 Some(ref prefix) => format!("{} {}", prefix, key),
1686 None => key,
1687 };
1688 req_builder = req_builder.header("Sudo", value);
1689 };
1690 if let Some(ref auth_conf) = configuration.basic_auth {
1691 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1692 };
1693 req_builder = req_builder.json(&p_body_body);
1694
1695 let req = req_builder.build()?;
1696 let resp = configuration.client.execute(req).await?;
1697
1698 let status = resp.status();
1699 let content_type = resp
1700 .headers()
1701 .get("content-type")
1702 .and_then(|v| v.to_str().ok())
1703 .unwrap_or("application/octet-stream");
1704 let content_type = super::ContentType::from(content_type);
1705
1706 if !status.is_client_error() && !status.is_server_error() {
1707 let content = resp.text().await?;
1708 match content_type {
1709 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1710 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))),
1711 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))),
1712 }
1713 } else {
1714 let content = resp.text().await?;
1715 let entity: Option<IssueCreateLabelError> = serde_json::from_str(&content).ok();
1716 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1717 }
1718}
1719
1720pub async fn issue_create_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option<models::CreateMilestoneOption>) -> Result<models::Milestone, Error<IssueCreateMilestoneError>> {
1721 let p_path_owner = owner;
1723 let p_path_repo = repo;
1724 let p_body_body = body;
1725
1726 let uri_str = format!("{}/repos/{owner}/{repo}/milestones", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1727 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1728
1729 if let Some(ref apikey) = configuration.api_key {
1730 let key = apikey.key.clone();
1731 let value = match apikey.prefix {
1732 Some(ref prefix) => format!("{} {}", prefix, key),
1733 None => key,
1734 };
1735 req_builder = req_builder.query(&[("access_token", value)]);
1736 }
1737 if let Some(ref apikey) = configuration.api_key {
1738 let key = apikey.key.clone();
1739 let value = match apikey.prefix {
1740 Some(ref prefix) => format!("{} {}", prefix, key),
1741 None => key,
1742 };
1743 req_builder = req_builder.query(&[("sudo", value)]);
1744 }
1745 if let Some(ref apikey) = configuration.api_key {
1746 let key = apikey.key.clone();
1747 let value = match apikey.prefix {
1748 Some(ref prefix) => format!("{} {}", prefix, key),
1749 None => key,
1750 };
1751 req_builder = req_builder.query(&[("token", value)]);
1752 }
1753 if let Some(ref user_agent) = configuration.user_agent {
1754 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1755 }
1756 if let Some(ref apikey) = configuration.api_key {
1757 let key = apikey.key.clone();
1758 let value = match apikey.prefix {
1759 Some(ref prefix) => format!("{} {}", prefix, key),
1760 None => key,
1761 };
1762 req_builder = req_builder.header("X-GITEA-OTP", value);
1763 };
1764 if let Some(ref apikey) = configuration.api_key {
1765 let key = apikey.key.clone();
1766 let value = match apikey.prefix {
1767 Some(ref prefix) => format!("{} {}", prefix, key),
1768 None => key,
1769 };
1770 req_builder = req_builder.header("Authorization", value);
1771 };
1772 if let Some(ref apikey) = configuration.api_key {
1773 let key = apikey.key.clone();
1774 let value = match apikey.prefix {
1775 Some(ref prefix) => format!("{} {}", prefix, key),
1776 None => key,
1777 };
1778 req_builder = req_builder.header("Sudo", value);
1779 };
1780 if let Some(ref auth_conf) = configuration.basic_auth {
1781 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1782 };
1783 req_builder = req_builder.json(&p_body_body);
1784
1785 let req = req_builder.build()?;
1786 let resp = configuration.client.execute(req).await?;
1787
1788 let status = resp.status();
1789 let content_type = resp
1790 .headers()
1791 .get("content-type")
1792 .and_then(|v| v.to_str().ok())
1793 .unwrap_or("application/octet-stream");
1794 let content_type = super::ContentType::from(content_type);
1795
1796 if !status.is_client_error() && !status.is_server_error() {
1797 let content = resp.text().await?;
1798 match content_type {
1799 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1800 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Milestone`"))),
1801 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::Milestone`")))),
1802 }
1803 } else {
1804 let content = resp.text().await?;
1805 let entity: Option<IssueCreateMilestoneError> = serde_json::from_str(&content).ok();
1806 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1807 }
1808}
1809
1810pub async fn issue_delete(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<IssueDeleteError>> {
1811 let p_path_owner = owner;
1813 let p_path_repo = repo;
1814 let p_path_index = index;
1815
1816 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
1817 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1818
1819 if let Some(ref apikey) = configuration.api_key {
1820 let key = apikey.key.clone();
1821 let value = match apikey.prefix {
1822 Some(ref prefix) => format!("{} {}", prefix, key),
1823 None => key,
1824 };
1825 req_builder = req_builder.query(&[("access_token", value)]);
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(&[("sudo", 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(&[("token", value)]);
1842 }
1843 if let Some(ref user_agent) = configuration.user_agent {
1844 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1845 }
1846 if let Some(ref apikey) = configuration.api_key {
1847 let key = apikey.key.clone();
1848 let value = match apikey.prefix {
1849 Some(ref prefix) => format!("{} {}", prefix, key),
1850 None => key,
1851 };
1852 req_builder = req_builder.header("X-GITEA-OTP", value);
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("Authorization", 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("Sudo", value);
1869 };
1870 if let Some(ref auth_conf) = configuration.basic_auth {
1871 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1872 };
1873
1874 let req = req_builder.build()?;
1875 let resp = configuration.client.execute(req).await?;
1876
1877 let status = resp.status();
1878
1879 if !status.is_client_error() && !status.is_server_error() {
1880 Ok(())
1881 } else {
1882 let content = resp.text().await?;
1883 let entity: Option<IssueDeleteError> = serde_json::from_str(&content).ok();
1884 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1885 }
1886}
1887
1888pub async fn issue_delete_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error<IssueDeleteCommentError>> {
1889 let p_path_owner = owner;
1891 let p_path_repo = repo;
1892 let p_path_id = id;
1893
1894 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
1895 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1896
1897 if let Some(ref apikey) = configuration.api_key {
1898 let key = apikey.key.clone();
1899 let value = match apikey.prefix {
1900 Some(ref prefix) => format!("{} {}", prefix, key),
1901 None => key,
1902 };
1903 req_builder = req_builder.query(&[("access_token", value)]);
1904 }
1905 if let Some(ref apikey) = configuration.api_key {
1906 let key = apikey.key.clone();
1907 let value = match apikey.prefix {
1908 Some(ref prefix) => format!("{} {}", prefix, key),
1909 None => key,
1910 };
1911 req_builder = req_builder.query(&[("sudo", value)]);
1912 }
1913 if let Some(ref apikey) = configuration.api_key {
1914 let key = apikey.key.clone();
1915 let value = match apikey.prefix {
1916 Some(ref prefix) => format!("{} {}", prefix, key),
1917 None => key,
1918 };
1919 req_builder = req_builder.query(&[("token", value)]);
1920 }
1921 if let Some(ref user_agent) = configuration.user_agent {
1922 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1923 }
1924 if let Some(ref apikey) = configuration.api_key {
1925 let key = apikey.key.clone();
1926 let value = match apikey.prefix {
1927 Some(ref prefix) => format!("{} {}", prefix, key),
1928 None => key,
1929 };
1930 req_builder = req_builder.header("X-GITEA-OTP", value);
1931 };
1932 if let Some(ref apikey) = configuration.api_key {
1933 let key = apikey.key.clone();
1934 let value = match apikey.prefix {
1935 Some(ref prefix) => format!("{} {}", prefix, key),
1936 None => key,
1937 };
1938 req_builder = req_builder.header("Authorization", value);
1939 };
1940 if let Some(ref apikey) = configuration.api_key {
1941 let key = apikey.key.clone();
1942 let value = match apikey.prefix {
1943 Some(ref prefix) => format!("{} {}", prefix, key),
1944 None => key,
1945 };
1946 req_builder = req_builder.header("Sudo", value);
1947 };
1948 if let Some(ref auth_conf) = configuration.basic_auth {
1949 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1950 };
1951
1952 let req = req_builder.build()?;
1953 let resp = configuration.client.execute(req).await?;
1954
1955 let status = resp.status();
1956
1957 if !status.is_client_error() && !status.is_server_error() {
1958 Ok(())
1959 } else {
1960 let content = resp.text().await?;
1961 let entity: Option<IssueDeleteCommentError> = serde_json::from_str(&content).ok();
1962 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1963 }
1964}
1965
1966#[deprecated]
1967pub async fn issue_delete_comment_deprecated(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i32, id: i64) -> Result<(), Error<IssueDeleteCommentDeprecatedError>> {
1968 let p_path_owner = owner;
1970 let p_path_repo = repo;
1971 let p_path_index = index;
1972 let p_path_id = id;
1973
1974 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{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);
1975 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1976
1977 if let Some(ref apikey) = configuration.api_key {
1978 let key = apikey.key.clone();
1979 let value = match apikey.prefix {
1980 Some(ref prefix) => format!("{} {}", prefix, key),
1981 None => key,
1982 };
1983 req_builder = req_builder.query(&[("access_token", value)]);
1984 }
1985 if let Some(ref apikey) = configuration.api_key {
1986 let key = apikey.key.clone();
1987 let value = match apikey.prefix {
1988 Some(ref prefix) => format!("{} {}", prefix, key),
1989 None => key,
1990 };
1991 req_builder = req_builder.query(&[("sudo", value)]);
1992 }
1993 if let Some(ref apikey) = configuration.api_key {
1994 let key = apikey.key.clone();
1995 let value = match apikey.prefix {
1996 Some(ref prefix) => format!("{} {}", prefix, key),
1997 None => key,
1998 };
1999 req_builder = req_builder.query(&[("token", value)]);
2000 }
2001 if let Some(ref user_agent) = configuration.user_agent {
2002 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2003 }
2004 if let Some(ref apikey) = configuration.api_key {
2005 let key = apikey.key.clone();
2006 let value = match apikey.prefix {
2007 Some(ref prefix) => format!("{} {}", prefix, key),
2008 None => key,
2009 };
2010 req_builder = req_builder.header("X-GITEA-OTP", value);
2011 };
2012 if let Some(ref apikey) = configuration.api_key {
2013 let key = apikey.key.clone();
2014 let value = match apikey.prefix {
2015 Some(ref prefix) => format!("{} {}", prefix, key),
2016 None => key,
2017 };
2018 req_builder = req_builder.header("Authorization", value);
2019 };
2020 if let Some(ref apikey) = configuration.api_key {
2021 let key = apikey.key.clone();
2022 let value = match apikey.prefix {
2023 Some(ref prefix) => format!("{} {}", prefix, key),
2024 None => key,
2025 };
2026 req_builder = req_builder.header("Sudo", value);
2027 };
2028 if let Some(ref auth_conf) = configuration.basic_auth {
2029 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2030 };
2031
2032 let req = req_builder.build()?;
2033 let resp = configuration.client.execute(req).await?;
2034
2035 let status = resp.status();
2036
2037 if !status.is_client_error() && !status.is_server_error() {
2038 Ok(())
2039 } else {
2040 let content = resp.text().await?;
2041 let entity: Option<IssueDeleteCommentDeprecatedError> = serde_json::from_str(&content).ok();
2042 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2043 }
2044}
2045
2046pub async fn issue_delete_comment_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, content: Option<models::EditReactionOption>) -> Result<(), Error<IssueDeleteCommentReactionError>> {
2047 let p_path_owner = owner;
2049 let p_path_repo = repo;
2050 let p_path_id = id;
2051 let p_body_content = content;
2052
2053 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
2054 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2055
2056 if let Some(ref apikey) = configuration.api_key {
2057 let key = apikey.key.clone();
2058 let value = match apikey.prefix {
2059 Some(ref prefix) => format!("{} {}", prefix, key),
2060 None => key,
2061 };
2062 req_builder = req_builder.query(&[("access_token", value)]);
2063 }
2064 if let Some(ref apikey) = configuration.api_key {
2065 let key = apikey.key.clone();
2066 let value = match apikey.prefix {
2067 Some(ref prefix) => format!("{} {}", prefix, key),
2068 None => key,
2069 };
2070 req_builder = req_builder.query(&[("sudo", value)]);
2071 }
2072 if let Some(ref apikey) = configuration.api_key {
2073 let key = apikey.key.clone();
2074 let value = match apikey.prefix {
2075 Some(ref prefix) => format!("{} {}", prefix, key),
2076 None => key,
2077 };
2078 req_builder = req_builder.query(&[("token", value)]);
2079 }
2080 if let Some(ref user_agent) = configuration.user_agent {
2081 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2082 }
2083 if let Some(ref apikey) = configuration.api_key {
2084 let key = apikey.key.clone();
2085 let value = match apikey.prefix {
2086 Some(ref prefix) => format!("{} {}", prefix, key),
2087 None => key,
2088 };
2089 req_builder = req_builder.header("X-GITEA-OTP", value);
2090 };
2091 if let Some(ref apikey) = configuration.api_key {
2092 let key = apikey.key.clone();
2093 let value = match apikey.prefix {
2094 Some(ref prefix) => format!("{} {}", prefix, key),
2095 None => key,
2096 };
2097 req_builder = req_builder.header("Authorization", value);
2098 };
2099 if let Some(ref apikey) = configuration.api_key {
2100 let key = apikey.key.clone();
2101 let value = match apikey.prefix {
2102 Some(ref prefix) => format!("{} {}", prefix, key),
2103 None => key,
2104 };
2105 req_builder = req_builder.header("Sudo", value);
2106 };
2107 if let Some(ref auth_conf) = configuration.basic_auth {
2108 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2109 };
2110 req_builder = req_builder.json(&p_body_content);
2111
2112 let req = req_builder.build()?;
2113 let resp = configuration.client.execute(req).await?;
2114
2115 let status = resp.status();
2116
2117 if !status.is_client_error() && !status.is_server_error() {
2118 Ok(())
2119 } else {
2120 let content = resp.text().await?;
2121 let entity: Option<IssueDeleteCommentReactionError> = serde_json::from_str(&content).ok();
2122 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2123 }
2124}
2125
2126pub async fn issue_delete_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment_id: i64) -> Result<(), Error<IssueDeleteIssueAttachmentError>> {
2127 let p_path_owner = owner;
2129 let p_path_repo = repo;
2130 let p_path_index = index;
2131 let p_path_attachment_id = attachment_id;
2132
2133 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, attachment_id=p_path_attachment_id);
2134 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2135
2136 if let Some(ref apikey) = configuration.api_key {
2137 let key = apikey.key.clone();
2138 let value = match apikey.prefix {
2139 Some(ref prefix) => format!("{} {}", prefix, key),
2140 None => key,
2141 };
2142 req_builder = req_builder.query(&[("access_token", value)]);
2143 }
2144 if let Some(ref apikey) = configuration.api_key {
2145 let key = apikey.key.clone();
2146 let value = match apikey.prefix {
2147 Some(ref prefix) => format!("{} {}", prefix, key),
2148 None => key,
2149 };
2150 req_builder = req_builder.query(&[("sudo", value)]);
2151 }
2152 if let Some(ref apikey) = configuration.api_key {
2153 let key = apikey.key.clone();
2154 let value = match apikey.prefix {
2155 Some(ref prefix) => format!("{} {}", prefix, key),
2156 None => key,
2157 };
2158 req_builder = req_builder.query(&[("token", value)]);
2159 }
2160 if let Some(ref user_agent) = configuration.user_agent {
2161 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2162 }
2163 if let Some(ref apikey) = configuration.api_key {
2164 let key = apikey.key.clone();
2165 let value = match apikey.prefix {
2166 Some(ref prefix) => format!("{} {}", prefix, key),
2167 None => key,
2168 };
2169 req_builder = req_builder.header("X-GITEA-OTP", value);
2170 };
2171 if let Some(ref apikey) = configuration.api_key {
2172 let key = apikey.key.clone();
2173 let value = match apikey.prefix {
2174 Some(ref prefix) => format!("{} {}", prefix, key),
2175 None => key,
2176 };
2177 req_builder = req_builder.header("Authorization", value);
2178 };
2179 if let Some(ref apikey) = configuration.api_key {
2180 let key = apikey.key.clone();
2181 let value = match apikey.prefix {
2182 Some(ref prefix) => format!("{} {}", prefix, key),
2183 None => key,
2184 };
2185 req_builder = req_builder.header("Sudo", value);
2186 };
2187 if let Some(ref auth_conf) = configuration.basic_auth {
2188 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2189 };
2190
2191 let req = req_builder.build()?;
2192 let resp = configuration.client.execute(req).await?;
2193
2194 let status = resp.status();
2195
2196 if !status.is_client_error() && !status.is_server_error() {
2197 Ok(())
2198 } else {
2199 let content = resp.text().await?;
2200 let entity: Option<IssueDeleteIssueAttachmentError> = serde_json::from_str(&content).ok();
2201 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2202 }
2203}
2204
2205pub async fn issue_delete_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result<(), Error<IssueDeleteIssueCommentAttachmentError>> {
2206 let p_path_owner = owner;
2208 let p_path_repo = repo;
2209 let p_path_id = id;
2210 let p_path_attachment_id = attachment_id;
2211
2212 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{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);
2213 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2214
2215 if let Some(ref apikey) = configuration.api_key {
2216 let key = apikey.key.clone();
2217 let value = match apikey.prefix {
2218 Some(ref prefix) => format!("{} {}", prefix, key),
2219 None => key,
2220 };
2221 req_builder = req_builder.query(&[("access_token", value)]);
2222 }
2223 if let Some(ref apikey) = configuration.api_key {
2224 let key = apikey.key.clone();
2225 let value = match apikey.prefix {
2226 Some(ref prefix) => format!("{} {}", prefix, key),
2227 None => key,
2228 };
2229 req_builder = req_builder.query(&[("sudo", value)]);
2230 }
2231 if let Some(ref apikey) = configuration.api_key {
2232 let key = apikey.key.clone();
2233 let value = match apikey.prefix {
2234 Some(ref prefix) => format!("{} {}", prefix, key),
2235 None => key,
2236 };
2237 req_builder = req_builder.query(&[("token", value)]);
2238 }
2239 if let Some(ref user_agent) = configuration.user_agent {
2240 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2241 }
2242 if let Some(ref apikey) = configuration.api_key {
2243 let key = apikey.key.clone();
2244 let value = match apikey.prefix {
2245 Some(ref prefix) => format!("{} {}", prefix, key),
2246 None => key,
2247 };
2248 req_builder = req_builder.header("X-GITEA-OTP", value);
2249 };
2250 if let Some(ref apikey) = configuration.api_key {
2251 let key = apikey.key.clone();
2252 let value = match apikey.prefix {
2253 Some(ref prefix) => format!("{} {}", prefix, key),
2254 None => key,
2255 };
2256 req_builder = req_builder.header("Authorization", value);
2257 };
2258 if let Some(ref apikey) = configuration.api_key {
2259 let key = apikey.key.clone();
2260 let value = match apikey.prefix {
2261 Some(ref prefix) => format!("{} {}", prefix, key),
2262 None => key,
2263 };
2264 req_builder = req_builder.header("Sudo", value);
2265 };
2266 if let Some(ref auth_conf) = configuration.basic_auth {
2267 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2268 };
2269
2270 let req = req_builder.build()?;
2271 let resp = configuration.client.execute(req).await?;
2272
2273 let status = resp.status();
2274
2275 if !status.is_client_error() && !status.is_server_error() {
2276 Ok(())
2277 } else {
2278 let content = resp.text().await?;
2279 let entity: Option<IssueDeleteIssueCommentAttachmentError> = serde_json::from_str(&content).ok();
2280 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2281 }
2282}
2283
2284pub async fn issue_delete_issue_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, content: Option<models::EditReactionOption>) -> Result<(), Error<IssueDeleteIssueReactionError>> {
2285 let p_path_owner = owner;
2287 let p_path_repo = repo;
2288 let p_path_index = index;
2289 let p_body_content = content;
2290
2291 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
2292 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2293
2294 if let Some(ref apikey) = configuration.api_key {
2295 let key = apikey.key.clone();
2296 let value = match apikey.prefix {
2297 Some(ref prefix) => format!("{} {}", prefix, key),
2298 None => key,
2299 };
2300 req_builder = req_builder.query(&[("access_token", value)]);
2301 }
2302 if let Some(ref apikey) = configuration.api_key {
2303 let key = apikey.key.clone();
2304 let value = match apikey.prefix {
2305 Some(ref prefix) => format!("{} {}", prefix, key),
2306 None => key,
2307 };
2308 req_builder = req_builder.query(&[("sudo", value)]);
2309 }
2310 if let Some(ref apikey) = configuration.api_key {
2311 let key = apikey.key.clone();
2312 let value = match apikey.prefix {
2313 Some(ref prefix) => format!("{} {}", prefix, key),
2314 None => key,
2315 };
2316 req_builder = req_builder.query(&[("token", value)]);
2317 }
2318 if let Some(ref user_agent) = configuration.user_agent {
2319 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2320 }
2321 if let Some(ref apikey) = configuration.api_key {
2322 let key = apikey.key.clone();
2323 let value = match apikey.prefix {
2324 Some(ref prefix) => format!("{} {}", prefix, key),
2325 None => key,
2326 };
2327 req_builder = req_builder.header("X-GITEA-OTP", value);
2328 };
2329 if let Some(ref apikey) = configuration.api_key {
2330 let key = apikey.key.clone();
2331 let value = match apikey.prefix {
2332 Some(ref prefix) => format!("{} {}", prefix, key),
2333 None => key,
2334 };
2335 req_builder = req_builder.header("Authorization", value);
2336 };
2337 if let Some(ref apikey) = configuration.api_key {
2338 let key = apikey.key.clone();
2339 let value = match apikey.prefix {
2340 Some(ref prefix) => format!("{} {}", prefix, key),
2341 None => key,
2342 };
2343 req_builder = req_builder.header("Sudo", value);
2344 };
2345 if let Some(ref auth_conf) = configuration.basic_auth {
2346 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2347 };
2348 req_builder = req_builder.json(&p_body_content);
2349
2350 let req = req_builder.build()?;
2351 let resp = configuration.client.execute(req).await?;
2352
2353 let status = resp.status();
2354
2355 if !status.is_client_error() && !status.is_server_error() {
2356 Ok(())
2357 } else {
2358 let content = resp.text().await?;
2359 let entity: Option<IssueDeleteIssueReactionError> = serde_json::from_str(&content).ok();
2360 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2361 }
2362}
2363
2364pub async fn issue_delete_label(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error<IssueDeleteLabelError>> {
2365 let p_path_owner = owner;
2367 let p_path_repo = repo;
2368 let p_path_id = id;
2369
2370 let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
2371 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2372
2373 if let Some(ref apikey) = configuration.api_key {
2374 let key = apikey.key.clone();
2375 let value = match apikey.prefix {
2376 Some(ref prefix) => format!("{} {}", prefix, key),
2377 None => key,
2378 };
2379 req_builder = req_builder.query(&[("access_token", value)]);
2380 }
2381 if let Some(ref apikey) = configuration.api_key {
2382 let key = apikey.key.clone();
2383 let value = match apikey.prefix {
2384 Some(ref prefix) => format!("{} {}", prefix, key),
2385 None => key,
2386 };
2387 req_builder = req_builder.query(&[("sudo", value)]);
2388 }
2389 if let Some(ref apikey) = configuration.api_key {
2390 let key = apikey.key.clone();
2391 let value = match apikey.prefix {
2392 Some(ref prefix) => format!("{} {}", prefix, key),
2393 None => key,
2394 };
2395 req_builder = req_builder.query(&[("token", value)]);
2396 }
2397 if let Some(ref user_agent) = configuration.user_agent {
2398 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2399 }
2400 if let Some(ref apikey) = configuration.api_key {
2401 let key = apikey.key.clone();
2402 let value = match apikey.prefix {
2403 Some(ref prefix) => format!("{} {}", prefix, key),
2404 None => key,
2405 };
2406 req_builder = req_builder.header("X-GITEA-OTP", value);
2407 };
2408 if let Some(ref apikey) = configuration.api_key {
2409 let key = apikey.key.clone();
2410 let value = match apikey.prefix {
2411 Some(ref prefix) => format!("{} {}", prefix, key),
2412 None => key,
2413 };
2414 req_builder = req_builder.header("Authorization", value);
2415 };
2416 if let Some(ref apikey) = configuration.api_key {
2417 let key = apikey.key.clone();
2418 let value = match apikey.prefix {
2419 Some(ref prefix) => format!("{} {}", prefix, key),
2420 None => key,
2421 };
2422 req_builder = req_builder.header("Sudo", value);
2423 };
2424 if let Some(ref auth_conf) = configuration.basic_auth {
2425 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2426 };
2427
2428 let req = req_builder.build()?;
2429 let resp = configuration.client.execute(req).await?;
2430
2431 let status = resp.status();
2432
2433 if !status.is_client_error() && !status.is_server_error() {
2434 Ok(())
2435 } else {
2436 let content = resp.text().await?;
2437 let entity: Option<IssueDeleteLabelError> = serde_json::from_str(&content).ok();
2438 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2439 }
2440}
2441
2442pub async fn issue_delete_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result<(), Error<IssueDeleteMilestoneError>> {
2443 let p_path_owner = owner;
2445 let p_path_repo = repo;
2446 let p_path_id = id;
2447
2448 let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{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));
2449 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2450
2451 if let Some(ref apikey) = configuration.api_key {
2452 let key = apikey.key.clone();
2453 let value = match apikey.prefix {
2454 Some(ref prefix) => format!("{} {}", prefix, key),
2455 None => key,
2456 };
2457 req_builder = req_builder.query(&[("access_token", value)]);
2458 }
2459 if let Some(ref apikey) = configuration.api_key {
2460 let key = apikey.key.clone();
2461 let value = match apikey.prefix {
2462 Some(ref prefix) => format!("{} {}", prefix, key),
2463 None => key,
2464 };
2465 req_builder = req_builder.query(&[("sudo", value)]);
2466 }
2467 if let Some(ref apikey) = configuration.api_key {
2468 let key = apikey.key.clone();
2469 let value = match apikey.prefix {
2470 Some(ref prefix) => format!("{} {}", prefix, key),
2471 None => key,
2472 };
2473 req_builder = req_builder.query(&[("token", value)]);
2474 }
2475 if let Some(ref user_agent) = configuration.user_agent {
2476 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2477 }
2478 if let Some(ref apikey) = configuration.api_key {
2479 let key = apikey.key.clone();
2480 let value = match apikey.prefix {
2481 Some(ref prefix) => format!("{} {}", prefix, key),
2482 None => key,
2483 };
2484 req_builder = req_builder.header("X-GITEA-OTP", value);
2485 };
2486 if let Some(ref apikey) = configuration.api_key {
2487 let key = apikey.key.clone();
2488 let value = match apikey.prefix {
2489 Some(ref prefix) => format!("{} {}", prefix, key),
2490 None => key,
2491 };
2492 req_builder = req_builder.header("Authorization", value);
2493 };
2494 if let Some(ref apikey) = configuration.api_key {
2495 let key = apikey.key.clone();
2496 let value = match apikey.prefix {
2497 Some(ref prefix) => format!("{} {}", prefix, key),
2498 None => key,
2499 };
2500 req_builder = req_builder.header("Sudo", value);
2501 };
2502 if let Some(ref auth_conf) = configuration.basic_auth {
2503 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2504 };
2505
2506 let req = req_builder.build()?;
2507 let resp = configuration.client.execute(req).await?;
2508
2509 let status = resp.status();
2510
2511 if !status.is_client_error() && !status.is_server_error() {
2512 Ok(())
2513 } else {
2514 let content = resp.text().await?;
2515 let entity: Option<IssueDeleteMilestoneError> = serde_json::from_str(&content).ok();
2516 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2517 }
2518}
2519
2520pub async fn issue_delete_stop_watch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<IssueDeleteStopWatchError>> {
2521 let p_path_owner = owner;
2523 let p_path_repo = repo;
2524 let p_path_index = index;
2525
2526 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/delete", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
2527 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2528
2529 if let Some(ref apikey) = configuration.api_key {
2530 let key = apikey.key.clone();
2531 let value = match apikey.prefix {
2532 Some(ref prefix) => format!("{} {}", prefix, key),
2533 None => key,
2534 };
2535 req_builder = req_builder.query(&[("access_token", value)]);
2536 }
2537 if let Some(ref apikey) = configuration.api_key {
2538 let key = apikey.key.clone();
2539 let value = match apikey.prefix {
2540 Some(ref prefix) => format!("{} {}", prefix, key),
2541 None => key,
2542 };
2543 req_builder = req_builder.query(&[("sudo", value)]);
2544 }
2545 if let Some(ref apikey) = configuration.api_key {
2546 let key = apikey.key.clone();
2547 let value = match apikey.prefix {
2548 Some(ref prefix) => format!("{} {}", prefix, key),
2549 None => key,
2550 };
2551 req_builder = req_builder.query(&[("token", value)]);
2552 }
2553 if let Some(ref user_agent) = configuration.user_agent {
2554 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2555 }
2556 if let Some(ref apikey) = configuration.api_key {
2557 let key = apikey.key.clone();
2558 let value = match apikey.prefix {
2559 Some(ref prefix) => format!("{} {}", prefix, key),
2560 None => key,
2561 };
2562 req_builder = req_builder.header("X-GITEA-OTP", value);
2563 };
2564 if let Some(ref apikey) = configuration.api_key {
2565 let key = apikey.key.clone();
2566 let value = match apikey.prefix {
2567 Some(ref prefix) => format!("{} {}", prefix, key),
2568 None => key,
2569 };
2570 req_builder = req_builder.header("Authorization", value);
2571 };
2572 if let Some(ref apikey) = configuration.api_key {
2573 let key = apikey.key.clone();
2574 let value = match apikey.prefix {
2575 Some(ref prefix) => format!("{} {}", prefix, key),
2576 None => key,
2577 };
2578 req_builder = req_builder.header("Sudo", value);
2579 };
2580 if let Some(ref auth_conf) = configuration.basic_auth {
2581 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2582 };
2583
2584 let req = req_builder.build()?;
2585 let resp = configuration.client.execute(req).await?;
2586
2587 let status = resp.status();
2588
2589 if !status.is_client_error() && !status.is_server_error() {
2590 Ok(())
2591 } else {
2592 let content = resp.text().await?;
2593 let entity: Option<IssueDeleteStopWatchError> = serde_json::from_str(&content).ok();
2594 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2595 }
2596}
2597
2598pub async fn issue_delete_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, user: &str) -> Result<(), Error<IssueDeleteSubscriptionError>> {
2599 let p_path_owner = owner;
2601 let p_path_repo = repo;
2602 let p_path_index = index;
2603 let p_path_user = user;
2604
2605 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, user=crate::apis::urlencode(p_path_user));
2606 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2607
2608 if let Some(ref apikey) = configuration.api_key {
2609 let key = apikey.key.clone();
2610 let value = match apikey.prefix {
2611 Some(ref prefix) => format!("{} {}", prefix, key),
2612 None => key,
2613 };
2614 req_builder = req_builder.query(&[("access_token", value)]);
2615 }
2616 if let Some(ref apikey) = configuration.api_key {
2617 let key = apikey.key.clone();
2618 let value = match apikey.prefix {
2619 Some(ref prefix) => format!("{} {}", prefix, key),
2620 None => key,
2621 };
2622 req_builder = req_builder.query(&[("sudo", value)]);
2623 }
2624 if let Some(ref apikey) = configuration.api_key {
2625 let key = apikey.key.clone();
2626 let value = match apikey.prefix {
2627 Some(ref prefix) => format!("{} {}", prefix, key),
2628 None => key,
2629 };
2630 req_builder = req_builder.query(&[("token", value)]);
2631 }
2632 if let Some(ref user_agent) = configuration.user_agent {
2633 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2634 }
2635 if let Some(ref apikey) = configuration.api_key {
2636 let key = apikey.key.clone();
2637 let value = match apikey.prefix {
2638 Some(ref prefix) => format!("{} {}", prefix, key),
2639 None => key,
2640 };
2641 req_builder = req_builder.header("X-GITEA-OTP", value);
2642 };
2643 if let Some(ref apikey) = configuration.api_key {
2644 let key = apikey.key.clone();
2645 let value = match apikey.prefix {
2646 Some(ref prefix) => format!("{} {}", prefix, key),
2647 None => key,
2648 };
2649 req_builder = req_builder.header("Authorization", value);
2650 };
2651 if let Some(ref apikey) = configuration.api_key {
2652 let key = apikey.key.clone();
2653 let value = match apikey.prefix {
2654 Some(ref prefix) => format!("{} {}", prefix, key),
2655 None => key,
2656 };
2657 req_builder = req_builder.header("Sudo", value);
2658 };
2659 if let Some(ref auth_conf) = configuration.basic_auth {
2660 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2661 };
2662
2663 let req = req_builder.build()?;
2664 let resp = configuration.client.execute(req).await?;
2665
2666 let status = resp.status();
2667
2668 if !status.is_client_error() && !status.is_server_error() {
2669 Ok(())
2670 } else {
2671 let content = resp.text().await?;
2672 let entity: Option<IssueDeleteSubscriptionError> = serde_json::from_str(&content).ok();
2673 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2674 }
2675}
2676
2677pub async fn issue_delete_time(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<(), Error<IssueDeleteTimeError>> {
2678 let p_path_owner = owner;
2680 let p_path_repo = repo;
2681 let p_path_index = index;
2682 let p_path_id = id;
2683
2684 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times/{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);
2685 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2686
2687 if let Some(ref apikey) = configuration.api_key {
2688 let key = apikey.key.clone();
2689 let value = match apikey.prefix {
2690 Some(ref prefix) => format!("{} {}", prefix, key),
2691 None => key,
2692 };
2693 req_builder = req_builder.query(&[("access_token", value)]);
2694 }
2695 if let Some(ref apikey) = configuration.api_key {
2696 let key = apikey.key.clone();
2697 let value = match apikey.prefix {
2698 Some(ref prefix) => format!("{} {}", prefix, key),
2699 None => key,
2700 };
2701 req_builder = req_builder.query(&[("sudo", value)]);
2702 }
2703 if let Some(ref apikey) = configuration.api_key {
2704 let key = apikey.key.clone();
2705 let value = match apikey.prefix {
2706 Some(ref prefix) => format!("{} {}", prefix, key),
2707 None => key,
2708 };
2709 req_builder = req_builder.query(&[("token", value)]);
2710 }
2711 if let Some(ref user_agent) = configuration.user_agent {
2712 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2713 }
2714 if let Some(ref apikey) = configuration.api_key {
2715 let key = apikey.key.clone();
2716 let value = match apikey.prefix {
2717 Some(ref prefix) => format!("{} {}", prefix, key),
2718 None => key,
2719 };
2720 req_builder = req_builder.header("X-GITEA-OTP", value);
2721 };
2722 if let Some(ref apikey) = configuration.api_key {
2723 let key = apikey.key.clone();
2724 let value = match apikey.prefix {
2725 Some(ref prefix) => format!("{} {}", prefix, key),
2726 None => key,
2727 };
2728 req_builder = req_builder.header("Authorization", value);
2729 };
2730 if let Some(ref apikey) = configuration.api_key {
2731 let key = apikey.key.clone();
2732 let value = match apikey.prefix {
2733 Some(ref prefix) => format!("{} {}", prefix, key),
2734 None => key,
2735 };
2736 req_builder = req_builder.header("Sudo", value);
2737 };
2738 if let Some(ref auth_conf) = configuration.basic_auth {
2739 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2740 };
2741
2742 let req = req_builder.build()?;
2743 let resp = configuration.client.execute(req).await?;
2744
2745 let status = resp.status();
2746
2747 if !status.is_client_error() && !status.is_server_error() {
2748 Ok(())
2749 } else {
2750 let content = resp.text().await?;
2751 let entity: Option<IssueDeleteTimeError> = serde_json::from_str(&content).ok();
2752 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2753 }
2754}
2755
2756pub async fn issue_edit_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option<models::EditIssueCommentOption>) -> Result<models::Comment, Error<IssueEditCommentError>> {
2757 let p_path_owner = owner;
2759 let p_path_repo = repo;
2760 let p_path_id = id;
2761 let p_body_body = body;
2762
2763 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
2764 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2765
2766 if let Some(ref apikey) = configuration.api_key {
2767 let key = apikey.key.clone();
2768 let value = match apikey.prefix {
2769 Some(ref prefix) => format!("{} {}", prefix, key),
2770 None => key,
2771 };
2772 req_builder = req_builder.query(&[("access_token", value)]);
2773 }
2774 if let Some(ref apikey) = configuration.api_key {
2775 let key = apikey.key.clone();
2776 let value = match apikey.prefix {
2777 Some(ref prefix) => format!("{} {}", prefix, key),
2778 None => key,
2779 };
2780 req_builder = req_builder.query(&[("sudo", value)]);
2781 }
2782 if let Some(ref apikey) = configuration.api_key {
2783 let key = apikey.key.clone();
2784 let value = match apikey.prefix {
2785 Some(ref prefix) => format!("{} {}", prefix, key),
2786 None => key,
2787 };
2788 req_builder = req_builder.query(&[("token", value)]);
2789 }
2790 if let Some(ref user_agent) = configuration.user_agent {
2791 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2792 }
2793 if let Some(ref apikey) = configuration.api_key {
2794 let key = apikey.key.clone();
2795 let value = match apikey.prefix {
2796 Some(ref prefix) => format!("{} {}", prefix, key),
2797 None => key,
2798 };
2799 req_builder = req_builder.header("X-GITEA-OTP", value);
2800 };
2801 if let Some(ref apikey) = configuration.api_key {
2802 let key = apikey.key.clone();
2803 let value = match apikey.prefix {
2804 Some(ref prefix) => format!("{} {}", prefix, key),
2805 None => key,
2806 };
2807 req_builder = req_builder.header("Authorization", value);
2808 };
2809 if let Some(ref apikey) = configuration.api_key {
2810 let key = apikey.key.clone();
2811 let value = match apikey.prefix {
2812 Some(ref prefix) => format!("{} {}", prefix, key),
2813 None => key,
2814 };
2815 req_builder = req_builder.header("Sudo", value);
2816 };
2817 if let Some(ref auth_conf) = configuration.basic_auth {
2818 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2819 };
2820 req_builder = req_builder.json(&p_body_body);
2821
2822 let req = req_builder.build()?;
2823 let resp = configuration.client.execute(req).await?;
2824
2825 let status = resp.status();
2826 let content_type = resp
2827 .headers()
2828 .get("content-type")
2829 .and_then(|v| v.to_str().ok())
2830 .unwrap_or("application/octet-stream");
2831 let content_type = super::ContentType::from(content_type);
2832
2833 if !status.is_client_error() && !status.is_server_error() {
2834 let content = resp.text().await?;
2835 match content_type {
2836 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2837 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))),
2838 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::Comment`")))),
2839 }
2840 } else {
2841 let content = resp.text().await?;
2842 let entity: Option<IssueEditCommentError> = serde_json::from_str(&content).ok();
2843 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2844 }
2845}
2846
2847#[deprecated]
2848pub async fn issue_edit_comment_deprecated(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i32, id: i64, body: Option<models::EditIssueCommentOption>) -> Result<models::Comment, Error<IssueEditCommentDeprecatedError>> {
2849 let p_path_owner = owner;
2851 let p_path_repo = repo;
2852 let p_path_index = index;
2853 let p_path_id = id;
2854 let p_body_body = body;
2855
2856 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{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);
2857 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2858
2859 if let Some(ref apikey) = configuration.api_key {
2860 let key = apikey.key.clone();
2861 let value = match apikey.prefix {
2862 Some(ref prefix) => format!("{} {}", prefix, key),
2863 None => key,
2864 };
2865 req_builder = req_builder.query(&[("access_token", value)]);
2866 }
2867 if let Some(ref apikey) = configuration.api_key {
2868 let key = apikey.key.clone();
2869 let value = match apikey.prefix {
2870 Some(ref prefix) => format!("{} {}", prefix, key),
2871 None => key,
2872 };
2873 req_builder = req_builder.query(&[("sudo", value)]);
2874 }
2875 if let Some(ref apikey) = configuration.api_key {
2876 let key = apikey.key.clone();
2877 let value = match apikey.prefix {
2878 Some(ref prefix) => format!("{} {}", prefix, key),
2879 None => key,
2880 };
2881 req_builder = req_builder.query(&[("token", value)]);
2882 }
2883 if let Some(ref user_agent) = configuration.user_agent {
2884 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2885 }
2886 if let Some(ref apikey) = configuration.api_key {
2887 let key = apikey.key.clone();
2888 let value = match apikey.prefix {
2889 Some(ref prefix) => format!("{} {}", prefix, key),
2890 None => key,
2891 };
2892 req_builder = req_builder.header("X-GITEA-OTP", value);
2893 };
2894 if let Some(ref apikey) = configuration.api_key {
2895 let key = apikey.key.clone();
2896 let value = match apikey.prefix {
2897 Some(ref prefix) => format!("{} {}", prefix, key),
2898 None => key,
2899 };
2900 req_builder = req_builder.header("Authorization", value);
2901 };
2902 if let Some(ref apikey) = configuration.api_key {
2903 let key = apikey.key.clone();
2904 let value = match apikey.prefix {
2905 Some(ref prefix) => format!("{} {}", prefix, key),
2906 None => key,
2907 };
2908 req_builder = req_builder.header("Sudo", value);
2909 };
2910 if let Some(ref auth_conf) = configuration.basic_auth {
2911 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2912 };
2913 req_builder = req_builder.json(&p_body_body);
2914
2915 let req = req_builder.build()?;
2916 let resp = configuration.client.execute(req).await?;
2917
2918 let status = resp.status();
2919 let content_type = resp
2920 .headers()
2921 .get("content-type")
2922 .and_then(|v| v.to_str().ok())
2923 .unwrap_or("application/octet-stream");
2924 let content_type = super::ContentType::from(content_type);
2925
2926 if !status.is_client_error() && !status.is_server_error() {
2927 let content = resp.text().await?;
2928 match content_type {
2929 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2930 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))),
2931 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::Comment`")))),
2932 }
2933 } else {
2934 let content = resp.text().await?;
2935 let entity: Option<IssueEditCommentDeprecatedError> = serde_json::from_str(&content).ok();
2936 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2937 }
2938}
2939
2940pub async fn issue_edit_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::EditIssueOption>) -> Result<models::Issue, Error<IssueEditIssueError>> {
2941 let p_path_owner = owner;
2943 let p_path_repo = repo;
2944 let p_path_index = index;
2945 let p_body_body = body;
2946
2947 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
2948 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2949
2950 if let Some(ref apikey) = configuration.api_key {
2951 let key = apikey.key.clone();
2952 let value = match apikey.prefix {
2953 Some(ref prefix) => format!("{} {}", prefix, key),
2954 None => key,
2955 };
2956 req_builder = req_builder.query(&[("access_token", value)]);
2957 }
2958 if let Some(ref apikey) = configuration.api_key {
2959 let key = apikey.key.clone();
2960 let value = match apikey.prefix {
2961 Some(ref prefix) => format!("{} {}", prefix, key),
2962 None => key,
2963 };
2964 req_builder = req_builder.query(&[("sudo", value)]);
2965 }
2966 if let Some(ref apikey) = configuration.api_key {
2967 let key = apikey.key.clone();
2968 let value = match apikey.prefix {
2969 Some(ref prefix) => format!("{} {}", prefix, key),
2970 None => key,
2971 };
2972 req_builder = req_builder.query(&[("token", value)]);
2973 }
2974 if let Some(ref user_agent) = configuration.user_agent {
2975 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", 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.header("Authorization", 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.header("Sudo", value);
3000 };
3001 if let Some(ref auth_conf) = configuration.basic_auth {
3002 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3003 };
3004 req_builder = req_builder.json(&p_body_body);
3005
3006 let req = req_builder.build()?;
3007 let resp = configuration.client.execute(req).await?;
3008
3009 let status = resp.status();
3010 let content_type = resp
3011 .headers()
3012 .get("content-type")
3013 .and_then(|v| v.to_str().ok())
3014 .unwrap_or("application/octet-stream");
3015 let content_type = super::ContentType::from(content_type);
3016
3017 if !status.is_client_error() && !status.is_server_error() {
3018 let content = resp.text().await?;
3019 match content_type {
3020 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3021 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))),
3022 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::Issue`")))),
3023 }
3024 } else {
3025 let content = resp.text().await?;
3026 let entity: Option<IssueEditIssueError> = serde_json::from_str(&content).ok();
3027 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3028 }
3029}
3030
3031pub async fn issue_edit_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment_id: i64, body: Option<models::EditAttachmentOptions>) -> Result<models::Attachment, Error<IssueEditIssueAttachmentError>> {
3032 let p_path_owner = owner;
3034 let p_path_repo = repo;
3035 let p_path_index = index;
3036 let p_path_attachment_id = attachment_id;
3037 let p_body_body = body;
3038
3039 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, attachment_id=p_path_attachment_id);
3040 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3041
3042 if let Some(ref apikey) = configuration.api_key {
3043 let key = apikey.key.clone();
3044 let value = match apikey.prefix {
3045 Some(ref prefix) => format!("{} {}", prefix, key),
3046 None => key,
3047 };
3048 req_builder = req_builder.query(&[("access_token", value)]);
3049 }
3050 if let Some(ref apikey) = configuration.api_key {
3051 let key = apikey.key.clone();
3052 let value = match apikey.prefix {
3053 Some(ref prefix) => format!("{} {}", prefix, key),
3054 None => key,
3055 };
3056 req_builder = req_builder.query(&[("sudo", value)]);
3057 }
3058 if let Some(ref apikey) = configuration.api_key {
3059 let key = apikey.key.clone();
3060 let value = match apikey.prefix {
3061 Some(ref prefix) => format!("{} {}", prefix, key),
3062 None => key,
3063 };
3064 req_builder = req_builder.query(&[("token", value)]);
3065 }
3066 if let Some(ref user_agent) = configuration.user_agent {
3067 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3068 }
3069 if let Some(ref apikey) = configuration.api_key {
3070 let key = apikey.key.clone();
3071 let value = match apikey.prefix {
3072 Some(ref prefix) => format!("{} {}", prefix, key),
3073 None => key,
3074 };
3075 req_builder = req_builder.header("X-GITEA-OTP", value);
3076 };
3077 if let Some(ref apikey) = configuration.api_key {
3078 let key = apikey.key.clone();
3079 let value = match apikey.prefix {
3080 Some(ref prefix) => format!("{} {}", prefix, key),
3081 None => key,
3082 };
3083 req_builder = req_builder.header("Authorization", value);
3084 };
3085 if let Some(ref apikey) = configuration.api_key {
3086 let key = apikey.key.clone();
3087 let value = match apikey.prefix {
3088 Some(ref prefix) => format!("{} {}", prefix, key),
3089 None => key,
3090 };
3091 req_builder = req_builder.header("Sudo", value);
3092 };
3093 if let Some(ref auth_conf) = configuration.basic_auth {
3094 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3095 };
3096 req_builder = req_builder.json(&p_body_body);
3097
3098 let req = req_builder.build()?;
3099 let resp = configuration.client.execute(req).await?;
3100
3101 let status = resp.status();
3102 let content_type = resp
3103 .headers()
3104 .get("content-type")
3105 .and_then(|v| v.to_str().ok())
3106 .unwrap_or("application/octet-stream");
3107 let content_type = super::ContentType::from(content_type);
3108
3109 if !status.is_client_error() && !status.is_server_error() {
3110 let content = resp.text().await?;
3111 match content_type {
3112 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3113 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
3114 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`")))),
3115 }
3116 } else {
3117 let content = resp.text().await?;
3118 let entity: Option<IssueEditIssueAttachmentError> = serde_json::from_str(&content).ok();
3119 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3120 }
3121}
3122
3123pub async fn issue_edit_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64, body: Option<models::EditAttachmentOptions>) -> Result<models::Attachment, Error<IssueEditIssueCommentAttachmentError>> {
3124 let p_path_owner = owner;
3126 let p_path_repo = repo;
3127 let p_path_id = id;
3128 let p_path_attachment_id = attachment_id;
3129 let p_body_body = body;
3130
3131 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{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);
3132 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3133
3134 if let Some(ref apikey) = configuration.api_key {
3135 let key = apikey.key.clone();
3136 let value = match apikey.prefix {
3137 Some(ref prefix) => format!("{} {}", prefix, key),
3138 None => key,
3139 };
3140 req_builder = req_builder.query(&[("access_token", value)]);
3141 }
3142 if let Some(ref apikey) = configuration.api_key {
3143 let key = apikey.key.clone();
3144 let value = match apikey.prefix {
3145 Some(ref prefix) => format!("{} {}", prefix, key),
3146 None => key,
3147 };
3148 req_builder = req_builder.query(&[("sudo", value)]);
3149 }
3150 if let Some(ref apikey) = configuration.api_key {
3151 let key = apikey.key.clone();
3152 let value = match apikey.prefix {
3153 Some(ref prefix) => format!("{} {}", prefix, key),
3154 None => key,
3155 };
3156 req_builder = req_builder.query(&[("token", value)]);
3157 }
3158 if let Some(ref user_agent) = configuration.user_agent {
3159 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
3168 };
3169 if let Some(ref apikey) = configuration.api_key {
3170 let key = apikey.key.clone();
3171 let value = match apikey.prefix {
3172 Some(ref prefix) => format!("{} {}", prefix, key),
3173 None => key,
3174 };
3175 req_builder = req_builder.header("Authorization", value);
3176 };
3177 if let Some(ref apikey) = configuration.api_key {
3178 let key = apikey.key.clone();
3179 let value = match apikey.prefix {
3180 Some(ref prefix) => format!("{} {}", prefix, key),
3181 None => key,
3182 };
3183 req_builder = req_builder.header("Sudo", value);
3184 };
3185 if let Some(ref auth_conf) = configuration.basic_auth {
3186 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3187 };
3188 req_builder = req_builder.json(&p_body_body);
3189
3190 let req = req_builder.build()?;
3191 let resp = configuration.client.execute(req).await?;
3192
3193 let status = resp.status();
3194 let content_type = resp
3195 .headers()
3196 .get("content-type")
3197 .and_then(|v| v.to_str().ok())
3198 .unwrap_or("application/octet-stream");
3199 let content_type = super::ContentType::from(content_type);
3200
3201 if !status.is_client_error() && !status.is_server_error() {
3202 let content = resp.text().await?;
3203 match content_type {
3204 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3205 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
3206 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`")))),
3207 }
3208 } else {
3209 let content = resp.text().await?;
3210 let entity: Option<IssueEditIssueCommentAttachmentError> = serde_json::from_str(&content).ok();
3211 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3212 }
3213}
3214
3215pub async fn issue_edit_issue_deadline(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::EditDeadlineOption>) -> Result<models::IssueDeadline, Error<IssueEditIssueDeadlineError>> {
3216 let p_path_owner = owner;
3218 let p_path_repo = repo;
3219 let p_path_index = index;
3220 let p_body_body = body;
3221
3222 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/deadline", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
3223 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3224
3225 if let Some(ref apikey) = configuration.api_key {
3226 let key = apikey.key.clone();
3227 let value = match apikey.prefix {
3228 Some(ref prefix) => format!("{} {}", prefix, key),
3229 None => key,
3230 };
3231 req_builder = req_builder.query(&[("access_token", value)]);
3232 }
3233 if let Some(ref apikey) = configuration.api_key {
3234 let key = apikey.key.clone();
3235 let value = match apikey.prefix {
3236 Some(ref prefix) => format!("{} {}", prefix, key),
3237 None => key,
3238 };
3239 req_builder = req_builder.query(&[("sudo", value)]);
3240 }
3241 if let Some(ref apikey) = configuration.api_key {
3242 let key = apikey.key.clone();
3243 let value = match apikey.prefix {
3244 Some(ref prefix) => format!("{} {}", prefix, key),
3245 None => key,
3246 };
3247 req_builder = req_builder.query(&[("token", value)]);
3248 }
3249 if let Some(ref user_agent) = configuration.user_agent {
3250 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3251 }
3252 if let Some(ref apikey) = configuration.api_key {
3253 let key = apikey.key.clone();
3254 let value = match apikey.prefix {
3255 Some(ref prefix) => format!("{} {}", prefix, key),
3256 None => key,
3257 };
3258 req_builder = req_builder.header("X-GITEA-OTP", value);
3259 };
3260 if let Some(ref apikey) = configuration.api_key {
3261 let key = apikey.key.clone();
3262 let value = match apikey.prefix {
3263 Some(ref prefix) => format!("{} {}", prefix, key),
3264 None => key,
3265 };
3266 req_builder = req_builder.header("Authorization", value);
3267 };
3268 if let Some(ref apikey) = configuration.api_key {
3269 let key = apikey.key.clone();
3270 let value = match apikey.prefix {
3271 Some(ref prefix) => format!("{} {}", prefix, key),
3272 None => key,
3273 };
3274 req_builder = req_builder.header("Sudo", value);
3275 };
3276 if let Some(ref auth_conf) = configuration.basic_auth {
3277 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3278 };
3279 req_builder = req_builder.json(&p_body_body);
3280
3281 let req = req_builder.build()?;
3282 let resp = configuration.client.execute(req).await?;
3283
3284 let status = resp.status();
3285 let content_type = resp
3286 .headers()
3287 .get("content-type")
3288 .and_then(|v| v.to_str().ok())
3289 .unwrap_or("application/octet-stream");
3290 let content_type = super::ContentType::from(content_type);
3291
3292 if !status.is_client_error() && !status.is_server_error() {
3293 let content = resp.text().await?;
3294 match content_type {
3295 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3296 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueDeadline`"))),
3297 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::IssueDeadline`")))),
3298 }
3299 } else {
3300 let content = resp.text().await?;
3301 let entity: Option<IssueEditIssueDeadlineError> = serde_json::from_str(&content).ok();
3302 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3303 }
3304}
3305
3306pub async fn issue_edit_label(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option<models::EditLabelOption>) -> Result<models::Label, Error<IssueEditLabelError>> {
3307 let p_path_owner = owner;
3309 let p_path_repo = repo;
3310 let p_path_id = id;
3311 let p_body_body = body;
3312
3313 let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
3314 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3315
3316 if let Some(ref apikey) = configuration.api_key {
3317 let key = apikey.key.clone();
3318 let value = match apikey.prefix {
3319 Some(ref prefix) => format!("{} {}", prefix, key),
3320 None => key,
3321 };
3322 req_builder = req_builder.query(&[("access_token", value)]);
3323 }
3324 if let Some(ref apikey) = configuration.api_key {
3325 let key = apikey.key.clone();
3326 let value = match apikey.prefix {
3327 Some(ref prefix) => format!("{} {}", prefix, key),
3328 None => key,
3329 };
3330 req_builder = req_builder.query(&[("sudo", value)]);
3331 }
3332 if let Some(ref apikey) = configuration.api_key {
3333 let key = apikey.key.clone();
3334 let value = match apikey.prefix {
3335 Some(ref prefix) => format!("{} {}", prefix, key),
3336 None => key,
3337 };
3338 req_builder = req_builder.query(&[("token", value)]);
3339 }
3340 if let Some(ref user_agent) = configuration.user_agent {
3341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3342 }
3343 if let Some(ref apikey) = configuration.api_key {
3344 let key = apikey.key.clone();
3345 let value = match apikey.prefix {
3346 Some(ref prefix) => format!("{} {}", prefix, key),
3347 None => key,
3348 };
3349 req_builder = req_builder.header("X-GITEA-OTP", value);
3350 };
3351 if let Some(ref apikey) = configuration.api_key {
3352 let key = apikey.key.clone();
3353 let value = match apikey.prefix {
3354 Some(ref prefix) => format!("{} {}", prefix, key),
3355 None => key,
3356 };
3357 req_builder = req_builder.header("Authorization", value);
3358 };
3359 if let Some(ref apikey) = configuration.api_key {
3360 let key = apikey.key.clone();
3361 let value = match apikey.prefix {
3362 Some(ref prefix) => format!("{} {}", prefix, key),
3363 None => key,
3364 };
3365 req_builder = req_builder.header("Sudo", value);
3366 };
3367 if let Some(ref auth_conf) = configuration.basic_auth {
3368 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3369 };
3370 req_builder = req_builder.json(&p_body_body);
3371
3372 let req = req_builder.build()?;
3373 let resp = configuration.client.execute(req).await?;
3374
3375 let status = resp.status();
3376 let content_type = resp
3377 .headers()
3378 .get("content-type")
3379 .and_then(|v| v.to_str().ok())
3380 .unwrap_or("application/octet-stream");
3381 let content_type = super::ContentType::from(content_type);
3382
3383 if !status.is_client_error() && !status.is_server_error() {
3384 let content = resp.text().await?;
3385 match content_type {
3386 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3387 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))),
3388 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))),
3389 }
3390 } else {
3391 let content = resp.text().await?;
3392 let entity: Option<IssueEditLabelError> = serde_json::from_str(&content).ok();
3393 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3394 }
3395}
3396
3397pub async fn issue_edit_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str, body: Option<models::EditMilestoneOption>) -> Result<models::Milestone, Error<IssueEditMilestoneError>> {
3398 let p_path_owner = owner;
3400 let p_path_repo = repo;
3401 let p_path_id = id;
3402 let p_body_body = body;
3403
3404 let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{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));
3405 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3406
3407 if let Some(ref apikey) = configuration.api_key {
3408 let key = apikey.key.clone();
3409 let value = match apikey.prefix {
3410 Some(ref prefix) => format!("{} {}", prefix, key),
3411 None => key,
3412 };
3413 req_builder = req_builder.query(&[("access_token", value)]);
3414 }
3415 if let Some(ref apikey) = configuration.api_key {
3416 let key = apikey.key.clone();
3417 let value = match apikey.prefix {
3418 Some(ref prefix) => format!("{} {}", prefix, key),
3419 None => key,
3420 };
3421 req_builder = req_builder.query(&[("sudo", value)]);
3422 }
3423 if let Some(ref apikey) = configuration.api_key {
3424 let key = apikey.key.clone();
3425 let value = match apikey.prefix {
3426 Some(ref prefix) => format!("{} {}", prefix, key),
3427 None => key,
3428 };
3429 req_builder = req_builder.query(&[("token", value)]);
3430 }
3431 if let Some(ref user_agent) = configuration.user_agent {
3432 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3433 }
3434 if let Some(ref apikey) = configuration.api_key {
3435 let key = apikey.key.clone();
3436 let value = match apikey.prefix {
3437 Some(ref prefix) => format!("{} {}", prefix, key),
3438 None => key,
3439 };
3440 req_builder = req_builder.header("X-GITEA-OTP", value);
3441 };
3442 if let Some(ref apikey) = configuration.api_key {
3443 let key = apikey.key.clone();
3444 let value = match apikey.prefix {
3445 Some(ref prefix) => format!("{} {}", prefix, key),
3446 None => key,
3447 };
3448 req_builder = req_builder.header("Authorization", value);
3449 };
3450 if let Some(ref apikey) = configuration.api_key {
3451 let key = apikey.key.clone();
3452 let value = match apikey.prefix {
3453 Some(ref prefix) => format!("{} {}", prefix, key),
3454 None => key,
3455 };
3456 req_builder = req_builder.header("Sudo", value);
3457 };
3458 if let Some(ref auth_conf) = configuration.basic_auth {
3459 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3460 };
3461 req_builder = req_builder.json(&p_body_body);
3462
3463 let req = req_builder.build()?;
3464 let resp = configuration.client.execute(req).await?;
3465
3466 let status = resp.status();
3467 let content_type = resp
3468 .headers()
3469 .get("content-type")
3470 .and_then(|v| v.to_str().ok())
3471 .unwrap_or("application/octet-stream");
3472 let content_type = super::ContentType::from(content_type);
3473
3474 if !status.is_client_error() && !status.is_server_error() {
3475 let content = resp.text().await?;
3476 match content_type {
3477 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3478 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Milestone`"))),
3479 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::Milestone`")))),
3480 }
3481 } else {
3482 let content = resp.text().await?;
3483 let entity: Option<IssueEditMilestoneError> = serde_json::from_str(&content).ok();
3484 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3485 }
3486}
3487
3488pub async fn issue_get_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<models::Comment, Error<IssueGetCommentError>> {
3489 let p_path_owner = owner;
3491 let p_path_repo = repo;
3492 let p_path_id = id;
3493
3494 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
3495 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3496
3497 if let Some(ref apikey) = configuration.api_key {
3498 let key = apikey.key.clone();
3499 let value = match apikey.prefix {
3500 Some(ref prefix) => format!("{} {}", prefix, key),
3501 None => key,
3502 };
3503 req_builder = req_builder.query(&[("access_token", value)]);
3504 }
3505 if let Some(ref apikey) = configuration.api_key {
3506 let key = apikey.key.clone();
3507 let value = match apikey.prefix {
3508 Some(ref prefix) => format!("{} {}", prefix, key),
3509 None => key,
3510 };
3511 req_builder = req_builder.query(&[("sudo", value)]);
3512 }
3513 if let Some(ref apikey) = configuration.api_key {
3514 let key = apikey.key.clone();
3515 let value = match apikey.prefix {
3516 Some(ref prefix) => format!("{} {}", prefix, key),
3517 None => key,
3518 };
3519 req_builder = req_builder.query(&[("token", value)]);
3520 }
3521 if let Some(ref user_agent) = configuration.user_agent {
3522 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
3531 };
3532 if let Some(ref apikey) = configuration.api_key {
3533 let key = apikey.key.clone();
3534 let value = match apikey.prefix {
3535 Some(ref prefix) => format!("{} {}", prefix, key),
3536 None => key,
3537 };
3538 req_builder = req_builder.header("Authorization", value);
3539 };
3540 if let Some(ref apikey) = configuration.api_key {
3541 let key = apikey.key.clone();
3542 let value = match apikey.prefix {
3543 Some(ref prefix) => format!("{} {}", prefix, key),
3544 None => key,
3545 };
3546 req_builder = req_builder.header("Sudo", value);
3547 };
3548 if let Some(ref auth_conf) = configuration.basic_auth {
3549 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3550 };
3551
3552 let req = req_builder.build()?;
3553 let resp = configuration.client.execute(req).await?;
3554
3555 let status = resp.status();
3556 let content_type = resp
3557 .headers()
3558 .get("content-type")
3559 .and_then(|v| v.to_str().ok())
3560 .unwrap_or("application/octet-stream");
3561 let content_type = super::ContentType::from(content_type);
3562
3563 if !status.is_client_error() && !status.is_server_error() {
3564 let content = resp.text().await?;
3565 match content_type {
3566 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3567 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))),
3568 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::Comment`")))),
3569 }
3570 } else {
3571 let content = resp.text().await?;
3572 let entity: Option<IssueGetCommentError> = serde_json::from_str(&content).ok();
3573 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3574 }
3575}
3576
3577pub async fn issue_get_comment_reactions(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<Vec<models::Reaction>, Error<IssueGetCommentReactionsError>> {
3578 let p_path_owner = owner;
3580 let p_path_repo = repo;
3581 let p_path_id = id;
3582
3583 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
3584 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3585
3586 if let Some(ref apikey) = configuration.api_key {
3587 let key = apikey.key.clone();
3588 let value = match apikey.prefix {
3589 Some(ref prefix) => format!("{} {}", prefix, key),
3590 None => key,
3591 };
3592 req_builder = req_builder.query(&[("access_token", value)]);
3593 }
3594 if let Some(ref apikey) = configuration.api_key {
3595 let key = apikey.key.clone();
3596 let value = match apikey.prefix {
3597 Some(ref prefix) => format!("{} {}", prefix, key),
3598 None => key,
3599 };
3600 req_builder = req_builder.query(&[("sudo", value)]);
3601 }
3602 if let Some(ref apikey) = configuration.api_key {
3603 let key = apikey.key.clone();
3604 let value = match apikey.prefix {
3605 Some(ref prefix) => format!("{} {}", prefix, key),
3606 None => key,
3607 };
3608 req_builder = req_builder.query(&[("token", value)]);
3609 }
3610 if let Some(ref user_agent) = configuration.user_agent {
3611 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", value);
3620 };
3621 if let Some(ref apikey) = configuration.api_key {
3622 let key = apikey.key.clone();
3623 let value = match apikey.prefix {
3624 Some(ref prefix) => format!("{} {}", prefix, key),
3625 None => key,
3626 };
3627 req_builder = req_builder.header("Authorization", value);
3628 };
3629 if let Some(ref apikey) = configuration.api_key {
3630 let key = apikey.key.clone();
3631 let value = match apikey.prefix {
3632 Some(ref prefix) => format!("{} {}", prefix, key),
3633 None => key,
3634 };
3635 req_builder = req_builder.header("Sudo", value);
3636 };
3637 if let Some(ref auth_conf) = configuration.basic_auth {
3638 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3639 };
3640
3641 let req = req_builder.build()?;
3642 let resp = configuration.client.execute(req).await?;
3643
3644 let status = resp.status();
3645 let content_type = resp
3646 .headers()
3647 .get("content-type")
3648 .and_then(|v| v.to_str().ok())
3649 .unwrap_or("application/octet-stream");
3650 let content_type = super::ContentType::from(content_type);
3651
3652 if !status.is_client_error() && !status.is_server_error() {
3653 let content = resp.text().await?;
3654 match content_type {
3655 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3656 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reaction>`"))),
3657 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::Reaction>`")))),
3658 }
3659 } else {
3660 let content = resp.text().await?;
3661 let entity: Option<IssueGetCommentReactionsError> = serde_json::from_str(&content).ok();
3662 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3663 }
3664}
3665
3666pub async fn issue_get_comments(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, since: Option<String>, before: Option<String>) -> Result<Vec<models::Comment>, Error<IssueGetCommentsError>> {
3667 let p_path_owner = owner;
3669 let p_path_repo = repo;
3670 let p_path_index = index;
3671 let p_query_since = since;
3672 let p_query_before = before;
3673
3674 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
3675 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3676
3677 if let Some(ref param_value) = p_query_since {
3678 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
3679 }
3680 if let Some(ref param_value) = p_query_before {
3681 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
3682 }
3683 if let Some(ref apikey) = configuration.api_key {
3684 let key = apikey.key.clone();
3685 let value = match apikey.prefix {
3686 Some(ref prefix) => format!("{} {}", prefix, key),
3687 None => key,
3688 };
3689 req_builder = req_builder.query(&[("access_token", value)]);
3690 }
3691 if let Some(ref apikey) = configuration.api_key {
3692 let key = apikey.key.clone();
3693 let value = match apikey.prefix {
3694 Some(ref prefix) => format!("{} {}", prefix, key),
3695 None => key,
3696 };
3697 req_builder = req_builder.query(&[("sudo", value)]);
3698 }
3699 if let Some(ref apikey) = configuration.api_key {
3700 let key = apikey.key.clone();
3701 let value = match apikey.prefix {
3702 Some(ref prefix) => format!("{} {}", prefix, key),
3703 None => key,
3704 };
3705 req_builder = req_builder.query(&[("token", value)]);
3706 }
3707 if let Some(ref user_agent) = configuration.user_agent {
3708 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3709 }
3710 if let Some(ref apikey) = configuration.api_key {
3711 let key = apikey.key.clone();
3712 let value = match apikey.prefix {
3713 Some(ref prefix) => format!("{} {}", prefix, key),
3714 None => key,
3715 };
3716 req_builder = req_builder.header("X-GITEA-OTP", value);
3717 };
3718 if let Some(ref apikey) = configuration.api_key {
3719 let key = apikey.key.clone();
3720 let value = match apikey.prefix {
3721 Some(ref prefix) => format!("{} {}", prefix, key),
3722 None => key,
3723 };
3724 req_builder = req_builder.header("Authorization", value);
3725 };
3726 if let Some(ref apikey) = configuration.api_key {
3727 let key = apikey.key.clone();
3728 let value = match apikey.prefix {
3729 Some(ref prefix) => format!("{} {}", prefix, key),
3730 None => key,
3731 };
3732 req_builder = req_builder.header("Sudo", value);
3733 };
3734 if let Some(ref auth_conf) = configuration.basic_auth {
3735 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3736 };
3737
3738 let req = req_builder.build()?;
3739 let resp = configuration.client.execute(req).await?;
3740
3741 let status = resp.status();
3742 let content_type = resp
3743 .headers()
3744 .get("content-type")
3745 .and_then(|v| v.to_str().ok())
3746 .unwrap_or("application/octet-stream");
3747 let content_type = super::ContentType::from(content_type);
3748
3749 if !status.is_client_error() && !status.is_server_error() {
3750 let content = resp.text().await?;
3751 match content_type {
3752 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3753 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Comment>`"))),
3754 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::Comment>`")))),
3755 }
3756 } else {
3757 let content = resp.text().await?;
3758 let entity: Option<IssueGetCommentsError> = serde_json::from_str(&content).ok();
3759 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3760 }
3761}
3762
3763pub async fn issue_get_comments_and_timeline(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, since: Option<String>, page: Option<i32>, limit: Option<i32>, before: Option<String>) -> Result<Vec<models::TimelineComment>, Error<IssueGetCommentsAndTimelineError>> {
3764 let p_path_owner = owner;
3766 let p_path_repo = repo;
3767 let p_path_index = index;
3768 let p_query_since = since;
3769 let p_query_page = page;
3770 let p_query_limit = limit;
3771 let p_query_before = before;
3772
3773 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/timeline", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
3774 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3775
3776 if let Some(ref param_value) = p_query_since {
3777 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
3778 }
3779 if let Some(ref param_value) = p_query_page {
3780 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3781 }
3782 if let Some(ref param_value) = p_query_limit {
3783 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
3784 }
3785 if let Some(ref param_value) = p_query_before {
3786 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
3787 }
3788 if let Some(ref apikey) = configuration.api_key {
3789 let key = apikey.key.clone();
3790 let value = match apikey.prefix {
3791 Some(ref prefix) => format!("{} {}", prefix, key),
3792 None => key,
3793 };
3794 req_builder = req_builder.query(&[("access_token", value)]);
3795 }
3796 if let Some(ref apikey) = configuration.api_key {
3797 let key = apikey.key.clone();
3798 let value = match apikey.prefix {
3799 Some(ref prefix) => format!("{} {}", prefix, key),
3800 None => key,
3801 };
3802 req_builder = req_builder.query(&[("sudo", value)]);
3803 }
3804 if let Some(ref apikey) = configuration.api_key {
3805 let key = apikey.key.clone();
3806 let value = match apikey.prefix {
3807 Some(ref prefix) => format!("{} {}", prefix, key),
3808 None => key,
3809 };
3810 req_builder = req_builder.query(&[("token", value)]);
3811 }
3812 if let Some(ref user_agent) = configuration.user_agent {
3813 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3814 }
3815 if let Some(ref apikey) = configuration.api_key {
3816 let key = apikey.key.clone();
3817 let value = match apikey.prefix {
3818 Some(ref prefix) => format!("{} {}", prefix, key),
3819 None => key,
3820 };
3821 req_builder = req_builder.header("X-GITEA-OTP", value);
3822 };
3823 if let Some(ref apikey) = configuration.api_key {
3824 let key = apikey.key.clone();
3825 let value = match apikey.prefix {
3826 Some(ref prefix) => format!("{} {}", prefix, key),
3827 None => key,
3828 };
3829 req_builder = req_builder.header("Authorization", value);
3830 };
3831 if let Some(ref apikey) = configuration.api_key {
3832 let key = apikey.key.clone();
3833 let value = match apikey.prefix {
3834 Some(ref prefix) => format!("{} {}", prefix, key),
3835 None => key,
3836 };
3837 req_builder = req_builder.header("Sudo", value);
3838 };
3839 if let Some(ref auth_conf) = configuration.basic_auth {
3840 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3841 };
3842
3843 let req = req_builder.build()?;
3844 let resp = configuration.client.execute(req).await?;
3845
3846 let status = resp.status();
3847 let content_type = resp
3848 .headers()
3849 .get("content-type")
3850 .and_then(|v| v.to_str().ok())
3851 .unwrap_or("application/octet-stream");
3852 let content_type = super::ContentType::from(content_type);
3853
3854 if !status.is_client_error() && !status.is_server_error() {
3855 let content = resp.text().await?;
3856 match content_type {
3857 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3858 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TimelineComment>`"))),
3859 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::TimelineComment>`")))),
3860 }
3861 } else {
3862 let content = resp.text().await?;
3863 let entity: Option<IssueGetCommentsAndTimelineError> = serde_json::from_str(&content).ok();
3864 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3865 }
3866}
3867
3868pub async fn issue_get_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<models::Issue, Error<IssueGetIssueError>> {
3869 let p_path_owner = owner;
3871 let p_path_repo = repo;
3872 let p_path_index = index;
3873
3874 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
3875 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3876
3877 if let Some(ref apikey) = configuration.api_key {
3878 let key = apikey.key.clone();
3879 let value = match apikey.prefix {
3880 Some(ref prefix) => format!("{} {}", prefix, key),
3881 None => key,
3882 };
3883 req_builder = req_builder.query(&[("access_token", value)]);
3884 }
3885 if let Some(ref apikey) = configuration.api_key {
3886 let key = apikey.key.clone();
3887 let value = match apikey.prefix {
3888 Some(ref prefix) => format!("{} {}", prefix, key),
3889 None => key,
3890 };
3891 req_builder = req_builder.query(&[("sudo", value)]);
3892 }
3893 if let Some(ref apikey) = configuration.api_key {
3894 let key = apikey.key.clone();
3895 let value = match apikey.prefix {
3896 Some(ref prefix) => format!("{} {}", prefix, key),
3897 None => key,
3898 };
3899 req_builder = req_builder.query(&[("token", value)]);
3900 }
3901 if let Some(ref user_agent) = configuration.user_agent {
3902 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3903 }
3904 if let Some(ref apikey) = configuration.api_key {
3905 let key = apikey.key.clone();
3906 let value = match apikey.prefix {
3907 Some(ref prefix) => format!("{} {}", prefix, key),
3908 None => key,
3909 };
3910 req_builder = req_builder.header("X-GITEA-OTP", value);
3911 };
3912 if let Some(ref apikey) = configuration.api_key {
3913 let key = apikey.key.clone();
3914 let value = match apikey.prefix {
3915 Some(ref prefix) => format!("{} {}", prefix, key),
3916 None => key,
3917 };
3918 req_builder = req_builder.header("Authorization", value);
3919 };
3920 if let Some(ref apikey) = configuration.api_key {
3921 let key = apikey.key.clone();
3922 let value = match apikey.prefix {
3923 Some(ref prefix) => format!("{} {}", prefix, key),
3924 None => key,
3925 };
3926 req_builder = req_builder.header("Sudo", value);
3927 };
3928 if let Some(ref auth_conf) = configuration.basic_auth {
3929 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
3930 };
3931
3932 let req = req_builder.build()?;
3933 let resp = configuration.client.execute(req).await?;
3934
3935 let status = resp.status();
3936 let content_type = resp
3937 .headers()
3938 .get("content-type")
3939 .and_then(|v| v.to_str().ok())
3940 .unwrap_or("application/octet-stream");
3941 let content_type = super::ContentType::from(content_type);
3942
3943 if !status.is_client_error() && !status.is_server_error() {
3944 let content = resp.text().await?;
3945 match content_type {
3946 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3947 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))),
3948 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::Issue`")))),
3949 }
3950 } else {
3951 let content = resp.text().await?;
3952 let entity: Option<IssueGetIssueError> = serde_json::from_str(&content).ok();
3953 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3954 }
3955}
3956
3957pub async fn issue_get_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment_id: i64) -> Result<models::Attachment, Error<IssueGetIssueAttachmentError>> {
3958 let p_path_owner = owner;
3960 let p_path_repo = repo;
3961 let p_path_index = index;
3962 let p_path_attachment_id = attachment_id;
3963
3964 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, attachment_id=p_path_attachment_id);
3965 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3966
3967 if let Some(ref apikey) = configuration.api_key {
3968 let key = apikey.key.clone();
3969 let value = match apikey.prefix {
3970 Some(ref prefix) => format!("{} {}", prefix, key),
3971 None => key,
3972 };
3973 req_builder = req_builder.query(&[("access_token", value)]);
3974 }
3975 if let Some(ref apikey) = configuration.api_key {
3976 let key = apikey.key.clone();
3977 let value = match apikey.prefix {
3978 Some(ref prefix) => format!("{} {}", prefix, key),
3979 None => key,
3980 };
3981 req_builder = req_builder.query(&[("sudo", value)]);
3982 }
3983 if let Some(ref apikey) = configuration.api_key {
3984 let key = apikey.key.clone();
3985 let value = match apikey.prefix {
3986 Some(ref prefix) => format!("{} {}", prefix, key),
3987 None => key,
3988 };
3989 req_builder = req_builder.query(&[("token", value)]);
3990 }
3991 if let Some(ref user_agent) = configuration.user_agent {
3992 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3993 }
3994 if let Some(ref apikey) = configuration.api_key {
3995 let key = apikey.key.clone();
3996 let value = match apikey.prefix {
3997 Some(ref prefix) => format!("{} {}", prefix, key),
3998 None => key,
3999 };
4000 req_builder = req_builder.header("X-GITEA-OTP", value);
4001 };
4002 if let Some(ref apikey) = configuration.api_key {
4003 let key = apikey.key.clone();
4004 let value = match apikey.prefix {
4005 Some(ref prefix) => format!("{} {}", prefix, key),
4006 None => key,
4007 };
4008 req_builder = req_builder.header("Authorization", value);
4009 };
4010 if let Some(ref apikey) = configuration.api_key {
4011 let key = apikey.key.clone();
4012 let value = match apikey.prefix {
4013 Some(ref prefix) => format!("{} {}", prefix, key),
4014 None => key,
4015 };
4016 req_builder = req_builder.header("Sudo", value);
4017 };
4018 if let Some(ref auth_conf) = configuration.basic_auth {
4019 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4020 };
4021
4022 let req = req_builder.build()?;
4023 let resp = configuration.client.execute(req).await?;
4024
4025 let status = resp.status();
4026 let content_type = resp
4027 .headers()
4028 .get("content-type")
4029 .and_then(|v| v.to_str().ok())
4030 .unwrap_or("application/octet-stream");
4031 let content_type = super::ContentType::from(content_type);
4032
4033 if !status.is_client_error() && !status.is_server_error() {
4034 let content = resp.text().await?;
4035 match content_type {
4036 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4037 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
4038 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`")))),
4039 }
4040 } else {
4041 let content = resp.text().await?;
4042 let entity: Option<IssueGetIssueAttachmentError> = serde_json::from_str(&content).ok();
4043 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4044 }
4045}
4046
4047pub async fn issue_get_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result<models::Attachment, Error<IssueGetIssueCommentAttachmentError>> {
4048 let p_path_owner = owner;
4050 let p_path_repo = repo;
4051 let p_path_id = id;
4052 let p_path_attachment_id = attachment_id;
4053
4054 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{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);
4055 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4056
4057 if let Some(ref apikey) = configuration.api_key {
4058 let key = apikey.key.clone();
4059 let value = match apikey.prefix {
4060 Some(ref prefix) => format!("{} {}", prefix, key),
4061 None => key,
4062 };
4063 req_builder = req_builder.query(&[("access_token", value)]);
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.query(&[("sudo", 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.query(&[("token", value)]);
4080 }
4081 if let Some(ref user_agent) = configuration.user_agent {
4082 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4083 }
4084 if let Some(ref apikey) = configuration.api_key {
4085 let key = apikey.key.clone();
4086 let value = match apikey.prefix {
4087 Some(ref prefix) => format!("{} {}", prefix, key),
4088 None => key,
4089 };
4090 req_builder = req_builder.header("X-GITEA-OTP", value);
4091 };
4092 if let Some(ref apikey) = configuration.api_key {
4093 let key = apikey.key.clone();
4094 let value = match apikey.prefix {
4095 Some(ref prefix) => format!("{} {}", prefix, key),
4096 None => key,
4097 };
4098 req_builder = req_builder.header("Authorization", value);
4099 };
4100 if let Some(ref apikey) = configuration.api_key {
4101 let key = apikey.key.clone();
4102 let value = match apikey.prefix {
4103 Some(ref prefix) => format!("{} {}", prefix, key),
4104 None => key,
4105 };
4106 req_builder = req_builder.header("Sudo", value);
4107 };
4108 if let Some(ref auth_conf) = configuration.basic_auth {
4109 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4110 };
4111
4112 let req = req_builder.build()?;
4113 let resp = configuration.client.execute(req).await?;
4114
4115 let status = resp.status();
4116 let content_type = resp
4117 .headers()
4118 .get("content-type")
4119 .and_then(|v| v.to_str().ok())
4120 .unwrap_or("application/octet-stream");
4121 let content_type = super::ContentType::from(content_type);
4122
4123 if !status.is_client_error() && !status.is_server_error() {
4124 let content = resp.text().await?;
4125 match content_type {
4126 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4127 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))),
4128 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`")))),
4129 }
4130 } else {
4131 let content = resp.text().await?;
4132 let entity: Option<IssueGetIssueCommentAttachmentError> = serde_json::from_str(&content).ok();
4133 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4134 }
4135}
4136
4137pub async fn issue_get_issue_reactions(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Reaction>, Error<IssueGetIssueReactionsError>> {
4138 let p_path_owner = owner;
4140 let p_path_repo = repo;
4141 let p_path_index = index;
4142 let p_query_page = page;
4143 let p_query_limit = limit;
4144
4145 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
4146 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4147
4148 if let Some(ref param_value) = p_query_page {
4149 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4150 }
4151 if let Some(ref param_value) = p_query_limit {
4152 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
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.query(&[("access_token", 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.query(&[("sudo", 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.query(&[("token", value)]);
4177 }
4178 if let Some(ref user_agent) = configuration.user_agent {
4179 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4180 }
4181 if let Some(ref apikey) = configuration.api_key {
4182 let key = apikey.key.clone();
4183 let value = match apikey.prefix {
4184 Some(ref prefix) => format!("{} {}", prefix, key),
4185 None => key,
4186 };
4187 req_builder = req_builder.header("X-GITEA-OTP", value);
4188 };
4189 if let Some(ref apikey) = configuration.api_key {
4190 let key = apikey.key.clone();
4191 let value = match apikey.prefix {
4192 Some(ref prefix) => format!("{} {}", prefix, key),
4193 None => key,
4194 };
4195 req_builder = req_builder.header("Authorization", value);
4196 };
4197 if let Some(ref apikey) = configuration.api_key {
4198 let key = apikey.key.clone();
4199 let value = match apikey.prefix {
4200 Some(ref prefix) => format!("{} {}", prefix, key),
4201 None => key,
4202 };
4203 req_builder = req_builder.header("Sudo", value);
4204 };
4205 if let Some(ref auth_conf) = configuration.basic_auth {
4206 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4207 };
4208
4209 let req = req_builder.build()?;
4210 let resp = configuration.client.execute(req).await?;
4211
4212 let status = resp.status();
4213 let content_type = resp
4214 .headers()
4215 .get("content-type")
4216 .and_then(|v| v.to_str().ok())
4217 .unwrap_or("application/octet-stream");
4218 let content_type = super::ContentType::from(content_type);
4219
4220 if !status.is_client_error() && !status.is_server_error() {
4221 let content = resp.text().await?;
4222 match content_type {
4223 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4224 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reaction>`"))),
4225 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::Reaction>`")))),
4226 }
4227 } else {
4228 let content = resp.text().await?;
4229 let entity: Option<IssueGetIssueReactionsError> = serde_json::from_str(&content).ok();
4230 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4231 }
4232}
4233
4234pub async fn issue_get_label(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<models::Label, Error<IssueGetLabelError>> {
4235 let p_path_owner = owner;
4237 let p_path_repo = repo;
4238 let p_path_id = id;
4239
4240 let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
4241 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
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::Label`"))),
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::Label`")))),
4315 }
4316 } else {
4317 let content = resp.text().await?;
4318 let entity: Option<IssueGetLabelError> = serde_json::from_str(&content).ok();
4319 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4320 }
4321}
4322
4323pub async fn issue_get_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<Vec<models::Label>, Error<IssueGetLabelsError>> {
4324 let p_path_owner = owner;
4326 let p_path_repo = repo;
4327 let p_path_index = index;
4328
4329 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
4330 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4331
4332 if let Some(ref apikey) = configuration.api_key {
4333 let key = apikey.key.clone();
4334 let value = match apikey.prefix {
4335 Some(ref prefix) => format!("{} {}", prefix, key),
4336 None => key,
4337 };
4338 req_builder = req_builder.query(&[("access_token", value)]);
4339 }
4340 if let Some(ref apikey) = configuration.api_key {
4341 let key = apikey.key.clone();
4342 let value = match apikey.prefix {
4343 Some(ref prefix) => format!("{} {}", prefix, key),
4344 None => key,
4345 };
4346 req_builder = req_builder.query(&[("sudo", value)]);
4347 }
4348 if let Some(ref apikey) = configuration.api_key {
4349 let key = apikey.key.clone();
4350 let value = match apikey.prefix {
4351 Some(ref prefix) => format!("{} {}", prefix, key),
4352 None => key,
4353 };
4354 req_builder = req_builder.query(&[("token", value)]);
4355 }
4356 if let Some(ref user_agent) = configuration.user_agent {
4357 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4358 }
4359 if let Some(ref apikey) = configuration.api_key {
4360 let key = apikey.key.clone();
4361 let value = match apikey.prefix {
4362 Some(ref prefix) => format!("{} {}", prefix, key),
4363 None => key,
4364 };
4365 req_builder = req_builder.header("X-GITEA-OTP", value);
4366 };
4367 if let Some(ref apikey) = configuration.api_key {
4368 let key = apikey.key.clone();
4369 let value = match apikey.prefix {
4370 Some(ref prefix) => format!("{} {}", prefix, key),
4371 None => key,
4372 };
4373 req_builder = req_builder.header("Authorization", value);
4374 };
4375 if let Some(ref apikey) = configuration.api_key {
4376 let key = apikey.key.clone();
4377 let value = match apikey.prefix {
4378 Some(ref prefix) => format!("{} {}", prefix, key),
4379 None => key,
4380 };
4381 req_builder = req_builder.header("Sudo", value);
4382 };
4383 if let Some(ref auth_conf) = configuration.basic_auth {
4384 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4385 };
4386
4387 let req = req_builder.build()?;
4388 let resp = configuration.client.execute(req).await?;
4389
4390 let status = resp.status();
4391 let content_type = resp
4392 .headers()
4393 .get("content-type")
4394 .and_then(|v| v.to_str().ok())
4395 .unwrap_or("application/octet-stream");
4396 let content_type = super::ContentType::from(content_type);
4397
4398 if !status.is_client_error() && !status.is_server_error() {
4399 let content = resp.text().await?;
4400 match content_type {
4401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))),
4403 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))),
4404 }
4405 } else {
4406 let content = resp.text().await?;
4407 let entity: Option<IssueGetLabelsError> = serde_json::from_str(&content).ok();
4408 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4409 }
4410}
4411
4412pub async fn issue_get_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result<models::Milestone, Error<IssueGetMilestoneError>> {
4413 let p_path_owner = owner;
4415 let p_path_repo = repo;
4416 let p_path_id = id;
4417
4418 let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{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));
4419 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4420
4421 if let Some(ref apikey) = configuration.api_key {
4422 let key = apikey.key.clone();
4423 let value = match apikey.prefix {
4424 Some(ref prefix) => format!("{} {}", prefix, key),
4425 None => key,
4426 };
4427 req_builder = req_builder.query(&[("access_token", value)]);
4428 }
4429 if let Some(ref apikey) = configuration.api_key {
4430 let key = apikey.key.clone();
4431 let value = match apikey.prefix {
4432 Some(ref prefix) => format!("{} {}", prefix, key),
4433 None => key,
4434 };
4435 req_builder = req_builder.query(&[("sudo", value)]);
4436 }
4437 if let Some(ref apikey) = configuration.api_key {
4438 let key = apikey.key.clone();
4439 let value = match apikey.prefix {
4440 Some(ref prefix) => format!("{} {}", prefix, key),
4441 None => key,
4442 };
4443 req_builder = req_builder.query(&[("token", value)]);
4444 }
4445 if let Some(ref user_agent) = configuration.user_agent {
4446 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4447 }
4448 if let Some(ref apikey) = configuration.api_key {
4449 let key = apikey.key.clone();
4450 let value = match apikey.prefix {
4451 Some(ref prefix) => format!("{} {}", prefix, key),
4452 None => key,
4453 };
4454 req_builder = req_builder.header("X-GITEA-OTP", value);
4455 };
4456 if let Some(ref apikey) = configuration.api_key {
4457 let key = apikey.key.clone();
4458 let value = match apikey.prefix {
4459 Some(ref prefix) => format!("{} {}", prefix, key),
4460 None => key,
4461 };
4462 req_builder = req_builder.header("Authorization", value);
4463 };
4464 if let Some(ref apikey) = configuration.api_key {
4465 let key = apikey.key.clone();
4466 let value = match apikey.prefix {
4467 Some(ref prefix) => format!("{} {}", prefix, key),
4468 None => key,
4469 };
4470 req_builder = req_builder.header("Sudo", value);
4471 };
4472 if let Some(ref auth_conf) = configuration.basic_auth {
4473 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4474 };
4475
4476 let req = req_builder.build()?;
4477 let resp = configuration.client.execute(req).await?;
4478
4479 let status = resp.status();
4480 let content_type = resp
4481 .headers()
4482 .get("content-type")
4483 .and_then(|v| v.to_str().ok())
4484 .unwrap_or("application/octet-stream");
4485 let content_type = super::ContentType::from(content_type);
4486
4487 if !status.is_client_error() && !status.is_server_error() {
4488 let content = resp.text().await?;
4489 match content_type {
4490 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4491 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Milestone`"))),
4492 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::Milestone`")))),
4493 }
4494 } else {
4495 let content = resp.text().await?;
4496 let entity: Option<IssueGetMilestoneError> = serde_json::from_str(&content).ok();
4497 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4498 }
4499}
4500
4501pub async fn issue_get_milestones_list(configuration: &configuration::Configuration, owner: &str, repo: &str, state: Option<&str>, name: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Milestone>, Error<IssueGetMilestonesListError>> {
4502 let p_path_owner = owner;
4504 let p_path_repo = repo;
4505 let p_query_state = state;
4506 let p_query_name = name;
4507 let p_query_page = page;
4508 let p_query_limit = limit;
4509
4510 let uri_str = format!("{}/repos/{owner}/{repo}/milestones", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4511 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4512
4513 if let Some(ref param_value) = p_query_state {
4514 req_builder = req_builder.query(&[("state", ¶m_value.to_string())]);
4515 }
4516 if let Some(ref param_value) = p_query_name {
4517 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
4518 }
4519 if let Some(ref param_value) = p_query_page {
4520 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4521 }
4522 if let Some(ref param_value) = p_query_limit {
4523 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4524 }
4525 if let Some(ref apikey) = configuration.api_key {
4526 let key = apikey.key.clone();
4527 let value = match apikey.prefix {
4528 Some(ref prefix) => format!("{} {}", prefix, key),
4529 None => key,
4530 };
4531 req_builder = req_builder.query(&[("access_token", value)]);
4532 }
4533 if let Some(ref apikey) = configuration.api_key {
4534 let key = apikey.key.clone();
4535 let value = match apikey.prefix {
4536 Some(ref prefix) => format!("{} {}", prefix, key),
4537 None => key,
4538 };
4539 req_builder = req_builder.query(&[("sudo", value)]);
4540 }
4541 if let Some(ref apikey) = configuration.api_key {
4542 let key = apikey.key.clone();
4543 let value = match apikey.prefix {
4544 Some(ref prefix) => format!("{} {}", prefix, key),
4545 None => key,
4546 };
4547 req_builder = req_builder.query(&[("token", value)]);
4548 }
4549 if let Some(ref user_agent) = configuration.user_agent {
4550 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4551 }
4552 if let Some(ref apikey) = configuration.api_key {
4553 let key = apikey.key.clone();
4554 let value = match apikey.prefix {
4555 Some(ref prefix) => format!("{} {}", prefix, key),
4556 None => key,
4557 };
4558 req_builder = req_builder.header("X-GITEA-OTP", value);
4559 };
4560 if let Some(ref apikey) = configuration.api_key {
4561 let key = apikey.key.clone();
4562 let value = match apikey.prefix {
4563 Some(ref prefix) => format!("{} {}", prefix, key),
4564 None => key,
4565 };
4566 req_builder = req_builder.header("Authorization", value);
4567 };
4568 if let Some(ref apikey) = configuration.api_key {
4569 let key = apikey.key.clone();
4570 let value = match apikey.prefix {
4571 Some(ref prefix) => format!("{} {}", prefix, key),
4572 None => key,
4573 };
4574 req_builder = req_builder.header("Sudo", value);
4575 };
4576 if let Some(ref auth_conf) = configuration.basic_auth {
4577 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4578 };
4579
4580 let req = req_builder.build()?;
4581 let resp = configuration.client.execute(req).await?;
4582
4583 let status = resp.status();
4584 let content_type = resp
4585 .headers()
4586 .get("content-type")
4587 .and_then(|v| v.to_str().ok())
4588 .unwrap_or("application/octet-stream");
4589 let content_type = super::ContentType::from(content_type);
4590
4591 if !status.is_client_error() && !status.is_server_error() {
4592 let content = resp.text().await?;
4593 match content_type {
4594 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4595 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Milestone>`"))),
4596 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::Milestone>`")))),
4597 }
4598 } else {
4599 let content = resp.text().await?;
4600 let entity: Option<IssueGetMilestonesListError> = serde_json::from_str(&content).ok();
4601 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4602 }
4603}
4604
4605pub async fn issue_get_repo_comments(configuration: &configuration::Configuration, owner: &str, repo: &str, since: Option<String>, before: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Comment>, Error<IssueGetRepoCommentsError>> {
4606 let p_path_owner = owner;
4608 let p_path_repo = repo;
4609 let p_query_since = since;
4610 let p_query_before = before;
4611 let p_query_page = page;
4612 let p_query_limit = limit;
4613
4614 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
4615 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4616
4617 if let Some(ref param_value) = p_query_since {
4618 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
4619 }
4620 if let Some(ref param_value) = p_query_before {
4621 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
4622 }
4623 if let Some(ref param_value) = p_query_page {
4624 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4625 }
4626 if let Some(ref param_value) = p_query_limit {
4627 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4628 }
4629 if let Some(ref apikey) = configuration.api_key {
4630 let key = apikey.key.clone();
4631 let value = match apikey.prefix {
4632 Some(ref prefix) => format!("{} {}", prefix, key),
4633 None => key,
4634 };
4635 req_builder = req_builder.query(&[("access_token", value)]);
4636 }
4637 if let Some(ref apikey) = configuration.api_key {
4638 let key = apikey.key.clone();
4639 let value = match apikey.prefix {
4640 Some(ref prefix) => format!("{} {}", prefix, key),
4641 None => key,
4642 };
4643 req_builder = req_builder.query(&[("sudo", value)]);
4644 }
4645 if let Some(ref apikey) = configuration.api_key {
4646 let key = apikey.key.clone();
4647 let value = match apikey.prefix {
4648 Some(ref prefix) => format!("{} {}", prefix, key),
4649 None => key,
4650 };
4651 req_builder = req_builder.query(&[("token", value)]);
4652 }
4653 if let Some(ref user_agent) = configuration.user_agent {
4654 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4655 }
4656 if let Some(ref apikey) = configuration.api_key {
4657 let key = apikey.key.clone();
4658 let value = match apikey.prefix {
4659 Some(ref prefix) => format!("{} {}", prefix, key),
4660 None => key,
4661 };
4662 req_builder = req_builder.header("X-GITEA-OTP", value);
4663 };
4664 if let Some(ref apikey) = configuration.api_key {
4665 let key = apikey.key.clone();
4666 let value = match apikey.prefix {
4667 Some(ref prefix) => format!("{} {}", prefix, key),
4668 None => key,
4669 };
4670 req_builder = req_builder.header("Authorization", value);
4671 };
4672 if let Some(ref apikey) = configuration.api_key {
4673 let key = apikey.key.clone();
4674 let value = match apikey.prefix {
4675 Some(ref prefix) => format!("{} {}", prefix, key),
4676 None => key,
4677 };
4678 req_builder = req_builder.header("Sudo", value);
4679 };
4680 if let Some(ref auth_conf) = configuration.basic_auth {
4681 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4682 };
4683
4684 let req = req_builder.build()?;
4685 let resp = configuration.client.execute(req).await?;
4686
4687 let status = resp.status();
4688 let content_type = resp
4689 .headers()
4690 .get("content-type")
4691 .and_then(|v| v.to_str().ok())
4692 .unwrap_or("application/octet-stream");
4693 let content_type = super::ContentType::from(content_type);
4694
4695 if !status.is_client_error() && !status.is_server_error() {
4696 let content = resp.text().await?;
4697 match content_type {
4698 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4699 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Comment>`"))),
4700 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::Comment>`")))),
4701 }
4702 } else {
4703 let content = resp.text().await?;
4704 let entity: Option<IssueGetRepoCommentsError> = serde_json::from_str(&content).ok();
4705 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4706 }
4707}
4708
4709pub async fn issue_list_blocks(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Issue>, Error<IssueListBlocksError>> {
4710 let p_path_owner = owner;
4712 let p_path_repo = repo;
4713 let p_path_index = index;
4714 let p_query_page = page;
4715 let p_query_limit = limit;
4716
4717 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index));
4718 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4719
4720 if let Some(ref param_value) = p_query_page {
4721 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4722 }
4723 if let Some(ref param_value) = p_query_limit {
4724 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
4725 }
4726 if let Some(ref apikey) = configuration.api_key {
4727 let key = apikey.key.clone();
4728 let value = match apikey.prefix {
4729 Some(ref prefix) => format!("{} {}", prefix, key),
4730 None => key,
4731 };
4732 req_builder = req_builder.query(&[("access_token", value)]);
4733 }
4734 if let Some(ref apikey) = configuration.api_key {
4735 let key = apikey.key.clone();
4736 let value = match apikey.prefix {
4737 Some(ref prefix) => format!("{} {}", prefix, key),
4738 None => key,
4739 };
4740 req_builder = req_builder.query(&[("sudo", value)]);
4741 }
4742 if let Some(ref apikey) = configuration.api_key {
4743 let key = apikey.key.clone();
4744 let value = match apikey.prefix {
4745 Some(ref prefix) => format!("{} {}", prefix, key),
4746 None => key,
4747 };
4748 req_builder = req_builder.query(&[("token", value)]);
4749 }
4750 if let Some(ref user_agent) = configuration.user_agent {
4751 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4752 }
4753 if let Some(ref apikey) = configuration.api_key {
4754 let key = apikey.key.clone();
4755 let value = match apikey.prefix {
4756 Some(ref prefix) => format!("{} {}", prefix, key),
4757 None => key,
4758 };
4759 req_builder = req_builder.header("X-GITEA-OTP", value);
4760 };
4761 if let Some(ref apikey) = configuration.api_key {
4762 let key = apikey.key.clone();
4763 let value = match apikey.prefix {
4764 Some(ref prefix) => format!("{} {}", prefix, key),
4765 None => key,
4766 };
4767 req_builder = req_builder.header("Authorization", value);
4768 };
4769 if let Some(ref apikey) = configuration.api_key {
4770 let key = apikey.key.clone();
4771 let value = match apikey.prefix {
4772 Some(ref prefix) => format!("{} {}", prefix, key),
4773 None => key,
4774 };
4775 req_builder = req_builder.header("Sudo", value);
4776 };
4777 if let Some(ref auth_conf) = configuration.basic_auth {
4778 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4779 };
4780
4781 let req = req_builder.build()?;
4782 let resp = configuration.client.execute(req).await?;
4783
4784 let status = resp.status();
4785 let content_type = resp
4786 .headers()
4787 .get("content-type")
4788 .and_then(|v| v.to_str().ok())
4789 .unwrap_or("application/octet-stream");
4790 let content_type = super::ContentType::from(content_type);
4791
4792 if !status.is_client_error() && !status.is_server_error() {
4793 let content = resp.text().await?;
4794 match content_type {
4795 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4796 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))),
4797 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>`")))),
4798 }
4799 } else {
4800 let content = resp.text().await?;
4801 let entity: Option<IssueListBlocksError> = serde_json::from_str(&content).ok();
4802 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4803 }
4804}
4805
4806pub async fn issue_list_issue_attachments(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<Vec<models::Attachment>, Error<IssueListIssueAttachmentsError>> {
4807 let p_path_owner = owner;
4809 let p_path_repo = repo;
4810 let p_path_index = index;
4811
4812 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
4813 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4814
4815 if let Some(ref apikey) = configuration.api_key {
4816 let key = apikey.key.clone();
4817 let value = match apikey.prefix {
4818 Some(ref prefix) => format!("{} {}", prefix, key),
4819 None => key,
4820 };
4821 req_builder = req_builder.query(&[("access_token", value)]);
4822 }
4823 if let Some(ref apikey) = configuration.api_key {
4824 let key = apikey.key.clone();
4825 let value = match apikey.prefix {
4826 Some(ref prefix) => format!("{} {}", prefix, key),
4827 None => key,
4828 };
4829 req_builder = req_builder.query(&[("sudo", value)]);
4830 }
4831 if let Some(ref apikey) = configuration.api_key {
4832 let key = apikey.key.clone();
4833 let value = match apikey.prefix {
4834 Some(ref prefix) => format!("{} {}", prefix, key),
4835 None => key,
4836 };
4837 req_builder = req_builder.query(&[("token", value)]);
4838 }
4839 if let Some(ref user_agent) = configuration.user_agent {
4840 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4841 }
4842 if let Some(ref apikey) = configuration.api_key {
4843 let key = apikey.key.clone();
4844 let value = match apikey.prefix {
4845 Some(ref prefix) => format!("{} {}", prefix, key),
4846 None => key,
4847 };
4848 req_builder = req_builder.header("X-GITEA-OTP", value);
4849 };
4850 if let Some(ref apikey) = configuration.api_key {
4851 let key = apikey.key.clone();
4852 let value = match apikey.prefix {
4853 Some(ref prefix) => format!("{} {}", prefix, key),
4854 None => key,
4855 };
4856 req_builder = req_builder.header("Authorization", value);
4857 };
4858 if let Some(ref apikey) = configuration.api_key {
4859 let key = apikey.key.clone();
4860 let value = match apikey.prefix {
4861 Some(ref prefix) => format!("{} {}", prefix, key),
4862 None => key,
4863 };
4864 req_builder = req_builder.header("Sudo", value);
4865 };
4866 if let Some(ref auth_conf) = configuration.basic_auth {
4867 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4868 };
4869
4870 let req = req_builder.build()?;
4871 let resp = configuration.client.execute(req).await?;
4872
4873 let status = resp.status();
4874 let content_type = resp
4875 .headers()
4876 .get("content-type")
4877 .and_then(|v| v.to_str().ok())
4878 .unwrap_or("application/octet-stream");
4879 let content_type = super::ContentType::from(content_type);
4880
4881 if !status.is_client_error() && !status.is_server_error() {
4882 let content = resp.text().await?;
4883 match content_type {
4884 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4885 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Attachment>`"))),
4886 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>`")))),
4887 }
4888 } else {
4889 let content = resp.text().await?;
4890 let entity: Option<IssueListIssueAttachmentsError> = serde_json::from_str(&content).ok();
4891 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4892 }
4893}
4894
4895pub async fn issue_list_issue_comment_attachments(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<Vec<models::Attachment>, Error<IssueListIssueCommentAttachmentsError>> {
4896 let p_path_owner = owner;
4898 let p_path_repo = repo;
4899 let p_path_id = id;
4900
4901 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
4902 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4903
4904 if let Some(ref apikey) = configuration.api_key {
4905 let key = apikey.key.clone();
4906 let value = match apikey.prefix {
4907 Some(ref prefix) => format!("{} {}", prefix, key),
4908 None => key,
4909 };
4910 req_builder = req_builder.query(&[("access_token", value)]);
4911 }
4912 if let Some(ref apikey) = configuration.api_key {
4913 let key = apikey.key.clone();
4914 let value = match apikey.prefix {
4915 Some(ref prefix) => format!("{} {}", prefix, key),
4916 None => key,
4917 };
4918 req_builder = req_builder.query(&[("sudo", value)]);
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.query(&[("token", value)]);
4927 }
4928 if let Some(ref user_agent) = configuration.user_agent {
4929 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4930 }
4931 if let Some(ref apikey) = configuration.api_key {
4932 let key = apikey.key.clone();
4933 let value = match apikey.prefix {
4934 Some(ref prefix) => format!("{} {}", prefix, key),
4935 None => key,
4936 };
4937 req_builder = req_builder.header("X-GITEA-OTP", value);
4938 };
4939 if let Some(ref apikey) = configuration.api_key {
4940 let key = apikey.key.clone();
4941 let value = match apikey.prefix {
4942 Some(ref prefix) => format!("{} {}", prefix, key),
4943 None => key,
4944 };
4945 req_builder = req_builder.header("Authorization", value);
4946 };
4947 if let Some(ref apikey) = configuration.api_key {
4948 let key = apikey.key.clone();
4949 let value = match apikey.prefix {
4950 Some(ref prefix) => format!("{} {}", prefix, key),
4951 None => key,
4952 };
4953 req_builder = req_builder.header("Sudo", value);
4954 };
4955 if let Some(ref auth_conf) = configuration.basic_auth {
4956 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
4957 };
4958
4959 let req = req_builder.build()?;
4960 let resp = configuration.client.execute(req).await?;
4961
4962 let status = resp.status();
4963 let content_type = resp
4964 .headers()
4965 .get("content-type")
4966 .and_then(|v| v.to_str().ok())
4967 .unwrap_or("application/octet-stream");
4968 let content_type = super::ContentType::from(content_type);
4969
4970 if !status.is_client_error() && !status.is_server_error() {
4971 let content = resp.text().await?;
4972 match content_type {
4973 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4974 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Attachment>`"))),
4975 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>`")))),
4976 }
4977 } else {
4978 let content = resp.text().await?;
4979 let entity: Option<IssueListIssueCommentAttachmentsError> = serde_json::from_str(&content).ok();
4980 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4981 }
4982}
4983
4984pub async fn issue_list_issue_dependencies(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Issue>, Error<IssueListIssueDependenciesError>> {
4985 let p_path_owner = owner;
4987 let p_path_repo = repo;
4988 let p_path_index = index;
4989 let p_query_page = page;
4990 let p_query_limit = limit;
4991
4992 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index));
4993 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4994
4995 if let Some(ref param_value) = p_query_page {
4996 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4997 }
4998 if let Some(ref param_value) = p_query_limit {
4999 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
5000 }
5001 if let Some(ref apikey) = configuration.api_key {
5002 let key = apikey.key.clone();
5003 let value = match apikey.prefix {
5004 Some(ref prefix) => format!("{} {}", prefix, key),
5005 None => key,
5006 };
5007 req_builder = req_builder.query(&[("access_token", value)]);
5008 }
5009 if let Some(ref apikey) = configuration.api_key {
5010 let key = apikey.key.clone();
5011 let value = match apikey.prefix {
5012 Some(ref prefix) => format!("{} {}", prefix, key),
5013 None => key,
5014 };
5015 req_builder = req_builder.query(&[("sudo", value)]);
5016 }
5017 if let Some(ref apikey) = configuration.api_key {
5018 let key = apikey.key.clone();
5019 let value = match apikey.prefix {
5020 Some(ref prefix) => format!("{} {}", prefix, key),
5021 None => key,
5022 };
5023 req_builder = req_builder.query(&[("token", value)]);
5024 }
5025 if let Some(ref user_agent) = configuration.user_agent {
5026 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5027 }
5028 if let Some(ref apikey) = configuration.api_key {
5029 let key = apikey.key.clone();
5030 let value = match apikey.prefix {
5031 Some(ref prefix) => format!("{} {}", prefix, key),
5032 None => key,
5033 };
5034 req_builder = req_builder.header("X-GITEA-OTP", value);
5035 };
5036 if let Some(ref apikey) = configuration.api_key {
5037 let key = apikey.key.clone();
5038 let value = match apikey.prefix {
5039 Some(ref prefix) => format!("{} {}", prefix, key),
5040 None => key,
5041 };
5042 req_builder = req_builder.header("Authorization", value);
5043 };
5044 if let Some(ref apikey) = configuration.api_key {
5045 let key = apikey.key.clone();
5046 let value = match apikey.prefix {
5047 Some(ref prefix) => format!("{} {}", prefix, key),
5048 None => key,
5049 };
5050 req_builder = req_builder.header("Sudo", value);
5051 };
5052 if let Some(ref auth_conf) = configuration.basic_auth {
5053 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5054 };
5055
5056 let req = req_builder.build()?;
5057 let resp = configuration.client.execute(req).await?;
5058
5059 let status = resp.status();
5060 let content_type = resp
5061 .headers()
5062 .get("content-type")
5063 .and_then(|v| v.to_str().ok())
5064 .unwrap_or("application/octet-stream");
5065 let content_type = super::ContentType::from(content_type);
5066
5067 if !status.is_client_error() && !status.is_server_error() {
5068 let content = resp.text().await?;
5069 match content_type {
5070 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5071 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))),
5072 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>`")))),
5073 }
5074 } else {
5075 let content = resp.text().await?;
5076 let entity: Option<IssueListIssueDependenciesError> = serde_json::from_str(&content).ok();
5077 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5078 }
5079}
5080
5081pub async fn issue_list_issues(configuration: &configuration::Configuration, owner: &str, repo: &str, state: Option<&str>, labels: Option<&str>, q: Option<&str>, r#type: Option<&str>, milestones: Option<&str>, since: Option<String>, before: Option<String>, created_by: Option<&str>, assigned_by: Option<&str>, mentioned_by: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Issue>, Error<IssueListIssuesError>> {
5082 let p_path_owner = owner;
5084 let p_path_repo = repo;
5085 let p_query_state = state;
5086 let p_query_labels = labels;
5087 let p_query_q = q;
5088 let p_query_type = r#type;
5089 let p_query_milestones = milestones;
5090 let p_query_since = since;
5091 let p_query_before = before;
5092 let p_query_created_by = created_by;
5093 let p_query_assigned_by = assigned_by;
5094 let p_query_mentioned_by = mentioned_by;
5095 let p_query_page = page;
5096 let p_query_limit = limit;
5097
5098 let uri_str = format!("{}/repos/{owner}/{repo}/issues", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
5099 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5100
5101 if let Some(ref param_value) = p_query_state {
5102 req_builder = req_builder.query(&[("state", ¶m_value.to_string())]);
5103 }
5104 if let Some(ref param_value) = p_query_labels {
5105 req_builder = req_builder.query(&[("labels", ¶m_value.to_string())]);
5106 }
5107 if let Some(ref param_value) = p_query_q {
5108 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
5109 }
5110 if let Some(ref param_value) = p_query_type {
5111 req_builder = req_builder.query(&[("type", ¶m_value.to_string())]);
5112 }
5113 if let Some(ref param_value) = p_query_milestones {
5114 req_builder = req_builder.query(&[("milestones", ¶m_value.to_string())]);
5115 }
5116 if let Some(ref param_value) = p_query_since {
5117 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
5118 }
5119 if let Some(ref param_value) = p_query_before {
5120 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
5121 }
5122 if let Some(ref param_value) = p_query_created_by {
5123 req_builder = req_builder.query(&[("created_by", ¶m_value.to_string())]);
5124 }
5125 if let Some(ref param_value) = p_query_assigned_by {
5126 req_builder = req_builder.query(&[("assigned_by", ¶m_value.to_string())]);
5127 }
5128 if let Some(ref param_value) = p_query_mentioned_by {
5129 req_builder = req_builder.query(&[("mentioned_by", ¶m_value.to_string())]);
5130 }
5131 if let Some(ref param_value) = p_query_page {
5132 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
5133 }
5134 if let Some(ref param_value) = p_query_limit {
5135 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
5136 }
5137 if let Some(ref apikey) = configuration.api_key {
5138 let key = apikey.key.clone();
5139 let value = match apikey.prefix {
5140 Some(ref prefix) => format!("{} {}", prefix, key),
5141 None => key,
5142 };
5143 req_builder = req_builder.query(&[("access_token", value)]);
5144 }
5145 if let Some(ref apikey) = configuration.api_key {
5146 let key = apikey.key.clone();
5147 let value = match apikey.prefix {
5148 Some(ref prefix) => format!("{} {}", prefix, key),
5149 None => key,
5150 };
5151 req_builder = req_builder.query(&[("sudo", value)]);
5152 }
5153 if let Some(ref apikey) = configuration.api_key {
5154 let key = apikey.key.clone();
5155 let value = match apikey.prefix {
5156 Some(ref prefix) => format!("{} {}", prefix, key),
5157 None => key,
5158 };
5159 req_builder = req_builder.query(&[("token", value)]);
5160 }
5161 if let Some(ref user_agent) = configuration.user_agent {
5162 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5163 }
5164 if let Some(ref apikey) = configuration.api_key {
5165 let key = apikey.key.clone();
5166 let value = match apikey.prefix {
5167 Some(ref prefix) => format!("{} {}", prefix, key),
5168 None => key,
5169 };
5170 req_builder = req_builder.header("X-GITEA-OTP", value);
5171 };
5172 if let Some(ref apikey) = configuration.api_key {
5173 let key = apikey.key.clone();
5174 let value = match apikey.prefix {
5175 Some(ref prefix) => format!("{} {}", prefix, key),
5176 None => key,
5177 };
5178 req_builder = req_builder.header("Authorization", value);
5179 };
5180 if let Some(ref apikey) = configuration.api_key {
5181 let key = apikey.key.clone();
5182 let value = match apikey.prefix {
5183 Some(ref prefix) => format!("{} {}", prefix, key),
5184 None => key,
5185 };
5186 req_builder = req_builder.header("Sudo", value);
5187 };
5188 if let Some(ref auth_conf) = configuration.basic_auth {
5189 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5190 };
5191
5192 let req = req_builder.build()?;
5193 let resp = configuration.client.execute(req).await?;
5194
5195 let status = resp.status();
5196 let content_type = resp
5197 .headers()
5198 .get("content-type")
5199 .and_then(|v| v.to_str().ok())
5200 .unwrap_or("application/octet-stream");
5201 let content_type = super::ContentType::from(content_type);
5202
5203 if !status.is_client_error() && !status.is_server_error() {
5204 let content = resp.text().await?;
5205 match content_type {
5206 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5207 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))),
5208 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>`")))),
5209 }
5210 } else {
5211 let content = resp.text().await?;
5212 let entity: Option<IssueListIssuesError> = serde_json::from_str(&content).ok();
5213 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5214 }
5215}
5216
5217pub async fn issue_list_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Label>, Error<IssueListLabelsError>> {
5218 let p_path_owner = owner;
5220 let p_path_repo = repo;
5221 let p_query_page = page;
5222 let p_query_limit = limit;
5223
5224 let uri_str = format!("{}/repos/{owner}/{repo}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
5225 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5226
5227 if let Some(ref param_value) = p_query_page {
5228 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
5229 }
5230 if let Some(ref param_value) = p_query_limit {
5231 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
5232 }
5233 if let Some(ref apikey) = configuration.api_key {
5234 let key = apikey.key.clone();
5235 let value = match apikey.prefix {
5236 Some(ref prefix) => format!("{} {}", prefix, key),
5237 None => key,
5238 };
5239 req_builder = req_builder.query(&[("access_token", value)]);
5240 }
5241 if let Some(ref apikey) = configuration.api_key {
5242 let key = apikey.key.clone();
5243 let value = match apikey.prefix {
5244 Some(ref prefix) => format!("{} {}", prefix, key),
5245 None => key,
5246 };
5247 req_builder = req_builder.query(&[("sudo", value)]);
5248 }
5249 if let Some(ref apikey) = configuration.api_key {
5250 let key = apikey.key.clone();
5251 let value = match apikey.prefix {
5252 Some(ref prefix) => format!("{} {}", prefix, key),
5253 None => key,
5254 };
5255 req_builder = req_builder.query(&[("token", value)]);
5256 }
5257 if let Some(ref user_agent) = configuration.user_agent {
5258 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5259 }
5260 if let Some(ref apikey) = configuration.api_key {
5261 let key = apikey.key.clone();
5262 let value = match apikey.prefix {
5263 Some(ref prefix) => format!("{} {}", prefix, key),
5264 None => key,
5265 };
5266 req_builder = req_builder.header("X-GITEA-OTP", value);
5267 };
5268 if let Some(ref apikey) = configuration.api_key {
5269 let key = apikey.key.clone();
5270 let value = match apikey.prefix {
5271 Some(ref prefix) => format!("{} {}", prefix, key),
5272 None => key,
5273 };
5274 req_builder = req_builder.header("Authorization", value);
5275 };
5276 if let Some(ref apikey) = configuration.api_key {
5277 let key = apikey.key.clone();
5278 let value = match apikey.prefix {
5279 Some(ref prefix) => format!("{} {}", prefix, key),
5280 None => key,
5281 };
5282 req_builder = req_builder.header("Sudo", value);
5283 };
5284 if let Some(ref auth_conf) = configuration.basic_auth {
5285 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5286 };
5287
5288 let req = req_builder.build()?;
5289 let resp = configuration.client.execute(req).await?;
5290
5291 let status = resp.status();
5292 let content_type = resp
5293 .headers()
5294 .get("content-type")
5295 .and_then(|v| v.to_str().ok())
5296 .unwrap_or("application/octet-stream");
5297 let content_type = super::ContentType::from(content_type);
5298
5299 if !status.is_client_error() && !status.is_server_error() {
5300 let content = resp.text().await?;
5301 match content_type {
5302 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5303 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))),
5304 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))),
5305 }
5306 } else {
5307 let content = resp.text().await?;
5308 let entity: Option<IssueListLabelsError> = serde_json::from_str(&content).ok();
5309 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5310 }
5311}
5312
5313pub async fn issue_lock_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::LockIssueOption>) -> Result<(), Error<IssueLockIssueError>> {
5314 let p_path_owner = owner;
5316 let p_path_repo = repo;
5317 let p_path_index = index;
5318 let p_body_body = body;
5319
5320 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/lock", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
5321 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
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(&[("access_token", value)]);
5330 }
5331 if let Some(ref apikey) = configuration.api_key {
5332 let key = apikey.key.clone();
5333 let value = match apikey.prefix {
5334 Some(ref prefix) => format!("{} {}", prefix, key),
5335 None => key,
5336 };
5337 req_builder = req_builder.query(&[("sudo", value)]);
5338 }
5339 if let Some(ref apikey) = configuration.api_key {
5340 let key = apikey.key.clone();
5341 let value = match apikey.prefix {
5342 Some(ref prefix) => format!("{} {}", prefix, key),
5343 None => key,
5344 };
5345 req_builder = req_builder.query(&[("token", value)]);
5346 }
5347 if let Some(ref user_agent) = configuration.user_agent {
5348 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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("X-GITEA-OTP", value);
5357 };
5358 if let Some(ref apikey) = configuration.api_key {
5359 let key = apikey.key.clone();
5360 let value = match apikey.prefix {
5361 Some(ref prefix) => format!("{} {}", prefix, key),
5362 None => key,
5363 };
5364 req_builder = req_builder.header("Authorization", value);
5365 };
5366 if let Some(ref apikey) = configuration.api_key {
5367 let key = apikey.key.clone();
5368 let value = match apikey.prefix {
5369 Some(ref prefix) => format!("{} {}", prefix, key),
5370 None => key,
5371 };
5372 req_builder = req_builder.header("Sudo", value);
5373 };
5374 if let Some(ref auth_conf) = configuration.basic_auth {
5375 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5376 };
5377 req_builder = req_builder.json(&p_body_body);
5378
5379 let req = req_builder.build()?;
5380 let resp = configuration.client.execute(req).await?;
5381
5382 let status = resp.status();
5383
5384 if !status.is_client_error() && !status.is_server_error() {
5385 Ok(())
5386 } else {
5387 let content = resp.text().await?;
5388 let entity: Option<IssueLockIssueError> = serde_json::from_str(&content).ok();
5389 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5390 }
5391}
5392
5393pub async fn issue_post_comment_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, content: Option<models::EditReactionOption>) -> Result<models::Reaction, Error<IssuePostCommentReactionError>> {
5394 let p_path_owner = owner;
5396 let p_path_repo = repo;
5397 let p_path_id = id;
5398 let p_body_content = content;
5399
5400 let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id);
5401 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5402
5403 if let Some(ref apikey) = configuration.api_key {
5404 let key = apikey.key.clone();
5405 let value = match apikey.prefix {
5406 Some(ref prefix) => format!("{} {}", prefix, key),
5407 None => key,
5408 };
5409 req_builder = req_builder.query(&[("access_token", value)]);
5410 }
5411 if let Some(ref apikey) = configuration.api_key {
5412 let key = apikey.key.clone();
5413 let value = match apikey.prefix {
5414 Some(ref prefix) => format!("{} {}", prefix, key),
5415 None => key,
5416 };
5417 req_builder = req_builder.query(&[("sudo", value)]);
5418 }
5419 if let Some(ref apikey) = configuration.api_key {
5420 let key = apikey.key.clone();
5421 let value = match apikey.prefix {
5422 Some(ref prefix) => format!("{} {}", prefix, key),
5423 None => key,
5424 };
5425 req_builder = req_builder.query(&[("token", value)]);
5426 }
5427 if let Some(ref user_agent) = configuration.user_agent {
5428 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5429 }
5430 if let Some(ref apikey) = configuration.api_key {
5431 let key = apikey.key.clone();
5432 let value = match apikey.prefix {
5433 Some(ref prefix) => format!("{} {}", prefix, key),
5434 None => key,
5435 };
5436 req_builder = req_builder.header("X-GITEA-OTP", value);
5437 };
5438 if let Some(ref apikey) = configuration.api_key {
5439 let key = apikey.key.clone();
5440 let value = match apikey.prefix {
5441 Some(ref prefix) => format!("{} {}", prefix, key),
5442 None => key,
5443 };
5444 req_builder = req_builder.header("Authorization", value);
5445 };
5446 if let Some(ref apikey) = configuration.api_key {
5447 let key = apikey.key.clone();
5448 let value = match apikey.prefix {
5449 Some(ref prefix) => format!("{} {}", prefix, key),
5450 None => key,
5451 };
5452 req_builder = req_builder.header("Sudo", value);
5453 };
5454 if let Some(ref auth_conf) = configuration.basic_auth {
5455 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5456 };
5457 req_builder = req_builder.json(&p_body_content);
5458
5459 let req = req_builder.build()?;
5460 let resp = configuration.client.execute(req).await?;
5461
5462 let status = resp.status();
5463 let content_type = resp
5464 .headers()
5465 .get("content-type")
5466 .and_then(|v| v.to_str().ok())
5467 .unwrap_or("application/octet-stream");
5468 let content_type = super::ContentType::from(content_type);
5469
5470 if !status.is_client_error() && !status.is_server_error() {
5471 let content = resp.text().await?;
5472 match content_type {
5473 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5474 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Reaction`"))),
5475 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::Reaction`")))),
5476 }
5477 } else {
5478 let content = resp.text().await?;
5479 let entity: Option<IssuePostCommentReactionError> = serde_json::from_str(&content).ok();
5480 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5481 }
5482}
5483
5484pub async fn issue_post_issue_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, content: Option<models::EditReactionOption>) -> Result<models::Reaction, Error<IssuePostIssueReactionError>> {
5485 let p_path_owner = owner;
5487 let p_path_repo = repo;
5488 let p_path_index = index;
5489 let p_body_content = content;
5490
5491 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
5492 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5493
5494 if let Some(ref apikey) = configuration.api_key {
5495 let key = apikey.key.clone();
5496 let value = match apikey.prefix {
5497 Some(ref prefix) => format!("{} {}", prefix, key),
5498 None => key,
5499 };
5500 req_builder = req_builder.query(&[("access_token", value)]);
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.query(&[("sudo", 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.query(&[("token", value)]);
5517 }
5518 if let Some(ref user_agent) = configuration.user_agent {
5519 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5520 }
5521 if let Some(ref apikey) = configuration.api_key {
5522 let key = apikey.key.clone();
5523 let value = match apikey.prefix {
5524 Some(ref prefix) => format!("{} {}", prefix, key),
5525 None => key,
5526 };
5527 req_builder = req_builder.header("X-GITEA-OTP", value);
5528 };
5529 if let Some(ref apikey) = configuration.api_key {
5530 let key = apikey.key.clone();
5531 let value = match apikey.prefix {
5532 Some(ref prefix) => format!("{} {}", prefix, key),
5533 None => key,
5534 };
5535 req_builder = req_builder.header("Authorization", value);
5536 };
5537 if let Some(ref apikey) = configuration.api_key {
5538 let key = apikey.key.clone();
5539 let value = match apikey.prefix {
5540 Some(ref prefix) => format!("{} {}", prefix, key),
5541 None => key,
5542 };
5543 req_builder = req_builder.header("Sudo", value);
5544 };
5545 if let Some(ref auth_conf) = configuration.basic_auth {
5546 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5547 };
5548 req_builder = req_builder.json(&p_body_content);
5549
5550 let req = req_builder.build()?;
5551 let resp = configuration.client.execute(req).await?;
5552
5553 let status = resp.status();
5554 let content_type = resp
5555 .headers()
5556 .get("content-type")
5557 .and_then(|v| v.to_str().ok())
5558 .unwrap_or("application/octet-stream");
5559 let content_type = super::ContentType::from(content_type);
5560
5561 if !status.is_client_error() && !status.is_server_error() {
5562 let content = resp.text().await?;
5563 match content_type {
5564 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5565 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Reaction`"))),
5566 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::Reaction`")))),
5567 }
5568 } else {
5569 let content = resp.text().await?;
5570 let entity: Option<IssuePostIssueReactionError> = serde_json::from_str(&content).ok();
5571 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5572 }
5573}
5574
5575pub async fn issue_remove_issue_blocking(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option<models::IssueMeta>) -> Result<models::Issue, Error<IssueRemoveIssueBlockingError>> {
5576 let p_path_owner = owner;
5578 let p_path_repo = repo;
5579 let p_path_index = index;
5580 let p_body_body = body;
5581
5582 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index));
5583 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5584
5585 if let Some(ref apikey) = configuration.api_key {
5586 let key = apikey.key.clone();
5587 let value = match apikey.prefix {
5588 Some(ref prefix) => format!("{} {}", prefix, key),
5589 None => key,
5590 };
5591 req_builder = req_builder.query(&[("access_token", value)]);
5592 }
5593 if let Some(ref apikey) = configuration.api_key {
5594 let key = apikey.key.clone();
5595 let value = match apikey.prefix {
5596 Some(ref prefix) => format!("{} {}", prefix, key),
5597 None => key,
5598 };
5599 req_builder = req_builder.query(&[("sudo", value)]);
5600 }
5601 if let Some(ref apikey) = configuration.api_key {
5602 let key = apikey.key.clone();
5603 let value = match apikey.prefix {
5604 Some(ref prefix) => format!("{} {}", prefix, key),
5605 None => key,
5606 };
5607 req_builder = req_builder.query(&[("token", value)]);
5608 }
5609 if let Some(ref user_agent) = configuration.user_agent {
5610 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5611 }
5612 if let Some(ref apikey) = configuration.api_key {
5613 let key = apikey.key.clone();
5614 let value = match apikey.prefix {
5615 Some(ref prefix) => format!("{} {}", prefix, key),
5616 None => key,
5617 };
5618 req_builder = req_builder.header("X-GITEA-OTP", value);
5619 };
5620 if let Some(ref apikey) = configuration.api_key {
5621 let key = apikey.key.clone();
5622 let value = match apikey.prefix {
5623 Some(ref prefix) => format!("{} {}", prefix, key),
5624 None => key,
5625 };
5626 req_builder = req_builder.header("Authorization", value);
5627 };
5628 if let Some(ref apikey) = configuration.api_key {
5629 let key = apikey.key.clone();
5630 let value = match apikey.prefix {
5631 Some(ref prefix) => format!("{} {}", prefix, key),
5632 None => key,
5633 };
5634 req_builder = req_builder.header("Sudo", value);
5635 };
5636 if let Some(ref auth_conf) = configuration.basic_auth {
5637 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5638 };
5639 req_builder = req_builder.json(&p_body_body);
5640
5641 let req = req_builder.build()?;
5642 let resp = configuration.client.execute(req).await?;
5643
5644 let status = resp.status();
5645 let content_type = resp
5646 .headers()
5647 .get("content-type")
5648 .and_then(|v| v.to_str().ok())
5649 .unwrap_or("application/octet-stream");
5650 let content_type = super::ContentType::from(content_type);
5651
5652 if !status.is_client_error() && !status.is_server_error() {
5653 let content = resp.text().await?;
5654 match content_type {
5655 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5656 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))),
5657 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::Issue`")))),
5658 }
5659 } else {
5660 let content = resp.text().await?;
5661 let entity: Option<IssueRemoveIssueBlockingError> = serde_json::from_str(&content).ok();
5662 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5663 }
5664}
5665
5666pub async fn issue_remove_issue_dependencies(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option<models::IssueMeta>) -> Result<models::Issue, Error<IssueRemoveIssueDependenciesError>> {
5667 let p_path_owner = owner;
5669 let p_path_repo = repo;
5670 let p_path_index = index;
5671 let p_body_body = body;
5672
5673 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index));
5674 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5675
5676 if let Some(ref apikey) = configuration.api_key {
5677 let key = apikey.key.clone();
5678 let value = match apikey.prefix {
5679 Some(ref prefix) => format!("{} {}", prefix, key),
5680 None => key,
5681 };
5682 req_builder = req_builder.query(&[("access_token", value)]);
5683 }
5684 if let Some(ref apikey) = configuration.api_key {
5685 let key = apikey.key.clone();
5686 let value = match apikey.prefix {
5687 Some(ref prefix) => format!("{} {}", prefix, key),
5688 None => key,
5689 };
5690 req_builder = req_builder.query(&[("sudo", value)]);
5691 }
5692 if let Some(ref apikey) = configuration.api_key {
5693 let key = apikey.key.clone();
5694 let value = match apikey.prefix {
5695 Some(ref prefix) => format!("{} {}", prefix, key),
5696 None => key,
5697 };
5698 req_builder = req_builder.query(&[("token", value)]);
5699 }
5700 if let Some(ref user_agent) = configuration.user_agent {
5701 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5702 }
5703 if let Some(ref apikey) = configuration.api_key {
5704 let key = apikey.key.clone();
5705 let value = match apikey.prefix {
5706 Some(ref prefix) => format!("{} {}", prefix, key),
5707 None => key,
5708 };
5709 req_builder = req_builder.header("X-GITEA-OTP", value);
5710 };
5711 if let Some(ref apikey) = configuration.api_key {
5712 let key = apikey.key.clone();
5713 let value = match apikey.prefix {
5714 Some(ref prefix) => format!("{} {}", prefix, key),
5715 None => key,
5716 };
5717 req_builder = req_builder.header("Authorization", value);
5718 };
5719 if let Some(ref apikey) = configuration.api_key {
5720 let key = apikey.key.clone();
5721 let value = match apikey.prefix {
5722 Some(ref prefix) => format!("{} {}", prefix, key),
5723 None => key,
5724 };
5725 req_builder = req_builder.header("Sudo", value);
5726 };
5727 if let Some(ref auth_conf) = configuration.basic_auth {
5728 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5729 };
5730 req_builder = req_builder.json(&p_body_body);
5731
5732 let req = req_builder.build()?;
5733 let resp = configuration.client.execute(req).await?;
5734
5735 let status = resp.status();
5736 let content_type = resp
5737 .headers()
5738 .get("content-type")
5739 .and_then(|v| v.to_str().ok())
5740 .unwrap_or("application/octet-stream");
5741 let content_type = super::ContentType::from(content_type);
5742
5743 if !status.is_client_error() && !status.is_server_error() {
5744 let content = resp.text().await?;
5745 match content_type {
5746 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5747 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))),
5748 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::Issue`")))),
5749 }
5750 } else {
5751 let content = resp.text().await?;
5752 let entity: Option<IssueRemoveIssueDependenciesError> = serde_json::from_str(&content).ok();
5753 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5754 }
5755}
5756
5757pub async fn issue_remove_label(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<(), Error<IssueRemoveLabelError>> {
5758 let p_path_owner = owner;
5760 let p_path_repo = repo;
5761 let p_path_index = index;
5762 let p_path_id = id;
5763
5764 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels/{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);
5765 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5766
5767 if let Some(ref apikey) = configuration.api_key {
5768 let key = apikey.key.clone();
5769 let value = match apikey.prefix {
5770 Some(ref prefix) => format!("{} {}", prefix, key),
5771 None => key,
5772 };
5773 req_builder = req_builder.query(&[("access_token", value)]);
5774 }
5775 if let Some(ref apikey) = configuration.api_key {
5776 let key = apikey.key.clone();
5777 let value = match apikey.prefix {
5778 Some(ref prefix) => format!("{} {}", prefix, key),
5779 None => key,
5780 };
5781 req_builder = req_builder.query(&[("sudo", value)]);
5782 }
5783 if let Some(ref apikey) = configuration.api_key {
5784 let key = apikey.key.clone();
5785 let value = match apikey.prefix {
5786 Some(ref prefix) => format!("{} {}", prefix, key),
5787 None => key,
5788 };
5789 req_builder = req_builder.query(&[("token", value)]);
5790 }
5791 if let Some(ref user_agent) = configuration.user_agent {
5792 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5793 }
5794 if let Some(ref apikey) = configuration.api_key {
5795 let key = apikey.key.clone();
5796 let value = match apikey.prefix {
5797 Some(ref prefix) => format!("{} {}", prefix, key),
5798 None => key,
5799 };
5800 req_builder = req_builder.header("X-GITEA-OTP", value);
5801 };
5802 if let Some(ref apikey) = configuration.api_key {
5803 let key = apikey.key.clone();
5804 let value = match apikey.prefix {
5805 Some(ref prefix) => format!("{} {}", prefix, key),
5806 None => key,
5807 };
5808 req_builder = req_builder.header("Authorization", value);
5809 };
5810 if let Some(ref apikey) = configuration.api_key {
5811 let key = apikey.key.clone();
5812 let value = match apikey.prefix {
5813 Some(ref prefix) => format!("{} {}", prefix, key),
5814 None => key,
5815 };
5816 req_builder = req_builder.header("Sudo", value);
5817 };
5818 if let Some(ref auth_conf) = configuration.basic_auth {
5819 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5820 };
5821
5822 let req = req_builder.build()?;
5823 let resp = configuration.client.execute(req).await?;
5824
5825 let status = resp.status();
5826
5827 if !status.is_client_error() && !status.is_server_error() {
5828 Ok(())
5829 } else {
5830 let content = resp.text().await?;
5831 let entity: Option<IssueRemoveLabelError> = serde_json::from_str(&content).ok();
5832 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5833 }
5834}
5835
5836pub async fn issue_replace_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option<models::IssueLabelsOption>) -> Result<Vec<models::Label>, Error<IssueReplaceLabelsError>> {
5837 let p_path_owner = owner;
5839 let p_path_repo = repo;
5840 let p_path_index = index;
5841 let p_body_body = body;
5842
5843 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
5844 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5845
5846 if let Some(ref apikey) = configuration.api_key {
5847 let key = apikey.key.clone();
5848 let value = match apikey.prefix {
5849 Some(ref prefix) => format!("{} {}", prefix, key),
5850 None => key,
5851 };
5852 req_builder = req_builder.query(&[("access_token", value)]);
5853 }
5854 if let Some(ref apikey) = configuration.api_key {
5855 let key = apikey.key.clone();
5856 let value = match apikey.prefix {
5857 Some(ref prefix) => format!("{} {}", prefix, key),
5858 None => key,
5859 };
5860 req_builder = req_builder.query(&[("sudo", value)]);
5861 }
5862 if let Some(ref apikey) = configuration.api_key {
5863 let key = apikey.key.clone();
5864 let value = match apikey.prefix {
5865 Some(ref prefix) => format!("{} {}", prefix, key),
5866 None => key,
5867 };
5868 req_builder = req_builder.query(&[("token", value)]);
5869 }
5870 if let Some(ref user_agent) = configuration.user_agent {
5871 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5872 }
5873 if let Some(ref apikey) = configuration.api_key {
5874 let key = apikey.key.clone();
5875 let value = match apikey.prefix {
5876 Some(ref prefix) => format!("{} {}", prefix, key),
5877 None => key,
5878 };
5879 req_builder = req_builder.header("X-GITEA-OTP", value);
5880 };
5881 if let Some(ref apikey) = configuration.api_key {
5882 let key = apikey.key.clone();
5883 let value = match apikey.prefix {
5884 Some(ref prefix) => format!("{} {}", prefix, key),
5885 None => key,
5886 };
5887 req_builder = req_builder.header("Authorization", value);
5888 };
5889 if let Some(ref apikey) = configuration.api_key {
5890 let key = apikey.key.clone();
5891 let value = match apikey.prefix {
5892 Some(ref prefix) => format!("{} {}", prefix, key),
5893 None => key,
5894 };
5895 req_builder = req_builder.header("Sudo", value);
5896 };
5897 if let Some(ref auth_conf) = configuration.basic_auth {
5898 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5899 };
5900 req_builder = req_builder.json(&p_body_body);
5901
5902 let req = req_builder.build()?;
5903 let resp = configuration.client.execute(req).await?;
5904
5905 let status = resp.status();
5906 let content_type = resp
5907 .headers()
5908 .get("content-type")
5909 .and_then(|v| v.to_str().ok())
5910 .unwrap_or("application/octet-stream");
5911 let content_type = super::ContentType::from(content_type);
5912
5913 if !status.is_client_error() && !status.is_server_error() {
5914 let content = resp.text().await?;
5915 match content_type {
5916 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5917 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))),
5918 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))),
5919 }
5920 } else {
5921 let content = resp.text().await?;
5922 let entity: Option<IssueReplaceLabelsError> = serde_json::from_str(&content).ok();
5923 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5924 }
5925}
5926
5927pub async fn issue_reset_time(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<IssueResetTimeError>> {
5928 let p_path_owner = owner;
5930 let p_path_repo = repo;
5931 let p_path_index = index;
5932
5933 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
5934 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5935
5936 if let Some(ref apikey) = configuration.api_key {
5937 let key = apikey.key.clone();
5938 let value = match apikey.prefix {
5939 Some(ref prefix) => format!("{} {}", prefix, key),
5940 None => key,
5941 };
5942 req_builder = req_builder.query(&[("access_token", value)]);
5943 }
5944 if let Some(ref apikey) = configuration.api_key {
5945 let key = apikey.key.clone();
5946 let value = match apikey.prefix {
5947 Some(ref prefix) => format!("{} {}", prefix, key),
5948 None => key,
5949 };
5950 req_builder = req_builder.query(&[("sudo", value)]);
5951 }
5952 if let Some(ref apikey) = configuration.api_key {
5953 let key = apikey.key.clone();
5954 let value = match apikey.prefix {
5955 Some(ref prefix) => format!("{} {}", prefix, key),
5956 None => key,
5957 };
5958 req_builder = req_builder.query(&[("token", value)]);
5959 }
5960 if let Some(ref user_agent) = configuration.user_agent {
5961 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5962 }
5963 if let Some(ref apikey) = configuration.api_key {
5964 let key = apikey.key.clone();
5965 let value = match apikey.prefix {
5966 Some(ref prefix) => format!("{} {}", prefix, key),
5967 None => key,
5968 };
5969 req_builder = req_builder.header("X-GITEA-OTP", value);
5970 };
5971 if let Some(ref apikey) = configuration.api_key {
5972 let key = apikey.key.clone();
5973 let value = match apikey.prefix {
5974 Some(ref prefix) => format!("{} {}", prefix, key),
5975 None => key,
5976 };
5977 req_builder = req_builder.header("Authorization", value);
5978 };
5979 if let Some(ref apikey) = configuration.api_key {
5980 let key = apikey.key.clone();
5981 let value = match apikey.prefix {
5982 Some(ref prefix) => format!("{} {}", prefix, key),
5983 None => key,
5984 };
5985 req_builder = req_builder.header("Sudo", value);
5986 };
5987 if let Some(ref auth_conf) = configuration.basic_auth {
5988 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
5989 };
5990
5991 let req = req_builder.build()?;
5992 let resp = configuration.client.execute(req).await?;
5993
5994 let status = resp.status();
5995
5996 if !status.is_client_error() && !status.is_server_error() {
5997 Ok(())
5998 } else {
5999 let content = resp.text().await?;
6000 let entity: Option<IssueResetTimeError> = serde_json::from_str(&content).ok();
6001 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6002 }
6003}
6004
6005pub async fn issue_search_issues(configuration: &configuration::Configuration, state: Option<&str>, labels: Option<&str>, milestones: Option<&str>, q: Option<&str>, priority_repo_id: Option<i64>, r#type: Option<&str>, since: Option<String>, before: Option<String>, assigned: Option<bool>, created: Option<bool>, mentioned: Option<bool>, review_requested: Option<bool>, reviewed: Option<bool>, owner: Option<&str>, team: Option<&str>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Issue>, Error<IssueSearchIssuesError>> {
6006 let p_query_state = state;
6008 let p_query_labels = labels;
6009 let p_query_milestones = milestones;
6010 let p_query_q = q;
6011 let p_query_priority_repo_id = priority_repo_id;
6012 let p_query_type = r#type;
6013 let p_query_since = since;
6014 let p_query_before = before;
6015 let p_query_assigned = assigned;
6016 let p_query_created = created;
6017 let p_query_mentioned = mentioned;
6018 let p_query_review_requested = review_requested;
6019 let p_query_reviewed = reviewed;
6020 let p_query_owner = owner;
6021 let p_query_team = team;
6022 let p_query_page = page;
6023 let p_query_limit = limit;
6024
6025 let uri_str = format!("{}/repos/issues/search", configuration.base_path);
6026 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6027
6028 if let Some(ref param_value) = p_query_state {
6029 req_builder = req_builder.query(&[("state", ¶m_value.to_string())]);
6030 }
6031 if let Some(ref param_value) = p_query_labels {
6032 req_builder = req_builder.query(&[("labels", ¶m_value.to_string())]);
6033 }
6034 if let Some(ref param_value) = p_query_milestones {
6035 req_builder = req_builder.query(&[("milestones", ¶m_value.to_string())]);
6036 }
6037 if let Some(ref param_value) = p_query_q {
6038 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
6039 }
6040 if let Some(ref param_value) = p_query_priority_repo_id {
6041 req_builder = req_builder.query(&[("priority_repo_id", ¶m_value.to_string())]);
6042 }
6043 if let Some(ref param_value) = p_query_type {
6044 req_builder = req_builder.query(&[("type", ¶m_value.to_string())]);
6045 }
6046 if let Some(ref param_value) = p_query_since {
6047 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
6048 }
6049 if let Some(ref param_value) = p_query_before {
6050 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
6051 }
6052 if let Some(ref param_value) = p_query_assigned {
6053 req_builder = req_builder.query(&[("assigned", ¶m_value.to_string())]);
6054 }
6055 if let Some(ref param_value) = p_query_created {
6056 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
6057 }
6058 if let Some(ref param_value) = p_query_mentioned {
6059 req_builder = req_builder.query(&[("mentioned", ¶m_value.to_string())]);
6060 }
6061 if let Some(ref param_value) = p_query_review_requested {
6062 req_builder = req_builder.query(&[("review_requested", ¶m_value.to_string())]);
6063 }
6064 if let Some(ref param_value) = p_query_reviewed {
6065 req_builder = req_builder.query(&[("reviewed", ¶m_value.to_string())]);
6066 }
6067 if let Some(ref param_value) = p_query_owner {
6068 req_builder = req_builder.query(&[("owner", ¶m_value.to_string())]);
6069 }
6070 if let Some(ref param_value) = p_query_team {
6071 req_builder = req_builder.query(&[("team", ¶m_value.to_string())]);
6072 }
6073 if let Some(ref param_value) = p_query_page {
6074 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
6075 }
6076 if let Some(ref param_value) = p_query_limit {
6077 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
6078 }
6079 if let Some(ref apikey) = configuration.api_key {
6080 let key = apikey.key.clone();
6081 let value = match apikey.prefix {
6082 Some(ref prefix) => format!("{} {}", prefix, key),
6083 None => key,
6084 };
6085 req_builder = req_builder.query(&[("access_token", value)]);
6086 }
6087 if let Some(ref apikey) = configuration.api_key {
6088 let key = apikey.key.clone();
6089 let value = match apikey.prefix {
6090 Some(ref prefix) => format!("{} {}", prefix, key),
6091 None => key,
6092 };
6093 req_builder = req_builder.query(&[("sudo", value)]);
6094 }
6095 if let Some(ref apikey) = configuration.api_key {
6096 let key = apikey.key.clone();
6097 let value = match apikey.prefix {
6098 Some(ref prefix) => format!("{} {}", prefix, key),
6099 None => key,
6100 };
6101 req_builder = req_builder.query(&[("token", value)]);
6102 }
6103 if let Some(ref user_agent) = configuration.user_agent {
6104 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6105 }
6106 if let Some(ref apikey) = configuration.api_key {
6107 let key = apikey.key.clone();
6108 let value = match apikey.prefix {
6109 Some(ref prefix) => format!("{} {}", prefix, key),
6110 None => key,
6111 };
6112 req_builder = req_builder.header("X-GITEA-OTP", value);
6113 };
6114 if let Some(ref apikey) = configuration.api_key {
6115 let key = apikey.key.clone();
6116 let value = match apikey.prefix {
6117 Some(ref prefix) => format!("{} {}", prefix, key),
6118 None => key,
6119 };
6120 req_builder = req_builder.header("Authorization", value);
6121 };
6122 if let Some(ref apikey) = configuration.api_key {
6123 let key = apikey.key.clone();
6124 let value = match apikey.prefix {
6125 Some(ref prefix) => format!("{} {}", prefix, key),
6126 None => key,
6127 };
6128 req_builder = req_builder.header("Sudo", value);
6129 };
6130 if let Some(ref auth_conf) = configuration.basic_auth {
6131 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6132 };
6133
6134 let req = req_builder.build()?;
6135 let resp = configuration.client.execute(req).await?;
6136
6137 let status = resp.status();
6138 let content_type = resp
6139 .headers()
6140 .get("content-type")
6141 .and_then(|v| v.to_str().ok())
6142 .unwrap_or("application/octet-stream");
6143 let content_type = super::ContentType::from(content_type);
6144
6145 if !status.is_client_error() && !status.is_server_error() {
6146 let content = resp.text().await?;
6147 match content_type {
6148 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6149 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))),
6150 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>`")))),
6151 }
6152 } else {
6153 let content = resp.text().await?;
6154 let entity: Option<IssueSearchIssuesError> = serde_json::from_str(&content).ok();
6155 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6156 }
6157}
6158
6159pub async fn issue_start_stop_watch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<IssueStartStopWatchError>> {
6160 let p_path_owner = owner;
6162 let p_path_repo = repo;
6163 let p_path_index = index;
6164
6165 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/start", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6166 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6167
6168 if let Some(ref apikey) = configuration.api_key {
6169 let key = apikey.key.clone();
6170 let value = match apikey.prefix {
6171 Some(ref prefix) => format!("{} {}", prefix, key),
6172 None => key,
6173 };
6174 req_builder = req_builder.query(&[("access_token", value)]);
6175 }
6176 if let Some(ref apikey) = configuration.api_key {
6177 let key = apikey.key.clone();
6178 let value = match apikey.prefix {
6179 Some(ref prefix) => format!("{} {}", prefix, key),
6180 None => key,
6181 };
6182 req_builder = req_builder.query(&[("sudo", value)]);
6183 }
6184 if let Some(ref apikey) = configuration.api_key {
6185 let key = apikey.key.clone();
6186 let value = match apikey.prefix {
6187 Some(ref prefix) => format!("{} {}", prefix, key),
6188 None => key,
6189 };
6190 req_builder = req_builder.query(&[("token", value)]);
6191 }
6192 if let Some(ref user_agent) = configuration.user_agent {
6193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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.header("X-GITEA-OTP", 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.header("Authorization", 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.header("Sudo", value);
6218 };
6219 if let Some(ref auth_conf) = configuration.basic_auth {
6220 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6221 };
6222
6223 let req = req_builder.build()?;
6224 let resp = configuration.client.execute(req).await?;
6225
6226 let status = resp.status();
6227
6228 if !status.is_client_error() && !status.is_server_error() {
6229 Ok(())
6230 } else {
6231 let content = resp.text().await?;
6232 let entity: Option<IssueStartStopWatchError> = serde_json::from_str(&content).ok();
6233 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6234 }
6235}
6236
6237pub async fn issue_stop_stop_watch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<IssueStopStopWatchError>> {
6238 let p_path_owner = owner;
6240 let p_path_repo = repo;
6241 let p_path_index = index;
6242
6243 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/stop", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6244 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6245
6246 if let Some(ref apikey) = configuration.api_key {
6247 let key = apikey.key.clone();
6248 let value = match apikey.prefix {
6249 Some(ref prefix) => format!("{} {}", prefix, key),
6250 None => key,
6251 };
6252 req_builder = req_builder.query(&[("access_token", value)]);
6253 }
6254 if let Some(ref apikey) = configuration.api_key {
6255 let key = apikey.key.clone();
6256 let value = match apikey.prefix {
6257 Some(ref prefix) => format!("{} {}", prefix, key),
6258 None => key,
6259 };
6260 req_builder = req_builder.query(&[("sudo", value)]);
6261 }
6262 if let Some(ref apikey) = configuration.api_key {
6263 let key = apikey.key.clone();
6264 let value = match apikey.prefix {
6265 Some(ref prefix) => format!("{} {}", prefix, key),
6266 None => key,
6267 };
6268 req_builder = req_builder.query(&[("token", value)]);
6269 }
6270 if let Some(ref user_agent) = configuration.user_agent {
6271 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6272 }
6273 if let Some(ref apikey) = configuration.api_key {
6274 let key = apikey.key.clone();
6275 let value = match apikey.prefix {
6276 Some(ref prefix) => format!("{} {}", prefix, key),
6277 None => key,
6278 };
6279 req_builder = req_builder.header("X-GITEA-OTP", value);
6280 };
6281 if let Some(ref apikey) = configuration.api_key {
6282 let key = apikey.key.clone();
6283 let value = match apikey.prefix {
6284 Some(ref prefix) => format!("{} {}", prefix, key),
6285 None => key,
6286 };
6287 req_builder = req_builder.header("Authorization", value);
6288 };
6289 if let Some(ref apikey) = configuration.api_key {
6290 let key = apikey.key.clone();
6291 let value = match apikey.prefix {
6292 Some(ref prefix) => format!("{} {}", prefix, key),
6293 None => key,
6294 };
6295 req_builder = req_builder.header("Sudo", value);
6296 };
6297 if let Some(ref auth_conf) = configuration.basic_auth {
6298 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6299 };
6300
6301 let req = req_builder.build()?;
6302 let resp = configuration.client.execute(req).await?;
6303
6304 let status = resp.status();
6305
6306 if !status.is_client_error() && !status.is_server_error() {
6307 Ok(())
6308 } else {
6309 let content = resp.text().await?;
6310 let entity: Option<IssueStopStopWatchError> = serde_json::from_str(&content).ok();
6311 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6312 }
6313}
6314
6315pub async fn issue_subscriptions(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::User>, Error<IssueSubscriptionsError>> {
6316 let p_path_owner = owner;
6318 let p_path_repo = repo;
6319 let p_path_index = index;
6320 let p_query_page = page;
6321 let p_query_limit = limit;
6322
6323 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6324 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6325
6326 if let Some(ref param_value) = p_query_page {
6327 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
6328 }
6329 if let Some(ref param_value) = p_query_limit {
6330 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
6331 }
6332 if let Some(ref apikey) = configuration.api_key {
6333 let key = apikey.key.clone();
6334 let value = match apikey.prefix {
6335 Some(ref prefix) => format!("{} {}", prefix, key),
6336 None => key,
6337 };
6338 req_builder = req_builder.query(&[("access_token", value)]);
6339 }
6340 if let Some(ref apikey) = configuration.api_key {
6341 let key = apikey.key.clone();
6342 let value = match apikey.prefix {
6343 Some(ref prefix) => format!("{} {}", prefix, key),
6344 None => key,
6345 };
6346 req_builder = req_builder.query(&[("sudo", value)]);
6347 }
6348 if let Some(ref apikey) = configuration.api_key {
6349 let key = apikey.key.clone();
6350 let value = match apikey.prefix {
6351 Some(ref prefix) => format!("{} {}", prefix, key),
6352 None => key,
6353 };
6354 req_builder = req_builder.query(&[("token", value)]);
6355 }
6356 if let Some(ref user_agent) = configuration.user_agent {
6357 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6358 }
6359 if let Some(ref apikey) = configuration.api_key {
6360 let key = apikey.key.clone();
6361 let value = match apikey.prefix {
6362 Some(ref prefix) => format!("{} {}", prefix, key),
6363 None => key,
6364 };
6365 req_builder = req_builder.header("X-GITEA-OTP", value);
6366 };
6367 if let Some(ref apikey) = configuration.api_key {
6368 let key = apikey.key.clone();
6369 let value = match apikey.prefix {
6370 Some(ref prefix) => format!("{} {}", prefix, key),
6371 None => key,
6372 };
6373 req_builder = req_builder.header("Authorization", value);
6374 };
6375 if let Some(ref apikey) = configuration.api_key {
6376 let key = apikey.key.clone();
6377 let value = match apikey.prefix {
6378 Some(ref prefix) => format!("{} {}", prefix, key),
6379 None => key,
6380 };
6381 req_builder = req_builder.header("Sudo", value);
6382 };
6383 if let Some(ref auth_conf) = configuration.basic_auth {
6384 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6385 };
6386
6387 let req = req_builder.build()?;
6388 let resp = configuration.client.execute(req).await?;
6389
6390 let status = resp.status();
6391 let content_type = resp
6392 .headers()
6393 .get("content-type")
6394 .and_then(|v| v.to_str().ok())
6395 .unwrap_or("application/octet-stream");
6396 let content_type = super::ContentType::from(content_type);
6397
6398 if !status.is_client_error() && !status.is_server_error() {
6399 let content = resp.text().await?;
6400 match content_type {
6401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
6403 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>`")))),
6404 }
6405 } else {
6406 let content = resp.text().await?;
6407 let entity: Option<IssueSubscriptionsError> = serde_json::from_str(&content).ok();
6408 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6409 }
6410}
6411
6412pub async fn issue_tracked_times(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, user: Option<&str>, since: Option<String>, before: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::TrackedTime>, Error<IssueTrackedTimesError>> {
6413 let p_path_owner = owner;
6415 let p_path_repo = repo;
6416 let p_path_index = index;
6417 let p_query_user = user;
6418 let p_query_since = since;
6419 let p_query_before = before;
6420 let p_query_page = page;
6421 let p_query_limit = limit;
6422
6423 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6424 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6425
6426 if let Some(ref param_value) = p_query_user {
6427 req_builder = req_builder.query(&[("user", ¶m_value.to_string())]);
6428 }
6429 if let Some(ref param_value) = p_query_since {
6430 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
6431 }
6432 if let Some(ref param_value) = p_query_before {
6433 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
6434 }
6435 if let Some(ref param_value) = p_query_page {
6436 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
6437 }
6438 if let Some(ref param_value) = p_query_limit {
6439 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
6440 }
6441 if let Some(ref apikey) = configuration.api_key {
6442 let key = apikey.key.clone();
6443 let value = match apikey.prefix {
6444 Some(ref prefix) => format!("{} {}", prefix, key),
6445 None => key,
6446 };
6447 req_builder = req_builder.query(&[("access_token", value)]);
6448 }
6449 if let Some(ref apikey) = configuration.api_key {
6450 let key = apikey.key.clone();
6451 let value = match apikey.prefix {
6452 Some(ref prefix) => format!("{} {}", prefix, key),
6453 None => key,
6454 };
6455 req_builder = req_builder.query(&[("sudo", value)]);
6456 }
6457 if let Some(ref apikey) = configuration.api_key {
6458 let key = apikey.key.clone();
6459 let value = match apikey.prefix {
6460 Some(ref prefix) => format!("{} {}", prefix, key),
6461 None => key,
6462 };
6463 req_builder = req_builder.query(&[("token", value)]);
6464 }
6465 if let Some(ref user_agent) = configuration.user_agent {
6466 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6467 }
6468 if let Some(ref apikey) = configuration.api_key {
6469 let key = apikey.key.clone();
6470 let value = match apikey.prefix {
6471 Some(ref prefix) => format!("{} {}", prefix, key),
6472 None => key,
6473 };
6474 req_builder = req_builder.header("X-GITEA-OTP", value);
6475 };
6476 if let Some(ref apikey) = configuration.api_key {
6477 let key = apikey.key.clone();
6478 let value = match apikey.prefix {
6479 Some(ref prefix) => format!("{} {}", prefix, key),
6480 None => key,
6481 };
6482 req_builder = req_builder.header("Authorization", value);
6483 };
6484 if let Some(ref apikey) = configuration.api_key {
6485 let key = apikey.key.clone();
6486 let value = match apikey.prefix {
6487 Some(ref prefix) => format!("{} {}", prefix, key),
6488 None => key,
6489 };
6490 req_builder = req_builder.header("Sudo", value);
6491 };
6492 if let Some(ref auth_conf) = configuration.basic_auth {
6493 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6494 };
6495
6496 let req = req_builder.build()?;
6497 let resp = configuration.client.execute(req).await?;
6498
6499 let status = resp.status();
6500 let content_type = resp
6501 .headers()
6502 .get("content-type")
6503 .and_then(|v| v.to_str().ok())
6504 .unwrap_or("application/octet-stream");
6505 let content_type = super::ContentType::from(content_type);
6506
6507 if !status.is_client_error() && !status.is_server_error() {
6508 let content = resp.text().await?;
6509 match content_type {
6510 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6511 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrackedTime>`"))),
6512 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>`")))),
6513 }
6514 } else {
6515 let content = resp.text().await?;
6516 let entity: Option<IssueTrackedTimesError> = serde_json::from_str(&content).ok();
6517 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6518 }
6519}
6520
6521pub async fn issue_unlock_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<IssueUnlockIssueError>> {
6522 let p_path_owner = owner;
6524 let p_path_repo = repo;
6525 let p_path_index = index;
6526
6527 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/lock", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6528 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
6529
6530 if let Some(ref apikey) = configuration.api_key {
6531 let key = apikey.key.clone();
6532 let value = match apikey.prefix {
6533 Some(ref prefix) => format!("{} {}", prefix, key),
6534 None => key,
6535 };
6536 req_builder = req_builder.query(&[("access_token", value)]);
6537 }
6538 if let Some(ref apikey) = configuration.api_key {
6539 let key = apikey.key.clone();
6540 let value = match apikey.prefix {
6541 Some(ref prefix) => format!("{} {}", prefix, key),
6542 None => key,
6543 };
6544 req_builder = req_builder.query(&[("sudo", value)]);
6545 }
6546 if let Some(ref apikey) = configuration.api_key {
6547 let key = apikey.key.clone();
6548 let value = match apikey.prefix {
6549 Some(ref prefix) => format!("{} {}", prefix, key),
6550 None => key,
6551 };
6552 req_builder = req_builder.query(&[("token", value)]);
6553 }
6554 if let Some(ref user_agent) = configuration.user_agent {
6555 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6556 }
6557 if let Some(ref apikey) = configuration.api_key {
6558 let key = apikey.key.clone();
6559 let value = match apikey.prefix {
6560 Some(ref prefix) => format!("{} {}", prefix, key),
6561 None => key,
6562 };
6563 req_builder = req_builder.header("X-GITEA-OTP", value);
6564 };
6565 if let Some(ref apikey) = configuration.api_key {
6566 let key = apikey.key.clone();
6567 let value = match apikey.prefix {
6568 Some(ref prefix) => format!("{} {}", prefix, key),
6569 None => key,
6570 };
6571 req_builder = req_builder.header("Authorization", value);
6572 };
6573 if let Some(ref apikey) = configuration.api_key {
6574 let key = apikey.key.clone();
6575 let value = match apikey.prefix {
6576 Some(ref prefix) => format!("{} {}", prefix, key),
6577 None => key,
6578 };
6579 req_builder = req_builder.header("Sudo", value);
6580 };
6581 if let Some(ref auth_conf) = configuration.basic_auth {
6582 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6583 };
6584
6585 let req = req_builder.build()?;
6586 let resp = configuration.client.execute(req).await?;
6587
6588 let status = resp.status();
6589
6590 if !status.is_client_error() && !status.is_server_error() {
6591 Ok(())
6592 } else {
6593 let content = resp.text().await?;
6594 let entity: Option<IssueUnlockIssueError> = serde_json::from_str(&content).ok();
6595 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6596 }
6597}
6598
6599pub async fn move_issue_pin(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, position: i64) -> Result<(), Error<MoveIssuePinError>> {
6600 let p_path_owner = owner;
6602 let p_path_repo = repo;
6603 let p_path_index = index;
6604 let p_path_position = position;
6605
6606 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin/{position}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, position=p_path_position);
6607 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
6608
6609 if let Some(ref apikey) = configuration.api_key {
6610 let key = apikey.key.clone();
6611 let value = match apikey.prefix {
6612 Some(ref prefix) => format!("{} {}", prefix, key),
6613 None => key,
6614 };
6615 req_builder = req_builder.query(&[("access_token", value)]);
6616 }
6617 if let Some(ref apikey) = configuration.api_key {
6618 let key = apikey.key.clone();
6619 let value = match apikey.prefix {
6620 Some(ref prefix) => format!("{} {}", prefix, key),
6621 None => key,
6622 };
6623 req_builder = req_builder.query(&[("sudo", value)]);
6624 }
6625 if let Some(ref apikey) = configuration.api_key {
6626 let key = apikey.key.clone();
6627 let value = match apikey.prefix {
6628 Some(ref prefix) => format!("{} {}", prefix, key),
6629 None => key,
6630 };
6631 req_builder = req_builder.query(&[("token", value)]);
6632 }
6633 if let Some(ref user_agent) = configuration.user_agent {
6634 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6635 }
6636 if let Some(ref apikey) = configuration.api_key {
6637 let key = apikey.key.clone();
6638 let value = match apikey.prefix {
6639 Some(ref prefix) => format!("{} {}", prefix, key),
6640 None => key,
6641 };
6642 req_builder = req_builder.header("X-GITEA-OTP", value);
6643 };
6644 if let Some(ref apikey) = configuration.api_key {
6645 let key = apikey.key.clone();
6646 let value = match apikey.prefix {
6647 Some(ref prefix) => format!("{} {}", prefix, key),
6648 None => key,
6649 };
6650 req_builder = req_builder.header("Authorization", value);
6651 };
6652 if let Some(ref apikey) = configuration.api_key {
6653 let key = apikey.key.clone();
6654 let value = match apikey.prefix {
6655 Some(ref prefix) => format!("{} {}", prefix, key),
6656 None => key,
6657 };
6658 req_builder = req_builder.header("Sudo", value);
6659 };
6660 if let Some(ref auth_conf) = configuration.basic_auth {
6661 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6662 };
6663
6664 let req = req_builder.build()?;
6665 let resp = configuration.client.execute(req).await?;
6666
6667 let status = resp.status();
6668
6669 if !status.is_client_error() && !status.is_server_error() {
6670 Ok(())
6671 } else {
6672 let content = resp.text().await?;
6673 let entity: Option<MoveIssuePinError> = serde_json::from_str(&content).ok();
6674 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6675 }
6676}
6677
6678pub async fn pin_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<PinIssueError>> {
6679 let p_path_owner = owner;
6681 let p_path_repo = repo;
6682 let p_path_index = index;
6683
6684 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6685 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6686
6687 if let Some(ref apikey) = configuration.api_key {
6688 let key = apikey.key.clone();
6689 let value = match apikey.prefix {
6690 Some(ref prefix) => format!("{} {}", prefix, key),
6691 None => key,
6692 };
6693 req_builder = req_builder.query(&[("access_token", value)]);
6694 }
6695 if let Some(ref apikey) = configuration.api_key {
6696 let key = apikey.key.clone();
6697 let value = match apikey.prefix {
6698 Some(ref prefix) => format!("{} {}", prefix, key),
6699 None => key,
6700 };
6701 req_builder = req_builder.query(&[("sudo", value)]);
6702 }
6703 if let Some(ref apikey) = configuration.api_key {
6704 let key = apikey.key.clone();
6705 let value = match apikey.prefix {
6706 Some(ref prefix) => format!("{} {}", prefix, key),
6707 None => key,
6708 };
6709 req_builder = req_builder.query(&[("token", value)]);
6710 }
6711 if let Some(ref user_agent) = configuration.user_agent {
6712 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6713 }
6714 if let Some(ref apikey) = configuration.api_key {
6715 let key = apikey.key.clone();
6716 let value = match apikey.prefix {
6717 Some(ref prefix) => format!("{} {}", prefix, key),
6718 None => key,
6719 };
6720 req_builder = req_builder.header("X-GITEA-OTP", value);
6721 };
6722 if let Some(ref apikey) = configuration.api_key {
6723 let key = apikey.key.clone();
6724 let value = match apikey.prefix {
6725 Some(ref prefix) => format!("{} {}", prefix, key),
6726 None => key,
6727 };
6728 req_builder = req_builder.header("Authorization", value);
6729 };
6730 if let Some(ref apikey) = configuration.api_key {
6731 let key = apikey.key.clone();
6732 let value = match apikey.prefix {
6733 Some(ref prefix) => format!("{} {}", prefix, key),
6734 None => key,
6735 };
6736 req_builder = req_builder.header("Sudo", value);
6737 };
6738 if let Some(ref auth_conf) = configuration.basic_auth {
6739 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6740 };
6741
6742 let req = req_builder.build()?;
6743 let resp = configuration.client.execute(req).await?;
6744
6745 let status = resp.status();
6746
6747 if !status.is_client_error() && !status.is_server_error() {
6748 Ok(())
6749 } else {
6750 let content = resp.text().await?;
6751 let entity: Option<PinIssueError> = serde_json::from_str(&content).ok();
6752 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6753 }
6754}
6755
6756pub async fn unpin_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error<UnpinIssueError>> {
6757 let p_path_owner = owner;
6759 let p_path_repo = repo;
6760 let p_path_index = index;
6761
6762 let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index);
6763 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
6764
6765 if let Some(ref apikey) = configuration.api_key {
6766 let key = apikey.key.clone();
6767 let value = match apikey.prefix {
6768 Some(ref prefix) => format!("{} {}", prefix, key),
6769 None => key,
6770 };
6771 req_builder = req_builder.query(&[("access_token", value)]);
6772 }
6773 if let Some(ref apikey) = configuration.api_key {
6774 let key = apikey.key.clone();
6775 let value = match apikey.prefix {
6776 Some(ref prefix) => format!("{} {}", prefix, key),
6777 None => key,
6778 };
6779 req_builder = req_builder.query(&[("sudo", value)]);
6780 }
6781 if let Some(ref apikey) = configuration.api_key {
6782 let key = apikey.key.clone();
6783 let value = match apikey.prefix {
6784 Some(ref prefix) => format!("{} {}", prefix, key),
6785 None => key,
6786 };
6787 req_builder = req_builder.query(&[("token", value)]);
6788 }
6789 if let Some(ref user_agent) = configuration.user_agent {
6790 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6791 }
6792 if let Some(ref apikey) = configuration.api_key {
6793 let key = apikey.key.clone();
6794 let value = match apikey.prefix {
6795 Some(ref prefix) => format!("{} {}", prefix, key),
6796 None => key,
6797 };
6798 req_builder = req_builder.header("X-GITEA-OTP", value);
6799 };
6800 if let Some(ref apikey) = configuration.api_key {
6801 let key = apikey.key.clone();
6802 let value = match apikey.prefix {
6803 Some(ref prefix) => format!("{} {}", prefix, key),
6804 None => key,
6805 };
6806 req_builder = req_builder.header("Authorization", value);
6807 };
6808 if let Some(ref apikey) = configuration.api_key {
6809 let key = apikey.key.clone();
6810 let value = match apikey.prefix {
6811 Some(ref prefix) => format!("{} {}", prefix, key),
6812 None => key,
6813 };
6814 req_builder = req_builder.header("Sudo", value);
6815 };
6816 if let Some(ref auth_conf) = configuration.basic_auth {
6817 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
6818 };
6819
6820 let req = req_builder.build()?;
6821 let resp = configuration.client.execute(req).await?;
6822
6823 let status = resp.status();
6824
6825 if !status.is_client_error() && !status.is_server_error() {
6826 Ok(())
6827 } else {
6828 let content = resp.text().await?;
6829 let entity: Option<UnpinIssueError> = serde_json::from_str(&content).ok();
6830 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6831 }
6832}
6833