1#![allow(
3 clippy::all
4)]
5use serde::Deserialize;
16
17use roctokit::adapters::{AdapterError, Client, GitHubRequest, GitHubResponseExt};
18use crate::models::*;
19
20use super::PerPage;
21
22use std::collections::HashMap;
23use serde_json::value::Value;
24
25pub struct Reactions<'api, C: Client> where AdapterError: From<<C as Client>::Err> {
26 client: &'api C
27}
28
29pub fn new<C: Client>(client: &C) -> Reactions<C> where AdapterError: From<<C as Client>::Err> {
30 Reactions { client }
31}
32
33#[derive(Debug, thiserror::Error)]
35pub enum ReactionsCreateForCommitCommentError {
36 #[error("Reaction created")]
37 Status201(Reaction),
38 #[error("Validation failed, or the endpoint has been spammed.")]
39 Status422(ValidationError),
40 #[error("Status code: {}", code)]
41 Generic { code: u16 },
42}
43
44impl From<ReactionsCreateForCommitCommentError> for AdapterError {
45 fn from(err: ReactionsCreateForCommitCommentError) -> Self {
46 let (description, status_code) = match err {
47 ReactionsCreateForCommitCommentError::Status201(_) => (String::from("Reaction created"), 201),
48 ReactionsCreateForCommitCommentError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
49 ReactionsCreateForCommitCommentError::Generic { code } => (String::from("Generic"), code)
50 };
51
52 Self::Endpoint {
53 description,
54 status_code,
55 source: Some(Box::new(err))
56 }
57 }
58}
59
60#[derive(Debug, thiserror::Error)]
62pub enum ReactionsCreateForIssueError {
63 #[error("Response")]
64 Status201(Reaction),
65 #[error("Validation failed, or the endpoint has been spammed.")]
66 Status422(ValidationError),
67 #[error("Status code: {}", code)]
68 Generic { code: u16 },
69}
70
71impl From<ReactionsCreateForIssueError> for AdapterError {
72 fn from(err: ReactionsCreateForIssueError) -> Self {
73 let (description, status_code) = match err {
74 ReactionsCreateForIssueError::Status201(_) => (String::from("Response"), 201),
75 ReactionsCreateForIssueError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
76 ReactionsCreateForIssueError::Generic { code } => (String::from("Generic"), code)
77 };
78
79 Self::Endpoint {
80 description,
81 status_code,
82 source: Some(Box::new(err))
83 }
84 }
85}
86
87#[derive(Debug, thiserror::Error)]
89pub enum ReactionsCreateForIssueCommentError {
90 #[error("Reaction created")]
91 Status201(Reaction),
92 #[error("Validation failed, or the endpoint has been spammed.")]
93 Status422(ValidationError),
94 #[error("Status code: {}", code)]
95 Generic { code: u16 },
96}
97
98impl From<ReactionsCreateForIssueCommentError> for AdapterError {
99 fn from(err: ReactionsCreateForIssueCommentError) -> Self {
100 let (description, status_code) = match err {
101 ReactionsCreateForIssueCommentError::Status201(_) => (String::from("Reaction created"), 201),
102 ReactionsCreateForIssueCommentError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
103 ReactionsCreateForIssueCommentError::Generic { code } => (String::from("Generic"), code)
104 };
105
106 Self::Endpoint {
107 description,
108 status_code,
109 source: Some(Box::new(err))
110 }
111 }
112}
113
114#[derive(Debug, thiserror::Error)]
116pub enum ReactionsCreateForPullRequestReviewCommentError {
117 #[error("Reaction created")]
118 Status201(Reaction),
119 #[error("Validation failed, or the endpoint has been spammed.")]
120 Status422(ValidationError),
121 #[error("Status code: {}", code)]
122 Generic { code: u16 },
123}
124
125impl From<ReactionsCreateForPullRequestReviewCommentError> for AdapterError {
126 fn from(err: ReactionsCreateForPullRequestReviewCommentError) -> Self {
127 let (description, status_code) = match err {
128 ReactionsCreateForPullRequestReviewCommentError::Status201(_) => (String::from("Reaction created"), 201),
129 ReactionsCreateForPullRequestReviewCommentError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
130 ReactionsCreateForPullRequestReviewCommentError::Generic { code } => (String::from("Generic"), code)
131 };
132
133 Self::Endpoint {
134 description,
135 status_code,
136 source: Some(Box::new(err))
137 }
138 }
139}
140
141#[derive(Debug, thiserror::Error)]
143pub enum ReactionsCreateForReleaseError {
144 #[error("Reaction created")]
145 Status201(Reaction),
146 #[error("Validation failed, or the endpoint has been spammed.")]
147 Status422(ValidationError),
148 #[error("Status code: {}", code)]
149 Generic { code: u16 },
150}
151
152impl From<ReactionsCreateForReleaseError> for AdapterError {
153 fn from(err: ReactionsCreateForReleaseError) -> Self {
154 let (description, status_code) = match err {
155 ReactionsCreateForReleaseError::Status201(_) => (String::from("Reaction created"), 201),
156 ReactionsCreateForReleaseError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
157 ReactionsCreateForReleaseError::Generic { code } => (String::from("Generic"), code)
158 };
159
160 Self::Endpoint {
161 description,
162 status_code,
163 source: Some(Box::new(err))
164 }
165 }
166}
167
168#[derive(Debug, thiserror::Error)]
170pub enum ReactionsCreateForTeamDiscussionCommentInOrgError {
171 #[error("Response")]
172 Status201(Reaction),
173 #[error("Status code: {}", code)]
174 Generic { code: u16 },
175}
176
177impl From<ReactionsCreateForTeamDiscussionCommentInOrgError> for AdapterError {
178 fn from(err: ReactionsCreateForTeamDiscussionCommentInOrgError) -> Self {
179 let (description, status_code) = match err {
180 ReactionsCreateForTeamDiscussionCommentInOrgError::Status201(_) => (String::from("Response"), 201),
181 ReactionsCreateForTeamDiscussionCommentInOrgError::Generic { code } => (String::from("Generic"), code)
182 };
183
184 Self::Endpoint {
185 description,
186 status_code,
187 source: Some(Box::new(err))
188 }
189 }
190}
191
192#[derive(Debug, thiserror::Error)]
194pub enum ReactionsCreateForTeamDiscussionCommentLegacyError {
195 #[error("Status code: {}", code)]
196 Generic { code: u16 },
197}
198
199impl From<ReactionsCreateForTeamDiscussionCommentLegacyError> for AdapterError {
200 fn from(err: ReactionsCreateForTeamDiscussionCommentLegacyError) -> Self {
201 let (description, status_code) = match err {
202 ReactionsCreateForTeamDiscussionCommentLegacyError::Generic { code } => (String::from("Generic"), code)
203 };
204
205 Self::Endpoint {
206 description,
207 status_code,
208 source: Some(Box::new(err))
209 }
210 }
211}
212
213#[derive(Debug, thiserror::Error)]
215pub enum ReactionsCreateForTeamDiscussionInOrgError {
216 #[error("Response")]
217 Status201(Reaction),
218 #[error("Status code: {}", code)]
219 Generic { code: u16 },
220}
221
222impl From<ReactionsCreateForTeamDiscussionInOrgError> for AdapterError {
223 fn from(err: ReactionsCreateForTeamDiscussionInOrgError) -> Self {
224 let (description, status_code) = match err {
225 ReactionsCreateForTeamDiscussionInOrgError::Status201(_) => (String::from("Response"), 201),
226 ReactionsCreateForTeamDiscussionInOrgError::Generic { code } => (String::from("Generic"), code)
227 };
228
229 Self::Endpoint {
230 description,
231 status_code,
232 source: Some(Box::new(err))
233 }
234 }
235}
236
237#[derive(Debug, thiserror::Error)]
239pub enum ReactionsCreateForTeamDiscussionLegacyError {
240 #[error("Status code: {}", code)]
241 Generic { code: u16 },
242}
243
244impl From<ReactionsCreateForTeamDiscussionLegacyError> for AdapterError {
245 fn from(err: ReactionsCreateForTeamDiscussionLegacyError) -> Self {
246 let (description, status_code) = match err {
247 ReactionsCreateForTeamDiscussionLegacyError::Generic { code } => (String::from("Generic"), code)
248 };
249
250 Self::Endpoint {
251 description,
252 status_code,
253 source: Some(Box::new(err))
254 }
255 }
256}
257
258#[derive(Debug, thiserror::Error)]
260pub enum ReactionsDeleteForCommitCommentError {
261 #[error("Status code: {}", code)]
262 Generic { code: u16 },
263}
264
265impl From<ReactionsDeleteForCommitCommentError> for AdapterError {
266 fn from(err: ReactionsDeleteForCommitCommentError) -> Self {
267 let (description, status_code) = match err {
268 ReactionsDeleteForCommitCommentError::Generic { code } => (String::from("Generic"), code)
269 };
270
271 Self::Endpoint {
272 description,
273 status_code,
274 source: Some(Box::new(err))
275 }
276 }
277}
278
279#[derive(Debug, thiserror::Error)]
281pub enum ReactionsDeleteForIssueError {
282 #[error("Status code: {}", code)]
283 Generic { code: u16 },
284}
285
286impl From<ReactionsDeleteForIssueError> for AdapterError {
287 fn from(err: ReactionsDeleteForIssueError) -> Self {
288 let (description, status_code) = match err {
289 ReactionsDeleteForIssueError::Generic { code } => (String::from("Generic"), code)
290 };
291
292 Self::Endpoint {
293 description,
294 status_code,
295 source: Some(Box::new(err))
296 }
297 }
298}
299
300#[derive(Debug, thiserror::Error)]
302pub enum ReactionsDeleteForIssueCommentError {
303 #[error("Status code: {}", code)]
304 Generic { code: u16 },
305}
306
307impl From<ReactionsDeleteForIssueCommentError> for AdapterError {
308 fn from(err: ReactionsDeleteForIssueCommentError) -> Self {
309 let (description, status_code) = match err {
310 ReactionsDeleteForIssueCommentError::Generic { code } => (String::from("Generic"), code)
311 };
312
313 Self::Endpoint {
314 description,
315 status_code,
316 source: Some(Box::new(err))
317 }
318 }
319}
320
321#[derive(Debug, thiserror::Error)]
323pub enum ReactionsDeleteForPullRequestCommentError {
324 #[error("Status code: {}", code)]
325 Generic { code: u16 },
326}
327
328impl From<ReactionsDeleteForPullRequestCommentError> for AdapterError {
329 fn from(err: ReactionsDeleteForPullRequestCommentError) -> Self {
330 let (description, status_code) = match err {
331 ReactionsDeleteForPullRequestCommentError::Generic { code } => (String::from("Generic"), code)
332 };
333
334 Self::Endpoint {
335 description,
336 status_code,
337 source: Some(Box::new(err))
338 }
339 }
340}
341
342#[derive(Debug, thiserror::Error)]
344pub enum ReactionsDeleteForReleaseError {
345 #[error("Status code: {}", code)]
346 Generic { code: u16 },
347}
348
349impl From<ReactionsDeleteForReleaseError> for AdapterError {
350 fn from(err: ReactionsDeleteForReleaseError) -> Self {
351 let (description, status_code) = match err {
352 ReactionsDeleteForReleaseError::Generic { code } => (String::from("Generic"), code)
353 };
354
355 Self::Endpoint {
356 description,
357 status_code,
358 source: Some(Box::new(err))
359 }
360 }
361}
362
363#[derive(Debug, thiserror::Error)]
365pub enum ReactionsDeleteForTeamDiscussionError {
366 #[error("Status code: {}", code)]
367 Generic { code: u16 },
368}
369
370impl From<ReactionsDeleteForTeamDiscussionError> for AdapterError {
371 fn from(err: ReactionsDeleteForTeamDiscussionError) -> Self {
372 let (description, status_code) = match err {
373 ReactionsDeleteForTeamDiscussionError::Generic { code } => (String::from("Generic"), code)
374 };
375
376 Self::Endpoint {
377 description,
378 status_code,
379 source: Some(Box::new(err))
380 }
381 }
382}
383
384#[derive(Debug, thiserror::Error)]
386pub enum ReactionsDeleteForTeamDiscussionCommentError {
387 #[error("Status code: {}", code)]
388 Generic { code: u16 },
389}
390
391impl From<ReactionsDeleteForTeamDiscussionCommentError> for AdapterError {
392 fn from(err: ReactionsDeleteForTeamDiscussionCommentError) -> Self {
393 let (description, status_code) = match err {
394 ReactionsDeleteForTeamDiscussionCommentError::Generic { code } => (String::from("Generic"), code)
395 };
396
397 Self::Endpoint {
398 description,
399 status_code,
400 source: Some(Box::new(err))
401 }
402 }
403}
404
405#[derive(Debug, thiserror::Error)]
407pub enum ReactionsListForCommitCommentError {
408 #[error("Resource not found")]
409 Status404(BasicError),
410 #[error("Status code: {}", code)]
411 Generic { code: u16 },
412}
413
414impl From<ReactionsListForCommitCommentError> for AdapterError {
415 fn from(err: ReactionsListForCommitCommentError) -> Self {
416 let (description, status_code) = match err {
417 ReactionsListForCommitCommentError::Status404(_) => (String::from("Resource not found"), 404),
418 ReactionsListForCommitCommentError::Generic { code } => (String::from("Generic"), code)
419 };
420
421 Self::Endpoint {
422 description,
423 status_code,
424 source: Some(Box::new(err))
425 }
426 }
427}
428
429#[derive(Debug, thiserror::Error)]
431pub enum ReactionsListForIssueError {
432 #[error("Resource not found")]
433 Status404(BasicError),
434 #[error("Gone")]
435 Status410(BasicError),
436 #[error("Status code: {}", code)]
437 Generic { code: u16 },
438}
439
440impl From<ReactionsListForIssueError> for AdapterError {
441 fn from(err: ReactionsListForIssueError) -> Self {
442 let (description, status_code) = match err {
443 ReactionsListForIssueError::Status404(_) => (String::from("Resource not found"), 404),
444 ReactionsListForIssueError::Status410(_) => (String::from("Gone"), 410),
445 ReactionsListForIssueError::Generic { code } => (String::from("Generic"), code)
446 };
447
448 Self::Endpoint {
449 description,
450 status_code,
451 source: Some(Box::new(err))
452 }
453 }
454}
455
456#[derive(Debug, thiserror::Error)]
458pub enum ReactionsListForIssueCommentError {
459 #[error("Resource not found")]
460 Status404(BasicError),
461 #[error("Status code: {}", code)]
462 Generic { code: u16 },
463}
464
465impl From<ReactionsListForIssueCommentError> for AdapterError {
466 fn from(err: ReactionsListForIssueCommentError) -> Self {
467 let (description, status_code) = match err {
468 ReactionsListForIssueCommentError::Status404(_) => (String::from("Resource not found"), 404),
469 ReactionsListForIssueCommentError::Generic { code } => (String::from("Generic"), code)
470 };
471
472 Self::Endpoint {
473 description,
474 status_code,
475 source: Some(Box::new(err))
476 }
477 }
478}
479
480#[derive(Debug, thiserror::Error)]
482pub enum ReactionsListForPullRequestReviewCommentError {
483 #[error("Resource not found")]
484 Status404(BasicError),
485 #[error("Status code: {}", code)]
486 Generic { code: u16 },
487}
488
489impl From<ReactionsListForPullRequestReviewCommentError> for AdapterError {
490 fn from(err: ReactionsListForPullRequestReviewCommentError) -> Self {
491 let (description, status_code) = match err {
492 ReactionsListForPullRequestReviewCommentError::Status404(_) => (String::from("Resource not found"), 404),
493 ReactionsListForPullRequestReviewCommentError::Generic { code } => (String::from("Generic"), code)
494 };
495
496 Self::Endpoint {
497 description,
498 status_code,
499 source: Some(Box::new(err))
500 }
501 }
502}
503
504#[derive(Debug, thiserror::Error)]
506pub enum ReactionsListForReleaseError {
507 #[error("Resource not found")]
508 Status404(BasicError),
509 #[error("Status code: {}", code)]
510 Generic { code: u16 },
511}
512
513impl From<ReactionsListForReleaseError> for AdapterError {
514 fn from(err: ReactionsListForReleaseError) -> Self {
515 let (description, status_code) = match err {
516 ReactionsListForReleaseError::Status404(_) => (String::from("Resource not found"), 404),
517 ReactionsListForReleaseError::Generic { code } => (String::from("Generic"), code)
518 };
519
520 Self::Endpoint {
521 description,
522 status_code,
523 source: Some(Box::new(err))
524 }
525 }
526}
527
528#[derive(Debug, thiserror::Error)]
530pub enum ReactionsListForTeamDiscussionCommentInOrgError {
531 #[error("Status code: {}", code)]
532 Generic { code: u16 },
533}
534
535impl From<ReactionsListForTeamDiscussionCommentInOrgError> for AdapterError {
536 fn from(err: ReactionsListForTeamDiscussionCommentInOrgError) -> Self {
537 let (description, status_code) = match err {
538 ReactionsListForTeamDiscussionCommentInOrgError::Generic { code } => (String::from("Generic"), code)
539 };
540
541 Self::Endpoint {
542 description,
543 status_code,
544 source: Some(Box::new(err))
545 }
546 }
547}
548
549#[derive(Debug, thiserror::Error)]
551pub enum ReactionsListForTeamDiscussionCommentLegacyError {
552 #[error("Status code: {}", code)]
553 Generic { code: u16 },
554}
555
556impl From<ReactionsListForTeamDiscussionCommentLegacyError> for AdapterError {
557 fn from(err: ReactionsListForTeamDiscussionCommentLegacyError) -> Self {
558 let (description, status_code) = match err {
559 ReactionsListForTeamDiscussionCommentLegacyError::Generic { code } => (String::from("Generic"), code)
560 };
561
562 Self::Endpoint {
563 description,
564 status_code,
565 source: Some(Box::new(err))
566 }
567 }
568}
569
570#[derive(Debug, thiserror::Error)]
572pub enum ReactionsListForTeamDiscussionInOrgError {
573 #[error("Status code: {}", code)]
574 Generic { code: u16 },
575}
576
577impl From<ReactionsListForTeamDiscussionInOrgError> for AdapterError {
578 fn from(err: ReactionsListForTeamDiscussionInOrgError) -> Self {
579 let (description, status_code) = match err {
580 ReactionsListForTeamDiscussionInOrgError::Generic { code } => (String::from("Generic"), code)
581 };
582
583 Self::Endpoint {
584 description,
585 status_code,
586 source: Some(Box::new(err))
587 }
588 }
589}
590
591#[derive(Debug, thiserror::Error)]
593pub enum ReactionsListForTeamDiscussionLegacyError {
594 #[error("Status code: {}", code)]
595 Generic { code: u16 },
596}
597
598impl From<ReactionsListForTeamDiscussionLegacyError> for AdapterError {
599 fn from(err: ReactionsListForTeamDiscussionLegacyError) -> Self {
600 let (description, status_code) = match err {
601 ReactionsListForTeamDiscussionLegacyError::Generic { code } => (String::from("Generic"), code)
602 };
603
604 Self::Endpoint {
605 description,
606 status_code,
607 source: Some(Box::new(err))
608 }
609 }
610}
611
612
613#[derive(Default, Serialize)]
615pub struct ReactionsListForCommitCommentParams<'req> {
616 content: Option<&'req str>,
618 per_page: Option<u16>,
620 page: Option<u16>
622}
623
624impl<'req> ReactionsListForCommitCommentParams<'req> {
625 pub fn new() -> Self {
626 Self::default()
627 }
628
629 pub fn content(self, content: &'req str) -> Self {
631 Self {
632 content: Some(content),
633 per_page: self.per_page,
634 page: self.page,
635 }
636 }
637
638 pub fn per_page(self, per_page: u16) -> Self {
640 Self {
641 content: self.content,
642 per_page: Some(per_page),
643 page: self.page,
644 }
645 }
646
647 pub fn page(self, page: u16) -> Self {
649 Self {
650 content: self.content,
651 per_page: self.per_page,
652 page: Some(page),
653 }
654 }
655}
656
657impl<'enc> From<&'enc PerPage> for ReactionsListForCommitCommentParams<'enc> {
658 fn from(per_page: &'enc PerPage) -> Self {
659 Self {
660 per_page: Some(per_page.per_page),
661 page: Some(per_page.page),
662 ..Default::default()
663 }
664 }
665}
666#[derive(Default, Serialize)]
668pub struct ReactionsListForIssueParams<'req> {
669 content: Option<&'req str>,
671 per_page: Option<u16>,
673 page: Option<u16>
675}
676
677impl<'req> ReactionsListForIssueParams<'req> {
678 pub fn new() -> Self {
679 Self::default()
680 }
681
682 pub fn content(self, content: &'req str) -> Self {
684 Self {
685 content: Some(content),
686 per_page: self.per_page,
687 page: self.page,
688 }
689 }
690
691 pub fn per_page(self, per_page: u16) -> Self {
693 Self {
694 content: self.content,
695 per_page: Some(per_page),
696 page: self.page,
697 }
698 }
699
700 pub fn page(self, page: u16) -> Self {
702 Self {
703 content: self.content,
704 per_page: self.per_page,
705 page: Some(page),
706 }
707 }
708}
709
710impl<'enc> From<&'enc PerPage> for ReactionsListForIssueParams<'enc> {
711 fn from(per_page: &'enc PerPage) -> Self {
712 Self {
713 per_page: Some(per_page.per_page),
714 page: Some(per_page.page),
715 ..Default::default()
716 }
717 }
718}
719#[derive(Default, Serialize)]
721pub struct ReactionsListForIssueCommentParams<'req> {
722 content: Option<&'req str>,
724 per_page: Option<u16>,
726 page: Option<u16>
728}
729
730impl<'req> ReactionsListForIssueCommentParams<'req> {
731 pub fn new() -> Self {
732 Self::default()
733 }
734
735 pub fn content(self, content: &'req str) -> Self {
737 Self {
738 content: Some(content),
739 per_page: self.per_page,
740 page: self.page,
741 }
742 }
743
744 pub fn per_page(self, per_page: u16) -> Self {
746 Self {
747 content: self.content,
748 per_page: Some(per_page),
749 page: self.page,
750 }
751 }
752
753 pub fn page(self, page: u16) -> Self {
755 Self {
756 content: self.content,
757 per_page: self.per_page,
758 page: Some(page),
759 }
760 }
761}
762
763impl<'enc> From<&'enc PerPage> for ReactionsListForIssueCommentParams<'enc> {
764 fn from(per_page: &'enc PerPage) -> Self {
765 Self {
766 per_page: Some(per_page.per_page),
767 page: Some(per_page.page),
768 ..Default::default()
769 }
770 }
771}
772#[derive(Default, Serialize)]
774pub struct ReactionsListForPullRequestReviewCommentParams<'req> {
775 content: Option<&'req str>,
777 per_page: Option<u16>,
779 page: Option<u16>
781}
782
783impl<'req> ReactionsListForPullRequestReviewCommentParams<'req> {
784 pub fn new() -> Self {
785 Self::default()
786 }
787
788 pub fn content(self, content: &'req str) -> Self {
790 Self {
791 content: Some(content),
792 per_page: self.per_page,
793 page: self.page,
794 }
795 }
796
797 pub fn per_page(self, per_page: u16) -> Self {
799 Self {
800 content: self.content,
801 per_page: Some(per_page),
802 page: self.page,
803 }
804 }
805
806 pub fn page(self, page: u16) -> Self {
808 Self {
809 content: self.content,
810 per_page: self.per_page,
811 page: Some(page),
812 }
813 }
814}
815
816impl<'enc> From<&'enc PerPage> for ReactionsListForPullRequestReviewCommentParams<'enc> {
817 fn from(per_page: &'enc PerPage) -> Self {
818 Self {
819 per_page: Some(per_page.per_page),
820 page: Some(per_page.page),
821 ..Default::default()
822 }
823 }
824}
825#[derive(Default, Serialize)]
827pub struct ReactionsListForReleaseParams<'req> {
828 content: Option<&'req str>,
830 per_page: Option<u16>,
832 page: Option<u16>
834}
835
836impl<'req> ReactionsListForReleaseParams<'req> {
837 pub fn new() -> Self {
838 Self::default()
839 }
840
841 pub fn content(self, content: &'req str) -> Self {
843 Self {
844 content: Some(content),
845 per_page: self.per_page,
846 page: self.page,
847 }
848 }
849
850 pub fn per_page(self, per_page: u16) -> Self {
852 Self {
853 content: self.content,
854 per_page: Some(per_page),
855 page: self.page,
856 }
857 }
858
859 pub fn page(self, page: u16) -> Self {
861 Self {
862 content: self.content,
863 per_page: self.per_page,
864 page: Some(page),
865 }
866 }
867}
868
869impl<'enc> From<&'enc PerPage> for ReactionsListForReleaseParams<'enc> {
870 fn from(per_page: &'enc PerPage) -> Self {
871 Self {
872 per_page: Some(per_page.per_page),
873 page: Some(per_page.page),
874 ..Default::default()
875 }
876 }
877}
878#[derive(Default, Serialize)]
880pub struct ReactionsListForTeamDiscussionCommentInOrgParams<'req> {
881 content: Option<&'req str>,
883 per_page: Option<u16>,
885 page: Option<u16>
887}
888
889impl<'req> ReactionsListForTeamDiscussionCommentInOrgParams<'req> {
890 pub fn new() -> Self {
891 Self::default()
892 }
893
894 pub fn content(self, content: &'req str) -> Self {
896 Self {
897 content: Some(content),
898 per_page: self.per_page,
899 page: self.page,
900 }
901 }
902
903 pub fn per_page(self, per_page: u16) -> Self {
905 Self {
906 content: self.content,
907 per_page: Some(per_page),
908 page: self.page,
909 }
910 }
911
912 pub fn page(self, page: u16) -> Self {
914 Self {
915 content: self.content,
916 per_page: self.per_page,
917 page: Some(page),
918 }
919 }
920}
921
922impl<'enc> From<&'enc PerPage> for ReactionsListForTeamDiscussionCommentInOrgParams<'enc> {
923 fn from(per_page: &'enc PerPage) -> Self {
924 Self {
925 per_page: Some(per_page.per_page),
926 page: Some(per_page.page),
927 ..Default::default()
928 }
929 }
930}
931#[derive(Default, Serialize)]
933pub struct ReactionsListForTeamDiscussionCommentLegacyParams<'req> {
934 content: Option<&'req str>,
936 per_page: Option<u16>,
938 page: Option<u16>
940}
941
942impl<'req> ReactionsListForTeamDiscussionCommentLegacyParams<'req> {
943 pub fn new() -> Self {
944 Self::default()
945 }
946
947 pub fn content(self, content: &'req str) -> Self {
949 Self {
950 content: Some(content),
951 per_page: self.per_page,
952 page: self.page,
953 }
954 }
955
956 pub fn per_page(self, per_page: u16) -> Self {
958 Self {
959 content: self.content,
960 per_page: Some(per_page),
961 page: self.page,
962 }
963 }
964
965 pub fn page(self, page: u16) -> Self {
967 Self {
968 content: self.content,
969 per_page: self.per_page,
970 page: Some(page),
971 }
972 }
973}
974
975impl<'enc> From<&'enc PerPage> for ReactionsListForTeamDiscussionCommentLegacyParams<'enc> {
976 fn from(per_page: &'enc PerPage) -> Self {
977 Self {
978 per_page: Some(per_page.per_page),
979 page: Some(per_page.page),
980 ..Default::default()
981 }
982 }
983}
984#[derive(Default, Serialize)]
986pub struct ReactionsListForTeamDiscussionInOrgParams<'req> {
987 content: Option<&'req str>,
989 per_page: Option<u16>,
991 page: Option<u16>
993}
994
995impl<'req> ReactionsListForTeamDiscussionInOrgParams<'req> {
996 pub fn new() -> Self {
997 Self::default()
998 }
999
1000 pub fn content(self, content: &'req str) -> Self {
1002 Self {
1003 content: Some(content),
1004 per_page: self.per_page,
1005 page: self.page,
1006 }
1007 }
1008
1009 pub fn per_page(self, per_page: u16) -> Self {
1011 Self {
1012 content: self.content,
1013 per_page: Some(per_page),
1014 page: self.page,
1015 }
1016 }
1017
1018 pub fn page(self, page: u16) -> Self {
1020 Self {
1021 content: self.content,
1022 per_page: self.per_page,
1023 page: Some(page),
1024 }
1025 }
1026}
1027
1028impl<'enc> From<&'enc PerPage> for ReactionsListForTeamDiscussionInOrgParams<'enc> {
1029 fn from(per_page: &'enc PerPage) -> Self {
1030 Self {
1031 per_page: Some(per_page.per_page),
1032 page: Some(per_page.page),
1033 ..Default::default()
1034 }
1035 }
1036}
1037#[derive(Default, Serialize)]
1039pub struct ReactionsListForTeamDiscussionLegacyParams<'req> {
1040 content: Option<&'req str>,
1042 per_page: Option<u16>,
1044 page: Option<u16>
1046}
1047
1048impl<'req> ReactionsListForTeamDiscussionLegacyParams<'req> {
1049 pub fn new() -> Self {
1050 Self::default()
1051 }
1052
1053 pub fn content(self, content: &'req str) -> Self {
1055 Self {
1056 content: Some(content),
1057 per_page: self.per_page,
1058 page: self.page,
1059 }
1060 }
1061
1062 pub fn per_page(self, per_page: u16) -> Self {
1064 Self {
1065 content: self.content,
1066 per_page: Some(per_page),
1067 page: self.page,
1068 }
1069 }
1070
1071 pub fn page(self, page: u16) -> Self {
1073 Self {
1074 content: self.content,
1075 per_page: self.per_page,
1076 page: Some(page),
1077 }
1078 }
1079}
1080
1081impl<'enc> From<&'enc PerPage> for ReactionsListForTeamDiscussionLegacyParams<'enc> {
1082 fn from(per_page: &'enc PerPage) -> Self {
1083 Self {
1084 per_page: Some(per_page.per_page),
1085 page: Some(per_page.page),
1086 ..Default::default()
1087 }
1088 }
1089}
1090
1091impl<'api, C: Client> Reactions<'api, C> where AdapterError: From<<C as Client>::Err> {
1092 pub async fn create_for_commit_comment_async(&self, owner: &str, repo: &str, comment_id: i64, body: PostReactionsCreateForCommitComment) -> Result<Reaction, AdapterError> {
1102
1103 let request_uri = format!("{}/repos/{}/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
1104
1105
1106 let req = GitHubRequest {
1107 uri: request_uri,
1108 body: Some(C::from_json::<PostReactionsCreateForCommitComment>(body)?),
1109 method: "POST",
1110 headers: vec![]
1111 };
1112
1113 let request = self.client.build(req)?;
1114
1115 let github_response = self.client.fetch_async(request).await?;
1118
1119 if github_response.is_success() {
1122 Ok(github_response.to_json_async().await?)
1123 } else {
1124 match github_response.status_code() {
1125 201 => Err(ReactionsCreateForCommitCommentError::Status201(github_response.to_json_async().await?).into()),
1126 422 => Err(ReactionsCreateForCommitCommentError::Status422(github_response.to_json_async().await?).into()),
1127 code => Err(ReactionsCreateForCommitCommentError::Generic { code }.into()),
1128 }
1129 }
1130 }
1131
1132 #[cfg(not(target_arch = "wasm32"))]
1142 pub fn create_for_commit_comment(&self, owner: &str, repo: &str, comment_id: i64, body: PostReactionsCreateForCommitComment) -> Result<Reaction, AdapterError> {
1143
1144 let request_uri = format!("{}/repos/{}/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
1145
1146
1147 let req = GitHubRequest {
1148 uri: request_uri,
1149 body: Some(C::from_json::<PostReactionsCreateForCommitComment>(body)?),
1150 method: "POST",
1151 headers: vec![]
1152 };
1153
1154 let request = self.client.build(req)?;
1155
1156 let github_response = self.client.fetch(request)?;
1159
1160 if github_response.is_success() {
1163 Ok(github_response.to_json()?)
1164 } else {
1165 match github_response.status_code() {
1166 201 => Err(ReactionsCreateForCommitCommentError::Status201(github_response.to_json()?).into()),
1167 422 => Err(ReactionsCreateForCommitCommentError::Status422(github_response.to_json()?).into()),
1168 code => Err(ReactionsCreateForCommitCommentError::Generic { code }.into()),
1169 }
1170 }
1171 }
1172
1173 pub async fn create_for_issue_async(&self, owner: &str, repo: &str, issue_number: i32, body: PostReactionsCreateForIssue) -> Result<Reaction, AdapterError> {
1183
1184 let request_uri = format!("{}/repos/{}/{}/issues/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, issue_number);
1185
1186
1187 let req = GitHubRequest {
1188 uri: request_uri,
1189 body: Some(C::from_json::<PostReactionsCreateForIssue>(body)?),
1190 method: "POST",
1191 headers: vec![]
1192 };
1193
1194 let request = self.client.build(req)?;
1195
1196 let github_response = self.client.fetch_async(request).await?;
1199
1200 if github_response.is_success() {
1203 Ok(github_response.to_json_async().await?)
1204 } else {
1205 match github_response.status_code() {
1206 201 => Err(ReactionsCreateForIssueError::Status201(github_response.to_json_async().await?).into()),
1207 422 => Err(ReactionsCreateForIssueError::Status422(github_response.to_json_async().await?).into()),
1208 code => Err(ReactionsCreateForIssueError::Generic { code }.into()),
1209 }
1210 }
1211 }
1212
1213 #[cfg(not(target_arch = "wasm32"))]
1223 pub fn create_for_issue(&self, owner: &str, repo: &str, issue_number: i32, body: PostReactionsCreateForIssue) -> Result<Reaction, AdapterError> {
1224
1225 let request_uri = format!("{}/repos/{}/{}/issues/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, issue_number);
1226
1227
1228 let req = GitHubRequest {
1229 uri: request_uri,
1230 body: Some(C::from_json::<PostReactionsCreateForIssue>(body)?),
1231 method: "POST",
1232 headers: vec![]
1233 };
1234
1235 let request = self.client.build(req)?;
1236
1237 let github_response = self.client.fetch(request)?;
1240
1241 if github_response.is_success() {
1244 Ok(github_response.to_json()?)
1245 } else {
1246 match github_response.status_code() {
1247 201 => Err(ReactionsCreateForIssueError::Status201(github_response.to_json()?).into()),
1248 422 => Err(ReactionsCreateForIssueError::Status422(github_response.to_json()?).into()),
1249 code => Err(ReactionsCreateForIssueError::Generic { code }.into()),
1250 }
1251 }
1252 }
1253
1254 pub async fn create_for_issue_comment_async(&self, owner: &str, repo: &str, comment_id: i64, body: PostReactionsCreateForIssueComment) -> Result<Reaction, AdapterError> {
1264
1265 let request_uri = format!("{}/repos/{}/{}/issues/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
1266
1267
1268 let req = GitHubRequest {
1269 uri: request_uri,
1270 body: Some(C::from_json::<PostReactionsCreateForIssueComment>(body)?),
1271 method: "POST",
1272 headers: vec![]
1273 };
1274
1275 let request = self.client.build(req)?;
1276
1277 let github_response = self.client.fetch_async(request).await?;
1280
1281 if github_response.is_success() {
1284 Ok(github_response.to_json_async().await?)
1285 } else {
1286 match github_response.status_code() {
1287 201 => Err(ReactionsCreateForIssueCommentError::Status201(github_response.to_json_async().await?).into()),
1288 422 => Err(ReactionsCreateForIssueCommentError::Status422(github_response.to_json_async().await?).into()),
1289 code => Err(ReactionsCreateForIssueCommentError::Generic { code }.into()),
1290 }
1291 }
1292 }
1293
1294 #[cfg(not(target_arch = "wasm32"))]
1304 pub fn create_for_issue_comment(&self, owner: &str, repo: &str, comment_id: i64, body: PostReactionsCreateForIssueComment) -> Result<Reaction, AdapterError> {
1305
1306 let request_uri = format!("{}/repos/{}/{}/issues/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
1307
1308
1309 let req = GitHubRequest {
1310 uri: request_uri,
1311 body: Some(C::from_json::<PostReactionsCreateForIssueComment>(body)?),
1312 method: "POST",
1313 headers: vec![]
1314 };
1315
1316 let request = self.client.build(req)?;
1317
1318 let github_response = self.client.fetch(request)?;
1321
1322 if github_response.is_success() {
1325 Ok(github_response.to_json()?)
1326 } else {
1327 match github_response.status_code() {
1328 201 => Err(ReactionsCreateForIssueCommentError::Status201(github_response.to_json()?).into()),
1329 422 => Err(ReactionsCreateForIssueCommentError::Status422(github_response.to_json()?).into()),
1330 code => Err(ReactionsCreateForIssueCommentError::Generic { code }.into()),
1331 }
1332 }
1333 }
1334
1335 pub async fn create_for_pull_request_review_comment_async(&self, owner: &str, repo: &str, comment_id: i64, body: PostReactionsCreateForPullRequestReviewComment) -> Result<Reaction, AdapterError> {
1345
1346 let request_uri = format!("{}/repos/{}/{}/pulls/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
1347
1348
1349 let req = GitHubRequest {
1350 uri: request_uri,
1351 body: Some(C::from_json::<PostReactionsCreateForPullRequestReviewComment>(body)?),
1352 method: "POST",
1353 headers: vec![]
1354 };
1355
1356 let request = self.client.build(req)?;
1357
1358 let github_response = self.client.fetch_async(request).await?;
1361
1362 if github_response.is_success() {
1365 Ok(github_response.to_json_async().await?)
1366 } else {
1367 match github_response.status_code() {
1368 201 => Err(ReactionsCreateForPullRequestReviewCommentError::Status201(github_response.to_json_async().await?).into()),
1369 422 => Err(ReactionsCreateForPullRequestReviewCommentError::Status422(github_response.to_json_async().await?).into()),
1370 code => Err(ReactionsCreateForPullRequestReviewCommentError::Generic { code }.into()),
1371 }
1372 }
1373 }
1374
1375 #[cfg(not(target_arch = "wasm32"))]
1385 pub fn create_for_pull_request_review_comment(&self, owner: &str, repo: &str, comment_id: i64, body: PostReactionsCreateForPullRequestReviewComment) -> Result<Reaction, AdapterError> {
1386
1387 let request_uri = format!("{}/repos/{}/{}/pulls/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
1388
1389
1390 let req = GitHubRequest {
1391 uri: request_uri,
1392 body: Some(C::from_json::<PostReactionsCreateForPullRequestReviewComment>(body)?),
1393 method: "POST",
1394 headers: vec![]
1395 };
1396
1397 let request = self.client.build(req)?;
1398
1399 let github_response = self.client.fetch(request)?;
1402
1403 if github_response.is_success() {
1406 Ok(github_response.to_json()?)
1407 } else {
1408 match github_response.status_code() {
1409 201 => Err(ReactionsCreateForPullRequestReviewCommentError::Status201(github_response.to_json()?).into()),
1410 422 => Err(ReactionsCreateForPullRequestReviewCommentError::Status422(github_response.to_json()?).into()),
1411 code => Err(ReactionsCreateForPullRequestReviewCommentError::Generic { code }.into()),
1412 }
1413 }
1414 }
1415
1416 pub async fn create_for_release_async(&self, owner: &str, repo: &str, release_id: i32, body: PostReactionsCreateForRelease) -> Result<Reaction, AdapterError> {
1426
1427 let request_uri = format!("{}/repos/{}/{}/releases/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, release_id);
1428
1429
1430 let req = GitHubRequest {
1431 uri: request_uri,
1432 body: Some(C::from_json::<PostReactionsCreateForRelease>(body)?),
1433 method: "POST",
1434 headers: vec![]
1435 };
1436
1437 let request = self.client.build(req)?;
1438
1439 let github_response = self.client.fetch_async(request).await?;
1442
1443 if github_response.is_success() {
1446 Ok(github_response.to_json_async().await?)
1447 } else {
1448 match github_response.status_code() {
1449 201 => Err(ReactionsCreateForReleaseError::Status201(github_response.to_json_async().await?).into()),
1450 422 => Err(ReactionsCreateForReleaseError::Status422(github_response.to_json_async().await?).into()),
1451 code => Err(ReactionsCreateForReleaseError::Generic { code }.into()),
1452 }
1453 }
1454 }
1455
1456 #[cfg(not(target_arch = "wasm32"))]
1466 pub fn create_for_release(&self, owner: &str, repo: &str, release_id: i32, body: PostReactionsCreateForRelease) -> Result<Reaction, AdapterError> {
1467
1468 let request_uri = format!("{}/repos/{}/{}/releases/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, release_id);
1469
1470
1471 let req = GitHubRequest {
1472 uri: request_uri,
1473 body: Some(C::from_json::<PostReactionsCreateForRelease>(body)?),
1474 method: "POST",
1475 headers: vec![]
1476 };
1477
1478 let request = self.client.build(req)?;
1479
1480 let github_response = self.client.fetch(request)?;
1483
1484 if github_response.is_success() {
1487 Ok(github_response.to_json()?)
1488 } else {
1489 match github_response.status_code() {
1490 201 => Err(ReactionsCreateForReleaseError::Status201(github_response.to_json()?).into()),
1491 422 => Err(ReactionsCreateForReleaseError::Status422(github_response.to_json()?).into()),
1492 code => Err(ReactionsCreateForReleaseError::Generic { code }.into()),
1493 }
1494 }
1495 }
1496
1497 pub async fn create_for_team_discussion_comment_in_org_async(&self, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, body: PostReactionsCreateForTeamDiscussionCommentInOrg) -> Result<Reaction, AdapterError> {
1514
1515 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, comment_number);
1516
1517
1518 let req = GitHubRequest {
1519 uri: request_uri,
1520 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionCommentInOrg>(body)?),
1521 method: "POST",
1522 headers: vec![]
1523 };
1524
1525 let request = self.client.build(req)?;
1526
1527 let github_response = self.client.fetch_async(request).await?;
1530
1531 if github_response.is_success() {
1534 Ok(github_response.to_json_async().await?)
1535 } else {
1536 match github_response.status_code() {
1537 201 => Err(ReactionsCreateForTeamDiscussionCommentInOrgError::Status201(github_response.to_json_async().await?).into()),
1538 code => Err(ReactionsCreateForTeamDiscussionCommentInOrgError::Generic { code }.into()),
1539 }
1540 }
1541 }
1542
1543 #[cfg(not(target_arch = "wasm32"))]
1560 pub fn create_for_team_discussion_comment_in_org(&self, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, body: PostReactionsCreateForTeamDiscussionCommentInOrg) -> Result<Reaction, AdapterError> {
1561
1562 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, comment_number);
1563
1564
1565 let req = GitHubRequest {
1566 uri: request_uri,
1567 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionCommentInOrg>(body)?),
1568 method: "POST",
1569 headers: vec![]
1570 };
1571
1572 let request = self.client.build(req)?;
1573
1574 let github_response = self.client.fetch(request)?;
1577
1578 if github_response.is_success() {
1581 Ok(github_response.to_json()?)
1582 } else {
1583 match github_response.status_code() {
1584 201 => Err(ReactionsCreateForTeamDiscussionCommentInOrgError::Status201(github_response.to_json()?).into()),
1585 code => Err(ReactionsCreateForTeamDiscussionCommentInOrgError::Generic { code }.into()),
1586 }
1587 }
1588 }
1589
1590 pub async fn create_for_team_discussion_comment_legacy_async(&self, team_id: i32, discussion_number: i32, comment_number: i32, body: PostReactionsCreateForTeamDiscussionCommentLegacy) -> Result<Reaction, AdapterError> {
1607
1608 let request_uri = format!("{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number, comment_number);
1609
1610
1611 let req = GitHubRequest {
1612 uri: request_uri,
1613 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionCommentLegacy>(body)?),
1614 method: "POST",
1615 headers: vec![]
1616 };
1617
1618 let request = self.client.build(req)?;
1619
1620 let github_response = self.client.fetch_async(request).await?;
1623
1624 if github_response.is_success() {
1627 Ok(github_response.to_json_async().await?)
1628 } else {
1629 match github_response.status_code() {
1630 code => Err(ReactionsCreateForTeamDiscussionCommentLegacyError::Generic { code }.into()),
1631 }
1632 }
1633 }
1634
1635 #[cfg(not(target_arch = "wasm32"))]
1652 pub fn create_for_team_discussion_comment_legacy(&self, team_id: i32, discussion_number: i32, comment_number: i32, body: PostReactionsCreateForTeamDiscussionCommentLegacy) -> Result<Reaction, AdapterError> {
1653
1654 let request_uri = format!("{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number, comment_number);
1655
1656
1657 let req = GitHubRequest {
1658 uri: request_uri,
1659 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionCommentLegacy>(body)?),
1660 method: "POST",
1661 headers: vec![]
1662 };
1663
1664 let request = self.client.build(req)?;
1665
1666 let github_response = self.client.fetch(request)?;
1669
1670 if github_response.is_success() {
1673 Ok(github_response.to_json()?)
1674 } else {
1675 match github_response.status_code() {
1676 code => Err(ReactionsCreateForTeamDiscussionCommentLegacyError::Generic { code }.into()),
1677 }
1678 }
1679 }
1680
1681 pub async fn create_for_team_discussion_in_org_async(&self, org: &str, team_slug: &str, discussion_number: i32, body: PostReactionsCreateForTeamDiscussionInOrg) -> Result<Reaction, AdapterError> {
1698
1699 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number);
1700
1701
1702 let req = GitHubRequest {
1703 uri: request_uri,
1704 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionInOrg>(body)?),
1705 method: "POST",
1706 headers: vec![]
1707 };
1708
1709 let request = self.client.build(req)?;
1710
1711 let github_response = self.client.fetch_async(request).await?;
1714
1715 if github_response.is_success() {
1718 Ok(github_response.to_json_async().await?)
1719 } else {
1720 match github_response.status_code() {
1721 201 => Err(ReactionsCreateForTeamDiscussionInOrgError::Status201(github_response.to_json_async().await?).into()),
1722 code => Err(ReactionsCreateForTeamDiscussionInOrgError::Generic { code }.into()),
1723 }
1724 }
1725 }
1726
1727 #[cfg(not(target_arch = "wasm32"))]
1744 pub fn create_for_team_discussion_in_org(&self, org: &str, team_slug: &str, discussion_number: i32, body: PostReactionsCreateForTeamDiscussionInOrg) -> Result<Reaction, AdapterError> {
1745
1746 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number);
1747
1748
1749 let req = GitHubRequest {
1750 uri: request_uri,
1751 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionInOrg>(body)?),
1752 method: "POST",
1753 headers: vec![]
1754 };
1755
1756 let request = self.client.build(req)?;
1757
1758 let github_response = self.client.fetch(request)?;
1761
1762 if github_response.is_success() {
1765 Ok(github_response.to_json()?)
1766 } else {
1767 match github_response.status_code() {
1768 201 => Err(ReactionsCreateForTeamDiscussionInOrgError::Status201(github_response.to_json()?).into()),
1769 code => Err(ReactionsCreateForTeamDiscussionInOrgError::Generic { code }.into()),
1770 }
1771 }
1772 }
1773
1774 pub async fn create_for_team_discussion_legacy_async(&self, team_id: i32, discussion_number: i32, body: PostReactionsCreateForTeamDiscussionLegacy) -> Result<Reaction, AdapterError> {
1791
1792 let request_uri = format!("{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number);
1793
1794
1795 let req = GitHubRequest {
1796 uri: request_uri,
1797 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionLegacy>(body)?),
1798 method: "POST",
1799 headers: vec![]
1800 };
1801
1802 let request = self.client.build(req)?;
1803
1804 let github_response = self.client.fetch_async(request).await?;
1807
1808 if github_response.is_success() {
1811 Ok(github_response.to_json_async().await?)
1812 } else {
1813 match github_response.status_code() {
1814 code => Err(ReactionsCreateForTeamDiscussionLegacyError::Generic { code }.into()),
1815 }
1816 }
1817 }
1818
1819 #[cfg(not(target_arch = "wasm32"))]
1836 pub fn create_for_team_discussion_legacy(&self, team_id: i32, discussion_number: i32, body: PostReactionsCreateForTeamDiscussionLegacy) -> Result<Reaction, AdapterError> {
1837
1838 let request_uri = format!("{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number);
1839
1840
1841 let req = GitHubRequest {
1842 uri: request_uri,
1843 body: Some(C::from_json::<PostReactionsCreateForTeamDiscussionLegacy>(body)?),
1844 method: "POST",
1845 headers: vec![]
1846 };
1847
1848 let request = self.client.build(req)?;
1849
1850 let github_response = self.client.fetch(request)?;
1853
1854 if github_response.is_success() {
1857 Ok(github_response.to_json()?)
1858 } else {
1859 match github_response.status_code() {
1860 code => Err(ReactionsCreateForTeamDiscussionLegacyError::Generic { code }.into()),
1861 }
1862 }
1863 }
1864
1865 pub async fn delete_for_commit_comment_async(&self, owner: &str, repo: &str, comment_id: i64, reaction_id: i32) -> Result<(), AdapterError> {
1878
1879 let request_uri = format!("{}/repos/{}/{}/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, comment_id, reaction_id);
1880
1881
1882 let req = GitHubRequest {
1883 uri: request_uri,
1884 body: None::<C::Body>,
1885 method: "DELETE",
1886 headers: vec![]
1887 };
1888
1889 let request = self.client.build(req)?;
1890
1891 let github_response = self.client.fetch_async(request).await?;
1894
1895 if github_response.is_success() {
1898 Ok(())
1899 } else {
1900 match github_response.status_code() {
1901 code => Err(ReactionsDeleteForCommitCommentError::Generic { code }.into()),
1902 }
1903 }
1904 }
1905
1906 #[cfg(not(target_arch = "wasm32"))]
1919 pub fn delete_for_commit_comment(&self, owner: &str, repo: &str, comment_id: i64, reaction_id: i32) -> Result<(), AdapterError> {
1920
1921 let request_uri = format!("{}/repos/{}/{}/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, comment_id, reaction_id);
1922
1923
1924 let req = GitHubRequest {
1925 uri: request_uri,
1926 body: None,
1927 method: "DELETE",
1928 headers: vec![]
1929 };
1930
1931 let request = self.client.build(req)?;
1932
1933 let github_response = self.client.fetch(request)?;
1936
1937 if github_response.is_success() {
1940 Ok(())
1941 } else {
1942 match github_response.status_code() {
1943 code => Err(ReactionsDeleteForCommitCommentError::Generic { code }.into()),
1944 }
1945 }
1946 }
1947
1948 pub async fn delete_for_issue_async(&self, owner: &str, repo: &str, issue_number: i32, reaction_id: i32) -> Result<(), AdapterError> {
1961
1962 let request_uri = format!("{}/repos/{}/{}/issues/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, issue_number, reaction_id);
1963
1964
1965 let req = GitHubRequest {
1966 uri: request_uri,
1967 body: None::<C::Body>,
1968 method: "DELETE",
1969 headers: vec![]
1970 };
1971
1972 let request = self.client.build(req)?;
1973
1974 let github_response = self.client.fetch_async(request).await?;
1977
1978 if github_response.is_success() {
1981 Ok(())
1982 } else {
1983 match github_response.status_code() {
1984 code => Err(ReactionsDeleteForIssueError::Generic { code }.into()),
1985 }
1986 }
1987 }
1988
1989 #[cfg(not(target_arch = "wasm32"))]
2002 pub fn delete_for_issue(&self, owner: &str, repo: &str, issue_number: i32, reaction_id: i32) -> Result<(), AdapterError> {
2003
2004 let request_uri = format!("{}/repos/{}/{}/issues/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, issue_number, reaction_id);
2005
2006
2007 let req = GitHubRequest {
2008 uri: request_uri,
2009 body: None,
2010 method: "DELETE",
2011 headers: vec![]
2012 };
2013
2014 let request = self.client.build(req)?;
2015
2016 let github_response = self.client.fetch(request)?;
2019
2020 if github_response.is_success() {
2023 Ok(())
2024 } else {
2025 match github_response.status_code() {
2026 code => Err(ReactionsDeleteForIssueError::Generic { code }.into()),
2027 }
2028 }
2029 }
2030
2031 pub async fn delete_for_issue_comment_async(&self, owner: &str, repo: &str, comment_id: i64, reaction_id: i32) -> Result<(), AdapterError> {
2044
2045 let request_uri = format!("{}/repos/{}/{}/issues/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, comment_id, reaction_id);
2046
2047
2048 let req = GitHubRequest {
2049 uri: request_uri,
2050 body: None::<C::Body>,
2051 method: "DELETE",
2052 headers: vec![]
2053 };
2054
2055 let request = self.client.build(req)?;
2056
2057 let github_response = self.client.fetch_async(request).await?;
2060
2061 if github_response.is_success() {
2064 Ok(())
2065 } else {
2066 match github_response.status_code() {
2067 code => Err(ReactionsDeleteForIssueCommentError::Generic { code }.into()),
2068 }
2069 }
2070 }
2071
2072 #[cfg(not(target_arch = "wasm32"))]
2085 pub fn delete_for_issue_comment(&self, owner: &str, repo: &str, comment_id: i64, reaction_id: i32) -> Result<(), AdapterError> {
2086
2087 let request_uri = format!("{}/repos/{}/{}/issues/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, comment_id, reaction_id);
2088
2089
2090 let req = GitHubRequest {
2091 uri: request_uri,
2092 body: None,
2093 method: "DELETE",
2094 headers: vec![]
2095 };
2096
2097 let request = self.client.build(req)?;
2098
2099 let github_response = self.client.fetch(request)?;
2102
2103 if github_response.is_success() {
2106 Ok(())
2107 } else {
2108 match github_response.status_code() {
2109 code => Err(ReactionsDeleteForIssueCommentError::Generic { code }.into()),
2110 }
2111 }
2112 }
2113
2114 pub async fn delete_for_pull_request_comment_async(&self, owner: &str, repo: &str, comment_id: i64, reaction_id: i32) -> Result<(), AdapterError> {
2127
2128 let request_uri = format!("{}/repos/{}/{}/pulls/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, comment_id, reaction_id);
2129
2130
2131 let req = GitHubRequest {
2132 uri: request_uri,
2133 body: None::<C::Body>,
2134 method: "DELETE",
2135 headers: vec![]
2136 };
2137
2138 let request = self.client.build(req)?;
2139
2140 let github_response = self.client.fetch_async(request).await?;
2143
2144 if github_response.is_success() {
2147 Ok(())
2148 } else {
2149 match github_response.status_code() {
2150 code => Err(ReactionsDeleteForPullRequestCommentError::Generic { code }.into()),
2151 }
2152 }
2153 }
2154
2155 #[cfg(not(target_arch = "wasm32"))]
2168 pub fn delete_for_pull_request_comment(&self, owner: &str, repo: &str, comment_id: i64, reaction_id: i32) -> Result<(), AdapterError> {
2169
2170 let request_uri = format!("{}/repos/{}/{}/pulls/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, comment_id, reaction_id);
2171
2172
2173 let req = GitHubRequest {
2174 uri: request_uri,
2175 body: None,
2176 method: "DELETE",
2177 headers: vec![]
2178 };
2179
2180 let request = self.client.build(req)?;
2181
2182 let github_response = self.client.fetch(request)?;
2185
2186 if github_response.is_success() {
2189 Ok(())
2190 } else {
2191 match github_response.status_code() {
2192 code => Err(ReactionsDeleteForPullRequestCommentError::Generic { code }.into()),
2193 }
2194 }
2195 }
2196
2197 pub async fn delete_for_release_async(&self, owner: &str, repo: &str, release_id: i32, reaction_id: i32) -> Result<(), AdapterError> {
2210
2211 let request_uri = format!("{}/repos/{}/{}/releases/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, release_id, reaction_id);
2212
2213
2214 let req = GitHubRequest {
2215 uri: request_uri,
2216 body: None::<C::Body>,
2217 method: "DELETE",
2218 headers: vec![]
2219 };
2220
2221 let request = self.client.build(req)?;
2222
2223 let github_response = self.client.fetch_async(request).await?;
2226
2227 if github_response.is_success() {
2230 Ok(())
2231 } else {
2232 match github_response.status_code() {
2233 code => Err(ReactionsDeleteForReleaseError::Generic { code }.into()),
2234 }
2235 }
2236 }
2237
2238 #[cfg(not(target_arch = "wasm32"))]
2251 pub fn delete_for_release(&self, owner: &str, repo: &str, release_id: i32, reaction_id: i32) -> Result<(), AdapterError> {
2252
2253 let request_uri = format!("{}/repos/{}/{}/releases/{}/reactions/{}", super::GITHUB_BASE_API_URL, owner, repo, release_id, reaction_id);
2254
2255
2256 let req = GitHubRequest {
2257 uri: request_uri,
2258 body: None,
2259 method: "DELETE",
2260 headers: vec![]
2261 };
2262
2263 let request = self.client.build(req)?;
2264
2265 let github_response = self.client.fetch(request)?;
2268
2269 if github_response.is_success() {
2272 Ok(())
2273 } else {
2274 match github_response.status_code() {
2275 code => Err(ReactionsDeleteForReleaseError::Generic { code }.into()),
2276 }
2277 }
2278 }
2279
2280 pub async fn delete_for_team_discussion_async(&self, org: &str, team_slug: &str, discussion_number: i32, reaction_id: i32) -> Result<(), AdapterError> {
2295
2296 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/reactions/{}", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, reaction_id);
2297
2298
2299 let req = GitHubRequest {
2300 uri: request_uri,
2301 body: None::<C::Body>,
2302 method: "DELETE",
2303 headers: vec![]
2304 };
2305
2306 let request = self.client.build(req)?;
2307
2308 let github_response = self.client.fetch_async(request).await?;
2311
2312 if github_response.is_success() {
2315 Ok(())
2316 } else {
2317 match github_response.status_code() {
2318 code => Err(ReactionsDeleteForTeamDiscussionError::Generic { code }.into()),
2319 }
2320 }
2321 }
2322
2323 #[cfg(not(target_arch = "wasm32"))]
2338 pub fn delete_for_team_discussion(&self, org: &str, team_slug: &str, discussion_number: i32, reaction_id: i32) -> Result<(), AdapterError> {
2339
2340 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/reactions/{}", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, reaction_id);
2341
2342
2343 let req = GitHubRequest {
2344 uri: request_uri,
2345 body: None,
2346 method: "DELETE",
2347 headers: vec![]
2348 };
2349
2350 let request = self.client.build(req)?;
2351
2352 let github_response = self.client.fetch(request)?;
2355
2356 if github_response.is_success() {
2359 Ok(())
2360 } else {
2361 match github_response.status_code() {
2362 code => Err(ReactionsDeleteForTeamDiscussionError::Generic { code }.into()),
2363 }
2364 }
2365 }
2366
2367 pub async fn delete_for_team_discussion_comment_async(&self, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, reaction_id: i32) -> Result<(), AdapterError> {
2382
2383 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, comment_number, reaction_id);
2384
2385
2386 let req = GitHubRequest {
2387 uri: request_uri,
2388 body: None::<C::Body>,
2389 method: "DELETE",
2390 headers: vec![]
2391 };
2392
2393 let request = self.client.build(req)?;
2394
2395 let github_response = self.client.fetch_async(request).await?;
2398
2399 if github_response.is_success() {
2402 Ok(())
2403 } else {
2404 match github_response.status_code() {
2405 code => Err(ReactionsDeleteForTeamDiscussionCommentError::Generic { code }.into()),
2406 }
2407 }
2408 }
2409
2410 #[cfg(not(target_arch = "wasm32"))]
2425 pub fn delete_for_team_discussion_comment(&self, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, reaction_id: i32) -> Result<(), AdapterError> {
2426
2427 let request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/comments/{}/reactions/{}", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, comment_number, reaction_id);
2428
2429
2430 let req = GitHubRequest {
2431 uri: request_uri,
2432 body: None,
2433 method: "DELETE",
2434 headers: vec![]
2435 };
2436
2437 let request = self.client.build(req)?;
2438
2439 let github_response = self.client.fetch(request)?;
2442
2443 if github_response.is_success() {
2446 Ok(())
2447 } else {
2448 match github_response.status_code() {
2449 code => Err(ReactionsDeleteForTeamDiscussionCommentError::Generic { code }.into()),
2450 }
2451 }
2452 }
2453
2454 pub async fn list_for_commit_comment_async(&self, owner: &str, repo: &str, comment_id: i64, query_params: Option<impl Into<ReactionsListForCommitCommentParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2464
2465 let mut request_uri = format!("{}/repos/{}/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
2466
2467 if let Some(params) = query_params {
2468 request_uri.push_str("?");
2469 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
2470 }
2471
2472 let req = GitHubRequest {
2473 uri: request_uri,
2474 body: None::<C::Body>,
2475 method: "GET",
2476 headers: vec![]
2477 };
2478
2479 let request = self.client.build(req)?;
2480
2481 let github_response = self.client.fetch_async(request).await?;
2484
2485 if github_response.is_success() {
2488 Ok(github_response.to_json_async().await?)
2489 } else {
2490 match github_response.status_code() {
2491 404 => Err(ReactionsListForCommitCommentError::Status404(github_response.to_json_async().await?).into()),
2492 code => Err(ReactionsListForCommitCommentError::Generic { code }.into()),
2493 }
2494 }
2495 }
2496
2497 #[cfg(not(target_arch = "wasm32"))]
2507 pub fn list_for_commit_comment(&self, owner: &str, repo: &str, comment_id: i64, query_params: Option<impl Into<ReactionsListForCommitCommentParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2508
2509 let mut request_uri = format!("{}/repos/{}/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
2510
2511 if let Some(params) = query_params {
2512 request_uri.push_str("?");
2513 let qp: ReactionsListForCommitCommentParams = params.into();
2514 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
2515 }
2516
2517 let req = GitHubRequest {
2518 uri: request_uri,
2519 body: None,
2520 method: "GET",
2521 headers: vec![]
2522 };
2523
2524 let request = self.client.build(req)?;
2525
2526 let github_response = self.client.fetch(request)?;
2529
2530 if github_response.is_success() {
2533 Ok(github_response.to_json()?)
2534 } else {
2535 match github_response.status_code() {
2536 404 => Err(ReactionsListForCommitCommentError::Status404(github_response.to_json()?).into()),
2537 code => Err(ReactionsListForCommitCommentError::Generic { code }.into()),
2538 }
2539 }
2540 }
2541
2542 pub async fn list_for_issue_async(&self, owner: &str, repo: &str, issue_number: i32, query_params: Option<impl Into<ReactionsListForIssueParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2552
2553 let mut request_uri = format!("{}/repos/{}/{}/issues/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, issue_number);
2554
2555 if let Some(params) = query_params {
2556 request_uri.push_str("?");
2557 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
2558 }
2559
2560 let req = GitHubRequest {
2561 uri: request_uri,
2562 body: None::<C::Body>,
2563 method: "GET",
2564 headers: vec![]
2565 };
2566
2567 let request = self.client.build(req)?;
2568
2569 let github_response = self.client.fetch_async(request).await?;
2572
2573 if github_response.is_success() {
2576 Ok(github_response.to_json_async().await?)
2577 } else {
2578 match github_response.status_code() {
2579 404 => Err(ReactionsListForIssueError::Status404(github_response.to_json_async().await?).into()),
2580 410 => Err(ReactionsListForIssueError::Status410(github_response.to_json_async().await?).into()),
2581 code => Err(ReactionsListForIssueError::Generic { code }.into()),
2582 }
2583 }
2584 }
2585
2586 #[cfg(not(target_arch = "wasm32"))]
2596 pub fn list_for_issue(&self, owner: &str, repo: &str, issue_number: i32, query_params: Option<impl Into<ReactionsListForIssueParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2597
2598 let mut request_uri = format!("{}/repos/{}/{}/issues/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, issue_number);
2599
2600 if let Some(params) = query_params {
2601 request_uri.push_str("?");
2602 let qp: ReactionsListForIssueParams = params.into();
2603 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
2604 }
2605
2606 let req = GitHubRequest {
2607 uri: request_uri,
2608 body: None,
2609 method: "GET",
2610 headers: vec![]
2611 };
2612
2613 let request = self.client.build(req)?;
2614
2615 let github_response = self.client.fetch(request)?;
2618
2619 if github_response.is_success() {
2622 Ok(github_response.to_json()?)
2623 } else {
2624 match github_response.status_code() {
2625 404 => Err(ReactionsListForIssueError::Status404(github_response.to_json()?).into()),
2626 410 => Err(ReactionsListForIssueError::Status410(github_response.to_json()?).into()),
2627 code => Err(ReactionsListForIssueError::Generic { code }.into()),
2628 }
2629 }
2630 }
2631
2632 pub async fn list_for_issue_comment_async(&self, owner: &str, repo: &str, comment_id: i64, query_params: Option<impl Into<ReactionsListForIssueCommentParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2642
2643 let mut request_uri = format!("{}/repos/{}/{}/issues/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
2644
2645 if let Some(params) = query_params {
2646 request_uri.push_str("?");
2647 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
2648 }
2649
2650 let req = GitHubRequest {
2651 uri: request_uri,
2652 body: None::<C::Body>,
2653 method: "GET",
2654 headers: vec![]
2655 };
2656
2657 let request = self.client.build(req)?;
2658
2659 let github_response = self.client.fetch_async(request).await?;
2662
2663 if github_response.is_success() {
2666 Ok(github_response.to_json_async().await?)
2667 } else {
2668 match github_response.status_code() {
2669 404 => Err(ReactionsListForIssueCommentError::Status404(github_response.to_json_async().await?).into()),
2670 code => Err(ReactionsListForIssueCommentError::Generic { code }.into()),
2671 }
2672 }
2673 }
2674
2675 #[cfg(not(target_arch = "wasm32"))]
2685 pub fn list_for_issue_comment(&self, owner: &str, repo: &str, comment_id: i64, query_params: Option<impl Into<ReactionsListForIssueCommentParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2686
2687 let mut request_uri = format!("{}/repos/{}/{}/issues/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
2688
2689 if let Some(params) = query_params {
2690 request_uri.push_str("?");
2691 let qp: ReactionsListForIssueCommentParams = params.into();
2692 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
2693 }
2694
2695 let req = GitHubRequest {
2696 uri: request_uri,
2697 body: None,
2698 method: "GET",
2699 headers: vec![]
2700 };
2701
2702 let request = self.client.build(req)?;
2703
2704 let github_response = self.client.fetch(request)?;
2707
2708 if github_response.is_success() {
2711 Ok(github_response.to_json()?)
2712 } else {
2713 match github_response.status_code() {
2714 404 => Err(ReactionsListForIssueCommentError::Status404(github_response.to_json()?).into()),
2715 code => Err(ReactionsListForIssueCommentError::Generic { code }.into()),
2716 }
2717 }
2718 }
2719
2720 pub async fn list_for_pull_request_review_comment_async(&self, owner: &str, repo: &str, comment_id: i64, query_params: Option<impl Into<ReactionsListForPullRequestReviewCommentParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2730
2731 let mut request_uri = format!("{}/repos/{}/{}/pulls/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
2732
2733 if let Some(params) = query_params {
2734 request_uri.push_str("?");
2735 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
2736 }
2737
2738 let req = GitHubRequest {
2739 uri: request_uri,
2740 body: None::<C::Body>,
2741 method: "GET",
2742 headers: vec![]
2743 };
2744
2745 let request = self.client.build(req)?;
2746
2747 let github_response = self.client.fetch_async(request).await?;
2750
2751 if github_response.is_success() {
2754 Ok(github_response.to_json_async().await?)
2755 } else {
2756 match github_response.status_code() {
2757 404 => Err(ReactionsListForPullRequestReviewCommentError::Status404(github_response.to_json_async().await?).into()),
2758 code => Err(ReactionsListForPullRequestReviewCommentError::Generic { code }.into()),
2759 }
2760 }
2761 }
2762
2763 #[cfg(not(target_arch = "wasm32"))]
2773 pub fn list_for_pull_request_review_comment(&self, owner: &str, repo: &str, comment_id: i64, query_params: Option<impl Into<ReactionsListForPullRequestReviewCommentParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2774
2775 let mut request_uri = format!("{}/repos/{}/{}/pulls/comments/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, comment_id);
2776
2777 if let Some(params) = query_params {
2778 request_uri.push_str("?");
2779 let qp: ReactionsListForPullRequestReviewCommentParams = params.into();
2780 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
2781 }
2782
2783 let req = GitHubRequest {
2784 uri: request_uri,
2785 body: None,
2786 method: "GET",
2787 headers: vec![]
2788 };
2789
2790 let request = self.client.build(req)?;
2791
2792 let github_response = self.client.fetch(request)?;
2795
2796 if github_response.is_success() {
2799 Ok(github_response.to_json()?)
2800 } else {
2801 match github_response.status_code() {
2802 404 => Err(ReactionsListForPullRequestReviewCommentError::Status404(github_response.to_json()?).into()),
2803 code => Err(ReactionsListForPullRequestReviewCommentError::Generic { code }.into()),
2804 }
2805 }
2806 }
2807
2808 pub async fn list_for_release_async(&self, owner: &str, repo: &str, release_id: i32, query_params: Option<impl Into<ReactionsListForReleaseParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2818
2819 let mut request_uri = format!("{}/repos/{}/{}/releases/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, release_id);
2820
2821 if let Some(params) = query_params {
2822 request_uri.push_str("?");
2823 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
2824 }
2825
2826 let req = GitHubRequest {
2827 uri: request_uri,
2828 body: None::<C::Body>,
2829 method: "GET",
2830 headers: vec![]
2831 };
2832
2833 let request = self.client.build(req)?;
2834
2835 let github_response = self.client.fetch_async(request).await?;
2838
2839 if github_response.is_success() {
2842 Ok(github_response.to_json_async().await?)
2843 } else {
2844 match github_response.status_code() {
2845 404 => Err(ReactionsListForReleaseError::Status404(github_response.to_json_async().await?).into()),
2846 code => Err(ReactionsListForReleaseError::Generic { code }.into()),
2847 }
2848 }
2849 }
2850
2851 #[cfg(not(target_arch = "wasm32"))]
2861 pub fn list_for_release(&self, owner: &str, repo: &str, release_id: i32, query_params: Option<impl Into<ReactionsListForReleaseParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2862
2863 let mut request_uri = format!("{}/repos/{}/{}/releases/{}/reactions", super::GITHUB_BASE_API_URL, owner, repo, release_id);
2864
2865 if let Some(params) = query_params {
2866 request_uri.push_str("?");
2867 let qp: ReactionsListForReleaseParams = params.into();
2868 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
2869 }
2870
2871 let req = GitHubRequest {
2872 uri: request_uri,
2873 body: None,
2874 method: "GET",
2875 headers: vec![]
2876 };
2877
2878 let request = self.client.build(req)?;
2879
2880 let github_response = self.client.fetch(request)?;
2883
2884 if github_response.is_success() {
2887 Ok(github_response.to_json()?)
2888 } else {
2889 match github_response.status_code() {
2890 404 => Err(ReactionsListForReleaseError::Status404(github_response.to_json()?).into()),
2891 code => Err(ReactionsListForReleaseError::Generic { code }.into()),
2892 }
2893 }
2894 }
2895
2896 pub async fn list_for_team_discussion_comment_in_org_async(&self, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionCommentInOrgParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2911
2912 let mut request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, comment_number);
2913
2914 if let Some(params) = query_params {
2915 request_uri.push_str("?");
2916 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
2917 }
2918
2919 let req = GitHubRequest {
2920 uri: request_uri,
2921 body: None::<C::Body>,
2922 method: "GET",
2923 headers: vec![]
2924 };
2925
2926 let request = self.client.build(req)?;
2927
2928 let github_response = self.client.fetch_async(request).await?;
2931
2932 if github_response.is_success() {
2935 Ok(github_response.to_json_async().await?)
2936 } else {
2937 match github_response.status_code() {
2938 code => Err(ReactionsListForTeamDiscussionCommentInOrgError::Generic { code }.into()),
2939 }
2940 }
2941 }
2942
2943 #[cfg(not(target_arch = "wasm32"))]
2958 pub fn list_for_team_discussion_comment_in_org(&self, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionCommentInOrgParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
2959
2960 let mut request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number, comment_number);
2961
2962 if let Some(params) = query_params {
2963 request_uri.push_str("?");
2964 let qp: ReactionsListForTeamDiscussionCommentInOrgParams = params.into();
2965 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
2966 }
2967
2968 let req = GitHubRequest {
2969 uri: request_uri,
2970 body: None,
2971 method: "GET",
2972 headers: vec![]
2973 };
2974
2975 let request = self.client.build(req)?;
2976
2977 let github_response = self.client.fetch(request)?;
2980
2981 if github_response.is_success() {
2984 Ok(github_response.to_json()?)
2985 } else {
2986 match github_response.status_code() {
2987 code => Err(ReactionsListForTeamDiscussionCommentInOrgError::Generic { code }.into()),
2988 }
2989 }
2990 }
2991
2992 pub async fn list_for_team_discussion_comment_legacy_async(&self, team_id: i32, discussion_number: i32, comment_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionCommentLegacyParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
3007
3008 let mut request_uri = format!("{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number, comment_number);
3009
3010 if let Some(params) = query_params {
3011 request_uri.push_str("?");
3012 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
3013 }
3014
3015 let req = GitHubRequest {
3016 uri: request_uri,
3017 body: None::<C::Body>,
3018 method: "GET",
3019 headers: vec![]
3020 };
3021
3022 let request = self.client.build(req)?;
3023
3024 let github_response = self.client.fetch_async(request).await?;
3027
3028 if github_response.is_success() {
3031 Ok(github_response.to_json_async().await?)
3032 } else {
3033 match github_response.status_code() {
3034 code => Err(ReactionsListForTeamDiscussionCommentLegacyError::Generic { code }.into()),
3035 }
3036 }
3037 }
3038
3039 #[cfg(not(target_arch = "wasm32"))]
3054 pub fn list_for_team_discussion_comment_legacy(&self, team_id: i32, discussion_number: i32, comment_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionCommentLegacyParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
3055
3056 let mut request_uri = format!("{}/teams/{}/discussions/{}/comments/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number, comment_number);
3057
3058 if let Some(params) = query_params {
3059 request_uri.push_str("?");
3060 let qp: ReactionsListForTeamDiscussionCommentLegacyParams = params.into();
3061 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
3062 }
3063
3064 let req = GitHubRequest {
3065 uri: request_uri,
3066 body: None,
3067 method: "GET",
3068 headers: vec![]
3069 };
3070
3071 let request = self.client.build(req)?;
3072
3073 let github_response = self.client.fetch(request)?;
3076
3077 if github_response.is_success() {
3080 Ok(github_response.to_json()?)
3081 } else {
3082 match github_response.status_code() {
3083 code => Err(ReactionsListForTeamDiscussionCommentLegacyError::Generic { code }.into()),
3084 }
3085 }
3086 }
3087
3088 pub async fn list_for_team_discussion_in_org_async(&self, org: &str, team_slug: &str, discussion_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionInOrgParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
3103
3104 let mut request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number);
3105
3106 if let Some(params) = query_params {
3107 request_uri.push_str("?");
3108 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
3109 }
3110
3111 let req = GitHubRequest {
3112 uri: request_uri,
3113 body: None::<C::Body>,
3114 method: "GET",
3115 headers: vec![]
3116 };
3117
3118 let request = self.client.build(req)?;
3119
3120 let github_response = self.client.fetch_async(request).await?;
3123
3124 if github_response.is_success() {
3127 Ok(github_response.to_json_async().await?)
3128 } else {
3129 match github_response.status_code() {
3130 code => Err(ReactionsListForTeamDiscussionInOrgError::Generic { code }.into()),
3131 }
3132 }
3133 }
3134
3135 #[cfg(not(target_arch = "wasm32"))]
3150 pub fn list_for_team_discussion_in_org(&self, org: &str, team_slug: &str, discussion_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionInOrgParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
3151
3152 let mut request_uri = format!("{}/orgs/{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, org, team_slug, discussion_number);
3153
3154 if let Some(params) = query_params {
3155 request_uri.push_str("?");
3156 let qp: ReactionsListForTeamDiscussionInOrgParams = params.into();
3157 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
3158 }
3159
3160 let req = GitHubRequest {
3161 uri: request_uri,
3162 body: None,
3163 method: "GET",
3164 headers: vec![]
3165 };
3166
3167 let request = self.client.build(req)?;
3168
3169 let github_response = self.client.fetch(request)?;
3172
3173 if github_response.is_success() {
3176 Ok(github_response.to_json()?)
3177 } else {
3178 match github_response.status_code() {
3179 code => Err(ReactionsListForTeamDiscussionInOrgError::Generic { code }.into()),
3180 }
3181 }
3182 }
3183
3184 pub async fn list_for_team_discussion_legacy_async(&self, team_id: i32, discussion_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionLegacyParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
3199
3200 let mut request_uri = format!("{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number);
3201
3202 if let Some(params) = query_params {
3203 request_uri.push_str("?");
3204 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
3205 }
3206
3207 let req = GitHubRequest {
3208 uri: request_uri,
3209 body: None::<C::Body>,
3210 method: "GET",
3211 headers: vec![]
3212 };
3213
3214 let request = self.client.build(req)?;
3215
3216 let github_response = self.client.fetch_async(request).await?;
3219
3220 if github_response.is_success() {
3223 Ok(github_response.to_json_async().await?)
3224 } else {
3225 match github_response.status_code() {
3226 code => Err(ReactionsListForTeamDiscussionLegacyError::Generic { code }.into()),
3227 }
3228 }
3229 }
3230
3231 #[cfg(not(target_arch = "wasm32"))]
3246 pub fn list_for_team_discussion_legacy(&self, team_id: i32, discussion_number: i32, query_params: Option<impl Into<ReactionsListForTeamDiscussionLegacyParams<'api>>>) -> Result<Vec<Reaction>, AdapterError> {
3247
3248 let mut request_uri = format!("{}/teams/{}/discussions/{}/reactions", super::GITHUB_BASE_API_URL, team_id, discussion_number);
3249
3250 if let Some(params) = query_params {
3251 request_uri.push_str("?");
3252 let qp: ReactionsListForTeamDiscussionLegacyParams = params.into();
3253 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
3254 }
3255
3256 let req = GitHubRequest {
3257 uri: request_uri,
3258 body: None,
3259 method: "GET",
3260 headers: vec![]
3261 };
3262
3263 let request = self.client.build(req)?;
3264
3265 let github_response = self.client.fetch(request)?;
3268
3269 if github_response.is_success() {
3272 Ok(github_response.to_json()?)
3273 } else {
3274 match github_response.status_code() {
3275 code => Err(ReactionsListForTeamDiscussionLegacyError::Generic { code }.into()),
3276 }
3277 }
3278 }
3279
3280}