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 Orgs<'api, C: Client> where AdapterError: From<<C as Client>::Err> {
26 client: &'api C
27}
28
29pub fn new<C: Client>(client: &C) -> Orgs<C> where AdapterError: From<<C as Client>::Err> {
30 Orgs { client }
31}
32
33#[derive(Debug, thiserror::Error)]
35pub enum OrgsAddSecurityManagerTeamError {
36 #[error("Status code: {}", code)]
37 Generic { code: u16 },
38}
39
40impl From<OrgsAddSecurityManagerTeamError> for AdapterError {
41 fn from(err: OrgsAddSecurityManagerTeamError) -> Self {
42 let (description, status_code) = match err {
43 OrgsAddSecurityManagerTeamError::Generic { code } => (String::from("Generic"), code)
44 };
45
46 Self::Endpoint {
47 description,
48 status_code,
49 source: Some(Box::new(err))
50 }
51 }
52}
53
54#[derive(Debug, thiserror::Error)]
56pub enum OrgsAssignTeamToOrgRoleError {
57 #[error("Response if the organization, team or role does not exist.")]
58 Status404,
59 #[error("Response if the organization roles feature is not enabled for the organization, or validation failed.")]
60 Status422,
61 #[error("Status code: {}", code)]
62 Generic { code: u16 },
63}
64
65impl From<OrgsAssignTeamToOrgRoleError> for AdapterError {
66 fn from(err: OrgsAssignTeamToOrgRoleError) -> Self {
67 let (description, status_code) = match err {
68 OrgsAssignTeamToOrgRoleError::Status404 => (String::from("Response if the organization, team or role does not exist."), 404),
69 OrgsAssignTeamToOrgRoleError::Status422 => (String::from("Response if the organization roles feature is not enabled for the organization, or validation failed."), 422),
70 OrgsAssignTeamToOrgRoleError::Generic { code } => (String::from("Generic"), code)
71 };
72
73 Self::Endpoint {
74 description,
75 status_code,
76 source: Some(Box::new(err))
77 }
78 }
79}
80
81#[derive(Debug, thiserror::Error)]
83pub enum OrgsAssignUserToOrgRoleError {
84 #[error("Response if the organization, user or role does not exist.")]
85 Status404,
86 #[error("Response if the organization roles feature is not enabled enabled for the organization, the validation failed, or the user is not an organization member.")]
87 Status422,
88 #[error("Status code: {}", code)]
89 Generic { code: u16 },
90}
91
92impl From<OrgsAssignUserToOrgRoleError> for AdapterError {
93 fn from(err: OrgsAssignUserToOrgRoleError) -> Self {
94 let (description, status_code) = match err {
95 OrgsAssignUserToOrgRoleError::Status404 => (String::from("Response if the organization, user or role does not exist."), 404),
96 OrgsAssignUserToOrgRoleError::Status422 => (String::from("Response if the organization roles feature is not enabled enabled for the organization, the validation failed, or the user is not an organization member."), 422),
97 OrgsAssignUserToOrgRoleError::Generic { code } => (String::from("Generic"), code)
98 };
99
100 Self::Endpoint {
101 description,
102 status_code,
103 source: Some(Box::new(err))
104 }
105 }
106}
107
108#[derive(Debug, thiserror::Error)]
110pub enum OrgsBlockUserError {
111 #[error("Validation failed, or the endpoint has been spammed.")]
112 Status422(ValidationError),
113 #[error("Status code: {}", code)]
114 Generic { code: u16 },
115}
116
117impl From<OrgsBlockUserError> for AdapterError {
118 fn from(err: OrgsBlockUserError) -> Self {
119 let (description, status_code) = match err {
120 OrgsBlockUserError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
121 OrgsBlockUserError::Generic { code } => (String::from("Generic"), code)
122 };
123
124 Self::Endpoint {
125 description,
126 status_code,
127 source: Some(Box::new(err))
128 }
129 }
130}
131
132#[derive(Debug, thiserror::Error)]
134pub enum OrgsCancelInvitationError {
135 #[error("Validation failed, or the endpoint has been spammed.")]
136 Status422(ValidationError),
137 #[error("Resource not found")]
138 Status404(BasicError),
139 #[error("Status code: {}", code)]
140 Generic { code: u16 },
141}
142
143impl From<OrgsCancelInvitationError> for AdapterError {
144 fn from(err: OrgsCancelInvitationError) -> Self {
145 let (description, status_code) = match err {
146 OrgsCancelInvitationError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
147 OrgsCancelInvitationError::Status404(_) => (String::from("Resource not found"), 404),
148 OrgsCancelInvitationError::Generic { code } => (String::from("Generic"), code)
149 };
150
151 Self::Endpoint {
152 description,
153 status_code,
154 source: Some(Box::new(err))
155 }
156 }
157}
158
159#[derive(Debug, thiserror::Error)]
161pub enum OrgsCheckBlockedUserError {
162 #[error("If the user is not blocked")]
163 Status404(BasicError),
164 #[error("Status code: {}", code)]
165 Generic { code: u16 },
166}
167
168impl From<OrgsCheckBlockedUserError> for AdapterError {
169 fn from(err: OrgsCheckBlockedUserError) -> Self {
170 let (description, status_code) = match err {
171 OrgsCheckBlockedUserError::Status404(_) => (String::from("If the user is not blocked"), 404),
172 OrgsCheckBlockedUserError::Generic { code } => (String::from("Generic"), code)
173 };
174
175 Self::Endpoint {
176 description,
177 status_code,
178 source: Some(Box::new(err))
179 }
180 }
181}
182
183#[derive(Debug, thiserror::Error)]
185pub enum OrgsCheckMembershipForUserError {
186 #[error("Response if requester is not an organization member")]
187 Status302,
188 #[error("Not Found if requester is an organization member and user is not a member")]
189 Status404,
190 #[error("Status code: {}", code)]
191 Generic { code: u16 },
192}
193
194impl From<OrgsCheckMembershipForUserError> for AdapterError {
195 fn from(err: OrgsCheckMembershipForUserError) -> Self {
196 let (description, status_code) = match err {
197 OrgsCheckMembershipForUserError::Status302 => (String::from("Response if requester is not an organization member"), 302),
198 OrgsCheckMembershipForUserError::Status404 => (String::from("Not Found if requester is an organization member and user is not a member"), 404),
199 OrgsCheckMembershipForUserError::Generic { code } => (String::from("Generic"), code)
200 };
201
202 Self::Endpoint {
203 description,
204 status_code,
205 source: Some(Box::new(err))
206 }
207 }
208}
209
210#[derive(Debug, thiserror::Error)]
212pub enum OrgsCheckPublicMembershipForUserError {
213 #[error("Not Found if user is not a public member")]
214 Status404,
215 #[error("Status code: {}", code)]
216 Generic { code: u16 },
217}
218
219impl From<OrgsCheckPublicMembershipForUserError> for AdapterError {
220 fn from(err: OrgsCheckPublicMembershipForUserError) -> Self {
221 let (description, status_code) = match err {
222 OrgsCheckPublicMembershipForUserError::Status404 => (String::from("Not Found if user is not a public member"), 404),
223 OrgsCheckPublicMembershipForUserError::Generic { code } => (String::from("Generic"), code)
224 };
225
226 Self::Endpoint {
227 description,
228 status_code,
229 source: Some(Box::new(err))
230 }
231 }
232}
233
234#[derive(Debug, thiserror::Error)]
236pub enum OrgsConvertMemberToOutsideCollaboratorError {
237 #[error("User was converted")]
238 Status204,
239 #[error("Forbidden if user is the last owner of the organization, not a member of the organization, or if the enterprise enforces a policy for inviting outside collaborators. For more information, see \"[Enforcing repository management policies in your enterprise](https://docs.github.com/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-inviting-outside-collaborators-to-repositories).\"")]
240 Status403,
241 #[error("Resource not found")]
242 Status404(BasicError),
243 #[error("Status code: {}", code)]
244 Generic { code: u16 },
245}
246
247impl From<OrgsConvertMemberToOutsideCollaboratorError> for AdapterError {
248 fn from(err: OrgsConvertMemberToOutsideCollaboratorError) -> Self {
249 let (description, status_code) = match err {
250 OrgsConvertMemberToOutsideCollaboratorError::Status204 => (String::from("User was converted"), 204),
251 OrgsConvertMemberToOutsideCollaboratorError::Status403 => (String::from("Forbidden if user is the last owner of the organization, not a member of the organization, or if the enterprise enforces a policy for inviting outside collaborators. For more information, see \"[Enforcing repository management policies in your enterprise](https://docs.github.com/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-inviting-outside-collaborators-to-repositories).\""), 403),
252 OrgsConvertMemberToOutsideCollaboratorError::Status404(_) => (String::from("Resource not found"), 404),
253 OrgsConvertMemberToOutsideCollaboratorError::Generic { code } => (String::from("Generic"), code)
254 };
255
256 Self::Endpoint {
257 description,
258 status_code,
259 source: Some(Box::new(err))
260 }
261 }
262}
263
264#[derive(Debug, thiserror::Error)]
266pub enum OrgsCreateInvitationError {
267 #[error("Validation failed, or the endpoint has been spammed.")]
268 Status422(ValidationError),
269 #[error("Resource not found")]
270 Status404(BasicError),
271 #[error("Status code: {}", code)]
272 Generic { code: u16 },
273}
274
275impl From<OrgsCreateInvitationError> for AdapterError {
276 fn from(err: OrgsCreateInvitationError) -> Self {
277 let (description, status_code) = match err {
278 OrgsCreateInvitationError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
279 OrgsCreateInvitationError::Status404(_) => (String::from("Resource not found"), 404),
280 OrgsCreateInvitationError::Generic { code } => (String::from("Generic"), code)
281 };
282
283 Self::Endpoint {
284 description,
285 status_code,
286 source: Some(Box::new(err))
287 }
288 }
289}
290
291#[derive(Debug, thiserror::Error)]
293pub enum OrgsCreateIssueTypeError {
294 #[error("Resource not found")]
295 Status404(BasicError),
296 #[error("Validation failed, or the endpoint has been spammed.")]
297 Status422(ValidationErrorSimple),
298 #[error("Status code: {}", code)]
299 Generic { code: u16 },
300}
301
302impl From<OrgsCreateIssueTypeError> for AdapterError {
303 fn from(err: OrgsCreateIssueTypeError) -> Self {
304 let (description, status_code) = match err {
305 OrgsCreateIssueTypeError::Status404(_) => (String::from("Resource not found"), 404),
306 OrgsCreateIssueTypeError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
307 OrgsCreateIssueTypeError::Generic { code } => (String::from("Generic"), code)
308 };
309
310 Self::Endpoint {
311 description,
312 status_code,
313 source: Some(Box::new(err))
314 }
315 }
316}
317
318#[derive(Debug, thiserror::Error)]
320pub enum OrgsCreateOrUpdateCustomPropertiesError {
321 #[error("Forbidden")]
322 Status403(BasicError),
323 #[error("Resource not found")]
324 Status404(BasicError),
325 #[error("Status code: {}", code)]
326 Generic { code: u16 },
327}
328
329impl From<OrgsCreateOrUpdateCustomPropertiesError> for AdapterError {
330 fn from(err: OrgsCreateOrUpdateCustomPropertiesError) -> Self {
331 let (description, status_code) = match err {
332 OrgsCreateOrUpdateCustomPropertiesError::Status403(_) => (String::from("Forbidden"), 403),
333 OrgsCreateOrUpdateCustomPropertiesError::Status404(_) => (String::from("Resource not found"), 404),
334 OrgsCreateOrUpdateCustomPropertiesError::Generic { code } => (String::from("Generic"), code)
335 };
336
337 Self::Endpoint {
338 description,
339 status_code,
340 source: Some(Box::new(err))
341 }
342 }
343}
344
345#[derive(Debug, thiserror::Error)]
347pub enum OrgsCreateOrUpdateCustomPropertiesValuesForReposError {
348 #[error("Forbidden")]
349 Status403(BasicError),
350 #[error("Resource not found")]
351 Status404(BasicError),
352 #[error("Validation failed, or the endpoint has been spammed.")]
353 Status422(ValidationError),
354 #[error("Status code: {}", code)]
355 Generic { code: u16 },
356}
357
358impl From<OrgsCreateOrUpdateCustomPropertiesValuesForReposError> for AdapterError {
359 fn from(err: OrgsCreateOrUpdateCustomPropertiesValuesForReposError) -> Self {
360 let (description, status_code) = match err {
361 OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status403(_) => (String::from("Forbidden"), 403),
362 OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status404(_) => (String::from("Resource not found"), 404),
363 OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
364 OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Generic { code } => (String::from("Generic"), code)
365 };
366
367 Self::Endpoint {
368 description,
369 status_code,
370 source: Some(Box::new(err))
371 }
372 }
373}
374
375#[derive(Debug, thiserror::Error)]
377pub enum OrgsCreateOrUpdateCustomPropertyError {
378 #[error("Forbidden")]
379 Status403(BasicError),
380 #[error("Resource not found")]
381 Status404(BasicError),
382 #[error("Status code: {}", code)]
383 Generic { code: u16 },
384}
385
386impl From<OrgsCreateOrUpdateCustomPropertyError> for AdapterError {
387 fn from(err: OrgsCreateOrUpdateCustomPropertyError) -> Self {
388 let (description, status_code) = match err {
389 OrgsCreateOrUpdateCustomPropertyError::Status403(_) => (String::from("Forbidden"), 403),
390 OrgsCreateOrUpdateCustomPropertyError::Status404(_) => (String::from("Resource not found"), 404),
391 OrgsCreateOrUpdateCustomPropertyError::Generic { code } => (String::from("Generic"), code)
392 };
393
394 Self::Endpoint {
395 description,
396 status_code,
397 source: Some(Box::new(err))
398 }
399 }
400}
401
402#[derive(Debug, thiserror::Error)]
404pub enum OrgsCreateWebhookError {
405 #[error("Validation failed, or the endpoint has been spammed.")]
406 Status422(ValidationError),
407 #[error("Resource not found")]
408 Status404(BasicError),
409 #[error("Status code: {}", code)]
410 Generic { code: u16 },
411}
412
413impl From<OrgsCreateWebhookError> for AdapterError {
414 fn from(err: OrgsCreateWebhookError) -> Self {
415 let (description, status_code) = match err {
416 OrgsCreateWebhookError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
417 OrgsCreateWebhookError::Status404(_) => (String::from("Resource not found"), 404),
418 OrgsCreateWebhookError::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 OrgsDeleteError {
432 #[error("Resource not found")]
433 Status404(BasicError),
434 #[error("Forbidden")]
435 Status403(BasicError),
436 #[error("Status code: {}", code)]
437 Generic { code: u16 },
438}
439
440impl From<OrgsDeleteError> for AdapterError {
441 fn from(err: OrgsDeleteError) -> Self {
442 let (description, status_code) = match err {
443 OrgsDeleteError::Status404(_) => (String::from("Resource not found"), 404),
444 OrgsDeleteError::Status403(_) => (String::from("Forbidden"), 403),
445 OrgsDeleteError::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 OrgsDeleteIssueTypeError {
459 #[error("Validation failed, or the endpoint has been spammed.")]
460 Status422(ValidationErrorSimple),
461 #[error("Resource not found")]
462 Status404(BasicError),
463 #[error("Status code: {}", code)]
464 Generic { code: u16 },
465}
466
467impl From<OrgsDeleteIssueTypeError> for AdapterError {
468 fn from(err: OrgsDeleteIssueTypeError) -> Self {
469 let (description, status_code) = match err {
470 OrgsDeleteIssueTypeError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
471 OrgsDeleteIssueTypeError::Status404(_) => (String::from("Resource not found"), 404),
472 OrgsDeleteIssueTypeError::Generic { code } => (String::from("Generic"), code)
473 };
474
475 Self::Endpoint {
476 description,
477 status_code,
478 source: Some(Box::new(err))
479 }
480 }
481}
482
483#[derive(Debug, thiserror::Error)]
485pub enum OrgsDeleteWebhookError {
486 #[error("Resource not found")]
487 Status404(BasicError),
488 #[error("Status code: {}", code)]
489 Generic { code: u16 },
490}
491
492impl From<OrgsDeleteWebhookError> for AdapterError {
493 fn from(err: OrgsDeleteWebhookError) -> Self {
494 let (description, status_code) = match err {
495 OrgsDeleteWebhookError::Status404(_) => (String::from("Resource not found"), 404),
496 OrgsDeleteWebhookError::Generic { code } => (String::from("Generic"), code)
497 };
498
499 Self::Endpoint {
500 description,
501 status_code,
502 source: Some(Box::new(err))
503 }
504 }
505}
506
507#[derive(Debug, thiserror::Error)]
509pub enum OrgsEnableOrDisableSecurityProductOnAllOrgReposError {
510 #[error("The action could not be taken due to an in progress enablement, or a policy is preventing enablement")]
511 Status422,
512 #[error("Status code: {}", code)]
513 Generic { code: u16 },
514}
515
516impl From<OrgsEnableOrDisableSecurityProductOnAllOrgReposError> for AdapterError {
517 fn from(err: OrgsEnableOrDisableSecurityProductOnAllOrgReposError) -> Self {
518 let (description, status_code) = match err {
519 OrgsEnableOrDisableSecurityProductOnAllOrgReposError::Status422 => (String::from("The action could not be taken due to an in progress enablement, or a policy is preventing enablement"), 422),
520 OrgsEnableOrDisableSecurityProductOnAllOrgReposError::Generic { code } => (String::from("Generic"), code)
521 };
522
523 Self::Endpoint {
524 description,
525 status_code,
526 source: Some(Box::new(err))
527 }
528 }
529}
530
531#[derive(Debug, thiserror::Error)]
533pub enum OrgsGetError {
534 #[error("Resource not found")]
535 Status404(BasicError),
536 #[error("Status code: {}", code)]
537 Generic { code: u16 },
538}
539
540impl From<OrgsGetError> for AdapterError {
541 fn from(err: OrgsGetError) -> Self {
542 let (description, status_code) = match err {
543 OrgsGetError::Status404(_) => (String::from("Resource not found"), 404),
544 OrgsGetError::Generic { code } => (String::from("Generic"), code)
545 };
546
547 Self::Endpoint {
548 description,
549 status_code,
550 source: Some(Box::new(err))
551 }
552 }
553}
554
555#[derive(Debug, thiserror::Error)]
557pub enum OrgsGetAllCustomPropertiesError {
558 #[error("Forbidden")]
559 Status403(BasicError),
560 #[error("Resource not found")]
561 Status404(BasicError),
562 #[error("Status code: {}", code)]
563 Generic { code: u16 },
564}
565
566impl From<OrgsGetAllCustomPropertiesError> for AdapterError {
567 fn from(err: OrgsGetAllCustomPropertiesError) -> Self {
568 let (description, status_code) = match err {
569 OrgsGetAllCustomPropertiesError::Status403(_) => (String::from("Forbidden"), 403),
570 OrgsGetAllCustomPropertiesError::Status404(_) => (String::from("Resource not found"), 404),
571 OrgsGetAllCustomPropertiesError::Generic { code } => (String::from("Generic"), code)
572 };
573
574 Self::Endpoint {
575 description,
576 status_code,
577 source: Some(Box::new(err))
578 }
579 }
580}
581
582#[derive(Debug, thiserror::Error)]
584pub enum OrgsGetCustomPropertyError {
585 #[error("Forbidden")]
586 Status403(BasicError),
587 #[error("Resource not found")]
588 Status404(BasicError),
589 #[error("Status code: {}", code)]
590 Generic { code: u16 },
591}
592
593impl From<OrgsGetCustomPropertyError> for AdapterError {
594 fn from(err: OrgsGetCustomPropertyError) -> Self {
595 let (description, status_code) = match err {
596 OrgsGetCustomPropertyError::Status403(_) => (String::from("Forbidden"), 403),
597 OrgsGetCustomPropertyError::Status404(_) => (String::from("Resource not found"), 404),
598 OrgsGetCustomPropertyError::Generic { code } => (String::from("Generic"), code)
599 };
600
601 Self::Endpoint {
602 description,
603 status_code,
604 source: Some(Box::new(err))
605 }
606 }
607}
608
609#[derive(Debug, thiserror::Error)]
611pub enum OrgsGetMembershipForAuthenticatedUserError {
612 #[error("Forbidden")]
613 Status403(BasicError),
614 #[error("Resource not found")]
615 Status404(BasicError),
616 #[error("Status code: {}", code)]
617 Generic { code: u16 },
618}
619
620impl From<OrgsGetMembershipForAuthenticatedUserError> for AdapterError {
621 fn from(err: OrgsGetMembershipForAuthenticatedUserError) -> Self {
622 let (description, status_code) = match err {
623 OrgsGetMembershipForAuthenticatedUserError::Status403(_) => (String::from("Forbidden"), 403),
624 OrgsGetMembershipForAuthenticatedUserError::Status404(_) => (String::from("Resource not found"), 404),
625 OrgsGetMembershipForAuthenticatedUserError::Generic { code } => (String::from("Generic"), code)
626 };
627
628 Self::Endpoint {
629 description,
630 status_code,
631 source: Some(Box::new(err))
632 }
633 }
634}
635
636#[derive(Debug, thiserror::Error)]
638pub enum OrgsGetMembershipForUserError {
639 #[error("Resource not found")]
640 Status404(BasicError),
641 #[error("Forbidden")]
642 Status403(BasicError),
643 #[error("Status code: {}", code)]
644 Generic { code: u16 },
645}
646
647impl From<OrgsGetMembershipForUserError> for AdapterError {
648 fn from(err: OrgsGetMembershipForUserError) -> Self {
649 let (description, status_code) = match err {
650 OrgsGetMembershipForUserError::Status404(_) => (String::from("Resource not found"), 404),
651 OrgsGetMembershipForUserError::Status403(_) => (String::from("Forbidden"), 403),
652 OrgsGetMembershipForUserError::Generic { code } => (String::from("Generic"), code)
653 };
654
655 Self::Endpoint {
656 description,
657 status_code,
658 source: Some(Box::new(err))
659 }
660 }
661}
662
663#[derive(Debug, thiserror::Error)]
665pub enum OrgsGetOrgRoleError {
666 #[error("Resource not found")]
667 Status404(BasicError),
668 #[error("Validation failed, or the endpoint has been spammed.")]
669 Status422(ValidationError),
670 #[error("Status code: {}", code)]
671 Generic { code: u16 },
672}
673
674impl From<OrgsGetOrgRoleError> for AdapterError {
675 fn from(err: OrgsGetOrgRoleError) -> Self {
676 let (description, status_code) = match err {
677 OrgsGetOrgRoleError::Status404(_) => (String::from("Resource not found"), 404),
678 OrgsGetOrgRoleError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
679 OrgsGetOrgRoleError::Generic { code } => (String::from("Generic"), code)
680 };
681
682 Self::Endpoint {
683 description,
684 status_code,
685 source: Some(Box::new(err))
686 }
687 }
688}
689
690#[derive(Debug, thiserror::Error)]
692pub enum OrgsGetOrgRulesetHistoryError {
693 #[error("Resource not found")]
694 Status404(BasicError),
695 #[error("Internal Error")]
696 Status500(BasicError),
697 #[error("Status code: {}", code)]
698 Generic { code: u16 },
699}
700
701impl From<OrgsGetOrgRulesetHistoryError> for AdapterError {
702 fn from(err: OrgsGetOrgRulesetHistoryError) -> Self {
703 let (description, status_code) = match err {
704 OrgsGetOrgRulesetHistoryError::Status404(_) => (String::from("Resource not found"), 404),
705 OrgsGetOrgRulesetHistoryError::Status500(_) => (String::from("Internal Error"), 500),
706 OrgsGetOrgRulesetHistoryError::Generic { code } => (String::from("Generic"), code)
707 };
708
709 Self::Endpoint {
710 description,
711 status_code,
712 source: Some(Box::new(err))
713 }
714 }
715}
716
717#[derive(Debug, thiserror::Error)]
719pub enum OrgsGetOrgRulesetVersionError {
720 #[error("Resource not found")]
721 Status404(BasicError),
722 #[error("Internal Error")]
723 Status500(BasicError),
724 #[error("Status code: {}", code)]
725 Generic { code: u16 },
726}
727
728impl From<OrgsGetOrgRulesetVersionError> for AdapterError {
729 fn from(err: OrgsGetOrgRulesetVersionError) -> Self {
730 let (description, status_code) = match err {
731 OrgsGetOrgRulesetVersionError::Status404(_) => (String::from("Resource not found"), 404),
732 OrgsGetOrgRulesetVersionError::Status500(_) => (String::from("Internal Error"), 500),
733 OrgsGetOrgRulesetVersionError::Generic { code } => (String::from("Generic"), code)
734 };
735
736 Self::Endpoint {
737 description,
738 status_code,
739 source: Some(Box::new(err))
740 }
741 }
742}
743
744#[derive(Debug, thiserror::Error)]
746pub enum OrgsGetRouteStatsByActorError {
747 #[error("Status code: {}", code)]
748 Generic { code: u16 },
749}
750
751impl From<OrgsGetRouteStatsByActorError> for AdapterError {
752 fn from(err: OrgsGetRouteStatsByActorError) -> Self {
753 let (description, status_code) = match err {
754 OrgsGetRouteStatsByActorError::Generic { code } => (String::from("Generic"), code)
755 };
756
757 Self::Endpoint {
758 description,
759 status_code,
760 source: Some(Box::new(err))
761 }
762 }
763}
764
765#[derive(Debug, thiserror::Error)]
767pub enum OrgsGetSubjectStatsError {
768 #[error("Status code: {}", code)]
769 Generic { code: u16 },
770}
771
772impl From<OrgsGetSubjectStatsError> for AdapterError {
773 fn from(err: OrgsGetSubjectStatsError) -> Self {
774 let (description, status_code) = match err {
775 OrgsGetSubjectStatsError::Generic { code } => (String::from("Generic"), code)
776 };
777
778 Self::Endpoint {
779 description,
780 status_code,
781 source: Some(Box::new(err))
782 }
783 }
784}
785
786#[derive(Debug, thiserror::Error)]
788pub enum OrgsGetSummaryStatsError {
789 #[error("Status code: {}", code)]
790 Generic { code: u16 },
791}
792
793impl From<OrgsGetSummaryStatsError> for AdapterError {
794 fn from(err: OrgsGetSummaryStatsError) -> Self {
795 let (description, status_code) = match err {
796 OrgsGetSummaryStatsError::Generic { code } => (String::from("Generic"), code)
797 };
798
799 Self::Endpoint {
800 description,
801 status_code,
802 source: Some(Box::new(err))
803 }
804 }
805}
806
807#[derive(Debug, thiserror::Error)]
809pub enum OrgsGetSummaryStatsByActorError {
810 #[error("Status code: {}", code)]
811 Generic { code: u16 },
812}
813
814impl From<OrgsGetSummaryStatsByActorError> for AdapterError {
815 fn from(err: OrgsGetSummaryStatsByActorError) -> Self {
816 let (description, status_code) = match err {
817 OrgsGetSummaryStatsByActorError::Generic { code } => (String::from("Generic"), code)
818 };
819
820 Self::Endpoint {
821 description,
822 status_code,
823 source: Some(Box::new(err))
824 }
825 }
826}
827
828#[derive(Debug, thiserror::Error)]
830pub enum OrgsGetSummaryStatsByUserError {
831 #[error("Status code: {}", code)]
832 Generic { code: u16 },
833}
834
835impl From<OrgsGetSummaryStatsByUserError> for AdapterError {
836 fn from(err: OrgsGetSummaryStatsByUserError) -> Self {
837 let (description, status_code) = match err {
838 OrgsGetSummaryStatsByUserError::Generic { code } => (String::from("Generic"), code)
839 };
840
841 Self::Endpoint {
842 description,
843 status_code,
844 source: Some(Box::new(err))
845 }
846 }
847}
848
849#[derive(Debug, thiserror::Error)]
851pub enum OrgsGetTimeStatsError {
852 #[error("Status code: {}", code)]
853 Generic { code: u16 },
854}
855
856impl From<OrgsGetTimeStatsError> for AdapterError {
857 fn from(err: OrgsGetTimeStatsError) -> Self {
858 let (description, status_code) = match err {
859 OrgsGetTimeStatsError::Generic { code } => (String::from("Generic"), code)
860 };
861
862 Self::Endpoint {
863 description,
864 status_code,
865 source: Some(Box::new(err))
866 }
867 }
868}
869
870#[derive(Debug, thiserror::Error)]
872pub enum OrgsGetTimeStatsByActorError {
873 #[error("Status code: {}", code)]
874 Generic { code: u16 },
875}
876
877impl From<OrgsGetTimeStatsByActorError> for AdapterError {
878 fn from(err: OrgsGetTimeStatsByActorError) -> Self {
879 let (description, status_code) = match err {
880 OrgsGetTimeStatsByActorError::Generic { code } => (String::from("Generic"), code)
881 };
882
883 Self::Endpoint {
884 description,
885 status_code,
886 source: Some(Box::new(err))
887 }
888 }
889}
890
891#[derive(Debug, thiserror::Error)]
893pub enum OrgsGetTimeStatsByUserError {
894 #[error("Status code: {}", code)]
895 Generic { code: u16 },
896}
897
898impl From<OrgsGetTimeStatsByUserError> for AdapterError {
899 fn from(err: OrgsGetTimeStatsByUserError) -> Self {
900 let (description, status_code) = match err {
901 OrgsGetTimeStatsByUserError::Generic { code } => (String::from("Generic"), code)
902 };
903
904 Self::Endpoint {
905 description,
906 status_code,
907 source: Some(Box::new(err))
908 }
909 }
910}
911
912#[derive(Debug, thiserror::Error)]
914pub enum OrgsGetUserStatsError {
915 #[error("Status code: {}", code)]
916 Generic { code: u16 },
917}
918
919impl From<OrgsGetUserStatsError> for AdapterError {
920 fn from(err: OrgsGetUserStatsError) -> Self {
921 let (description, status_code) = match err {
922 OrgsGetUserStatsError::Generic { code } => (String::from("Generic"), code)
923 };
924
925 Self::Endpoint {
926 description,
927 status_code,
928 source: Some(Box::new(err))
929 }
930 }
931}
932
933#[derive(Debug, thiserror::Error)]
935pub enum OrgsGetWebhookError {
936 #[error("Resource not found")]
937 Status404(BasicError),
938 #[error("Status code: {}", code)]
939 Generic { code: u16 },
940}
941
942impl From<OrgsGetWebhookError> for AdapterError {
943 fn from(err: OrgsGetWebhookError) -> Self {
944 let (description, status_code) = match err {
945 OrgsGetWebhookError::Status404(_) => (String::from("Resource not found"), 404),
946 OrgsGetWebhookError::Generic { code } => (String::from("Generic"), code)
947 };
948
949 Self::Endpoint {
950 description,
951 status_code,
952 source: Some(Box::new(err))
953 }
954 }
955}
956
957#[derive(Debug, thiserror::Error)]
959pub enum OrgsGetWebhookConfigForOrgError {
960 #[error("Status code: {}", code)]
961 Generic { code: u16 },
962}
963
964impl From<OrgsGetWebhookConfigForOrgError> for AdapterError {
965 fn from(err: OrgsGetWebhookConfigForOrgError) -> Self {
966 let (description, status_code) = match err {
967 OrgsGetWebhookConfigForOrgError::Generic { code } => (String::from("Generic"), code)
968 };
969
970 Self::Endpoint {
971 description,
972 status_code,
973 source: Some(Box::new(err))
974 }
975 }
976}
977
978#[derive(Debug, thiserror::Error)]
980pub enum OrgsGetWebhookDeliveryError {
981 #[error("Bad Request")]
982 Status400(BasicError),
983 #[error("Validation failed, or the endpoint has been spammed.")]
984 Status422(ValidationError),
985 #[error("Status code: {}", code)]
986 Generic { code: u16 },
987}
988
989impl From<OrgsGetWebhookDeliveryError> for AdapterError {
990 fn from(err: OrgsGetWebhookDeliveryError) -> Self {
991 let (description, status_code) = match err {
992 OrgsGetWebhookDeliveryError::Status400(_) => (String::from("Bad Request"), 400),
993 OrgsGetWebhookDeliveryError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
994 OrgsGetWebhookDeliveryError::Generic { code } => (String::from("Generic"), code)
995 };
996
997 Self::Endpoint {
998 description,
999 status_code,
1000 source: Some(Box::new(err))
1001 }
1002 }
1003}
1004
1005#[derive(Debug, thiserror::Error)]
1007pub enum OrgsListError {
1008 #[error("Not modified")]
1009 Status304,
1010 #[error("Status code: {}", code)]
1011 Generic { code: u16 },
1012}
1013
1014impl From<OrgsListError> for AdapterError {
1015 fn from(err: OrgsListError) -> Self {
1016 let (description, status_code) = match err {
1017 OrgsListError::Status304 => (String::from("Not modified"), 304),
1018 OrgsListError::Generic { code } => (String::from("Generic"), code)
1019 };
1020
1021 Self::Endpoint {
1022 description,
1023 status_code,
1024 source: Some(Box::new(err))
1025 }
1026 }
1027}
1028
1029#[derive(Debug, thiserror::Error)]
1031pub enum OrgsListAppInstallationsError {
1032 #[error("Status code: {}", code)]
1033 Generic { code: u16 },
1034}
1035
1036impl From<OrgsListAppInstallationsError> for AdapterError {
1037 fn from(err: OrgsListAppInstallationsError) -> Self {
1038 let (description, status_code) = match err {
1039 OrgsListAppInstallationsError::Generic { code } => (String::from("Generic"), code)
1040 };
1041
1042 Self::Endpoint {
1043 description,
1044 status_code,
1045 source: Some(Box::new(err))
1046 }
1047 }
1048}
1049
1050#[derive(Debug, thiserror::Error)]
1052pub enum OrgsListAttestationsError {
1053 #[error("Status code: {}", code)]
1054 Generic { code: u16 },
1055}
1056
1057impl From<OrgsListAttestationsError> for AdapterError {
1058 fn from(err: OrgsListAttestationsError) -> Self {
1059 let (description, status_code) = match err {
1060 OrgsListAttestationsError::Generic { code } => (String::from("Generic"), code)
1061 };
1062
1063 Self::Endpoint {
1064 description,
1065 status_code,
1066 source: Some(Box::new(err))
1067 }
1068 }
1069}
1070
1071#[derive(Debug, thiserror::Error)]
1073pub enum OrgsListAttestationsBulkError {
1074 #[error("Status code: {}", code)]
1075 Generic { code: u16 },
1076}
1077
1078impl From<OrgsListAttestationsBulkError> for AdapterError {
1079 fn from(err: OrgsListAttestationsBulkError) -> Self {
1080 let (description, status_code) = match err {
1081 OrgsListAttestationsBulkError::Generic { code } => (String::from("Generic"), code)
1082 };
1083
1084 Self::Endpoint {
1085 description,
1086 status_code,
1087 source: Some(Box::new(err))
1088 }
1089 }
1090}
1091
1092#[derive(Debug, thiserror::Error)]
1094pub enum OrgsListBlockedUsersError {
1095 #[error("Status code: {}", code)]
1096 Generic { code: u16 },
1097}
1098
1099impl From<OrgsListBlockedUsersError> for AdapterError {
1100 fn from(err: OrgsListBlockedUsersError) -> Self {
1101 let (description, status_code) = match err {
1102 OrgsListBlockedUsersError::Generic { code } => (String::from("Generic"), code)
1103 };
1104
1105 Self::Endpoint {
1106 description,
1107 status_code,
1108 source: Some(Box::new(err))
1109 }
1110 }
1111}
1112
1113#[derive(Debug, thiserror::Error)]
1115pub enum OrgsListCustomPropertiesValuesForReposError {
1116 #[error("Forbidden")]
1117 Status403(BasicError),
1118 #[error("Resource not found")]
1119 Status404(BasicError),
1120 #[error("Status code: {}", code)]
1121 Generic { code: u16 },
1122}
1123
1124impl From<OrgsListCustomPropertiesValuesForReposError> for AdapterError {
1125 fn from(err: OrgsListCustomPropertiesValuesForReposError) -> Self {
1126 let (description, status_code) = match err {
1127 OrgsListCustomPropertiesValuesForReposError::Status403(_) => (String::from("Forbidden"), 403),
1128 OrgsListCustomPropertiesValuesForReposError::Status404(_) => (String::from("Resource not found"), 404),
1129 OrgsListCustomPropertiesValuesForReposError::Generic { code } => (String::from("Generic"), code)
1130 };
1131
1132 Self::Endpoint {
1133 description,
1134 status_code,
1135 source: Some(Box::new(err))
1136 }
1137 }
1138}
1139
1140#[derive(Debug, thiserror::Error)]
1142pub enum OrgsListFailedInvitationsError {
1143 #[error("Resource not found")]
1144 Status404(BasicError),
1145 #[error("Status code: {}", code)]
1146 Generic { code: u16 },
1147}
1148
1149impl From<OrgsListFailedInvitationsError> for AdapterError {
1150 fn from(err: OrgsListFailedInvitationsError) -> Self {
1151 let (description, status_code) = match err {
1152 OrgsListFailedInvitationsError::Status404(_) => (String::from("Resource not found"), 404),
1153 OrgsListFailedInvitationsError::Generic { code } => (String::from("Generic"), code)
1154 };
1155
1156 Self::Endpoint {
1157 description,
1158 status_code,
1159 source: Some(Box::new(err))
1160 }
1161 }
1162}
1163
1164#[derive(Debug, thiserror::Error)]
1166pub enum OrgsListForAuthenticatedUserError {
1167 #[error("Not modified")]
1168 Status304,
1169 #[error("Forbidden")]
1170 Status403(BasicError),
1171 #[error("Requires authentication")]
1172 Status401(BasicError),
1173 #[error("Status code: {}", code)]
1174 Generic { code: u16 },
1175}
1176
1177impl From<OrgsListForAuthenticatedUserError> for AdapterError {
1178 fn from(err: OrgsListForAuthenticatedUserError) -> Self {
1179 let (description, status_code) = match err {
1180 OrgsListForAuthenticatedUserError::Status304 => (String::from("Not modified"), 304),
1181 OrgsListForAuthenticatedUserError::Status403(_) => (String::from("Forbidden"), 403),
1182 OrgsListForAuthenticatedUserError::Status401(_) => (String::from("Requires authentication"), 401),
1183 OrgsListForAuthenticatedUserError::Generic { code } => (String::from("Generic"), code)
1184 };
1185
1186 Self::Endpoint {
1187 description,
1188 status_code,
1189 source: Some(Box::new(err))
1190 }
1191 }
1192}
1193
1194#[derive(Debug, thiserror::Error)]
1196pub enum OrgsListForUserError {
1197 #[error("Status code: {}", code)]
1198 Generic { code: u16 },
1199}
1200
1201impl From<OrgsListForUserError> for AdapterError {
1202 fn from(err: OrgsListForUserError) -> Self {
1203 let (description, status_code) = match err {
1204 OrgsListForUserError::Generic { code } => (String::from("Generic"), code)
1205 };
1206
1207 Self::Endpoint {
1208 description,
1209 status_code,
1210 source: Some(Box::new(err))
1211 }
1212 }
1213}
1214
1215#[derive(Debug, thiserror::Error)]
1217pub enum OrgsListInvitationTeamsError {
1218 #[error("Resource not found")]
1219 Status404(BasicError),
1220 #[error("Status code: {}", code)]
1221 Generic { code: u16 },
1222}
1223
1224impl From<OrgsListInvitationTeamsError> for AdapterError {
1225 fn from(err: OrgsListInvitationTeamsError) -> Self {
1226 let (description, status_code) = match err {
1227 OrgsListInvitationTeamsError::Status404(_) => (String::from("Resource not found"), 404),
1228 OrgsListInvitationTeamsError::Generic { code } => (String::from("Generic"), code)
1229 };
1230
1231 Self::Endpoint {
1232 description,
1233 status_code,
1234 source: Some(Box::new(err))
1235 }
1236 }
1237}
1238
1239#[derive(Debug, thiserror::Error)]
1241pub enum OrgsListIssueTypesError {
1242 #[error("Resource not found")]
1243 Status404(BasicError),
1244 #[error("Status code: {}", code)]
1245 Generic { code: u16 },
1246}
1247
1248impl From<OrgsListIssueTypesError> for AdapterError {
1249 fn from(err: OrgsListIssueTypesError) -> Self {
1250 let (description, status_code) = match err {
1251 OrgsListIssueTypesError::Status404(_) => (String::from("Resource not found"), 404),
1252 OrgsListIssueTypesError::Generic { code } => (String::from("Generic"), code)
1253 };
1254
1255 Self::Endpoint {
1256 description,
1257 status_code,
1258 source: Some(Box::new(err))
1259 }
1260 }
1261}
1262
1263#[derive(Debug, thiserror::Error)]
1265pub enum OrgsListMembersError {
1266 #[error("Validation failed, or the endpoint has been spammed.")]
1267 Status422(ValidationError),
1268 #[error("Status code: {}", code)]
1269 Generic { code: u16 },
1270}
1271
1272impl From<OrgsListMembersError> for AdapterError {
1273 fn from(err: OrgsListMembersError) -> Self {
1274 let (description, status_code) = match err {
1275 OrgsListMembersError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1276 OrgsListMembersError::Generic { code } => (String::from("Generic"), code)
1277 };
1278
1279 Self::Endpoint {
1280 description,
1281 status_code,
1282 source: Some(Box::new(err))
1283 }
1284 }
1285}
1286
1287#[derive(Debug, thiserror::Error)]
1289pub enum OrgsListMembershipsForAuthenticatedUserError {
1290 #[error("Not modified")]
1291 Status304,
1292 #[error("Forbidden")]
1293 Status403(BasicError),
1294 #[error("Requires authentication")]
1295 Status401(BasicError),
1296 #[error("Validation failed, or the endpoint has been spammed.")]
1297 Status422(ValidationError),
1298 #[error("Status code: {}", code)]
1299 Generic { code: u16 },
1300}
1301
1302impl From<OrgsListMembershipsForAuthenticatedUserError> for AdapterError {
1303 fn from(err: OrgsListMembershipsForAuthenticatedUserError) -> Self {
1304 let (description, status_code) = match err {
1305 OrgsListMembershipsForAuthenticatedUserError::Status304 => (String::from("Not modified"), 304),
1306 OrgsListMembershipsForAuthenticatedUserError::Status403(_) => (String::from("Forbidden"), 403),
1307 OrgsListMembershipsForAuthenticatedUserError::Status401(_) => (String::from("Requires authentication"), 401),
1308 OrgsListMembershipsForAuthenticatedUserError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1309 OrgsListMembershipsForAuthenticatedUserError::Generic { code } => (String::from("Generic"), code)
1310 };
1311
1312 Self::Endpoint {
1313 description,
1314 status_code,
1315 source: Some(Box::new(err))
1316 }
1317 }
1318}
1319
1320#[derive(Debug, thiserror::Error)]
1322pub enum OrgsListOrgRoleTeamsError {
1323 #[error("Response if the organization or role does not exist.")]
1324 Status404,
1325 #[error("Response if the organization roles feature is not enabled or validation failed.")]
1326 Status422,
1327 #[error("Status code: {}", code)]
1328 Generic { code: u16 },
1329}
1330
1331impl From<OrgsListOrgRoleTeamsError> for AdapterError {
1332 fn from(err: OrgsListOrgRoleTeamsError) -> Self {
1333 let (description, status_code) = match err {
1334 OrgsListOrgRoleTeamsError::Status404 => (String::from("Response if the organization or role does not exist."), 404),
1335 OrgsListOrgRoleTeamsError::Status422 => (String::from("Response if the organization roles feature is not enabled or validation failed."), 422),
1336 OrgsListOrgRoleTeamsError::Generic { code } => (String::from("Generic"), code)
1337 };
1338
1339 Self::Endpoint {
1340 description,
1341 status_code,
1342 source: Some(Box::new(err))
1343 }
1344 }
1345}
1346
1347#[derive(Debug, thiserror::Error)]
1349pub enum OrgsListOrgRoleUsersError {
1350 #[error("Response if the organization or role does not exist.")]
1351 Status404,
1352 #[error("Response if the organization roles feature is not enabled or validation failed.")]
1353 Status422,
1354 #[error("Status code: {}", code)]
1355 Generic { code: u16 },
1356}
1357
1358impl From<OrgsListOrgRoleUsersError> for AdapterError {
1359 fn from(err: OrgsListOrgRoleUsersError) -> Self {
1360 let (description, status_code) = match err {
1361 OrgsListOrgRoleUsersError::Status404 => (String::from("Response if the organization or role does not exist."), 404),
1362 OrgsListOrgRoleUsersError::Status422 => (String::from("Response if the organization roles feature is not enabled or validation failed."), 422),
1363 OrgsListOrgRoleUsersError::Generic { code } => (String::from("Generic"), code)
1364 };
1365
1366 Self::Endpoint {
1367 description,
1368 status_code,
1369 source: Some(Box::new(err))
1370 }
1371 }
1372}
1373
1374#[derive(Debug, thiserror::Error)]
1376pub enum OrgsListOrgRolesError {
1377 #[error("Resource not found")]
1378 Status404(BasicError),
1379 #[error("Validation failed, or the endpoint has been spammed.")]
1380 Status422(ValidationError),
1381 #[error("Status code: {}", code)]
1382 Generic { code: u16 },
1383}
1384
1385impl From<OrgsListOrgRolesError> for AdapterError {
1386 fn from(err: OrgsListOrgRolesError) -> Self {
1387 let (description, status_code) = match err {
1388 OrgsListOrgRolesError::Status404(_) => (String::from("Resource not found"), 404),
1389 OrgsListOrgRolesError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1390 OrgsListOrgRolesError::Generic { code } => (String::from("Generic"), code)
1391 };
1392
1393 Self::Endpoint {
1394 description,
1395 status_code,
1396 source: Some(Box::new(err))
1397 }
1398 }
1399}
1400
1401#[derive(Debug, thiserror::Error)]
1403pub enum OrgsListOutsideCollaboratorsError {
1404 #[error("Status code: {}", code)]
1405 Generic { code: u16 },
1406}
1407
1408impl From<OrgsListOutsideCollaboratorsError> for AdapterError {
1409 fn from(err: OrgsListOutsideCollaboratorsError) -> Self {
1410 let (description, status_code) = match err {
1411 OrgsListOutsideCollaboratorsError::Generic { code } => (String::from("Generic"), code)
1412 };
1413
1414 Self::Endpoint {
1415 description,
1416 status_code,
1417 source: Some(Box::new(err))
1418 }
1419 }
1420}
1421
1422#[derive(Debug, thiserror::Error)]
1424pub enum OrgsListPatGrantRepositoriesError {
1425 #[error("Internal Error")]
1426 Status500(BasicError),
1427 #[error("Resource not found")]
1428 Status404(BasicError),
1429 #[error("Forbidden")]
1430 Status403(BasicError),
1431 #[error("Status code: {}", code)]
1432 Generic { code: u16 },
1433}
1434
1435impl From<OrgsListPatGrantRepositoriesError> for AdapterError {
1436 fn from(err: OrgsListPatGrantRepositoriesError) -> Self {
1437 let (description, status_code) = match err {
1438 OrgsListPatGrantRepositoriesError::Status500(_) => (String::from("Internal Error"), 500),
1439 OrgsListPatGrantRepositoriesError::Status404(_) => (String::from("Resource not found"), 404),
1440 OrgsListPatGrantRepositoriesError::Status403(_) => (String::from("Forbidden"), 403),
1441 OrgsListPatGrantRepositoriesError::Generic { code } => (String::from("Generic"), code)
1442 };
1443
1444 Self::Endpoint {
1445 description,
1446 status_code,
1447 source: Some(Box::new(err))
1448 }
1449 }
1450}
1451
1452#[derive(Debug, thiserror::Error)]
1454pub enum OrgsListPatGrantRequestRepositoriesError {
1455 #[error("Internal Error")]
1456 Status500(BasicError),
1457 #[error("Resource not found")]
1458 Status404(BasicError),
1459 #[error("Forbidden")]
1460 Status403(BasicError),
1461 #[error("Status code: {}", code)]
1462 Generic { code: u16 },
1463}
1464
1465impl From<OrgsListPatGrantRequestRepositoriesError> for AdapterError {
1466 fn from(err: OrgsListPatGrantRequestRepositoriesError) -> Self {
1467 let (description, status_code) = match err {
1468 OrgsListPatGrantRequestRepositoriesError::Status500(_) => (String::from("Internal Error"), 500),
1469 OrgsListPatGrantRequestRepositoriesError::Status404(_) => (String::from("Resource not found"), 404),
1470 OrgsListPatGrantRequestRepositoriesError::Status403(_) => (String::from("Forbidden"), 403),
1471 OrgsListPatGrantRequestRepositoriesError::Generic { code } => (String::from("Generic"), code)
1472 };
1473
1474 Self::Endpoint {
1475 description,
1476 status_code,
1477 source: Some(Box::new(err))
1478 }
1479 }
1480}
1481
1482#[derive(Debug, thiserror::Error)]
1484pub enum OrgsListPatGrantRequestsError {
1485 #[error("Internal Error")]
1486 Status500(BasicError),
1487 #[error("Validation failed, or the endpoint has been spammed.")]
1488 Status422(ValidationError),
1489 #[error("Resource not found")]
1490 Status404(BasicError),
1491 #[error("Forbidden")]
1492 Status403(BasicError),
1493 #[error("Status code: {}", code)]
1494 Generic { code: u16 },
1495}
1496
1497impl From<OrgsListPatGrantRequestsError> for AdapterError {
1498 fn from(err: OrgsListPatGrantRequestsError) -> Self {
1499 let (description, status_code) = match err {
1500 OrgsListPatGrantRequestsError::Status500(_) => (String::from("Internal Error"), 500),
1501 OrgsListPatGrantRequestsError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1502 OrgsListPatGrantRequestsError::Status404(_) => (String::from("Resource not found"), 404),
1503 OrgsListPatGrantRequestsError::Status403(_) => (String::from("Forbidden"), 403),
1504 OrgsListPatGrantRequestsError::Generic { code } => (String::from("Generic"), code)
1505 };
1506
1507 Self::Endpoint {
1508 description,
1509 status_code,
1510 source: Some(Box::new(err))
1511 }
1512 }
1513}
1514
1515#[derive(Debug, thiserror::Error)]
1517pub enum OrgsListPatGrantsError {
1518 #[error("Internal Error")]
1519 Status500(BasicError),
1520 #[error("Validation failed, or the endpoint has been spammed.")]
1521 Status422(ValidationError),
1522 #[error("Resource not found")]
1523 Status404(BasicError),
1524 #[error("Forbidden")]
1525 Status403(BasicError),
1526 #[error("Status code: {}", code)]
1527 Generic { code: u16 },
1528}
1529
1530impl From<OrgsListPatGrantsError> for AdapterError {
1531 fn from(err: OrgsListPatGrantsError) -> Self {
1532 let (description, status_code) = match err {
1533 OrgsListPatGrantsError::Status500(_) => (String::from("Internal Error"), 500),
1534 OrgsListPatGrantsError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1535 OrgsListPatGrantsError::Status404(_) => (String::from("Resource not found"), 404),
1536 OrgsListPatGrantsError::Status403(_) => (String::from("Forbidden"), 403),
1537 OrgsListPatGrantsError::Generic { code } => (String::from("Generic"), code)
1538 };
1539
1540 Self::Endpoint {
1541 description,
1542 status_code,
1543 source: Some(Box::new(err))
1544 }
1545 }
1546}
1547
1548#[derive(Debug, thiserror::Error)]
1550pub enum OrgsListPendingInvitationsError {
1551 #[error("Resource not found")]
1552 Status404(BasicError),
1553 #[error("Status code: {}", code)]
1554 Generic { code: u16 },
1555}
1556
1557impl From<OrgsListPendingInvitationsError> for AdapterError {
1558 fn from(err: OrgsListPendingInvitationsError) -> Self {
1559 let (description, status_code) = match err {
1560 OrgsListPendingInvitationsError::Status404(_) => (String::from("Resource not found"), 404),
1561 OrgsListPendingInvitationsError::Generic { code } => (String::from("Generic"), code)
1562 };
1563
1564 Self::Endpoint {
1565 description,
1566 status_code,
1567 source: Some(Box::new(err))
1568 }
1569 }
1570}
1571
1572#[derive(Debug, thiserror::Error)]
1574pub enum OrgsListPublicMembersError {
1575 #[error("Status code: {}", code)]
1576 Generic { code: u16 },
1577}
1578
1579impl From<OrgsListPublicMembersError> for AdapterError {
1580 fn from(err: OrgsListPublicMembersError) -> Self {
1581 let (description, status_code) = match err {
1582 OrgsListPublicMembersError::Generic { code } => (String::from("Generic"), code)
1583 };
1584
1585 Self::Endpoint {
1586 description,
1587 status_code,
1588 source: Some(Box::new(err))
1589 }
1590 }
1591}
1592
1593#[derive(Debug, thiserror::Error)]
1595pub enum OrgsListSecurityManagerTeamsError {
1596 #[error("Status code: {}", code)]
1597 Generic { code: u16 },
1598}
1599
1600impl From<OrgsListSecurityManagerTeamsError> for AdapterError {
1601 fn from(err: OrgsListSecurityManagerTeamsError) -> Self {
1602 let (description, status_code) = match err {
1603 OrgsListSecurityManagerTeamsError::Generic { code } => (String::from("Generic"), code)
1604 };
1605
1606 Self::Endpoint {
1607 description,
1608 status_code,
1609 source: Some(Box::new(err))
1610 }
1611 }
1612}
1613
1614#[derive(Debug, thiserror::Error)]
1616pub enum OrgsListWebhookDeliveriesError {
1617 #[error("Bad Request")]
1618 Status400(BasicError),
1619 #[error("Validation failed, or the endpoint has been spammed.")]
1620 Status422(ValidationError),
1621 #[error("Status code: {}", code)]
1622 Generic { code: u16 },
1623}
1624
1625impl From<OrgsListWebhookDeliveriesError> for AdapterError {
1626 fn from(err: OrgsListWebhookDeliveriesError) -> Self {
1627 let (description, status_code) = match err {
1628 OrgsListWebhookDeliveriesError::Status400(_) => (String::from("Bad Request"), 400),
1629 OrgsListWebhookDeliveriesError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1630 OrgsListWebhookDeliveriesError::Generic { code } => (String::from("Generic"), code)
1631 };
1632
1633 Self::Endpoint {
1634 description,
1635 status_code,
1636 source: Some(Box::new(err))
1637 }
1638 }
1639}
1640
1641#[derive(Debug, thiserror::Error)]
1643pub enum OrgsListWebhooksError {
1644 #[error("Resource not found")]
1645 Status404(BasicError),
1646 #[error("Status code: {}", code)]
1647 Generic { code: u16 },
1648}
1649
1650impl From<OrgsListWebhooksError> for AdapterError {
1651 fn from(err: OrgsListWebhooksError) -> Self {
1652 let (description, status_code) = match err {
1653 OrgsListWebhooksError::Status404(_) => (String::from("Resource not found"), 404),
1654 OrgsListWebhooksError::Generic { code } => (String::from("Generic"), code)
1655 };
1656
1657 Self::Endpoint {
1658 description,
1659 status_code,
1660 source: Some(Box::new(err))
1661 }
1662 }
1663}
1664
1665#[derive(Debug, thiserror::Error)]
1667pub enum OrgsPingWebhookError {
1668 #[error("Resource not found")]
1669 Status404(BasicError),
1670 #[error("Status code: {}", code)]
1671 Generic { code: u16 },
1672}
1673
1674impl From<OrgsPingWebhookError> for AdapterError {
1675 fn from(err: OrgsPingWebhookError) -> Self {
1676 let (description, status_code) = match err {
1677 OrgsPingWebhookError::Status404(_) => (String::from("Resource not found"), 404),
1678 OrgsPingWebhookError::Generic { code } => (String::from("Generic"), code)
1679 };
1680
1681 Self::Endpoint {
1682 description,
1683 status_code,
1684 source: Some(Box::new(err))
1685 }
1686 }
1687}
1688
1689#[derive(Debug, thiserror::Error)]
1691pub enum OrgsRedeliverWebhookDeliveryError {
1692 #[error("Bad Request")]
1693 Status400(BasicError),
1694 #[error("Validation failed, or the endpoint has been spammed.")]
1695 Status422(ValidationError),
1696 #[error("Status code: {}", code)]
1697 Generic { code: u16 },
1698}
1699
1700impl From<OrgsRedeliverWebhookDeliveryError> for AdapterError {
1701 fn from(err: OrgsRedeliverWebhookDeliveryError) -> Self {
1702 let (description, status_code) = match err {
1703 OrgsRedeliverWebhookDeliveryError::Status400(_) => (String::from("Bad Request"), 400),
1704 OrgsRedeliverWebhookDeliveryError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1705 OrgsRedeliverWebhookDeliveryError::Generic { code } => (String::from("Generic"), code)
1706 };
1707
1708 Self::Endpoint {
1709 description,
1710 status_code,
1711 source: Some(Box::new(err))
1712 }
1713 }
1714}
1715
1716#[derive(Debug, thiserror::Error)]
1718pub enum OrgsRemoveCustomPropertyError {
1719 #[error("Forbidden")]
1720 Status403(BasicError),
1721 #[error("Resource not found")]
1722 Status404(BasicError),
1723 #[error("Status code: {}", code)]
1724 Generic { code: u16 },
1725}
1726
1727impl From<OrgsRemoveCustomPropertyError> for AdapterError {
1728 fn from(err: OrgsRemoveCustomPropertyError) -> Self {
1729 let (description, status_code) = match err {
1730 OrgsRemoveCustomPropertyError::Status403(_) => (String::from("Forbidden"), 403),
1731 OrgsRemoveCustomPropertyError::Status404(_) => (String::from("Resource not found"), 404),
1732 OrgsRemoveCustomPropertyError::Generic { code } => (String::from("Generic"), code)
1733 };
1734
1735 Self::Endpoint {
1736 description,
1737 status_code,
1738 source: Some(Box::new(err))
1739 }
1740 }
1741}
1742
1743#[derive(Debug, thiserror::Error)]
1745pub enum OrgsRemoveMemberError {
1746 #[error("Forbidden")]
1747 Status403(BasicError),
1748 #[error("Status code: {}", code)]
1749 Generic { code: u16 },
1750}
1751
1752impl From<OrgsRemoveMemberError> for AdapterError {
1753 fn from(err: OrgsRemoveMemberError) -> Self {
1754 let (description, status_code) = match err {
1755 OrgsRemoveMemberError::Status403(_) => (String::from("Forbidden"), 403),
1756 OrgsRemoveMemberError::Generic { code } => (String::from("Generic"), code)
1757 };
1758
1759 Self::Endpoint {
1760 description,
1761 status_code,
1762 source: Some(Box::new(err))
1763 }
1764 }
1765}
1766
1767#[derive(Debug, thiserror::Error)]
1769pub enum OrgsRemoveMembershipForUserError {
1770 #[error("Forbidden")]
1771 Status403(BasicError),
1772 #[error("Resource not found")]
1773 Status404(BasicError),
1774 #[error("Status code: {}", code)]
1775 Generic { code: u16 },
1776}
1777
1778impl From<OrgsRemoveMembershipForUserError> for AdapterError {
1779 fn from(err: OrgsRemoveMembershipForUserError) -> Self {
1780 let (description, status_code) = match err {
1781 OrgsRemoveMembershipForUserError::Status403(_) => (String::from("Forbidden"), 403),
1782 OrgsRemoveMembershipForUserError::Status404(_) => (String::from("Resource not found"), 404),
1783 OrgsRemoveMembershipForUserError::Generic { code } => (String::from("Generic"), code)
1784 };
1785
1786 Self::Endpoint {
1787 description,
1788 status_code,
1789 source: Some(Box::new(err))
1790 }
1791 }
1792}
1793
1794#[derive(Debug, thiserror::Error)]
1796pub enum OrgsRemoveOutsideCollaboratorError {
1797 #[error("Unprocessable Entity if user is a member of the organization")]
1798 Status422(PutTeamsAddOrUpdateProjectPermissionsLegacyResponse403),
1799 #[error("Status code: {}", code)]
1800 Generic { code: u16 },
1801}
1802
1803impl From<OrgsRemoveOutsideCollaboratorError> for AdapterError {
1804 fn from(err: OrgsRemoveOutsideCollaboratorError) -> Self {
1805 let (description, status_code) = match err {
1806 OrgsRemoveOutsideCollaboratorError::Status422(_) => (String::from("Unprocessable Entity if user is a member of the organization"), 422),
1807 OrgsRemoveOutsideCollaboratorError::Generic { code } => (String::from("Generic"), code)
1808 };
1809
1810 Self::Endpoint {
1811 description,
1812 status_code,
1813 source: Some(Box::new(err))
1814 }
1815 }
1816}
1817
1818#[derive(Debug, thiserror::Error)]
1820pub enum OrgsRemovePublicMembershipForAuthenticatedUserError {
1821 #[error("Status code: {}", code)]
1822 Generic { code: u16 },
1823}
1824
1825impl From<OrgsRemovePublicMembershipForAuthenticatedUserError> for AdapterError {
1826 fn from(err: OrgsRemovePublicMembershipForAuthenticatedUserError) -> Self {
1827 let (description, status_code) = match err {
1828 OrgsRemovePublicMembershipForAuthenticatedUserError::Generic { code } => (String::from("Generic"), code)
1829 };
1830
1831 Self::Endpoint {
1832 description,
1833 status_code,
1834 source: Some(Box::new(err))
1835 }
1836 }
1837}
1838
1839#[derive(Debug, thiserror::Error)]
1841pub enum OrgsRemoveSecurityManagerTeamError {
1842 #[error("Status code: {}", code)]
1843 Generic { code: u16 },
1844}
1845
1846impl From<OrgsRemoveSecurityManagerTeamError> for AdapterError {
1847 fn from(err: OrgsRemoveSecurityManagerTeamError) -> Self {
1848 let (description, status_code) = match err {
1849 OrgsRemoveSecurityManagerTeamError::Generic { code } => (String::from("Generic"), code)
1850 };
1851
1852 Self::Endpoint {
1853 description,
1854 status_code,
1855 source: Some(Box::new(err))
1856 }
1857 }
1858}
1859
1860#[derive(Debug, thiserror::Error)]
1862pub enum OrgsReviewPatGrantRequestError {
1863 #[error("Internal Error")]
1864 Status500(BasicError),
1865 #[error("Validation failed, or the endpoint has been spammed.")]
1866 Status422(ValidationError),
1867 #[error("Resource not found")]
1868 Status404(BasicError),
1869 #[error("Forbidden")]
1870 Status403(BasicError),
1871 #[error("Status code: {}", code)]
1872 Generic { code: u16 },
1873}
1874
1875impl From<OrgsReviewPatGrantRequestError> for AdapterError {
1876 fn from(err: OrgsReviewPatGrantRequestError) -> Self {
1877 let (description, status_code) = match err {
1878 OrgsReviewPatGrantRequestError::Status500(_) => (String::from("Internal Error"), 500),
1879 OrgsReviewPatGrantRequestError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1880 OrgsReviewPatGrantRequestError::Status404(_) => (String::from("Resource not found"), 404),
1881 OrgsReviewPatGrantRequestError::Status403(_) => (String::from("Forbidden"), 403),
1882 OrgsReviewPatGrantRequestError::Generic { code } => (String::from("Generic"), code)
1883 };
1884
1885 Self::Endpoint {
1886 description,
1887 status_code,
1888 source: Some(Box::new(err))
1889 }
1890 }
1891}
1892
1893#[derive(Debug, thiserror::Error)]
1895pub enum OrgsReviewPatGrantRequestsInBulkError {
1896 #[error("Internal Error")]
1897 Status500(BasicError),
1898 #[error("Validation failed, or the endpoint has been spammed.")]
1899 Status422(ValidationError),
1900 #[error("Resource not found")]
1901 Status404(BasicError),
1902 #[error("Forbidden")]
1903 Status403(BasicError),
1904 #[error("Status code: {}", code)]
1905 Generic { code: u16 },
1906}
1907
1908impl From<OrgsReviewPatGrantRequestsInBulkError> for AdapterError {
1909 fn from(err: OrgsReviewPatGrantRequestsInBulkError) -> Self {
1910 let (description, status_code) = match err {
1911 OrgsReviewPatGrantRequestsInBulkError::Status500(_) => (String::from("Internal Error"), 500),
1912 OrgsReviewPatGrantRequestsInBulkError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
1913 OrgsReviewPatGrantRequestsInBulkError::Status404(_) => (String::from("Resource not found"), 404),
1914 OrgsReviewPatGrantRequestsInBulkError::Status403(_) => (String::from("Forbidden"), 403),
1915 OrgsReviewPatGrantRequestsInBulkError::Generic { code } => (String::from("Generic"), code)
1916 };
1917
1918 Self::Endpoint {
1919 description,
1920 status_code,
1921 source: Some(Box::new(err))
1922 }
1923 }
1924}
1925
1926#[derive(Debug, thiserror::Error)]
1928pub enum OrgsRevokeAllOrgRolesTeamError {
1929 #[error("Status code: {}", code)]
1930 Generic { code: u16 },
1931}
1932
1933impl From<OrgsRevokeAllOrgRolesTeamError> for AdapterError {
1934 fn from(err: OrgsRevokeAllOrgRolesTeamError) -> Self {
1935 let (description, status_code) = match err {
1936 OrgsRevokeAllOrgRolesTeamError::Generic { code } => (String::from("Generic"), code)
1937 };
1938
1939 Self::Endpoint {
1940 description,
1941 status_code,
1942 source: Some(Box::new(err))
1943 }
1944 }
1945}
1946
1947#[derive(Debug, thiserror::Error)]
1949pub enum OrgsRevokeAllOrgRolesUserError {
1950 #[error("Status code: {}", code)]
1951 Generic { code: u16 },
1952}
1953
1954impl From<OrgsRevokeAllOrgRolesUserError> for AdapterError {
1955 fn from(err: OrgsRevokeAllOrgRolesUserError) -> Self {
1956 let (description, status_code) = match err {
1957 OrgsRevokeAllOrgRolesUserError::Generic { code } => (String::from("Generic"), code)
1958 };
1959
1960 Self::Endpoint {
1961 description,
1962 status_code,
1963 source: Some(Box::new(err))
1964 }
1965 }
1966}
1967
1968#[derive(Debug, thiserror::Error)]
1970pub enum OrgsRevokeOrgRoleTeamError {
1971 #[error("Status code: {}", code)]
1972 Generic { code: u16 },
1973}
1974
1975impl From<OrgsRevokeOrgRoleTeamError> for AdapterError {
1976 fn from(err: OrgsRevokeOrgRoleTeamError) -> Self {
1977 let (description, status_code) = match err {
1978 OrgsRevokeOrgRoleTeamError::Generic { code } => (String::from("Generic"), code)
1979 };
1980
1981 Self::Endpoint {
1982 description,
1983 status_code,
1984 source: Some(Box::new(err))
1985 }
1986 }
1987}
1988
1989#[derive(Debug, thiserror::Error)]
1991pub enum OrgsRevokeOrgRoleUserError {
1992 #[error("Status code: {}", code)]
1993 Generic { code: u16 },
1994}
1995
1996impl From<OrgsRevokeOrgRoleUserError> for AdapterError {
1997 fn from(err: OrgsRevokeOrgRoleUserError) -> Self {
1998 let (description, status_code) = match err {
1999 OrgsRevokeOrgRoleUserError::Generic { code } => (String::from("Generic"), code)
2000 };
2001
2002 Self::Endpoint {
2003 description,
2004 status_code,
2005 source: Some(Box::new(err))
2006 }
2007 }
2008}
2009
2010#[derive(Debug, thiserror::Error)]
2012pub enum OrgsSetMembershipForUserError {
2013 #[error("Validation failed, or the endpoint has been spammed.")]
2014 Status422(ValidationError),
2015 #[error("Forbidden")]
2016 Status403(BasicError),
2017 #[error("Status code: {}", code)]
2018 Generic { code: u16 },
2019}
2020
2021impl From<OrgsSetMembershipForUserError> for AdapterError {
2022 fn from(err: OrgsSetMembershipForUserError) -> Self {
2023 let (description, status_code) = match err {
2024 OrgsSetMembershipForUserError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
2025 OrgsSetMembershipForUserError::Status403(_) => (String::from("Forbidden"), 403),
2026 OrgsSetMembershipForUserError::Generic { code } => (String::from("Generic"), code)
2027 };
2028
2029 Self::Endpoint {
2030 description,
2031 status_code,
2032 source: Some(Box::new(err))
2033 }
2034 }
2035}
2036
2037#[derive(Debug, thiserror::Error)]
2039pub enum OrgsSetPublicMembershipForAuthenticatedUserError {
2040 #[error("Forbidden")]
2041 Status403(BasicError),
2042 #[error("Status code: {}", code)]
2043 Generic { code: u16 },
2044}
2045
2046impl From<OrgsSetPublicMembershipForAuthenticatedUserError> for AdapterError {
2047 fn from(err: OrgsSetPublicMembershipForAuthenticatedUserError) -> Self {
2048 let (description, status_code) = match err {
2049 OrgsSetPublicMembershipForAuthenticatedUserError::Status403(_) => (String::from("Forbidden"), 403),
2050 OrgsSetPublicMembershipForAuthenticatedUserError::Generic { code } => (String::from("Generic"), code)
2051 };
2052
2053 Self::Endpoint {
2054 description,
2055 status_code,
2056 source: Some(Box::new(err))
2057 }
2058 }
2059}
2060
2061#[derive(Debug, thiserror::Error)]
2063pub enum OrgsUnblockUserError {
2064 #[error("Status code: {}", code)]
2065 Generic { code: u16 },
2066}
2067
2068impl From<OrgsUnblockUserError> for AdapterError {
2069 fn from(err: OrgsUnblockUserError) -> Self {
2070 let (description, status_code) = match err {
2071 OrgsUnblockUserError::Generic { code } => (String::from("Generic"), code)
2072 };
2073
2074 Self::Endpoint {
2075 description,
2076 status_code,
2077 source: Some(Box::new(err))
2078 }
2079 }
2080}
2081
2082#[derive(Debug, thiserror::Error)]
2084pub enum OrgsUpdateError {
2085 #[error("Validation failed")]
2086 Status422(PostProjectsCreateCardResponse422),
2087 #[error("Conflict")]
2088 Status409(BasicError),
2089 #[error("Status code: {}", code)]
2090 Generic { code: u16 },
2091}
2092
2093impl From<OrgsUpdateError> for AdapterError {
2094 fn from(err: OrgsUpdateError) -> Self {
2095 let (description, status_code) = match err {
2096 OrgsUpdateError::Status422(_) => (String::from("Validation failed"), 422),
2097 OrgsUpdateError::Status409(_) => (String::from("Conflict"), 409),
2098 OrgsUpdateError::Generic { code } => (String::from("Generic"), code)
2099 };
2100
2101 Self::Endpoint {
2102 description,
2103 status_code,
2104 source: Some(Box::new(err))
2105 }
2106 }
2107}
2108
2109#[derive(Debug, thiserror::Error)]
2111pub enum OrgsUpdateIssueTypeError {
2112 #[error("Resource not found")]
2113 Status404(BasicError),
2114 #[error("Validation failed, or the endpoint has been spammed.")]
2115 Status422(ValidationErrorSimple),
2116 #[error("Status code: {}", code)]
2117 Generic { code: u16 },
2118}
2119
2120impl From<OrgsUpdateIssueTypeError> for AdapterError {
2121 fn from(err: OrgsUpdateIssueTypeError) -> Self {
2122 let (description, status_code) = match err {
2123 OrgsUpdateIssueTypeError::Status404(_) => (String::from("Resource not found"), 404),
2124 OrgsUpdateIssueTypeError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
2125 OrgsUpdateIssueTypeError::Generic { code } => (String::from("Generic"), code)
2126 };
2127
2128 Self::Endpoint {
2129 description,
2130 status_code,
2131 source: Some(Box::new(err))
2132 }
2133 }
2134}
2135
2136#[derive(Debug, thiserror::Error)]
2138pub enum OrgsUpdateMembershipForAuthenticatedUserError {
2139 #[error("Forbidden")]
2140 Status403(BasicError),
2141 #[error("Resource not found")]
2142 Status404(BasicError),
2143 #[error("Validation failed, or the endpoint has been spammed.")]
2144 Status422(ValidationError),
2145 #[error("Status code: {}", code)]
2146 Generic { code: u16 },
2147}
2148
2149impl From<OrgsUpdateMembershipForAuthenticatedUserError> for AdapterError {
2150 fn from(err: OrgsUpdateMembershipForAuthenticatedUserError) -> Self {
2151 let (description, status_code) = match err {
2152 OrgsUpdateMembershipForAuthenticatedUserError::Status403(_) => (String::from("Forbidden"), 403),
2153 OrgsUpdateMembershipForAuthenticatedUserError::Status404(_) => (String::from("Resource not found"), 404),
2154 OrgsUpdateMembershipForAuthenticatedUserError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
2155 OrgsUpdateMembershipForAuthenticatedUserError::Generic { code } => (String::from("Generic"), code)
2156 };
2157
2158 Self::Endpoint {
2159 description,
2160 status_code,
2161 source: Some(Box::new(err))
2162 }
2163 }
2164}
2165
2166#[derive(Debug, thiserror::Error)]
2168pub enum OrgsUpdatePatAccessError {
2169 #[error("Internal Error")]
2170 Status500(BasicError),
2171 #[error("Resource not found")]
2172 Status404(BasicError),
2173 #[error("Forbidden")]
2174 Status403(BasicError),
2175 #[error("Validation failed, or the endpoint has been spammed.")]
2176 Status422(ValidationError),
2177 #[error("Status code: {}", code)]
2178 Generic { code: u16 },
2179}
2180
2181impl From<OrgsUpdatePatAccessError> for AdapterError {
2182 fn from(err: OrgsUpdatePatAccessError) -> Self {
2183 let (description, status_code) = match err {
2184 OrgsUpdatePatAccessError::Status500(_) => (String::from("Internal Error"), 500),
2185 OrgsUpdatePatAccessError::Status404(_) => (String::from("Resource not found"), 404),
2186 OrgsUpdatePatAccessError::Status403(_) => (String::from("Forbidden"), 403),
2187 OrgsUpdatePatAccessError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
2188 OrgsUpdatePatAccessError::Generic { code } => (String::from("Generic"), code)
2189 };
2190
2191 Self::Endpoint {
2192 description,
2193 status_code,
2194 source: Some(Box::new(err))
2195 }
2196 }
2197}
2198
2199#[derive(Debug, thiserror::Error)]
2201pub enum OrgsUpdatePatAccessesError {
2202 #[error("Internal Error")]
2203 Status500(BasicError),
2204 #[error("Resource not found")]
2205 Status404(BasicError),
2206 #[error("Forbidden")]
2207 Status403(BasicError),
2208 #[error("Validation failed, or the endpoint has been spammed.")]
2209 Status422(ValidationError),
2210 #[error("Status code: {}", code)]
2211 Generic { code: u16 },
2212}
2213
2214impl From<OrgsUpdatePatAccessesError> for AdapterError {
2215 fn from(err: OrgsUpdatePatAccessesError) -> Self {
2216 let (description, status_code) = match err {
2217 OrgsUpdatePatAccessesError::Status500(_) => (String::from("Internal Error"), 500),
2218 OrgsUpdatePatAccessesError::Status404(_) => (String::from("Resource not found"), 404),
2219 OrgsUpdatePatAccessesError::Status403(_) => (String::from("Forbidden"), 403),
2220 OrgsUpdatePatAccessesError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
2221 OrgsUpdatePatAccessesError::Generic { code } => (String::from("Generic"), code)
2222 };
2223
2224 Self::Endpoint {
2225 description,
2226 status_code,
2227 source: Some(Box::new(err))
2228 }
2229 }
2230}
2231
2232#[derive(Debug, thiserror::Error)]
2234pub enum OrgsUpdateWebhookError {
2235 #[error("Validation failed, or the endpoint has been spammed.")]
2236 Status422(ValidationError),
2237 #[error("Resource not found")]
2238 Status404(BasicError),
2239 #[error("Status code: {}", code)]
2240 Generic { code: u16 },
2241}
2242
2243impl From<OrgsUpdateWebhookError> for AdapterError {
2244 fn from(err: OrgsUpdateWebhookError) -> Self {
2245 let (description, status_code) = match err {
2246 OrgsUpdateWebhookError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
2247 OrgsUpdateWebhookError::Status404(_) => (String::from("Resource not found"), 404),
2248 OrgsUpdateWebhookError::Generic { code } => (String::from("Generic"), code)
2249 };
2250
2251 Self::Endpoint {
2252 description,
2253 status_code,
2254 source: Some(Box::new(err))
2255 }
2256 }
2257}
2258
2259#[derive(Debug, thiserror::Error)]
2261pub enum OrgsUpdateWebhookConfigForOrgError {
2262 #[error("Status code: {}", code)]
2263 Generic { code: u16 },
2264}
2265
2266impl From<OrgsUpdateWebhookConfigForOrgError> for AdapterError {
2267 fn from(err: OrgsUpdateWebhookConfigForOrgError) -> Self {
2268 let (description, status_code) = match err {
2269 OrgsUpdateWebhookConfigForOrgError::Generic { code } => (String::from("Generic"), code)
2270 };
2271
2272 Self::Endpoint {
2273 description,
2274 status_code,
2275 source: Some(Box::new(err))
2276 }
2277 }
2278}
2279
2280
2281#[derive(Default, Serialize)]
2283pub struct OrgsGetOrgRulesetHistoryParams {
2284 per_page: Option<u16>,
2286 page: Option<u16>
2288}
2289
2290impl OrgsGetOrgRulesetHistoryParams {
2291 pub fn new() -> Self {
2292 Self::default()
2293 }
2294
2295 pub fn per_page(self, per_page: u16) -> Self {
2297 Self {
2298 per_page: Some(per_page),
2299 page: self.page,
2300 }
2301 }
2302
2303 pub fn page(self, page: u16) -> Self {
2305 Self {
2306 per_page: self.per_page,
2307 page: Some(page),
2308 }
2309 }
2310}
2311
2312impl<'enc> From<&'enc PerPage> for OrgsGetOrgRulesetHistoryParams {
2313 fn from(per_page: &'enc PerPage) -> Self {
2314 Self {
2315 per_page: Some(per_page.per_page),
2316 page: Some(per_page.page),
2317 ..Default::default()
2318 }
2319 }
2320}
2321#[derive(Default, Serialize)]
2323pub struct OrgsGetRouteStatsByActorParams<'req> {
2324 min_timestamp: &'req str,
2326 max_timestamp: Option<&'req str>,
2328 page: Option<u16>,
2330 per_page: Option<u16>,
2332 direction: Option<&'req str>,
2334 sort: Option<Vec<String>>,
2336 api_route_substring: Option<&'req str>
2338}
2339
2340impl<'req> OrgsGetRouteStatsByActorParams<'req> {
2341 pub fn new() -> Self {
2342 Self::default()
2343 }
2344
2345 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2347 Self {
2348 min_timestamp: min_timestamp,
2349 max_timestamp: self.max_timestamp,
2350 page: self.page,
2351 per_page: self.per_page,
2352 direction: self.direction,
2353 sort: self.sort,
2354 api_route_substring: self.api_route_substring,
2355 }
2356 }
2357
2358 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2360 Self {
2361 min_timestamp: self.min_timestamp,
2362 max_timestamp: Some(max_timestamp),
2363 page: self.page,
2364 per_page: self.per_page,
2365 direction: self.direction,
2366 sort: self.sort,
2367 api_route_substring: self.api_route_substring,
2368 }
2369 }
2370
2371 pub fn page(self, page: u16) -> Self {
2373 Self {
2374 min_timestamp: self.min_timestamp,
2375 max_timestamp: self.max_timestamp,
2376 page: Some(page),
2377 per_page: self.per_page,
2378 direction: self.direction,
2379 sort: self.sort,
2380 api_route_substring: self.api_route_substring,
2381 }
2382 }
2383
2384 pub fn per_page(self, per_page: u16) -> Self {
2386 Self {
2387 min_timestamp: self.min_timestamp,
2388 max_timestamp: self.max_timestamp,
2389 page: self.page,
2390 per_page: Some(per_page),
2391 direction: self.direction,
2392 sort: self.sort,
2393 api_route_substring: self.api_route_substring,
2394 }
2395 }
2396
2397 pub fn direction(self, direction: &'req str) -> Self {
2399 Self {
2400 min_timestamp: self.min_timestamp,
2401 max_timestamp: self.max_timestamp,
2402 page: self.page,
2403 per_page: self.per_page,
2404 direction: Some(direction),
2405 sort: self.sort,
2406 api_route_substring: self.api_route_substring,
2407 }
2408 }
2409
2410 pub fn sort(self, sort: Vec<String>) -> Self {
2412 Self {
2413 min_timestamp: self.min_timestamp,
2414 max_timestamp: self.max_timestamp,
2415 page: self.page,
2416 per_page: self.per_page,
2417 direction: self.direction,
2418 sort: Some(sort),
2419 api_route_substring: self.api_route_substring,
2420 }
2421 }
2422
2423 pub fn api_route_substring(self, api_route_substring: &'req str) -> Self {
2425 Self {
2426 min_timestamp: self.min_timestamp,
2427 max_timestamp: self.max_timestamp,
2428 page: self.page,
2429 per_page: self.per_page,
2430 direction: self.direction,
2431 sort: self.sort,
2432 api_route_substring: Some(api_route_substring),
2433 }
2434 }
2435}
2436
2437impl<'enc> From<&'enc PerPage> for OrgsGetRouteStatsByActorParams<'enc> {
2438 fn from(per_page: &'enc PerPage) -> Self {
2439 Self {
2440 per_page: Some(per_page.per_page),
2441 page: Some(per_page.page),
2442 ..Default::default()
2443 }
2444 }
2445}
2446#[derive(Default, Serialize)]
2448pub struct OrgsGetSubjectStatsParams<'req> {
2449 min_timestamp: &'req str,
2451 max_timestamp: Option<&'req str>,
2453 page: Option<u16>,
2455 per_page: Option<u16>,
2457 direction: Option<&'req str>,
2459 sort: Option<Vec<String>>,
2461 subject_name_substring: Option<&'req str>
2463}
2464
2465impl<'req> OrgsGetSubjectStatsParams<'req> {
2466 pub fn new() -> Self {
2467 Self::default()
2468 }
2469
2470 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2472 Self {
2473 min_timestamp: min_timestamp,
2474 max_timestamp: self.max_timestamp,
2475 page: self.page,
2476 per_page: self.per_page,
2477 direction: self.direction,
2478 sort: self.sort,
2479 subject_name_substring: self.subject_name_substring,
2480 }
2481 }
2482
2483 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2485 Self {
2486 min_timestamp: self.min_timestamp,
2487 max_timestamp: Some(max_timestamp),
2488 page: self.page,
2489 per_page: self.per_page,
2490 direction: self.direction,
2491 sort: self.sort,
2492 subject_name_substring: self.subject_name_substring,
2493 }
2494 }
2495
2496 pub fn page(self, page: u16) -> Self {
2498 Self {
2499 min_timestamp: self.min_timestamp,
2500 max_timestamp: self.max_timestamp,
2501 page: Some(page),
2502 per_page: self.per_page,
2503 direction: self.direction,
2504 sort: self.sort,
2505 subject_name_substring: self.subject_name_substring,
2506 }
2507 }
2508
2509 pub fn per_page(self, per_page: u16) -> Self {
2511 Self {
2512 min_timestamp: self.min_timestamp,
2513 max_timestamp: self.max_timestamp,
2514 page: self.page,
2515 per_page: Some(per_page),
2516 direction: self.direction,
2517 sort: self.sort,
2518 subject_name_substring: self.subject_name_substring,
2519 }
2520 }
2521
2522 pub fn direction(self, direction: &'req str) -> Self {
2524 Self {
2525 min_timestamp: self.min_timestamp,
2526 max_timestamp: self.max_timestamp,
2527 page: self.page,
2528 per_page: self.per_page,
2529 direction: Some(direction),
2530 sort: self.sort,
2531 subject_name_substring: self.subject_name_substring,
2532 }
2533 }
2534
2535 pub fn sort(self, sort: Vec<String>) -> Self {
2537 Self {
2538 min_timestamp: self.min_timestamp,
2539 max_timestamp: self.max_timestamp,
2540 page: self.page,
2541 per_page: self.per_page,
2542 direction: self.direction,
2543 sort: Some(sort),
2544 subject_name_substring: self.subject_name_substring,
2545 }
2546 }
2547
2548 pub fn subject_name_substring(self, subject_name_substring: &'req str) -> Self {
2550 Self {
2551 min_timestamp: self.min_timestamp,
2552 max_timestamp: self.max_timestamp,
2553 page: self.page,
2554 per_page: self.per_page,
2555 direction: self.direction,
2556 sort: self.sort,
2557 subject_name_substring: Some(subject_name_substring),
2558 }
2559 }
2560}
2561
2562impl<'enc> From<&'enc PerPage> for OrgsGetSubjectStatsParams<'enc> {
2563 fn from(per_page: &'enc PerPage) -> Self {
2564 Self {
2565 per_page: Some(per_page.per_page),
2566 page: Some(per_page.page),
2567 ..Default::default()
2568 }
2569 }
2570}
2571#[derive(Default, Serialize)]
2573pub struct OrgsGetSummaryStatsParams<'req> {
2574 min_timestamp: &'req str,
2576 max_timestamp: Option<&'req str>
2578}
2579
2580impl<'req> OrgsGetSummaryStatsParams<'req> {
2581 pub fn new() -> Self {
2582 Self::default()
2583 }
2584
2585 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2587 Self {
2588 min_timestamp: min_timestamp,
2589 max_timestamp: self.max_timestamp,
2590 }
2591 }
2592
2593 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2595 Self {
2596 min_timestamp: self.min_timestamp,
2597 max_timestamp: Some(max_timestamp),
2598 }
2599 }
2600}
2601
2602#[derive(Default, Serialize)]
2604pub struct OrgsGetSummaryStatsByActorParams<'req> {
2605 min_timestamp: &'req str,
2607 max_timestamp: Option<&'req str>
2609}
2610
2611impl<'req> OrgsGetSummaryStatsByActorParams<'req> {
2612 pub fn new() -> Self {
2613 Self::default()
2614 }
2615
2616 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2618 Self {
2619 min_timestamp: min_timestamp,
2620 max_timestamp: self.max_timestamp,
2621 }
2622 }
2623
2624 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2626 Self {
2627 min_timestamp: self.min_timestamp,
2628 max_timestamp: Some(max_timestamp),
2629 }
2630 }
2631}
2632
2633#[derive(Default, Serialize)]
2635pub struct OrgsGetSummaryStatsByUserParams<'req> {
2636 min_timestamp: &'req str,
2638 max_timestamp: Option<&'req str>
2640}
2641
2642impl<'req> OrgsGetSummaryStatsByUserParams<'req> {
2643 pub fn new() -> Self {
2644 Self::default()
2645 }
2646
2647 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2649 Self {
2650 min_timestamp: min_timestamp,
2651 max_timestamp: self.max_timestamp,
2652 }
2653 }
2654
2655 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2657 Self {
2658 min_timestamp: self.min_timestamp,
2659 max_timestamp: Some(max_timestamp),
2660 }
2661 }
2662}
2663
2664#[derive(Default, Serialize)]
2666pub struct OrgsGetTimeStatsParams<'req> {
2667 min_timestamp: &'req str,
2669 max_timestamp: Option<&'req str>,
2671 timestamp_increment: &'req str
2673}
2674
2675impl<'req> OrgsGetTimeStatsParams<'req> {
2676 pub fn new() -> Self {
2677 Self::default()
2678 }
2679
2680 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2682 Self {
2683 min_timestamp: min_timestamp,
2684 max_timestamp: self.max_timestamp,
2685 timestamp_increment: self.timestamp_increment,
2686 }
2687 }
2688
2689 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2691 Self {
2692 min_timestamp: self.min_timestamp,
2693 max_timestamp: Some(max_timestamp),
2694 timestamp_increment: self.timestamp_increment,
2695 }
2696 }
2697
2698 pub fn timestamp_increment(self, timestamp_increment: &'req str) -> Self {
2700 Self {
2701 min_timestamp: self.min_timestamp,
2702 max_timestamp: self.max_timestamp,
2703 timestamp_increment: timestamp_increment,
2704 }
2705 }
2706}
2707
2708#[derive(Default, Serialize)]
2710pub struct OrgsGetTimeStatsByActorParams<'req> {
2711 min_timestamp: &'req str,
2713 max_timestamp: Option<&'req str>,
2715 timestamp_increment: &'req str
2717}
2718
2719impl<'req> OrgsGetTimeStatsByActorParams<'req> {
2720 pub fn new() -> Self {
2721 Self::default()
2722 }
2723
2724 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2726 Self {
2727 min_timestamp: min_timestamp,
2728 max_timestamp: self.max_timestamp,
2729 timestamp_increment: self.timestamp_increment,
2730 }
2731 }
2732
2733 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2735 Self {
2736 min_timestamp: self.min_timestamp,
2737 max_timestamp: Some(max_timestamp),
2738 timestamp_increment: self.timestamp_increment,
2739 }
2740 }
2741
2742 pub fn timestamp_increment(self, timestamp_increment: &'req str) -> Self {
2744 Self {
2745 min_timestamp: self.min_timestamp,
2746 max_timestamp: self.max_timestamp,
2747 timestamp_increment: timestamp_increment,
2748 }
2749 }
2750}
2751
2752#[derive(Default, Serialize)]
2754pub struct OrgsGetTimeStatsByUserParams<'req> {
2755 min_timestamp: &'req str,
2757 max_timestamp: Option<&'req str>,
2759 timestamp_increment: &'req str
2761}
2762
2763impl<'req> OrgsGetTimeStatsByUserParams<'req> {
2764 pub fn new() -> Self {
2765 Self::default()
2766 }
2767
2768 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2770 Self {
2771 min_timestamp: min_timestamp,
2772 max_timestamp: self.max_timestamp,
2773 timestamp_increment: self.timestamp_increment,
2774 }
2775 }
2776
2777 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2779 Self {
2780 min_timestamp: self.min_timestamp,
2781 max_timestamp: Some(max_timestamp),
2782 timestamp_increment: self.timestamp_increment,
2783 }
2784 }
2785
2786 pub fn timestamp_increment(self, timestamp_increment: &'req str) -> Self {
2788 Self {
2789 min_timestamp: self.min_timestamp,
2790 max_timestamp: self.max_timestamp,
2791 timestamp_increment: timestamp_increment,
2792 }
2793 }
2794}
2795
2796#[derive(Default, Serialize)]
2798pub struct OrgsGetUserStatsParams<'req> {
2799 min_timestamp: &'req str,
2801 max_timestamp: Option<&'req str>,
2803 page: Option<u16>,
2805 per_page: Option<u16>,
2807 direction: Option<&'req str>,
2809 sort: Option<Vec<String>>,
2811 actor_name_substring: Option<&'req str>
2813}
2814
2815impl<'req> OrgsGetUserStatsParams<'req> {
2816 pub fn new() -> Self {
2817 Self::default()
2818 }
2819
2820 pub fn min_timestamp(self, min_timestamp: &'req str) -> Self {
2822 Self {
2823 min_timestamp: min_timestamp,
2824 max_timestamp: self.max_timestamp,
2825 page: self.page,
2826 per_page: self.per_page,
2827 direction: self.direction,
2828 sort: self.sort,
2829 actor_name_substring: self.actor_name_substring,
2830 }
2831 }
2832
2833 pub fn max_timestamp(self, max_timestamp: &'req str) -> Self {
2835 Self {
2836 min_timestamp: self.min_timestamp,
2837 max_timestamp: Some(max_timestamp),
2838 page: self.page,
2839 per_page: self.per_page,
2840 direction: self.direction,
2841 sort: self.sort,
2842 actor_name_substring: self.actor_name_substring,
2843 }
2844 }
2845
2846 pub fn page(self, page: u16) -> Self {
2848 Self {
2849 min_timestamp: self.min_timestamp,
2850 max_timestamp: self.max_timestamp,
2851 page: Some(page),
2852 per_page: self.per_page,
2853 direction: self.direction,
2854 sort: self.sort,
2855 actor_name_substring: self.actor_name_substring,
2856 }
2857 }
2858
2859 pub fn per_page(self, per_page: u16) -> Self {
2861 Self {
2862 min_timestamp: self.min_timestamp,
2863 max_timestamp: self.max_timestamp,
2864 page: self.page,
2865 per_page: Some(per_page),
2866 direction: self.direction,
2867 sort: self.sort,
2868 actor_name_substring: self.actor_name_substring,
2869 }
2870 }
2871
2872 pub fn direction(self, direction: &'req str) -> Self {
2874 Self {
2875 min_timestamp: self.min_timestamp,
2876 max_timestamp: self.max_timestamp,
2877 page: self.page,
2878 per_page: self.per_page,
2879 direction: Some(direction),
2880 sort: self.sort,
2881 actor_name_substring: self.actor_name_substring,
2882 }
2883 }
2884
2885 pub fn sort(self, sort: Vec<String>) -> Self {
2887 Self {
2888 min_timestamp: self.min_timestamp,
2889 max_timestamp: self.max_timestamp,
2890 page: self.page,
2891 per_page: self.per_page,
2892 direction: self.direction,
2893 sort: Some(sort),
2894 actor_name_substring: self.actor_name_substring,
2895 }
2896 }
2897
2898 pub fn actor_name_substring(self, actor_name_substring: &'req str) -> Self {
2900 Self {
2901 min_timestamp: self.min_timestamp,
2902 max_timestamp: self.max_timestamp,
2903 page: self.page,
2904 per_page: self.per_page,
2905 direction: self.direction,
2906 sort: self.sort,
2907 actor_name_substring: Some(actor_name_substring),
2908 }
2909 }
2910}
2911
2912impl<'enc> From<&'enc PerPage> for OrgsGetUserStatsParams<'enc> {
2913 fn from(per_page: &'enc PerPage) -> Self {
2914 Self {
2915 per_page: Some(per_page.per_page),
2916 page: Some(per_page.page),
2917 ..Default::default()
2918 }
2919 }
2920}
2921#[derive(Default, Serialize)]
2923pub struct OrgsListParams {
2924 since: Option<i32>,
2926 per_page: Option<u16>
2928}
2929
2930impl OrgsListParams {
2931 pub fn new() -> Self {
2932 Self::default()
2933 }
2934
2935 pub fn since(self, since: i32) -> Self {
2937 Self {
2938 since: Some(since),
2939 per_page: self.per_page,
2940 }
2941 }
2942
2943 pub fn per_page(self, per_page: u16) -> Self {
2945 Self {
2946 since: self.since,
2947 per_page: Some(per_page),
2948 }
2949 }
2950}
2951
2952#[derive(Default, Serialize)]
2954pub struct OrgsListAppInstallationsParams {
2955 per_page: Option<u16>,
2957 page: Option<u16>
2959}
2960
2961impl OrgsListAppInstallationsParams {
2962 pub fn new() -> Self {
2963 Self::default()
2964 }
2965
2966 pub fn per_page(self, per_page: u16) -> Self {
2968 Self {
2969 per_page: Some(per_page),
2970 page: self.page,
2971 }
2972 }
2973
2974 pub fn page(self, page: u16) -> Self {
2976 Self {
2977 per_page: self.per_page,
2978 page: Some(page),
2979 }
2980 }
2981}
2982
2983impl<'enc> From<&'enc PerPage> for OrgsListAppInstallationsParams {
2984 fn from(per_page: &'enc PerPage) -> Self {
2985 Self {
2986 per_page: Some(per_page.per_page),
2987 page: Some(per_page.page),
2988 ..Default::default()
2989 }
2990 }
2991}
2992#[derive(Default, Serialize)]
2994pub struct OrgsListAttestationsParams<'req> {
2995 per_page: Option<u16>,
2997 before: Option<&'req str>,
2999 after: Option<&'req str>,
3001 predicate_type: Option<&'req str>
3003}
3004
3005impl<'req> OrgsListAttestationsParams<'req> {
3006 pub fn new() -> Self {
3007 Self::default()
3008 }
3009
3010 pub fn per_page(self, per_page: u16) -> Self {
3012 Self {
3013 per_page: Some(per_page),
3014 before: self.before,
3015 after: self.after,
3016 predicate_type: self.predicate_type,
3017 }
3018 }
3019
3020 pub fn before(self, before: &'req str) -> Self {
3022 Self {
3023 per_page: self.per_page,
3024 before: Some(before),
3025 after: self.after,
3026 predicate_type: self.predicate_type,
3027 }
3028 }
3029
3030 pub fn after(self, after: &'req str) -> Self {
3032 Self {
3033 per_page: self.per_page,
3034 before: self.before,
3035 after: Some(after),
3036 predicate_type: self.predicate_type,
3037 }
3038 }
3039
3040 pub fn predicate_type(self, predicate_type: &'req str) -> Self {
3042 Self {
3043 per_page: self.per_page,
3044 before: self.before,
3045 after: self.after,
3046 predicate_type: Some(predicate_type),
3047 }
3048 }
3049}
3050
3051#[derive(Default, Serialize)]
3053pub struct OrgsListAttestationsBulkParams<'req> {
3054 per_page: Option<u16>,
3056 before: Option<&'req str>,
3058 after: Option<&'req str>
3060}
3061
3062impl<'req> OrgsListAttestationsBulkParams<'req> {
3063 pub fn new() -> Self {
3064 Self::default()
3065 }
3066
3067 pub fn per_page(self, per_page: u16) -> Self {
3069 Self {
3070 per_page: Some(per_page),
3071 before: self.before,
3072 after: self.after,
3073 }
3074 }
3075
3076 pub fn before(self, before: &'req str) -> Self {
3078 Self {
3079 per_page: self.per_page,
3080 before: Some(before),
3081 after: self.after,
3082 }
3083 }
3084
3085 pub fn after(self, after: &'req str) -> Self {
3087 Self {
3088 per_page: self.per_page,
3089 before: self.before,
3090 after: Some(after),
3091 }
3092 }
3093}
3094
3095#[derive(Default, Serialize)]
3097pub struct OrgsListBlockedUsersParams {
3098 per_page: Option<u16>,
3100 page: Option<u16>
3102}
3103
3104impl OrgsListBlockedUsersParams {
3105 pub fn new() -> Self {
3106 Self::default()
3107 }
3108
3109 pub fn per_page(self, per_page: u16) -> Self {
3111 Self {
3112 per_page: Some(per_page),
3113 page: self.page,
3114 }
3115 }
3116
3117 pub fn page(self, page: u16) -> Self {
3119 Self {
3120 per_page: self.per_page,
3121 page: Some(page),
3122 }
3123 }
3124}
3125
3126impl<'enc> From<&'enc PerPage> for OrgsListBlockedUsersParams {
3127 fn from(per_page: &'enc PerPage) -> Self {
3128 Self {
3129 per_page: Some(per_page.per_page),
3130 page: Some(per_page.page),
3131 ..Default::default()
3132 }
3133 }
3134}
3135#[derive(Default, Serialize)]
3137pub struct OrgsListCustomPropertiesValuesForReposParams<'req> {
3138 per_page: Option<u16>,
3140 page: Option<u16>,
3142 repository_query: Option<&'req str>
3144}
3145
3146impl<'req> OrgsListCustomPropertiesValuesForReposParams<'req> {
3147 pub fn new() -> Self {
3148 Self::default()
3149 }
3150
3151 pub fn per_page(self, per_page: u16) -> Self {
3153 Self {
3154 per_page: Some(per_page),
3155 page: self.page,
3156 repository_query: self.repository_query,
3157 }
3158 }
3159
3160 pub fn page(self, page: u16) -> Self {
3162 Self {
3163 per_page: self.per_page,
3164 page: Some(page),
3165 repository_query: self.repository_query,
3166 }
3167 }
3168
3169 pub fn repository_query(self, repository_query: &'req str) -> Self {
3171 Self {
3172 per_page: self.per_page,
3173 page: self.page,
3174 repository_query: Some(repository_query),
3175 }
3176 }
3177}
3178
3179impl<'enc> From<&'enc PerPage> for OrgsListCustomPropertiesValuesForReposParams<'enc> {
3180 fn from(per_page: &'enc PerPage) -> Self {
3181 Self {
3182 per_page: Some(per_page.per_page),
3183 page: Some(per_page.page),
3184 ..Default::default()
3185 }
3186 }
3187}
3188#[derive(Default, Serialize)]
3190pub struct OrgsListFailedInvitationsParams {
3191 per_page: Option<u16>,
3193 page: Option<u16>
3195}
3196
3197impl OrgsListFailedInvitationsParams {
3198 pub fn new() -> Self {
3199 Self::default()
3200 }
3201
3202 pub fn per_page(self, per_page: u16) -> Self {
3204 Self {
3205 per_page: Some(per_page),
3206 page: self.page,
3207 }
3208 }
3209
3210 pub fn page(self, page: u16) -> Self {
3212 Self {
3213 per_page: self.per_page,
3214 page: Some(page),
3215 }
3216 }
3217}
3218
3219impl<'enc> From<&'enc PerPage> for OrgsListFailedInvitationsParams {
3220 fn from(per_page: &'enc PerPage) -> Self {
3221 Self {
3222 per_page: Some(per_page.per_page),
3223 page: Some(per_page.page),
3224 ..Default::default()
3225 }
3226 }
3227}
3228#[derive(Default, Serialize)]
3230pub struct OrgsListForAuthenticatedUserParams {
3231 per_page: Option<u16>,
3233 page: Option<u16>
3235}
3236
3237impl OrgsListForAuthenticatedUserParams {
3238 pub fn new() -> Self {
3239 Self::default()
3240 }
3241
3242 pub fn per_page(self, per_page: u16) -> Self {
3244 Self {
3245 per_page: Some(per_page),
3246 page: self.page,
3247 }
3248 }
3249
3250 pub fn page(self, page: u16) -> Self {
3252 Self {
3253 per_page: self.per_page,
3254 page: Some(page),
3255 }
3256 }
3257}
3258
3259impl<'enc> From<&'enc PerPage> for OrgsListForAuthenticatedUserParams {
3260 fn from(per_page: &'enc PerPage) -> Self {
3261 Self {
3262 per_page: Some(per_page.per_page),
3263 page: Some(per_page.page),
3264 ..Default::default()
3265 }
3266 }
3267}
3268#[derive(Default, Serialize)]
3270pub struct OrgsListForUserParams {
3271 per_page: Option<u16>,
3273 page: Option<u16>
3275}
3276
3277impl OrgsListForUserParams {
3278 pub fn new() -> Self {
3279 Self::default()
3280 }
3281
3282 pub fn per_page(self, per_page: u16) -> Self {
3284 Self {
3285 per_page: Some(per_page),
3286 page: self.page,
3287 }
3288 }
3289
3290 pub fn page(self, page: u16) -> Self {
3292 Self {
3293 per_page: self.per_page,
3294 page: Some(page),
3295 }
3296 }
3297}
3298
3299impl<'enc> From<&'enc PerPage> for OrgsListForUserParams {
3300 fn from(per_page: &'enc PerPage) -> Self {
3301 Self {
3302 per_page: Some(per_page.per_page),
3303 page: Some(per_page.page),
3304 ..Default::default()
3305 }
3306 }
3307}
3308#[derive(Default, Serialize)]
3310pub struct OrgsListInvitationTeamsParams {
3311 per_page: Option<u16>,
3313 page: Option<u16>
3315}
3316
3317impl OrgsListInvitationTeamsParams {
3318 pub fn new() -> Self {
3319 Self::default()
3320 }
3321
3322 pub fn per_page(self, per_page: u16) -> Self {
3324 Self {
3325 per_page: Some(per_page),
3326 page: self.page,
3327 }
3328 }
3329
3330 pub fn page(self, page: u16) -> Self {
3332 Self {
3333 per_page: self.per_page,
3334 page: Some(page),
3335 }
3336 }
3337}
3338
3339impl<'enc> From<&'enc PerPage> for OrgsListInvitationTeamsParams {
3340 fn from(per_page: &'enc PerPage) -> Self {
3341 Self {
3342 per_page: Some(per_page.per_page),
3343 page: Some(per_page.page),
3344 ..Default::default()
3345 }
3346 }
3347}
3348#[derive(Default, Serialize)]
3350pub struct OrgsListMembersParams<'req> {
3351 filter: Option<&'req str>,
3353 role: Option<&'req str>,
3355 per_page: Option<u16>,
3357 page: Option<u16>
3359}
3360
3361impl<'req> OrgsListMembersParams<'req> {
3362 pub fn new() -> Self {
3363 Self::default()
3364 }
3365
3366 pub fn filter(self, filter: &'req str) -> Self {
3368 Self {
3369 filter: Some(filter),
3370 role: self.role,
3371 per_page: self.per_page,
3372 page: self.page,
3373 }
3374 }
3375
3376 pub fn role(self, role: &'req str) -> Self {
3378 Self {
3379 filter: self.filter,
3380 role: Some(role),
3381 per_page: self.per_page,
3382 page: self.page,
3383 }
3384 }
3385
3386 pub fn per_page(self, per_page: u16) -> Self {
3388 Self {
3389 filter: self.filter,
3390 role: self.role,
3391 per_page: Some(per_page),
3392 page: self.page,
3393 }
3394 }
3395
3396 pub fn page(self, page: u16) -> Self {
3398 Self {
3399 filter: self.filter,
3400 role: self.role,
3401 per_page: self.per_page,
3402 page: Some(page),
3403 }
3404 }
3405}
3406
3407impl<'enc> From<&'enc PerPage> for OrgsListMembersParams<'enc> {
3408 fn from(per_page: &'enc PerPage) -> Self {
3409 Self {
3410 per_page: Some(per_page.per_page),
3411 page: Some(per_page.page),
3412 ..Default::default()
3413 }
3414 }
3415}
3416#[derive(Default, Serialize)]
3418pub struct OrgsListMembershipsForAuthenticatedUserParams<'req> {
3419 state: Option<&'req str>,
3421 per_page: Option<u16>,
3423 page: Option<u16>
3425}
3426
3427impl<'req> OrgsListMembershipsForAuthenticatedUserParams<'req> {
3428 pub fn new() -> Self {
3429 Self::default()
3430 }
3431
3432 pub fn state(self, state: &'req str) -> Self {
3434 Self {
3435 state: Some(state),
3436 per_page: self.per_page,
3437 page: self.page,
3438 }
3439 }
3440
3441 pub fn per_page(self, per_page: u16) -> Self {
3443 Self {
3444 state: self.state,
3445 per_page: Some(per_page),
3446 page: self.page,
3447 }
3448 }
3449
3450 pub fn page(self, page: u16) -> Self {
3452 Self {
3453 state: self.state,
3454 per_page: self.per_page,
3455 page: Some(page),
3456 }
3457 }
3458}
3459
3460impl<'enc> From<&'enc PerPage> for OrgsListMembershipsForAuthenticatedUserParams<'enc> {
3461 fn from(per_page: &'enc PerPage) -> Self {
3462 Self {
3463 per_page: Some(per_page.per_page),
3464 page: Some(per_page.page),
3465 ..Default::default()
3466 }
3467 }
3468}
3469#[derive(Default, Serialize)]
3471pub struct OrgsListOrgRoleTeamsParams {
3472 per_page: Option<u16>,
3474 page: Option<u16>
3476}
3477
3478impl OrgsListOrgRoleTeamsParams {
3479 pub fn new() -> Self {
3480 Self::default()
3481 }
3482
3483 pub fn per_page(self, per_page: u16) -> Self {
3485 Self {
3486 per_page: Some(per_page),
3487 page: self.page,
3488 }
3489 }
3490
3491 pub fn page(self, page: u16) -> Self {
3493 Self {
3494 per_page: self.per_page,
3495 page: Some(page),
3496 }
3497 }
3498}
3499
3500impl<'enc> From<&'enc PerPage> for OrgsListOrgRoleTeamsParams {
3501 fn from(per_page: &'enc PerPage) -> Self {
3502 Self {
3503 per_page: Some(per_page.per_page),
3504 page: Some(per_page.page),
3505 ..Default::default()
3506 }
3507 }
3508}
3509#[derive(Default, Serialize)]
3511pub struct OrgsListOrgRoleUsersParams {
3512 per_page: Option<u16>,
3514 page: Option<u16>
3516}
3517
3518impl OrgsListOrgRoleUsersParams {
3519 pub fn new() -> Self {
3520 Self::default()
3521 }
3522
3523 pub fn per_page(self, per_page: u16) -> Self {
3525 Self {
3526 per_page: Some(per_page),
3527 page: self.page,
3528 }
3529 }
3530
3531 pub fn page(self, page: u16) -> Self {
3533 Self {
3534 per_page: self.per_page,
3535 page: Some(page),
3536 }
3537 }
3538}
3539
3540impl<'enc> From<&'enc PerPage> for OrgsListOrgRoleUsersParams {
3541 fn from(per_page: &'enc PerPage) -> Self {
3542 Self {
3543 per_page: Some(per_page.per_page),
3544 page: Some(per_page.page),
3545 ..Default::default()
3546 }
3547 }
3548}
3549#[derive(Default, Serialize)]
3551pub struct OrgsListOutsideCollaboratorsParams<'req> {
3552 filter: Option<&'req str>,
3554 per_page: Option<u16>,
3556 page: Option<u16>
3558}
3559
3560impl<'req> OrgsListOutsideCollaboratorsParams<'req> {
3561 pub fn new() -> Self {
3562 Self::default()
3563 }
3564
3565 pub fn filter(self, filter: &'req str) -> Self {
3567 Self {
3568 filter: Some(filter),
3569 per_page: self.per_page,
3570 page: self.page,
3571 }
3572 }
3573
3574 pub fn per_page(self, per_page: u16) -> Self {
3576 Self {
3577 filter: self.filter,
3578 per_page: Some(per_page),
3579 page: self.page,
3580 }
3581 }
3582
3583 pub fn page(self, page: u16) -> Self {
3585 Self {
3586 filter: self.filter,
3587 per_page: self.per_page,
3588 page: Some(page),
3589 }
3590 }
3591}
3592
3593impl<'enc> From<&'enc PerPage> for OrgsListOutsideCollaboratorsParams<'enc> {
3594 fn from(per_page: &'enc PerPage) -> Self {
3595 Self {
3596 per_page: Some(per_page.per_page),
3597 page: Some(per_page.page),
3598 ..Default::default()
3599 }
3600 }
3601}
3602#[derive(Default, Serialize)]
3604pub struct OrgsListPatGrantRepositoriesParams {
3605 per_page: Option<u16>,
3607 page: Option<u16>
3609}
3610
3611impl OrgsListPatGrantRepositoriesParams {
3612 pub fn new() -> Self {
3613 Self::default()
3614 }
3615
3616 pub fn per_page(self, per_page: u16) -> Self {
3618 Self {
3619 per_page: Some(per_page),
3620 page: self.page,
3621 }
3622 }
3623
3624 pub fn page(self, page: u16) -> Self {
3626 Self {
3627 per_page: self.per_page,
3628 page: Some(page),
3629 }
3630 }
3631}
3632
3633impl<'enc> From<&'enc PerPage> for OrgsListPatGrantRepositoriesParams {
3634 fn from(per_page: &'enc PerPage) -> Self {
3635 Self {
3636 per_page: Some(per_page.per_page),
3637 page: Some(per_page.page),
3638 ..Default::default()
3639 }
3640 }
3641}
3642#[derive(Default, Serialize)]
3644pub struct OrgsListPatGrantRequestRepositoriesParams {
3645 per_page: Option<u16>,
3647 page: Option<u16>
3649}
3650
3651impl OrgsListPatGrantRequestRepositoriesParams {
3652 pub fn new() -> Self {
3653 Self::default()
3654 }
3655
3656 pub fn per_page(self, per_page: u16) -> Self {
3658 Self {
3659 per_page: Some(per_page),
3660 page: self.page,
3661 }
3662 }
3663
3664 pub fn page(self, page: u16) -> Self {
3666 Self {
3667 per_page: self.per_page,
3668 page: Some(page),
3669 }
3670 }
3671}
3672
3673impl<'enc> From<&'enc PerPage> for OrgsListPatGrantRequestRepositoriesParams {
3674 fn from(per_page: &'enc PerPage) -> Self {
3675 Self {
3676 per_page: Some(per_page.per_page),
3677 page: Some(per_page.page),
3678 ..Default::default()
3679 }
3680 }
3681}
3682#[derive(Default, Serialize)]
3684pub struct OrgsListPatGrantRequestsParams<'req> {
3685 per_page: Option<u16>,
3687 page: Option<u16>,
3689 sort: Option<&'req str>,
3691 direction: Option<&'req str>,
3693 owner: Option<Vec<String>>,
3695 repository: Option<&'req str>,
3697 permission: Option<&'req str>,
3699 last_used_before: Option<chrono::DateTime<chrono::Utc>>,
3701 last_used_after: Option<chrono::DateTime<chrono::Utc>>,
3703 token_id: Option<Vec<String>>
3705}
3706
3707impl<'req> OrgsListPatGrantRequestsParams<'req> {
3708 pub fn new() -> Self {
3709 Self::default()
3710 }
3711
3712 pub fn per_page(self, per_page: u16) -> Self {
3714 Self {
3715 per_page: Some(per_page),
3716 page: self.page,
3717 sort: self.sort,
3718 direction: self.direction,
3719 owner: self.owner,
3720 repository: self.repository,
3721 permission: self.permission,
3722 last_used_before: self.last_used_before,
3723 last_used_after: self.last_used_after,
3724 token_id: self.token_id,
3725 }
3726 }
3727
3728 pub fn page(self, page: u16) -> Self {
3730 Self {
3731 per_page: self.per_page,
3732 page: Some(page),
3733 sort: self.sort,
3734 direction: self.direction,
3735 owner: self.owner,
3736 repository: self.repository,
3737 permission: self.permission,
3738 last_used_before: self.last_used_before,
3739 last_used_after: self.last_used_after,
3740 token_id: self.token_id,
3741 }
3742 }
3743
3744 pub fn sort(self, sort: &'req str) -> Self {
3746 Self {
3747 per_page: self.per_page,
3748 page: self.page,
3749 sort: Some(sort),
3750 direction: self.direction,
3751 owner: self.owner,
3752 repository: self.repository,
3753 permission: self.permission,
3754 last_used_before: self.last_used_before,
3755 last_used_after: self.last_used_after,
3756 token_id: self.token_id,
3757 }
3758 }
3759
3760 pub fn direction(self, direction: &'req str) -> Self {
3762 Self {
3763 per_page: self.per_page,
3764 page: self.page,
3765 sort: self.sort,
3766 direction: Some(direction),
3767 owner: self.owner,
3768 repository: self.repository,
3769 permission: self.permission,
3770 last_used_before: self.last_used_before,
3771 last_used_after: self.last_used_after,
3772 token_id: self.token_id,
3773 }
3774 }
3775
3776 pub fn owner(self, owner: Vec<String>) -> Self {
3778 Self {
3779 per_page: self.per_page,
3780 page: self.page,
3781 sort: self.sort,
3782 direction: self.direction,
3783 owner: Some(owner),
3784 repository: self.repository,
3785 permission: self.permission,
3786 last_used_before: self.last_used_before,
3787 last_used_after: self.last_used_after,
3788 token_id: self.token_id,
3789 }
3790 }
3791
3792 pub fn repository(self, repository: &'req str) -> Self {
3794 Self {
3795 per_page: self.per_page,
3796 page: self.page,
3797 sort: self.sort,
3798 direction: self.direction,
3799 owner: self.owner,
3800 repository: Some(repository),
3801 permission: self.permission,
3802 last_used_before: self.last_used_before,
3803 last_used_after: self.last_used_after,
3804 token_id: self.token_id,
3805 }
3806 }
3807
3808 pub fn permission(self, permission: &'req str) -> Self {
3810 Self {
3811 per_page: self.per_page,
3812 page: self.page,
3813 sort: self.sort,
3814 direction: self.direction,
3815 owner: self.owner,
3816 repository: self.repository,
3817 permission: Some(permission),
3818 last_used_before: self.last_used_before,
3819 last_used_after: self.last_used_after,
3820 token_id: self.token_id,
3821 }
3822 }
3823
3824 pub fn last_used_before(self, last_used_before: chrono::DateTime<chrono::Utc>) -> Self {
3826 Self {
3827 per_page: self.per_page,
3828 page: self.page,
3829 sort: self.sort,
3830 direction: self.direction,
3831 owner: self.owner,
3832 repository: self.repository,
3833 permission: self.permission,
3834 last_used_before: Some(last_used_before),
3835 last_used_after: self.last_used_after,
3836 token_id: self.token_id,
3837 }
3838 }
3839
3840 pub fn last_used_after(self, last_used_after: chrono::DateTime<chrono::Utc>) -> Self {
3842 Self {
3843 per_page: self.per_page,
3844 page: self.page,
3845 sort: self.sort,
3846 direction: self.direction,
3847 owner: self.owner,
3848 repository: self.repository,
3849 permission: self.permission,
3850 last_used_before: self.last_used_before,
3851 last_used_after: Some(last_used_after),
3852 token_id: self.token_id,
3853 }
3854 }
3855
3856 pub fn token_id(self, token_id: Vec<String>) -> Self {
3858 Self {
3859 per_page: self.per_page,
3860 page: self.page,
3861 sort: self.sort,
3862 direction: self.direction,
3863 owner: self.owner,
3864 repository: self.repository,
3865 permission: self.permission,
3866 last_used_before: self.last_used_before,
3867 last_used_after: self.last_used_after,
3868 token_id: Some(token_id),
3869 }
3870 }
3871}
3872
3873impl<'enc> From<&'enc PerPage> for OrgsListPatGrantRequestsParams<'enc> {
3874 fn from(per_page: &'enc PerPage) -> Self {
3875 Self {
3876 per_page: Some(per_page.per_page),
3877 page: Some(per_page.page),
3878 ..Default::default()
3879 }
3880 }
3881}
3882#[derive(Default, Serialize)]
3884pub struct OrgsListPatGrantsParams<'req> {
3885 per_page: Option<u16>,
3887 page: Option<u16>,
3889 sort: Option<&'req str>,
3891 direction: Option<&'req str>,
3893 owner: Option<Vec<String>>,
3895 repository: Option<&'req str>,
3897 permission: Option<&'req str>,
3899 last_used_before: Option<chrono::DateTime<chrono::Utc>>,
3901 last_used_after: Option<chrono::DateTime<chrono::Utc>>,
3903 token_id: Option<Vec<String>>
3905}
3906
3907impl<'req> OrgsListPatGrantsParams<'req> {
3908 pub fn new() -> Self {
3909 Self::default()
3910 }
3911
3912 pub fn per_page(self, per_page: u16) -> Self {
3914 Self {
3915 per_page: Some(per_page),
3916 page: self.page,
3917 sort: self.sort,
3918 direction: self.direction,
3919 owner: self.owner,
3920 repository: self.repository,
3921 permission: self.permission,
3922 last_used_before: self.last_used_before,
3923 last_used_after: self.last_used_after,
3924 token_id: self.token_id,
3925 }
3926 }
3927
3928 pub fn page(self, page: u16) -> Self {
3930 Self {
3931 per_page: self.per_page,
3932 page: Some(page),
3933 sort: self.sort,
3934 direction: self.direction,
3935 owner: self.owner,
3936 repository: self.repository,
3937 permission: self.permission,
3938 last_used_before: self.last_used_before,
3939 last_used_after: self.last_used_after,
3940 token_id: self.token_id,
3941 }
3942 }
3943
3944 pub fn sort(self, sort: &'req str) -> Self {
3946 Self {
3947 per_page: self.per_page,
3948 page: self.page,
3949 sort: Some(sort),
3950 direction: self.direction,
3951 owner: self.owner,
3952 repository: self.repository,
3953 permission: self.permission,
3954 last_used_before: self.last_used_before,
3955 last_used_after: self.last_used_after,
3956 token_id: self.token_id,
3957 }
3958 }
3959
3960 pub fn direction(self, direction: &'req str) -> Self {
3962 Self {
3963 per_page: self.per_page,
3964 page: self.page,
3965 sort: self.sort,
3966 direction: Some(direction),
3967 owner: self.owner,
3968 repository: self.repository,
3969 permission: self.permission,
3970 last_used_before: self.last_used_before,
3971 last_used_after: self.last_used_after,
3972 token_id: self.token_id,
3973 }
3974 }
3975
3976 pub fn owner(self, owner: Vec<String>) -> Self {
3978 Self {
3979 per_page: self.per_page,
3980 page: self.page,
3981 sort: self.sort,
3982 direction: self.direction,
3983 owner: Some(owner),
3984 repository: self.repository,
3985 permission: self.permission,
3986 last_used_before: self.last_used_before,
3987 last_used_after: self.last_used_after,
3988 token_id: self.token_id,
3989 }
3990 }
3991
3992 pub fn repository(self, repository: &'req str) -> Self {
3994 Self {
3995 per_page: self.per_page,
3996 page: self.page,
3997 sort: self.sort,
3998 direction: self.direction,
3999 owner: self.owner,
4000 repository: Some(repository),
4001 permission: self.permission,
4002 last_used_before: self.last_used_before,
4003 last_used_after: self.last_used_after,
4004 token_id: self.token_id,
4005 }
4006 }
4007
4008 pub fn permission(self, permission: &'req str) -> Self {
4010 Self {
4011 per_page: self.per_page,
4012 page: self.page,
4013 sort: self.sort,
4014 direction: self.direction,
4015 owner: self.owner,
4016 repository: self.repository,
4017 permission: Some(permission),
4018 last_used_before: self.last_used_before,
4019 last_used_after: self.last_used_after,
4020 token_id: self.token_id,
4021 }
4022 }
4023
4024 pub fn last_used_before(self, last_used_before: chrono::DateTime<chrono::Utc>) -> Self {
4026 Self {
4027 per_page: self.per_page,
4028 page: self.page,
4029 sort: self.sort,
4030 direction: self.direction,
4031 owner: self.owner,
4032 repository: self.repository,
4033 permission: self.permission,
4034 last_used_before: Some(last_used_before),
4035 last_used_after: self.last_used_after,
4036 token_id: self.token_id,
4037 }
4038 }
4039
4040 pub fn last_used_after(self, last_used_after: chrono::DateTime<chrono::Utc>) -> Self {
4042 Self {
4043 per_page: self.per_page,
4044 page: self.page,
4045 sort: self.sort,
4046 direction: self.direction,
4047 owner: self.owner,
4048 repository: self.repository,
4049 permission: self.permission,
4050 last_used_before: self.last_used_before,
4051 last_used_after: Some(last_used_after),
4052 token_id: self.token_id,
4053 }
4054 }
4055
4056 pub fn token_id(self, token_id: Vec<String>) -> Self {
4058 Self {
4059 per_page: self.per_page,
4060 page: self.page,
4061 sort: self.sort,
4062 direction: self.direction,
4063 owner: self.owner,
4064 repository: self.repository,
4065 permission: self.permission,
4066 last_used_before: self.last_used_before,
4067 last_used_after: self.last_used_after,
4068 token_id: Some(token_id),
4069 }
4070 }
4071}
4072
4073impl<'enc> From<&'enc PerPage> for OrgsListPatGrantsParams<'enc> {
4074 fn from(per_page: &'enc PerPage) -> Self {
4075 Self {
4076 per_page: Some(per_page.per_page),
4077 page: Some(per_page.page),
4078 ..Default::default()
4079 }
4080 }
4081}
4082#[derive(Default, Serialize)]
4084pub struct OrgsListPendingInvitationsParams<'req> {
4085 per_page: Option<u16>,
4087 page: Option<u16>,
4089 role: Option<&'req str>,
4091 invitation_source: Option<&'req str>
4093}
4094
4095impl<'req> OrgsListPendingInvitationsParams<'req> {
4096 pub fn new() -> Self {
4097 Self::default()
4098 }
4099
4100 pub fn per_page(self, per_page: u16) -> Self {
4102 Self {
4103 per_page: Some(per_page),
4104 page: self.page,
4105 role: self.role,
4106 invitation_source: self.invitation_source,
4107 }
4108 }
4109
4110 pub fn page(self, page: u16) -> Self {
4112 Self {
4113 per_page: self.per_page,
4114 page: Some(page),
4115 role: self.role,
4116 invitation_source: self.invitation_source,
4117 }
4118 }
4119
4120 pub fn role(self, role: &'req str) -> Self {
4122 Self {
4123 per_page: self.per_page,
4124 page: self.page,
4125 role: Some(role),
4126 invitation_source: self.invitation_source,
4127 }
4128 }
4129
4130 pub fn invitation_source(self, invitation_source: &'req str) -> Self {
4132 Self {
4133 per_page: self.per_page,
4134 page: self.page,
4135 role: self.role,
4136 invitation_source: Some(invitation_source),
4137 }
4138 }
4139}
4140
4141impl<'enc> From<&'enc PerPage> for OrgsListPendingInvitationsParams<'enc> {
4142 fn from(per_page: &'enc PerPage) -> Self {
4143 Self {
4144 per_page: Some(per_page.per_page),
4145 page: Some(per_page.page),
4146 ..Default::default()
4147 }
4148 }
4149}
4150#[derive(Default, Serialize)]
4152pub struct OrgsListPublicMembersParams {
4153 per_page: Option<u16>,
4155 page: Option<u16>
4157}
4158
4159impl OrgsListPublicMembersParams {
4160 pub fn new() -> Self {
4161 Self::default()
4162 }
4163
4164 pub fn per_page(self, per_page: u16) -> Self {
4166 Self {
4167 per_page: Some(per_page),
4168 page: self.page,
4169 }
4170 }
4171
4172 pub fn page(self, page: u16) -> Self {
4174 Self {
4175 per_page: self.per_page,
4176 page: Some(page),
4177 }
4178 }
4179}
4180
4181impl<'enc> From<&'enc PerPage> for OrgsListPublicMembersParams {
4182 fn from(per_page: &'enc PerPage) -> Self {
4183 Self {
4184 per_page: Some(per_page.per_page),
4185 page: Some(per_page.page),
4186 ..Default::default()
4187 }
4188 }
4189}
4190#[derive(Default, Serialize)]
4192pub struct OrgsListWebhookDeliveriesParams<'req> {
4193 per_page: Option<u16>,
4195 cursor: Option<&'req str>
4197}
4198
4199impl<'req> OrgsListWebhookDeliveriesParams<'req> {
4200 pub fn new() -> Self {
4201 Self::default()
4202 }
4203
4204 pub fn per_page(self, per_page: u16) -> Self {
4206 Self {
4207 per_page: Some(per_page),
4208 cursor: self.cursor,
4209 }
4210 }
4211
4212 pub fn cursor(self, cursor: &'req str) -> Self {
4214 Self {
4215 per_page: self.per_page,
4216 cursor: Some(cursor),
4217 }
4218 }
4219}
4220
4221#[derive(Default, Serialize)]
4223pub struct OrgsListWebhooksParams {
4224 per_page: Option<u16>,
4226 page: Option<u16>
4228}
4229
4230impl OrgsListWebhooksParams {
4231 pub fn new() -> Self {
4232 Self::default()
4233 }
4234
4235 pub fn per_page(self, per_page: u16) -> Self {
4237 Self {
4238 per_page: Some(per_page),
4239 page: self.page,
4240 }
4241 }
4242
4243 pub fn page(self, page: u16) -> Self {
4245 Self {
4246 per_page: self.per_page,
4247 page: Some(page),
4248 }
4249 }
4250}
4251
4252impl<'enc> From<&'enc PerPage> for OrgsListWebhooksParams {
4253 fn from(per_page: &'enc PerPage) -> Self {
4254 Self {
4255 per_page: Some(per_page.per_page),
4256 page: Some(per_page.page),
4257 ..Default::default()
4258 }
4259 }
4260}
4261
4262impl<'api, C: Client> Orgs<'api, C> where AdapterError: From<<C as Client>::Err> {
4263 pub async fn add_security_manager_team_async(&self, org: &str, team_slug: &str) -> Result<(), AdapterError> {
4274
4275 let request_uri = format!("{}/orgs/{}/security-managers/teams/{}", super::GITHUB_BASE_API_URL, org, team_slug);
4276
4277
4278 let req = GitHubRequest {
4279 uri: request_uri,
4280 body: None::<C::Body>,
4281 method: "PUT",
4282 headers: vec![]
4283 };
4284
4285 let request = self.client.build(req)?;
4286
4287 let github_response = self.client.fetch_async(request).await?;
4290
4291 if github_response.is_success() {
4294 Ok(())
4295 } else {
4296 match github_response.status_code() {
4297 code => Err(OrgsAddSecurityManagerTeamError::Generic { code }.into()),
4298 }
4299 }
4300 }
4301
4302 #[cfg(not(target_arch = "wasm32"))]
4313 pub fn add_security_manager_team(&self, org: &str, team_slug: &str) -> Result<(), AdapterError> {
4314
4315 let request_uri = format!("{}/orgs/{}/security-managers/teams/{}", super::GITHUB_BASE_API_URL, org, team_slug);
4316
4317
4318 let req = GitHubRequest {
4319 uri: request_uri,
4320 body: None,
4321 method: "PUT",
4322 headers: vec![]
4323 };
4324
4325 let request = self.client.build(req)?;
4326
4327 let github_response = self.client.fetch(request)?;
4330
4331 if github_response.is_success() {
4334 Ok(())
4335 } else {
4336 match github_response.status_code() {
4337 code => Err(OrgsAddSecurityManagerTeamError::Generic { code }.into()),
4338 }
4339 }
4340 }
4341
4342 pub async fn assign_team_to_org_role_async(&self, org: &str, team_slug: &str, role_id: i32) -> Result<(), AdapterError> {
4356
4357 let request_uri = format!("{}/orgs/{}/organization-roles/teams/{}/{}", super::GITHUB_BASE_API_URL, org, team_slug, role_id);
4358
4359
4360 let req = GitHubRequest {
4361 uri: request_uri,
4362 body: None::<C::Body>,
4363 method: "PUT",
4364 headers: vec![]
4365 };
4366
4367 let request = self.client.build(req)?;
4368
4369 let github_response = self.client.fetch_async(request).await?;
4372
4373 if github_response.is_success() {
4376 Ok(())
4377 } else {
4378 match github_response.status_code() {
4379 404 => Err(OrgsAssignTeamToOrgRoleError::Status404.into()),
4380 422 => Err(OrgsAssignTeamToOrgRoleError::Status422.into()),
4381 code => Err(OrgsAssignTeamToOrgRoleError::Generic { code }.into()),
4382 }
4383 }
4384 }
4385
4386 #[cfg(not(target_arch = "wasm32"))]
4400 pub fn assign_team_to_org_role(&self, org: &str, team_slug: &str, role_id: i32) -> Result<(), AdapterError> {
4401
4402 let request_uri = format!("{}/orgs/{}/organization-roles/teams/{}/{}", super::GITHUB_BASE_API_URL, org, team_slug, role_id);
4403
4404
4405 let req = GitHubRequest {
4406 uri: request_uri,
4407 body: None,
4408 method: "PUT",
4409 headers: vec![]
4410 };
4411
4412 let request = self.client.build(req)?;
4413
4414 let github_response = self.client.fetch(request)?;
4417
4418 if github_response.is_success() {
4421 Ok(())
4422 } else {
4423 match github_response.status_code() {
4424 404 => Err(OrgsAssignTeamToOrgRoleError::Status404.into()),
4425 422 => Err(OrgsAssignTeamToOrgRoleError::Status422.into()),
4426 code => Err(OrgsAssignTeamToOrgRoleError::Generic { code }.into()),
4427 }
4428 }
4429 }
4430
4431 pub async fn assign_user_to_org_role_async(&self, org: &str, username: &str, role_id: i32) -> Result<(), AdapterError> {
4445
4446 let request_uri = format!("{}/orgs/{}/organization-roles/users/{}/{}", super::GITHUB_BASE_API_URL, org, username, role_id);
4447
4448
4449 let req = GitHubRequest {
4450 uri: request_uri,
4451 body: None::<C::Body>,
4452 method: "PUT",
4453 headers: vec![]
4454 };
4455
4456 let request = self.client.build(req)?;
4457
4458 let github_response = self.client.fetch_async(request).await?;
4461
4462 if github_response.is_success() {
4465 Ok(())
4466 } else {
4467 match github_response.status_code() {
4468 404 => Err(OrgsAssignUserToOrgRoleError::Status404.into()),
4469 422 => Err(OrgsAssignUserToOrgRoleError::Status422.into()),
4470 code => Err(OrgsAssignUserToOrgRoleError::Generic { code }.into()),
4471 }
4472 }
4473 }
4474
4475 #[cfg(not(target_arch = "wasm32"))]
4489 pub fn assign_user_to_org_role(&self, org: &str, username: &str, role_id: i32) -> Result<(), AdapterError> {
4490
4491 let request_uri = format!("{}/orgs/{}/organization-roles/users/{}/{}", super::GITHUB_BASE_API_URL, org, username, role_id);
4492
4493
4494 let req = GitHubRequest {
4495 uri: request_uri,
4496 body: None,
4497 method: "PUT",
4498 headers: vec![]
4499 };
4500
4501 let request = self.client.build(req)?;
4502
4503 let github_response = self.client.fetch(request)?;
4506
4507 if github_response.is_success() {
4510 Ok(())
4511 } else {
4512 match github_response.status_code() {
4513 404 => Err(OrgsAssignUserToOrgRoleError::Status404.into()),
4514 422 => Err(OrgsAssignUserToOrgRoleError::Status422.into()),
4515 code => Err(OrgsAssignUserToOrgRoleError::Generic { code }.into()),
4516 }
4517 }
4518 }
4519
4520 pub async fn block_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4530
4531 let request_uri = format!("{}/orgs/{}/blocks/{}", super::GITHUB_BASE_API_URL, org, username);
4532
4533
4534 let req = GitHubRequest {
4535 uri: request_uri,
4536 body: None::<C::Body>,
4537 method: "PUT",
4538 headers: vec![]
4539 };
4540
4541 let request = self.client.build(req)?;
4542
4543 let github_response = self.client.fetch_async(request).await?;
4546
4547 if github_response.is_success() {
4550 Ok(())
4551 } else {
4552 match github_response.status_code() {
4553 422 => Err(OrgsBlockUserError::Status422(github_response.to_json_async().await?).into()),
4554 code => Err(OrgsBlockUserError::Generic { code }.into()),
4555 }
4556 }
4557 }
4558
4559 #[cfg(not(target_arch = "wasm32"))]
4569 pub fn block_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4570
4571 let request_uri = format!("{}/orgs/{}/blocks/{}", super::GITHUB_BASE_API_URL, org, username);
4572
4573
4574 let req = GitHubRequest {
4575 uri: request_uri,
4576 body: None,
4577 method: "PUT",
4578 headers: vec![]
4579 };
4580
4581 let request = self.client.build(req)?;
4582
4583 let github_response = self.client.fetch(request)?;
4586
4587 if github_response.is_success() {
4590 Ok(())
4591 } else {
4592 match github_response.status_code() {
4593 422 => Err(OrgsBlockUserError::Status422(github_response.to_json()?).into()),
4594 code => Err(OrgsBlockUserError::Generic { code }.into()),
4595 }
4596 }
4597 }
4598
4599 pub async fn cancel_invitation_async(&self, org: &str, invitation_id: i32) -> Result<(), AdapterError> {
4611
4612 let request_uri = format!("{}/orgs/{}/invitations/{}", super::GITHUB_BASE_API_URL, org, invitation_id);
4613
4614
4615 let req = GitHubRequest {
4616 uri: request_uri,
4617 body: None::<C::Body>,
4618 method: "DELETE",
4619 headers: vec![]
4620 };
4621
4622 let request = self.client.build(req)?;
4623
4624 let github_response = self.client.fetch_async(request).await?;
4627
4628 if github_response.is_success() {
4631 Ok(())
4632 } else {
4633 match github_response.status_code() {
4634 422 => Err(OrgsCancelInvitationError::Status422(github_response.to_json_async().await?).into()),
4635 404 => Err(OrgsCancelInvitationError::Status404(github_response.to_json_async().await?).into()),
4636 code => Err(OrgsCancelInvitationError::Generic { code }.into()),
4637 }
4638 }
4639 }
4640
4641 #[cfg(not(target_arch = "wasm32"))]
4653 pub fn cancel_invitation(&self, org: &str, invitation_id: i32) -> Result<(), AdapterError> {
4654
4655 let request_uri = format!("{}/orgs/{}/invitations/{}", super::GITHUB_BASE_API_URL, org, invitation_id);
4656
4657
4658 let req = GitHubRequest {
4659 uri: request_uri,
4660 body: None,
4661 method: "DELETE",
4662 headers: vec![]
4663 };
4664
4665 let request = self.client.build(req)?;
4666
4667 let github_response = self.client.fetch(request)?;
4670
4671 if github_response.is_success() {
4674 Ok(())
4675 } else {
4676 match github_response.status_code() {
4677 422 => Err(OrgsCancelInvitationError::Status422(github_response.to_json()?).into()),
4678 404 => Err(OrgsCancelInvitationError::Status404(github_response.to_json()?).into()),
4679 code => Err(OrgsCancelInvitationError::Generic { code }.into()),
4680 }
4681 }
4682 }
4683
4684 pub async fn check_blocked_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4694
4695 let request_uri = format!("{}/orgs/{}/blocks/{}", super::GITHUB_BASE_API_URL, org, username);
4696
4697
4698 let req = GitHubRequest {
4699 uri: request_uri,
4700 body: None::<C::Body>,
4701 method: "GET",
4702 headers: vec![]
4703 };
4704
4705 let request = self.client.build(req)?;
4706
4707 let github_response = self.client.fetch_async(request).await?;
4710
4711 if github_response.is_success() {
4714 Ok(())
4715 } else {
4716 match github_response.status_code() {
4717 404 => Err(OrgsCheckBlockedUserError::Status404(github_response.to_json_async().await?).into()),
4718 code => Err(OrgsCheckBlockedUserError::Generic { code }.into()),
4719 }
4720 }
4721 }
4722
4723 #[cfg(not(target_arch = "wasm32"))]
4733 pub fn check_blocked_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4734
4735 let request_uri = format!("{}/orgs/{}/blocks/{}", super::GITHUB_BASE_API_URL, org, username);
4736
4737
4738 let req = GitHubRequest {
4739 uri: request_uri,
4740 body: None,
4741 method: "GET",
4742 headers: vec![]
4743 };
4744
4745 let request = self.client.build(req)?;
4746
4747 let github_response = self.client.fetch(request)?;
4750
4751 if github_response.is_success() {
4754 Ok(())
4755 } else {
4756 match github_response.status_code() {
4757 404 => Err(OrgsCheckBlockedUserError::Status404(github_response.to_json()?).into()),
4758 code => Err(OrgsCheckBlockedUserError::Generic { code }.into()),
4759 }
4760 }
4761 }
4762
4763 pub async fn check_membership_for_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4773
4774 let request_uri = format!("{}/orgs/{}/members/{}", super::GITHUB_BASE_API_URL, org, username);
4775
4776
4777 let req = GitHubRequest {
4778 uri: request_uri,
4779 body: None::<C::Body>,
4780 method: "GET",
4781 headers: vec![]
4782 };
4783
4784 let request = self.client.build(req)?;
4785
4786 let github_response = self.client.fetch_async(request).await?;
4789
4790 if github_response.is_success() {
4793 Ok(())
4794 } else {
4795 match github_response.status_code() {
4796 302 => Err(OrgsCheckMembershipForUserError::Status302.into()),
4797 404 => Err(OrgsCheckMembershipForUserError::Status404.into()),
4798 code => Err(OrgsCheckMembershipForUserError::Generic { code }.into()),
4799 }
4800 }
4801 }
4802
4803 #[cfg(not(target_arch = "wasm32"))]
4813 pub fn check_membership_for_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4814
4815 let request_uri = format!("{}/orgs/{}/members/{}", super::GITHUB_BASE_API_URL, org, username);
4816
4817
4818 let req = GitHubRequest {
4819 uri: request_uri,
4820 body: None,
4821 method: "GET",
4822 headers: vec![]
4823 };
4824
4825 let request = self.client.build(req)?;
4826
4827 let github_response = self.client.fetch(request)?;
4830
4831 if github_response.is_success() {
4834 Ok(())
4835 } else {
4836 match github_response.status_code() {
4837 302 => Err(OrgsCheckMembershipForUserError::Status302.into()),
4838 404 => Err(OrgsCheckMembershipForUserError::Status404.into()),
4839 code => Err(OrgsCheckMembershipForUserError::Generic { code }.into()),
4840 }
4841 }
4842 }
4843
4844 pub async fn check_public_membership_for_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4854
4855 let request_uri = format!("{}/orgs/{}/public_members/{}", super::GITHUB_BASE_API_URL, org, username);
4856
4857
4858 let req = GitHubRequest {
4859 uri: request_uri,
4860 body: None::<C::Body>,
4861 method: "GET",
4862 headers: vec![]
4863 };
4864
4865 let request = self.client.build(req)?;
4866
4867 let github_response = self.client.fetch_async(request).await?;
4870
4871 if github_response.is_success() {
4874 Ok(())
4875 } else {
4876 match github_response.status_code() {
4877 404 => Err(OrgsCheckPublicMembershipForUserError::Status404.into()),
4878 code => Err(OrgsCheckPublicMembershipForUserError::Generic { code }.into()),
4879 }
4880 }
4881 }
4882
4883 #[cfg(not(target_arch = "wasm32"))]
4893 pub fn check_public_membership_for_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
4894
4895 let request_uri = format!("{}/orgs/{}/public_members/{}", super::GITHUB_BASE_API_URL, org, username);
4896
4897
4898 let req = GitHubRequest {
4899 uri: request_uri,
4900 body: None,
4901 method: "GET",
4902 headers: vec![]
4903 };
4904
4905 let request = self.client.build(req)?;
4906
4907 let github_response = self.client.fetch(request)?;
4910
4911 if github_response.is_success() {
4914 Ok(())
4915 } else {
4916 match github_response.status_code() {
4917 404 => Err(OrgsCheckPublicMembershipForUserError::Status404.into()),
4918 code => Err(OrgsCheckPublicMembershipForUserError::Generic { code }.into()),
4919 }
4920 }
4921 }
4922
4923 pub async fn convert_member_to_outside_collaborator_async(&self, org: &str, username: &str, body: PutOrgsConvertMemberToOutsideCollaborator) -> Result<HashMap<String, Value>, AdapterError> {
4933
4934 let request_uri = format!("{}/orgs/{}/outside_collaborators/{}", super::GITHUB_BASE_API_URL, org, username);
4935
4936
4937 let req = GitHubRequest {
4938 uri: request_uri,
4939 body: Some(C::from_json::<PutOrgsConvertMemberToOutsideCollaborator>(body)?),
4940 method: "PUT",
4941 headers: vec![]
4942 };
4943
4944 let request = self.client.build(req)?;
4945
4946 let github_response = self.client.fetch_async(request).await?;
4949
4950 if github_response.is_success() {
4953 Ok(github_response.to_json_async().await?)
4954 } else {
4955 match github_response.status_code() {
4956 204 => Err(OrgsConvertMemberToOutsideCollaboratorError::Status204.into()),
4957 403 => Err(OrgsConvertMemberToOutsideCollaboratorError::Status403.into()),
4958 404 => Err(OrgsConvertMemberToOutsideCollaboratorError::Status404(github_response.to_json_async().await?).into()),
4959 code => Err(OrgsConvertMemberToOutsideCollaboratorError::Generic { code }.into()),
4960 }
4961 }
4962 }
4963
4964 #[cfg(not(target_arch = "wasm32"))]
4974 pub fn convert_member_to_outside_collaborator(&self, org: &str, username: &str, body: PutOrgsConvertMemberToOutsideCollaborator) -> Result<HashMap<String, Value>, AdapterError> {
4975
4976 let request_uri = format!("{}/orgs/{}/outside_collaborators/{}", super::GITHUB_BASE_API_URL, org, username);
4977
4978
4979 let req = GitHubRequest {
4980 uri: request_uri,
4981 body: Some(C::from_json::<PutOrgsConvertMemberToOutsideCollaborator>(body)?),
4982 method: "PUT",
4983 headers: vec![]
4984 };
4985
4986 let request = self.client.build(req)?;
4987
4988 let github_response = self.client.fetch(request)?;
4991
4992 if github_response.is_success() {
4995 Ok(github_response.to_json()?)
4996 } else {
4997 match github_response.status_code() {
4998 204 => Err(OrgsConvertMemberToOutsideCollaboratorError::Status204.into()),
4999 403 => Err(OrgsConvertMemberToOutsideCollaboratorError::Status403.into()),
5000 404 => Err(OrgsConvertMemberToOutsideCollaboratorError::Status404(github_response.to_json()?).into()),
5001 code => Err(OrgsConvertMemberToOutsideCollaboratorError::Generic { code }.into()),
5002 }
5003 }
5004 }
5005
5006 pub async fn create_invitation_async(&self, org: &str, body: PostOrgsCreateInvitation) -> Result<OrganizationInvitation, AdapterError> {
5019
5020 let request_uri = format!("{}/orgs/{}/invitations", super::GITHUB_BASE_API_URL, org);
5021
5022
5023 let req = GitHubRequest {
5024 uri: request_uri,
5025 body: Some(C::from_json::<PostOrgsCreateInvitation>(body)?),
5026 method: "POST",
5027 headers: vec![]
5028 };
5029
5030 let request = self.client.build(req)?;
5031
5032 let github_response = self.client.fetch_async(request).await?;
5035
5036 if github_response.is_success() {
5039 Ok(github_response.to_json_async().await?)
5040 } else {
5041 match github_response.status_code() {
5042 422 => Err(OrgsCreateInvitationError::Status422(github_response.to_json_async().await?).into()),
5043 404 => Err(OrgsCreateInvitationError::Status404(github_response.to_json_async().await?).into()),
5044 code => Err(OrgsCreateInvitationError::Generic { code }.into()),
5045 }
5046 }
5047 }
5048
5049 #[cfg(not(target_arch = "wasm32"))]
5062 pub fn create_invitation(&self, org: &str, body: PostOrgsCreateInvitation) -> Result<OrganizationInvitation, AdapterError> {
5063
5064 let request_uri = format!("{}/orgs/{}/invitations", super::GITHUB_BASE_API_URL, org);
5065
5066
5067 let req = GitHubRequest {
5068 uri: request_uri,
5069 body: Some(C::from_json::<PostOrgsCreateInvitation>(body)?),
5070 method: "POST",
5071 headers: vec![]
5072 };
5073
5074 let request = self.client.build(req)?;
5075
5076 let github_response = self.client.fetch(request)?;
5079
5080 if github_response.is_success() {
5083 Ok(github_response.to_json()?)
5084 } else {
5085 match github_response.status_code() {
5086 422 => Err(OrgsCreateInvitationError::Status422(github_response.to_json()?).into()),
5087 404 => Err(OrgsCreateInvitationError::Status404(github_response.to_json()?).into()),
5088 code => Err(OrgsCreateInvitationError::Generic { code }.into()),
5089 }
5090 }
5091 }
5092
5093 pub async fn create_issue_type_async(&self, org: &str, body: PostOrgsCreateIssueType) -> Result<IssueType, AdapterError> {
5108
5109 let request_uri = format!("{}/orgs/{}/issue-types", super::GITHUB_BASE_API_URL, org);
5110
5111
5112 let req = GitHubRequest {
5113 uri: request_uri,
5114 body: Some(C::from_json::<PostOrgsCreateIssueType>(body)?),
5115 method: "POST",
5116 headers: vec![]
5117 };
5118
5119 let request = self.client.build(req)?;
5120
5121 let github_response = self.client.fetch_async(request).await?;
5124
5125 if github_response.is_success() {
5128 Ok(github_response.to_json_async().await?)
5129 } else {
5130 match github_response.status_code() {
5131 404 => Err(OrgsCreateIssueTypeError::Status404(github_response.to_json_async().await?).into()),
5132 422 => Err(OrgsCreateIssueTypeError::Status422(github_response.to_json_async().await?).into()),
5133 code => Err(OrgsCreateIssueTypeError::Generic { code }.into()),
5134 }
5135 }
5136 }
5137
5138 #[cfg(not(target_arch = "wasm32"))]
5153 pub fn create_issue_type(&self, org: &str, body: PostOrgsCreateIssueType) -> Result<IssueType, AdapterError> {
5154
5155 let request_uri = format!("{}/orgs/{}/issue-types", super::GITHUB_BASE_API_URL, org);
5156
5157
5158 let req = GitHubRequest {
5159 uri: request_uri,
5160 body: Some(C::from_json::<PostOrgsCreateIssueType>(body)?),
5161 method: "POST",
5162 headers: vec![]
5163 };
5164
5165 let request = self.client.build(req)?;
5166
5167 let github_response = self.client.fetch(request)?;
5170
5171 if github_response.is_success() {
5174 Ok(github_response.to_json()?)
5175 } else {
5176 match github_response.status_code() {
5177 404 => Err(OrgsCreateIssueTypeError::Status404(github_response.to_json()?).into()),
5178 422 => Err(OrgsCreateIssueTypeError::Status422(github_response.to_json()?).into()),
5179 code => Err(OrgsCreateIssueTypeError::Generic { code }.into()),
5180 }
5181 }
5182 }
5183
5184 pub async fn create_or_update_custom_properties_async(&self, org: &str, body: PatchOrgsCreateOrUpdateCustomProperties) -> Result<Vec<CustomProperty>, AdapterError> {
5202
5203 let request_uri = format!("{}/orgs/{}/properties/schema", super::GITHUB_BASE_API_URL, org);
5204
5205
5206 let req = GitHubRequest {
5207 uri: request_uri,
5208 body: Some(C::from_json::<PatchOrgsCreateOrUpdateCustomProperties>(body)?),
5209 method: "PATCH",
5210 headers: vec![]
5211 };
5212
5213 let request = self.client.build(req)?;
5214
5215 let github_response = self.client.fetch_async(request).await?;
5218
5219 if github_response.is_success() {
5222 Ok(github_response.to_json_async().await?)
5223 } else {
5224 match github_response.status_code() {
5225 403 => Err(OrgsCreateOrUpdateCustomPropertiesError::Status403(github_response.to_json_async().await?).into()),
5226 404 => Err(OrgsCreateOrUpdateCustomPropertiesError::Status404(github_response.to_json_async().await?).into()),
5227 code => Err(OrgsCreateOrUpdateCustomPropertiesError::Generic { code }.into()),
5228 }
5229 }
5230 }
5231
5232 #[cfg(not(target_arch = "wasm32"))]
5250 pub fn create_or_update_custom_properties(&self, org: &str, body: PatchOrgsCreateOrUpdateCustomProperties) -> Result<Vec<CustomProperty>, AdapterError> {
5251
5252 let request_uri = format!("{}/orgs/{}/properties/schema", super::GITHUB_BASE_API_URL, org);
5253
5254
5255 let req = GitHubRequest {
5256 uri: request_uri,
5257 body: Some(C::from_json::<PatchOrgsCreateOrUpdateCustomProperties>(body)?),
5258 method: "PATCH",
5259 headers: vec![]
5260 };
5261
5262 let request = self.client.build(req)?;
5263
5264 let github_response = self.client.fetch(request)?;
5267
5268 if github_response.is_success() {
5271 Ok(github_response.to_json()?)
5272 } else {
5273 match github_response.status_code() {
5274 403 => Err(OrgsCreateOrUpdateCustomPropertiesError::Status403(github_response.to_json()?).into()),
5275 404 => Err(OrgsCreateOrUpdateCustomPropertiesError::Status404(github_response.to_json()?).into()),
5276 code => Err(OrgsCreateOrUpdateCustomPropertiesError::Generic { code }.into()),
5277 }
5278 }
5279 }
5280
5281 pub async fn create_or_update_custom_properties_values_for_repos_async(&self, org: &str, body: PatchOrgsCreateOrUpdateCustomPropertiesValuesForRepos) -> Result<(), AdapterError> {
5300
5301 let request_uri = format!("{}/orgs/{}/properties/values", super::GITHUB_BASE_API_URL, org);
5302
5303
5304 let req = GitHubRequest {
5305 uri: request_uri,
5306 body: Some(C::from_json::<PatchOrgsCreateOrUpdateCustomPropertiesValuesForRepos>(body)?),
5307 method: "PATCH",
5308 headers: vec![]
5309 };
5310
5311 let request = self.client.build(req)?;
5312
5313 let github_response = self.client.fetch_async(request).await?;
5316
5317 if github_response.is_success() {
5320 Ok(())
5321 } else {
5322 match github_response.status_code() {
5323 403 => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status403(github_response.to_json_async().await?).into()),
5324 404 => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status404(github_response.to_json_async().await?).into()),
5325 422 => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status422(github_response.to_json_async().await?).into()),
5326 code => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Generic { code }.into()),
5327 }
5328 }
5329 }
5330
5331 #[cfg(not(target_arch = "wasm32"))]
5350 pub fn create_or_update_custom_properties_values_for_repos(&self, org: &str, body: PatchOrgsCreateOrUpdateCustomPropertiesValuesForRepos) -> Result<(), AdapterError> {
5351
5352 let request_uri = format!("{}/orgs/{}/properties/values", super::GITHUB_BASE_API_URL, org);
5353
5354
5355 let req = GitHubRequest {
5356 uri: request_uri,
5357 body: Some(C::from_json::<PatchOrgsCreateOrUpdateCustomPropertiesValuesForRepos>(body)?),
5358 method: "PATCH",
5359 headers: vec![]
5360 };
5361
5362 let request = self.client.build(req)?;
5363
5364 let github_response = self.client.fetch(request)?;
5367
5368 if github_response.is_success() {
5371 Ok(())
5372 } else {
5373 match github_response.status_code() {
5374 403 => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status403(github_response.to_json()?).into()),
5375 404 => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status404(github_response.to_json()?).into()),
5376 422 => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Status422(github_response.to_json()?).into()),
5377 code => Err(OrgsCreateOrUpdateCustomPropertiesValuesForReposError::Generic { code }.into()),
5378 }
5379 }
5380 }
5381
5382 pub async fn create_or_update_custom_property_async(&self, org: &str, custom_property_name: &str, body: PutOrgsCreateOrUpdateCustomProperty) -> Result<CustomProperty, AdapterError> {
5396
5397 let request_uri = format!("{}/orgs/{}/properties/schema/{}", super::GITHUB_BASE_API_URL, org, custom_property_name);
5398
5399
5400 let req = GitHubRequest {
5401 uri: request_uri,
5402 body: Some(C::from_json::<PutOrgsCreateOrUpdateCustomProperty>(body)?),
5403 method: "PUT",
5404 headers: vec![]
5405 };
5406
5407 let request = self.client.build(req)?;
5408
5409 let github_response = self.client.fetch_async(request).await?;
5412
5413 if github_response.is_success() {
5416 Ok(github_response.to_json_async().await?)
5417 } else {
5418 match github_response.status_code() {
5419 403 => Err(OrgsCreateOrUpdateCustomPropertyError::Status403(github_response.to_json_async().await?).into()),
5420 404 => Err(OrgsCreateOrUpdateCustomPropertyError::Status404(github_response.to_json_async().await?).into()),
5421 code => Err(OrgsCreateOrUpdateCustomPropertyError::Generic { code }.into()),
5422 }
5423 }
5424 }
5425
5426 #[cfg(not(target_arch = "wasm32"))]
5440 pub fn create_or_update_custom_property(&self, org: &str, custom_property_name: &str, body: PutOrgsCreateOrUpdateCustomProperty) -> Result<CustomProperty, AdapterError> {
5441
5442 let request_uri = format!("{}/orgs/{}/properties/schema/{}", super::GITHUB_BASE_API_URL, org, custom_property_name);
5443
5444
5445 let req = GitHubRequest {
5446 uri: request_uri,
5447 body: Some(C::from_json::<PutOrgsCreateOrUpdateCustomProperty>(body)?),
5448 method: "PUT",
5449 headers: vec![]
5450 };
5451
5452 let request = self.client.build(req)?;
5453
5454 let github_response = self.client.fetch(request)?;
5457
5458 if github_response.is_success() {
5461 Ok(github_response.to_json()?)
5462 } else {
5463 match github_response.status_code() {
5464 403 => Err(OrgsCreateOrUpdateCustomPropertyError::Status403(github_response.to_json()?).into()),
5465 404 => Err(OrgsCreateOrUpdateCustomPropertyError::Status404(github_response.to_json()?).into()),
5466 code => Err(OrgsCreateOrUpdateCustomPropertyError::Generic { code }.into()),
5467 }
5468 }
5469 }
5470
5471 pub async fn create_webhook_async(&self, org: &str, body: PostOrgsCreateWebhook) -> Result<OrgHook, AdapterError> {
5486
5487 let request_uri = format!("{}/orgs/{}/hooks", super::GITHUB_BASE_API_URL, org);
5488
5489
5490 let req = GitHubRequest {
5491 uri: request_uri,
5492 body: Some(C::from_json::<PostOrgsCreateWebhook>(body)?),
5493 method: "POST",
5494 headers: vec![]
5495 };
5496
5497 let request = self.client.build(req)?;
5498
5499 let github_response = self.client.fetch_async(request).await?;
5502
5503 if github_response.is_success() {
5506 Ok(github_response.to_json_async().await?)
5507 } else {
5508 match github_response.status_code() {
5509 422 => Err(OrgsCreateWebhookError::Status422(github_response.to_json_async().await?).into()),
5510 404 => Err(OrgsCreateWebhookError::Status404(github_response.to_json_async().await?).into()),
5511 code => Err(OrgsCreateWebhookError::Generic { code }.into()),
5512 }
5513 }
5514 }
5515
5516 #[cfg(not(target_arch = "wasm32"))]
5531 pub fn create_webhook(&self, org: &str, body: PostOrgsCreateWebhook) -> Result<OrgHook, AdapterError> {
5532
5533 let request_uri = format!("{}/orgs/{}/hooks", super::GITHUB_BASE_API_URL, org);
5534
5535
5536 let req = GitHubRequest {
5537 uri: request_uri,
5538 body: Some(C::from_json::<PostOrgsCreateWebhook>(body)?),
5539 method: "POST",
5540 headers: vec![]
5541 };
5542
5543 let request = self.client.build(req)?;
5544
5545 let github_response = self.client.fetch(request)?;
5548
5549 if github_response.is_success() {
5552 Ok(github_response.to_json()?)
5553 } else {
5554 match github_response.status_code() {
5555 422 => Err(OrgsCreateWebhookError::Status422(github_response.to_json()?).into()),
5556 404 => Err(OrgsCreateWebhookError::Status404(github_response.to_json()?).into()),
5557 code => Err(OrgsCreateWebhookError::Generic { code }.into()),
5558 }
5559 }
5560 }
5561
5562 pub async fn delete_async(&self, org: &str) -> Result<HashMap<String, Value>, AdapterError> {
5578
5579 let request_uri = format!("{}/orgs/{}", super::GITHUB_BASE_API_URL, org);
5580
5581
5582 let req = GitHubRequest {
5583 uri: request_uri,
5584 body: None::<C::Body>,
5585 method: "DELETE",
5586 headers: vec![]
5587 };
5588
5589 let request = self.client.build(req)?;
5590
5591 let github_response = self.client.fetch_async(request).await?;
5594
5595 if github_response.is_success() {
5598 Ok(github_response.to_json_async().await?)
5599 } else {
5600 match github_response.status_code() {
5601 404 => Err(OrgsDeleteError::Status404(github_response.to_json_async().await?).into()),
5602 403 => Err(OrgsDeleteError::Status403(github_response.to_json_async().await?).into()),
5603 code => Err(OrgsDeleteError::Generic { code }.into()),
5604 }
5605 }
5606 }
5607
5608 #[cfg(not(target_arch = "wasm32"))]
5624 pub fn delete(&self, org: &str) -> Result<HashMap<String, Value>, AdapterError> {
5625
5626 let request_uri = format!("{}/orgs/{}", super::GITHUB_BASE_API_URL, org);
5627
5628
5629 let req = GitHubRequest {
5630 uri: request_uri,
5631 body: None,
5632 method: "DELETE",
5633 headers: vec![]
5634 };
5635
5636 let request = self.client.build(req)?;
5637
5638 let github_response = self.client.fetch(request)?;
5641
5642 if github_response.is_success() {
5645 Ok(github_response.to_json()?)
5646 } else {
5647 match github_response.status_code() {
5648 404 => Err(OrgsDeleteError::Status404(github_response.to_json()?).into()),
5649 403 => Err(OrgsDeleteError::Status403(github_response.to_json()?).into()),
5650 code => Err(OrgsDeleteError::Generic { code }.into()),
5651 }
5652 }
5653 }
5654
5655 pub async fn delete_issue_type_async(&self, org: &str, issue_type_id: i32) -> Result<(), AdapterError> {
5670
5671 let request_uri = format!("{}/orgs/{}/issue-types/{}", super::GITHUB_BASE_API_URL, org, issue_type_id);
5672
5673
5674 let req = GitHubRequest {
5675 uri: request_uri,
5676 body: None::<C::Body>,
5677 method: "DELETE",
5678 headers: vec![]
5679 };
5680
5681 let request = self.client.build(req)?;
5682
5683 let github_response = self.client.fetch_async(request).await?;
5686
5687 if github_response.is_success() {
5690 Ok(())
5691 } else {
5692 match github_response.status_code() {
5693 422 => Err(OrgsDeleteIssueTypeError::Status422(github_response.to_json_async().await?).into()),
5694 404 => Err(OrgsDeleteIssueTypeError::Status404(github_response.to_json_async().await?).into()),
5695 code => Err(OrgsDeleteIssueTypeError::Generic { code }.into()),
5696 }
5697 }
5698 }
5699
5700 #[cfg(not(target_arch = "wasm32"))]
5715 pub fn delete_issue_type(&self, org: &str, issue_type_id: i32) -> Result<(), AdapterError> {
5716
5717 let request_uri = format!("{}/orgs/{}/issue-types/{}", super::GITHUB_BASE_API_URL, org, issue_type_id);
5718
5719
5720 let req = GitHubRequest {
5721 uri: request_uri,
5722 body: None,
5723 method: "DELETE",
5724 headers: vec![]
5725 };
5726
5727 let request = self.client.build(req)?;
5728
5729 let github_response = self.client.fetch(request)?;
5732
5733 if github_response.is_success() {
5736 Ok(())
5737 } else {
5738 match github_response.status_code() {
5739 422 => Err(OrgsDeleteIssueTypeError::Status422(github_response.to_json()?).into()),
5740 404 => Err(OrgsDeleteIssueTypeError::Status404(github_response.to_json()?).into()),
5741 code => Err(OrgsDeleteIssueTypeError::Generic { code }.into()),
5742 }
5743 }
5744 }
5745
5746 pub async fn delete_webhook_async(&self, org: &str, hook_id: i32) -> Result<(), AdapterError> {
5761
5762 let request_uri = format!("{}/orgs/{}/hooks/{}", super::GITHUB_BASE_API_URL, org, hook_id);
5763
5764
5765 let req = GitHubRequest {
5766 uri: request_uri,
5767 body: None::<C::Body>,
5768 method: "DELETE",
5769 headers: vec![]
5770 };
5771
5772 let request = self.client.build(req)?;
5773
5774 let github_response = self.client.fetch_async(request).await?;
5777
5778 if github_response.is_success() {
5781 Ok(())
5782 } else {
5783 match github_response.status_code() {
5784 404 => Err(OrgsDeleteWebhookError::Status404(github_response.to_json_async().await?).into()),
5785 code => Err(OrgsDeleteWebhookError::Generic { code }.into()),
5786 }
5787 }
5788 }
5789
5790 #[cfg(not(target_arch = "wasm32"))]
5805 pub fn delete_webhook(&self, org: &str, hook_id: i32) -> Result<(), AdapterError> {
5806
5807 let request_uri = format!("{}/orgs/{}/hooks/{}", super::GITHUB_BASE_API_URL, org, hook_id);
5808
5809
5810 let req = GitHubRequest {
5811 uri: request_uri,
5812 body: None,
5813 method: "DELETE",
5814 headers: vec![]
5815 };
5816
5817 let request = self.client.build(req)?;
5818
5819 let github_response = self.client.fetch(request)?;
5822
5823 if github_response.is_success() {
5826 Ok(())
5827 } else {
5828 match github_response.status_code() {
5829 404 => Err(OrgsDeleteWebhookError::Status404(github_response.to_json()?).into()),
5830 code => Err(OrgsDeleteWebhookError::Generic { code }.into()),
5831 }
5832 }
5833 }
5834
5835 pub async fn enable_or_disable_security_product_on_all_org_repos_async(&self, org: &str, security_product: &str, enablement: &str, body: PostOrgsEnableOrDisableSecurityProductOnAllOrgRepos) -> Result<(), AdapterError> {
5852
5853 let request_uri = format!("{}/orgs/{}/{}/{}", super::GITHUB_BASE_API_URL, org, security_product, enablement);
5854
5855
5856 let req = GitHubRequest {
5857 uri: request_uri,
5858 body: Some(C::from_json::<PostOrgsEnableOrDisableSecurityProductOnAllOrgRepos>(body)?),
5859 method: "POST",
5860 headers: vec![]
5861 };
5862
5863 let request = self.client.build(req)?;
5864
5865 let github_response = self.client.fetch_async(request).await?;
5868
5869 if github_response.is_success() {
5872 Ok(())
5873 } else {
5874 match github_response.status_code() {
5875 422 => Err(OrgsEnableOrDisableSecurityProductOnAllOrgReposError::Status422.into()),
5876 code => Err(OrgsEnableOrDisableSecurityProductOnAllOrgReposError::Generic { code }.into()),
5877 }
5878 }
5879 }
5880
5881 #[cfg(not(target_arch = "wasm32"))]
5898 pub fn enable_or_disable_security_product_on_all_org_repos(&self, org: &str, security_product: &str, enablement: &str, body: PostOrgsEnableOrDisableSecurityProductOnAllOrgRepos) -> Result<(), AdapterError> {
5899
5900 let request_uri = format!("{}/orgs/{}/{}/{}", super::GITHUB_BASE_API_URL, org, security_product, enablement);
5901
5902
5903 let req = GitHubRequest {
5904 uri: request_uri,
5905 body: Some(C::from_json::<PostOrgsEnableOrDisableSecurityProductOnAllOrgRepos>(body)?),
5906 method: "POST",
5907 headers: vec![]
5908 };
5909
5910 let request = self.client.build(req)?;
5911
5912 let github_response = self.client.fetch(request)?;
5915
5916 if github_response.is_success() {
5919 Ok(())
5920 } else {
5921 match github_response.status_code() {
5922 422 => Err(OrgsEnableOrDisableSecurityProductOnAllOrgReposError::Status422.into()),
5923 code => Err(OrgsEnableOrDisableSecurityProductOnAllOrgReposError::Generic { code }.into()),
5924 }
5925 }
5926 }
5927
5928 pub async fn get_async(&self, org: &str) -> Result<OrganizationFull, AdapterError> {
5946
5947 let request_uri = format!("{}/orgs/{}", super::GITHUB_BASE_API_URL, org);
5948
5949
5950 let req = GitHubRequest {
5951 uri: request_uri,
5952 body: None::<C::Body>,
5953 method: "GET",
5954 headers: vec![]
5955 };
5956
5957 let request = self.client.build(req)?;
5958
5959 let github_response = self.client.fetch_async(request).await?;
5962
5963 if github_response.is_success() {
5966 Ok(github_response.to_json_async().await?)
5967 } else {
5968 match github_response.status_code() {
5969 404 => Err(OrgsGetError::Status404(github_response.to_json_async().await?).into()),
5970 code => Err(OrgsGetError::Generic { code }.into()),
5971 }
5972 }
5973 }
5974
5975 #[cfg(not(target_arch = "wasm32"))]
5993 pub fn get(&self, org: &str) -> Result<OrganizationFull, AdapterError> {
5994
5995 let request_uri = format!("{}/orgs/{}", super::GITHUB_BASE_API_URL, org);
5996
5997
5998 let req = GitHubRequest {
5999 uri: request_uri,
6000 body: None,
6001 method: "GET",
6002 headers: vec![]
6003 };
6004
6005 let request = self.client.build(req)?;
6006
6007 let github_response = self.client.fetch(request)?;
6010
6011 if github_response.is_success() {
6014 Ok(github_response.to_json()?)
6015 } else {
6016 match github_response.status_code() {
6017 404 => Err(OrgsGetError::Status404(github_response.to_json()?).into()),
6018 code => Err(OrgsGetError::Generic { code }.into()),
6019 }
6020 }
6021 }
6022
6023 pub async fn get_all_custom_properties_async(&self, org: &str) -> Result<Vec<CustomProperty>, AdapterError> {
6034
6035 let request_uri = format!("{}/orgs/{}/properties/schema", super::GITHUB_BASE_API_URL, org);
6036
6037
6038 let req = GitHubRequest {
6039 uri: request_uri,
6040 body: None::<C::Body>,
6041 method: "GET",
6042 headers: vec![]
6043 };
6044
6045 let request = self.client.build(req)?;
6046
6047 let github_response = self.client.fetch_async(request).await?;
6050
6051 if github_response.is_success() {
6054 Ok(github_response.to_json_async().await?)
6055 } else {
6056 match github_response.status_code() {
6057 403 => Err(OrgsGetAllCustomPropertiesError::Status403(github_response.to_json_async().await?).into()),
6058 404 => Err(OrgsGetAllCustomPropertiesError::Status404(github_response.to_json_async().await?).into()),
6059 code => Err(OrgsGetAllCustomPropertiesError::Generic { code }.into()),
6060 }
6061 }
6062 }
6063
6064 #[cfg(not(target_arch = "wasm32"))]
6075 pub fn get_all_custom_properties(&self, org: &str) -> Result<Vec<CustomProperty>, AdapterError> {
6076
6077 let request_uri = format!("{}/orgs/{}/properties/schema", super::GITHUB_BASE_API_URL, org);
6078
6079
6080 let req = GitHubRequest {
6081 uri: request_uri,
6082 body: None,
6083 method: "GET",
6084 headers: vec![]
6085 };
6086
6087 let request = self.client.build(req)?;
6088
6089 let github_response = self.client.fetch(request)?;
6092
6093 if github_response.is_success() {
6096 Ok(github_response.to_json()?)
6097 } else {
6098 match github_response.status_code() {
6099 403 => Err(OrgsGetAllCustomPropertiesError::Status403(github_response.to_json()?).into()),
6100 404 => Err(OrgsGetAllCustomPropertiesError::Status404(github_response.to_json()?).into()),
6101 code => Err(OrgsGetAllCustomPropertiesError::Generic { code }.into()),
6102 }
6103 }
6104 }
6105
6106 pub async fn get_custom_property_async(&self, org: &str, custom_property_name: &str) -> Result<CustomProperty, AdapterError> {
6117
6118 let request_uri = format!("{}/orgs/{}/properties/schema/{}", super::GITHUB_BASE_API_URL, org, custom_property_name);
6119
6120
6121 let req = GitHubRequest {
6122 uri: request_uri,
6123 body: None::<C::Body>,
6124 method: "GET",
6125 headers: vec![]
6126 };
6127
6128 let request = self.client.build(req)?;
6129
6130 let github_response = self.client.fetch_async(request).await?;
6133
6134 if github_response.is_success() {
6137 Ok(github_response.to_json_async().await?)
6138 } else {
6139 match github_response.status_code() {
6140 403 => Err(OrgsGetCustomPropertyError::Status403(github_response.to_json_async().await?).into()),
6141 404 => Err(OrgsGetCustomPropertyError::Status404(github_response.to_json_async().await?).into()),
6142 code => Err(OrgsGetCustomPropertyError::Generic { code }.into()),
6143 }
6144 }
6145 }
6146
6147 #[cfg(not(target_arch = "wasm32"))]
6158 pub fn get_custom_property(&self, org: &str, custom_property_name: &str) -> Result<CustomProperty, AdapterError> {
6159
6160 let request_uri = format!("{}/orgs/{}/properties/schema/{}", super::GITHUB_BASE_API_URL, org, custom_property_name);
6161
6162
6163 let req = GitHubRequest {
6164 uri: request_uri,
6165 body: None,
6166 method: "GET",
6167 headers: vec![]
6168 };
6169
6170 let request = self.client.build(req)?;
6171
6172 let github_response = self.client.fetch(request)?;
6175
6176 if github_response.is_success() {
6179 Ok(github_response.to_json()?)
6180 } else {
6181 match github_response.status_code() {
6182 403 => Err(OrgsGetCustomPropertyError::Status403(github_response.to_json()?).into()),
6183 404 => Err(OrgsGetCustomPropertyError::Status404(github_response.to_json()?).into()),
6184 code => Err(OrgsGetCustomPropertyError::Generic { code }.into()),
6185 }
6186 }
6187 }
6188
6189 pub async fn get_membership_for_authenticated_user_async(&self, org: &str) -> Result<OrgMembership, AdapterError> {
6199
6200 let request_uri = format!("{}/user/memberships/orgs/{}", super::GITHUB_BASE_API_URL, org);
6201
6202
6203 let req = GitHubRequest {
6204 uri: request_uri,
6205 body: None::<C::Body>,
6206 method: "GET",
6207 headers: vec![]
6208 };
6209
6210 let request = self.client.build(req)?;
6211
6212 let github_response = self.client.fetch_async(request).await?;
6215
6216 if github_response.is_success() {
6219 Ok(github_response.to_json_async().await?)
6220 } else {
6221 match github_response.status_code() {
6222 403 => Err(OrgsGetMembershipForAuthenticatedUserError::Status403(github_response.to_json_async().await?).into()),
6223 404 => Err(OrgsGetMembershipForAuthenticatedUserError::Status404(github_response.to_json_async().await?).into()),
6224 code => Err(OrgsGetMembershipForAuthenticatedUserError::Generic { code }.into()),
6225 }
6226 }
6227 }
6228
6229 #[cfg(not(target_arch = "wasm32"))]
6239 pub fn get_membership_for_authenticated_user(&self, org: &str) -> Result<OrgMembership, AdapterError> {
6240
6241 let request_uri = format!("{}/user/memberships/orgs/{}", super::GITHUB_BASE_API_URL, org);
6242
6243
6244 let req = GitHubRequest {
6245 uri: request_uri,
6246 body: None,
6247 method: "GET",
6248 headers: vec![]
6249 };
6250
6251 let request = self.client.build(req)?;
6252
6253 let github_response = self.client.fetch(request)?;
6256
6257 if github_response.is_success() {
6260 Ok(github_response.to_json()?)
6261 } else {
6262 match github_response.status_code() {
6263 403 => Err(OrgsGetMembershipForAuthenticatedUserError::Status403(github_response.to_json()?).into()),
6264 404 => Err(OrgsGetMembershipForAuthenticatedUserError::Status404(github_response.to_json()?).into()),
6265 code => Err(OrgsGetMembershipForAuthenticatedUserError::Generic { code }.into()),
6266 }
6267 }
6268 }
6269
6270 pub async fn get_membership_for_user_async(&self, org: &str, username: &str) -> Result<OrgMembership, AdapterError> {
6280
6281 let request_uri = format!("{}/orgs/{}/memberships/{}", super::GITHUB_BASE_API_URL, org, username);
6282
6283
6284 let req = GitHubRequest {
6285 uri: request_uri,
6286 body: None::<C::Body>,
6287 method: "GET",
6288 headers: vec![]
6289 };
6290
6291 let request = self.client.build(req)?;
6292
6293 let github_response = self.client.fetch_async(request).await?;
6296
6297 if github_response.is_success() {
6300 Ok(github_response.to_json_async().await?)
6301 } else {
6302 match github_response.status_code() {
6303 404 => Err(OrgsGetMembershipForUserError::Status404(github_response.to_json_async().await?).into()),
6304 403 => Err(OrgsGetMembershipForUserError::Status403(github_response.to_json_async().await?).into()),
6305 code => Err(OrgsGetMembershipForUserError::Generic { code }.into()),
6306 }
6307 }
6308 }
6309
6310 #[cfg(not(target_arch = "wasm32"))]
6320 pub fn get_membership_for_user(&self, org: &str, username: &str) -> Result<OrgMembership, AdapterError> {
6321
6322 let request_uri = format!("{}/orgs/{}/memberships/{}", super::GITHUB_BASE_API_URL, org, username);
6323
6324
6325 let req = GitHubRequest {
6326 uri: request_uri,
6327 body: None,
6328 method: "GET",
6329 headers: vec![]
6330 };
6331
6332 let request = self.client.build(req)?;
6333
6334 let github_response = self.client.fetch(request)?;
6337
6338 if github_response.is_success() {
6341 Ok(github_response.to_json()?)
6342 } else {
6343 match github_response.status_code() {
6344 404 => Err(OrgsGetMembershipForUserError::Status404(github_response.to_json()?).into()),
6345 403 => Err(OrgsGetMembershipForUserError::Status403(github_response.to_json()?).into()),
6346 code => Err(OrgsGetMembershipForUserError::Generic { code }.into()),
6347 }
6348 }
6349 }
6350
6351 pub async fn get_org_role_async(&self, org: &str, role_id: i32) -> Result<OrganizationRole, AdapterError> {
6368
6369 let request_uri = format!("{}/orgs/{}/organization-roles/{}", super::GITHUB_BASE_API_URL, org, role_id);
6370
6371
6372 let req = GitHubRequest {
6373 uri: request_uri,
6374 body: None::<C::Body>,
6375 method: "GET",
6376 headers: vec![]
6377 };
6378
6379 let request = self.client.build(req)?;
6380
6381 let github_response = self.client.fetch_async(request).await?;
6384
6385 if github_response.is_success() {
6388 Ok(github_response.to_json_async().await?)
6389 } else {
6390 match github_response.status_code() {
6391 404 => Err(OrgsGetOrgRoleError::Status404(github_response.to_json_async().await?).into()),
6392 422 => Err(OrgsGetOrgRoleError::Status422(github_response.to_json_async().await?).into()),
6393 code => Err(OrgsGetOrgRoleError::Generic { code }.into()),
6394 }
6395 }
6396 }
6397
6398 #[cfg(not(target_arch = "wasm32"))]
6415 pub fn get_org_role(&self, org: &str, role_id: i32) -> Result<OrganizationRole, AdapterError> {
6416
6417 let request_uri = format!("{}/orgs/{}/organization-roles/{}", super::GITHUB_BASE_API_URL, org, role_id);
6418
6419
6420 let req = GitHubRequest {
6421 uri: request_uri,
6422 body: None,
6423 method: "GET",
6424 headers: vec![]
6425 };
6426
6427 let request = self.client.build(req)?;
6428
6429 let github_response = self.client.fetch(request)?;
6432
6433 if github_response.is_success() {
6436 Ok(github_response.to_json()?)
6437 } else {
6438 match github_response.status_code() {
6439 404 => Err(OrgsGetOrgRoleError::Status404(github_response.to_json()?).into()),
6440 422 => Err(OrgsGetOrgRoleError::Status422(github_response.to_json()?).into()),
6441 code => Err(OrgsGetOrgRoleError::Generic { code }.into()),
6442 }
6443 }
6444 }
6445
6446 pub async fn get_org_ruleset_history_async(&self, org: &str, ruleset_id: i32, query_params: Option<impl Into<OrgsGetOrgRulesetHistoryParams>>) -> Result<Vec<RulesetVersion>, AdapterError> {
6456
6457 let mut request_uri = format!("{}/orgs/{}/rulesets/{}/history", super::GITHUB_BASE_API_URL, org, ruleset_id);
6458
6459 if let Some(params) = query_params {
6460 request_uri.push_str("?");
6461 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
6462 }
6463
6464 let req = GitHubRequest {
6465 uri: request_uri,
6466 body: None::<C::Body>,
6467 method: "GET",
6468 headers: vec![]
6469 };
6470
6471 let request = self.client.build(req)?;
6472
6473 let github_response = self.client.fetch_async(request).await?;
6476
6477 if github_response.is_success() {
6480 Ok(github_response.to_json_async().await?)
6481 } else {
6482 match github_response.status_code() {
6483 404 => Err(OrgsGetOrgRulesetHistoryError::Status404(github_response.to_json_async().await?).into()),
6484 500 => Err(OrgsGetOrgRulesetHistoryError::Status500(github_response.to_json_async().await?).into()),
6485 code => Err(OrgsGetOrgRulesetHistoryError::Generic { code }.into()),
6486 }
6487 }
6488 }
6489
6490 #[cfg(not(target_arch = "wasm32"))]
6500 pub fn get_org_ruleset_history(&self, org: &str, ruleset_id: i32, query_params: Option<impl Into<OrgsGetOrgRulesetHistoryParams>>) -> Result<Vec<RulesetVersion>, AdapterError> {
6501
6502 let mut request_uri = format!("{}/orgs/{}/rulesets/{}/history", super::GITHUB_BASE_API_URL, org, ruleset_id);
6503
6504 if let Some(params) = query_params {
6505 request_uri.push_str("?");
6506 let qp: OrgsGetOrgRulesetHistoryParams = params.into();
6507 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
6508 }
6509
6510 let req = GitHubRequest {
6511 uri: request_uri,
6512 body: None,
6513 method: "GET",
6514 headers: vec![]
6515 };
6516
6517 let request = self.client.build(req)?;
6518
6519 let github_response = self.client.fetch(request)?;
6522
6523 if github_response.is_success() {
6526 Ok(github_response.to_json()?)
6527 } else {
6528 match github_response.status_code() {
6529 404 => Err(OrgsGetOrgRulesetHistoryError::Status404(github_response.to_json()?).into()),
6530 500 => Err(OrgsGetOrgRulesetHistoryError::Status500(github_response.to_json()?).into()),
6531 code => Err(OrgsGetOrgRulesetHistoryError::Generic { code }.into()),
6532 }
6533 }
6534 }
6535
6536 pub async fn get_org_ruleset_version_async(&self, org: &str, ruleset_id: i32, version_id: i32) -> Result<RulesetVersionWithState, AdapterError> {
6546
6547 let request_uri = format!("{}/orgs/{}/rulesets/{}/history/{}", super::GITHUB_BASE_API_URL, org, ruleset_id, version_id);
6548
6549
6550 let req = GitHubRequest {
6551 uri: request_uri,
6552 body: None::<C::Body>,
6553 method: "GET",
6554 headers: vec![]
6555 };
6556
6557 let request = self.client.build(req)?;
6558
6559 let github_response = self.client.fetch_async(request).await?;
6562
6563 if github_response.is_success() {
6566 Ok(github_response.to_json_async().await?)
6567 } else {
6568 match github_response.status_code() {
6569 404 => Err(OrgsGetOrgRulesetVersionError::Status404(github_response.to_json_async().await?).into()),
6570 500 => Err(OrgsGetOrgRulesetVersionError::Status500(github_response.to_json_async().await?).into()),
6571 code => Err(OrgsGetOrgRulesetVersionError::Generic { code }.into()),
6572 }
6573 }
6574 }
6575
6576 #[cfg(not(target_arch = "wasm32"))]
6586 pub fn get_org_ruleset_version(&self, org: &str, ruleset_id: i32, version_id: i32) -> Result<RulesetVersionWithState, AdapterError> {
6587
6588 let request_uri = format!("{}/orgs/{}/rulesets/{}/history/{}", super::GITHUB_BASE_API_URL, org, ruleset_id, version_id);
6589
6590
6591 let req = GitHubRequest {
6592 uri: request_uri,
6593 body: None,
6594 method: "GET",
6595 headers: vec![]
6596 };
6597
6598 let request = self.client.build(req)?;
6599
6600 let github_response = self.client.fetch(request)?;
6603
6604 if github_response.is_success() {
6607 Ok(github_response.to_json()?)
6608 } else {
6609 match github_response.status_code() {
6610 404 => Err(OrgsGetOrgRulesetVersionError::Status404(github_response.to_json()?).into()),
6611 500 => Err(OrgsGetOrgRulesetVersionError::Status500(github_response.to_json()?).into()),
6612 code => Err(OrgsGetOrgRulesetVersionError::Generic { code }.into()),
6613 }
6614 }
6615 }
6616
6617 pub async fn get_route_stats_by_actor_async(&self, org: &str, actor_type: &str, actor_id: i32, query_params: impl Into<OrgsGetRouteStatsByActorParams<'api>>) -> Result<ApiInsightsRouteStats, AdapterError> {
6627
6628 let mut request_uri = format!("{}/orgs/{}/insights/api/route-stats/{}/{}", super::GITHUB_BASE_API_URL, org, actor_type, actor_id);
6629
6630 request_uri.push_str("?");
6631 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
6632
6633 let req = GitHubRequest {
6634 uri: request_uri,
6635 body: None::<C::Body>,
6636 method: "GET",
6637 headers: vec![]
6638 };
6639
6640 let request = self.client.build(req)?;
6641
6642 let github_response = self.client.fetch_async(request).await?;
6645
6646 if github_response.is_success() {
6649 Ok(github_response.to_json_async().await?)
6650 } else {
6651 match github_response.status_code() {
6652 code => Err(OrgsGetRouteStatsByActorError::Generic { code }.into()),
6653 }
6654 }
6655 }
6656
6657 #[cfg(not(target_arch = "wasm32"))]
6667 pub fn get_route_stats_by_actor(&self, org: &str, actor_type: &str, actor_id: i32, query_params: impl Into<OrgsGetRouteStatsByActorParams<'api>>) -> Result<ApiInsightsRouteStats, AdapterError> {
6668
6669 let mut request_uri = format!("{}/orgs/{}/insights/api/route-stats/{}/{}", super::GITHUB_BASE_API_URL, org, actor_type, actor_id);
6670
6671 request_uri.push_str("?");
6672 let qp: OrgsGetRouteStatsByActorParams = query_params.into();
6673 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
6674
6675 let req = GitHubRequest {
6676 uri: request_uri,
6677 body: None,
6678 method: "GET",
6679 headers: vec![]
6680 };
6681
6682 let request = self.client.build(req)?;
6683
6684 let github_response = self.client.fetch(request)?;
6687
6688 if github_response.is_success() {
6691 Ok(github_response.to_json()?)
6692 } else {
6693 match github_response.status_code() {
6694 code => Err(OrgsGetRouteStatsByActorError::Generic { code }.into()),
6695 }
6696 }
6697 }
6698
6699 pub async fn get_subject_stats_async(&self, org: &str, query_params: impl Into<OrgsGetSubjectStatsParams<'api>>) -> Result<ApiInsightsSubjectStats, AdapterError> {
6709
6710 let mut request_uri = format!("{}/orgs/{}/insights/api/subject-stats", super::GITHUB_BASE_API_URL, org);
6711
6712 request_uri.push_str("?");
6713 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
6714
6715 let req = GitHubRequest {
6716 uri: request_uri,
6717 body: None::<C::Body>,
6718 method: "GET",
6719 headers: vec![]
6720 };
6721
6722 let request = self.client.build(req)?;
6723
6724 let github_response = self.client.fetch_async(request).await?;
6727
6728 if github_response.is_success() {
6731 Ok(github_response.to_json_async().await?)
6732 } else {
6733 match github_response.status_code() {
6734 code => Err(OrgsGetSubjectStatsError::Generic { code }.into()),
6735 }
6736 }
6737 }
6738
6739 #[cfg(not(target_arch = "wasm32"))]
6749 pub fn get_subject_stats(&self, org: &str, query_params: impl Into<OrgsGetSubjectStatsParams<'api>>) -> Result<ApiInsightsSubjectStats, AdapterError> {
6750
6751 let mut request_uri = format!("{}/orgs/{}/insights/api/subject-stats", super::GITHUB_BASE_API_URL, org);
6752
6753 request_uri.push_str("?");
6754 let qp: OrgsGetSubjectStatsParams = query_params.into();
6755 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
6756
6757 let req = GitHubRequest {
6758 uri: request_uri,
6759 body: None,
6760 method: "GET",
6761 headers: vec![]
6762 };
6763
6764 let request = self.client.build(req)?;
6765
6766 let github_response = self.client.fetch(request)?;
6769
6770 if github_response.is_success() {
6773 Ok(github_response.to_json()?)
6774 } else {
6775 match github_response.status_code() {
6776 code => Err(OrgsGetSubjectStatsError::Generic { code }.into()),
6777 }
6778 }
6779 }
6780
6781 pub async fn get_summary_stats_async(&self, org: &str, query_params: impl Into<OrgsGetSummaryStatsParams<'api>>) -> Result<ApiInsightsSummaryStats, AdapterError> {
6791
6792 let mut request_uri = format!("{}/orgs/{}/insights/api/summary-stats", super::GITHUB_BASE_API_URL, org);
6793
6794 request_uri.push_str("?");
6795 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
6796
6797 let req = GitHubRequest {
6798 uri: request_uri,
6799 body: None::<C::Body>,
6800 method: "GET",
6801 headers: vec![]
6802 };
6803
6804 let request = self.client.build(req)?;
6805
6806 let github_response = self.client.fetch_async(request).await?;
6809
6810 if github_response.is_success() {
6813 Ok(github_response.to_json_async().await?)
6814 } else {
6815 match github_response.status_code() {
6816 code => Err(OrgsGetSummaryStatsError::Generic { code }.into()),
6817 }
6818 }
6819 }
6820
6821 #[cfg(not(target_arch = "wasm32"))]
6831 pub fn get_summary_stats(&self, org: &str, query_params: impl Into<OrgsGetSummaryStatsParams<'api>>) -> Result<ApiInsightsSummaryStats, AdapterError> {
6832
6833 let mut request_uri = format!("{}/orgs/{}/insights/api/summary-stats", super::GITHUB_BASE_API_URL, org);
6834
6835 request_uri.push_str("?");
6836 let qp: OrgsGetSummaryStatsParams = query_params.into();
6837 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
6838
6839 let req = GitHubRequest {
6840 uri: request_uri,
6841 body: None,
6842 method: "GET",
6843 headers: vec![]
6844 };
6845
6846 let request = self.client.build(req)?;
6847
6848 let github_response = self.client.fetch(request)?;
6851
6852 if github_response.is_success() {
6855 Ok(github_response.to_json()?)
6856 } else {
6857 match github_response.status_code() {
6858 code => Err(OrgsGetSummaryStatsError::Generic { code }.into()),
6859 }
6860 }
6861 }
6862
6863 pub async fn get_summary_stats_by_actor_async(&self, org: &str, actor_type: &str, actor_id: i32, query_params: impl Into<OrgsGetSummaryStatsByActorParams<'api>>) -> Result<ApiInsightsSummaryStats, AdapterError> {
6873
6874 let mut request_uri = format!("{}/orgs/{}/insights/api/summary-stats/{}/{}", super::GITHUB_BASE_API_URL, org, actor_type, actor_id);
6875
6876 request_uri.push_str("?");
6877 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
6878
6879 let req = GitHubRequest {
6880 uri: request_uri,
6881 body: None::<C::Body>,
6882 method: "GET",
6883 headers: vec![]
6884 };
6885
6886 let request = self.client.build(req)?;
6887
6888 let github_response = self.client.fetch_async(request).await?;
6891
6892 if github_response.is_success() {
6895 Ok(github_response.to_json_async().await?)
6896 } else {
6897 match github_response.status_code() {
6898 code => Err(OrgsGetSummaryStatsByActorError::Generic { code }.into()),
6899 }
6900 }
6901 }
6902
6903 #[cfg(not(target_arch = "wasm32"))]
6913 pub fn get_summary_stats_by_actor(&self, org: &str, actor_type: &str, actor_id: i32, query_params: impl Into<OrgsGetSummaryStatsByActorParams<'api>>) -> Result<ApiInsightsSummaryStats, AdapterError> {
6914
6915 let mut request_uri = format!("{}/orgs/{}/insights/api/summary-stats/{}/{}", super::GITHUB_BASE_API_URL, org, actor_type, actor_id);
6916
6917 request_uri.push_str("?");
6918 let qp: OrgsGetSummaryStatsByActorParams = query_params.into();
6919 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
6920
6921 let req = GitHubRequest {
6922 uri: request_uri,
6923 body: None,
6924 method: "GET",
6925 headers: vec![]
6926 };
6927
6928 let request = self.client.build(req)?;
6929
6930 let github_response = self.client.fetch(request)?;
6933
6934 if github_response.is_success() {
6937 Ok(github_response.to_json()?)
6938 } else {
6939 match github_response.status_code() {
6940 code => Err(OrgsGetSummaryStatsByActorError::Generic { code }.into()),
6941 }
6942 }
6943 }
6944
6945 pub async fn get_summary_stats_by_user_async(&self, org: &str, user_id: &str, query_params: impl Into<OrgsGetSummaryStatsByUserParams<'api>>) -> Result<ApiInsightsSummaryStats, AdapterError> {
6955
6956 let mut request_uri = format!("{}/orgs/{}/insights/api/summary-stats/users/{}", super::GITHUB_BASE_API_URL, org, user_id);
6957
6958 request_uri.push_str("?");
6959 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
6960
6961 let req = GitHubRequest {
6962 uri: request_uri,
6963 body: None::<C::Body>,
6964 method: "GET",
6965 headers: vec![]
6966 };
6967
6968 let request = self.client.build(req)?;
6969
6970 let github_response = self.client.fetch_async(request).await?;
6973
6974 if github_response.is_success() {
6977 Ok(github_response.to_json_async().await?)
6978 } else {
6979 match github_response.status_code() {
6980 code => Err(OrgsGetSummaryStatsByUserError::Generic { code }.into()),
6981 }
6982 }
6983 }
6984
6985 #[cfg(not(target_arch = "wasm32"))]
6995 pub fn get_summary_stats_by_user(&self, org: &str, user_id: &str, query_params: impl Into<OrgsGetSummaryStatsByUserParams<'api>>) -> Result<ApiInsightsSummaryStats, AdapterError> {
6996
6997 let mut request_uri = format!("{}/orgs/{}/insights/api/summary-stats/users/{}", super::GITHUB_BASE_API_URL, org, user_id);
6998
6999 request_uri.push_str("?");
7000 let qp: OrgsGetSummaryStatsByUserParams = query_params.into();
7001 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7002
7003 let req = GitHubRequest {
7004 uri: request_uri,
7005 body: None,
7006 method: "GET",
7007 headers: vec![]
7008 };
7009
7010 let request = self.client.build(req)?;
7011
7012 let github_response = self.client.fetch(request)?;
7015
7016 if github_response.is_success() {
7019 Ok(github_response.to_json()?)
7020 } else {
7021 match github_response.status_code() {
7022 code => Err(OrgsGetSummaryStatsByUserError::Generic { code }.into()),
7023 }
7024 }
7025 }
7026
7027 pub async fn get_time_stats_async(&self, org: &str, query_params: impl Into<OrgsGetTimeStatsParams<'api>>) -> Result<ApiInsightsTimeStats, AdapterError> {
7037
7038 let mut request_uri = format!("{}/orgs/{}/insights/api/time-stats", super::GITHUB_BASE_API_URL, org);
7039
7040 request_uri.push_str("?");
7041 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
7042
7043 let req = GitHubRequest {
7044 uri: request_uri,
7045 body: None::<C::Body>,
7046 method: "GET",
7047 headers: vec![]
7048 };
7049
7050 let request = self.client.build(req)?;
7051
7052 let github_response = self.client.fetch_async(request).await?;
7055
7056 if github_response.is_success() {
7059 Ok(github_response.to_json_async().await?)
7060 } else {
7061 match github_response.status_code() {
7062 code => Err(OrgsGetTimeStatsError::Generic { code }.into()),
7063 }
7064 }
7065 }
7066
7067 #[cfg(not(target_arch = "wasm32"))]
7077 pub fn get_time_stats(&self, org: &str, query_params: impl Into<OrgsGetTimeStatsParams<'api>>) -> Result<ApiInsightsTimeStats, AdapterError> {
7078
7079 let mut request_uri = format!("{}/orgs/{}/insights/api/time-stats", super::GITHUB_BASE_API_URL, org);
7080
7081 request_uri.push_str("?");
7082 let qp: OrgsGetTimeStatsParams = query_params.into();
7083 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7084
7085 let req = GitHubRequest {
7086 uri: request_uri,
7087 body: None,
7088 method: "GET",
7089 headers: vec![]
7090 };
7091
7092 let request = self.client.build(req)?;
7093
7094 let github_response = self.client.fetch(request)?;
7097
7098 if github_response.is_success() {
7101 Ok(github_response.to_json()?)
7102 } else {
7103 match github_response.status_code() {
7104 code => Err(OrgsGetTimeStatsError::Generic { code }.into()),
7105 }
7106 }
7107 }
7108
7109 pub async fn get_time_stats_by_actor_async(&self, org: &str, actor_type: &str, actor_id: i32, query_params: impl Into<OrgsGetTimeStatsByActorParams<'api>>) -> Result<ApiInsightsTimeStats, AdapterError> {
7119
7120 let mut request_uri = format!("{}/orgs/{}/insights/api/time-stats/{}/{}", super::GITHUB_BASE_API_URL, org, actor_type, actor_id);
7121
7122 request_uri.push_str("?");
7123 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
7124
7125 let req = GitHubRequest {
7126 uri: request_uri,
7127 body: None::<C::Body>,
7128 method: "GET",
7129 headers: vec![]
7130 };
7131
7132 let request = self.client.build(req)?;
7133
7134 let github_response = self.client.fetch_async(request).await?;
7137
7138 if github_response.is_success() {
7141 Ok(github_response.to_json_async().await?)
7142 } else {
7143 match github_response.status_code() {
7144 code => Err(OrgsGetTimeStatsByActorError::Generic { code }.into()),
7145 }
7146 }
7147 }
7148
7149 #[cfg(not(target_arch = "wasm32"))]
7159 pub fn get_time_stats_by_actor(&self, org: &str, actor_type: &str, actor_id: i32, query_params: impl Into<OrgsGetTimeStatsByActorParams<'api>>) -> Result<ApiInsightsTimeStats, AdapterError> {
7160
7161 let mut request_uri = format!("{}/orgs/{}/insights/api/time-stats/{}/{}", super::GITHUB_BASE_API_URL, org, actor_type, actor_id);
7162
7163 request_uri.push_str("?");
7164 let qp: OrgsGetTimeStatsByActorParams = query_params.into();
7165 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7166
7167 let req = GitHubRequest {
7168 uri: request_uri,
7169 body: None,
7170 method: "GET",
7171 headers: vec![]
7172 };
7173
7174 let request = self.client.build(req)?;
7175
7176 let github_response = self.client.fetch(request)?;
7179
7180 if github_response.is_success() {
7183 Ok(github_response.to_json()?)
7184 } else {
7185 match github_response.status_code() {
7186 code => Err(OrgsGetTimeStatsByActorError::Generic { code }.into()),
7187 }
7188 }
7189 }
7190
7191 pub async fn get_time_stats_by_user_async(&self, org: &str, user_id: &str, query_params: impl Into<OrgsGetTimeStatsByUserParams<'api>>) -> Result<ApiInsightsTimeStats, AdapterError> {
7201
7202 let mut request_uri = format!("{}/orgs/{}/insights/api/time-stats/users/{}", super::GITHUB_BASE_API_URL, org, user_id);
7203
7204 request_uri.push_str("?");
7205 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
7206
7207 let req = GitHubRequest {
7208 uri: request_uri,
7209 body: None::<C::Body>,
7210 method: "GET",
7211 headers: vec![]
7212 };
7213
7214 let request = self.client.build(req)?;
7215
7216 let github_response = self.client.fetch_async(request).await?;
7219
7220 if github_response.is_success() {
7223 Ok(github_response.to_json_async().await?)
7224 } else {
7225 match github_response.status_code() {
7226 code => Err(OrgsGetTimeStatsByUserError::Generic { code }.into()),
7227 }
7228 }
7229 }
7230
7231 #[cfg(not(target_arch = "wasm32"))]
7241 pub fn get_time_stats_by_user(&self, org: &str, user_id: &str, query_params: impl Into<OrgsGetTimeStatsByUserParams<'api>>) -> Result<ApiInsightsTimeStats, AdapterError> {
7242
7243 let mut request_uri = format!("{}/orgs/{}/insights/api/time-stats/users/{}", super::GITHUB_BASE_API_URL, org, user_id);
7244
7245 request_uri.push_str("?");
7246 let qp: OrgsGetTimeStatsByUserParams = query_params.into();
7247 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7248
7249 let req = GitHubRequest {
7250 uri: request_uri,
7251 body: None,
7252 method: "GET",
7253 headers: vec![]
7254 };
7255
7256 let request = self.client.build(req)?;
7257
7258 let github_response = self.client.fetch(request)?;
7261
7262 if github_response.is_success() {
7265 Ok(github_response.to_json()?)
7266 } else {
7267 match github_response.status_code() {
7268 code => Err(OrgsGetTimeStatsByUserError::Generic { code }.into()),
7269 }
7270 }
7271 }
7272
7273 pub async fn get_user_stats_async(&self, org: &str, user_id: &str, query_params: impl Into<OrgsGetUserStatsParams<'api>>) -> Result<ApiInsightsUserStats, AdapterError> {
7283
7284 let mut request_uri = format!("{}/orgs/{}/insights/api/user-stats/{}", super::GITHUB_BASE_API_URL, org, user_id);
7285
7286 request_uri.push_str("?");
7287 request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
7288
7289 let req = GitHubRequest {
7290 uri: request_uri,
7291 body: None::<C::Body>,
7292 method: "GET",
7293 headers: vec![]
7294 };
7295
7296 let request = self.client.build(req)?;
7297
7298 let github_response = self.client.fetch_async(request).await?;
7301
7302 if github_response.is_success() {
7305 Ok(github_response.to_json_async().await?)
7306 } else {
7307 match github_response.status_code() {
7308 code => Err(OrgsGetUserStatsError::Generic { code }.into()),
7309 }
7310 }
7311 }
7312
7313 #[cfg(not(target_arch = "wasm32"))]
7323 pub fn get_user_stats(&self, org: &str, user_id: &str, query_params: impl Into<OrgsGetUserStatsParams<'api>>) -> Result<ApiInsightsUserStats, AdapterError> {
7324
7325 let mut request_uri = format!("{}/orgs/{}/insights/api/user-stats/{}", super::GITHUB_BASE_API_URL, org, user_id);
7326
7327 request_uri.push_str("?");
7328 let qp: OrgsGetUserStatsParams = query_params.into();
7329 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7330
7331 let req = GitHubRequest {
7332 uri: request_uri,
7333 body: None,
7334 method: "GET",
7335 headers: vec![]
7336 };
7337
7338 let request = self.client.build(req)?;
7339
7340 let github_response = self.client.fetch(request)?;
7343
7344 if github_response.is_success() {
7347 Ok(github_response.to_json()?)
7348 } else {
7349 match github_response.status_code() {
7350 code => Err(OrgsGetUserStatsError::Generic { code }.into()),
7351 }
7352 }
7353 }
7354
7355 pub async fn get_webhook_async(&self, org: &str, hook_id: i32) -> Result<OrgHook, AdapterError> {
7371
7372 let request_uri = format!("{}/orgs/{}/hooks/{}", super::GITHUB_BASE_API_URL, org, hook_id);
7373
7374
7375 let req = GitHubRequest {
7376 uri: request_uri,
7377 body: None::<C::Body>,
7378 method: "GET",
7379 headers: vec![]
7380 };
7381
7382 let request = self.client.build(req)?;
7383
7384 let github_response = self.client.fetch_async(request).await?;
7387
7388 if github_response.is_success() {
7391 Ok(github_response.to_json_async().await?)
7392 } else {
7393 match github_response.status_code() {
7394 404 => Err(OrgsGetWebhookError::Status404(github_response.to_json_async().await?).into()),
7395 code => Err(OrgsGetWebhookError::Generic { code }.into()),
7396 }
7397 }
7398 }
7399
7400 #[cfg(not(target_arch = "wasm32"))]
7416 pub fn get_webhook(&self, org: &str, hook_id: i32) -> Result<OrgHook, AdapterError> {
7417
7418 let request_uri = format!("{}/orgs/{}/hooks/{}", super::GITHUB_BASE_API_URL, org, hook_id);
7419
7420
7421 let req = GitHubRequest {
7422 uri: request_uri,
7423 body: None,
7424 method: "GET",
7425 headers: vec![]
7426 };
7427
7428 let request = self.client.build(req)?;
7429
7430 let github_response = self.client.fetch(request)?;
7433
7434 if github_response.is_success() {
7437 Ok(github_response.to_json()?)
7438 } else {
7439 match github_response.status_code() {
7440 404 => Err(OrgsGetWebhookError::Status404(github_response.to_json()?).into()),
7441 code => Err(OrgsGetWebhookError::Generic { code }.into()),
7442 }
7443 }
7444 }
7445
7446 pub async fn get_webhook_config_for_org_async(&self, org: &str, hook_id: i32) -> Result<WebhookConfig, AdapterError> {
7461
7462 let request_uri = format!("{}/orgs/{}/hooks/{}/config", super::GITHUB_BASE_API_URL, org, hook_id);
7463
7464
7465 let req = GitHubRequest {
7466 uri: request_uri,
7467 body: None::<C::Body>,
7468 method: "GET",
7469 headers: vec![]
7470 };
7471
7472 let request = self.client.build(req)?;
7473
7474 let github_response = self.client.fetch_async(request).await?;
7477
7478 if github_response.is_success() {
7481 Ok(github_response.to_json_async().await?)
7482 } else {
7483 match github_response.status_code() {
7484 code => Err(OrgsGetWebhookConfigForOrgError::Generic { code }.into()),
7485 }
7486 }
7487 }
7488
7489 #[cfg(not(target_arch = "wasm32"))]
7504 pub fn get_webhook_config_for_org(&self, org: &str, hook_id: i32) -> Result<WebhookConfig, AdapterError> {
7505
7506 let request_uri = format!("{}/orgs/{}/hooks/{}/config", super::GITHUB_BASE_API_URL, org, hook_id);
7507
7508
7509 let req = GitHubRequest {
7510 uri: request_uri,
7511 body: None,
7512 method: "GET",
7513 headers: vec![]
7514 };
7515
7516 let request = self.client.build(req)?;
7517
7518 let github_response = self.client.fetch(request)?;
7521
7522 if github_response.is_success() {
7525 Ok(github_response.to_json()?)
7526 } else {
7527 match github_response.status_code() {
7528 code => Err(OrgsGetWebhookConfigForOrgError::Generic { code }.into()),
7529 }
7530 }
7531 }
7532
7533 pub async fn get_webhook_delivery_async(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result<HookDelivery, AdapterError> {
7548
7549 let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id);
7550
7551
7552 let req = GitHubRequest {
7553 uri: request_uri,
7554 body: None::<C::Body>,
7555 method: "GET",
7556 headers: vec![]
7557 };
7558
7559 let request = self.client.build(req)?;
7560
7561 let github_response = self.client.fetch_async(request).await?;
7564
7565 if github_response.is_success() {
7568 Ok(github_response.to_json_async().await?)
7569 } else {
7570 match github_response.status_code() {
7571 400 => Err(OrgsGetWebhookDeliveryError::Status400(github_response.to_json_async().await?).into()),
7572 422 => Err(OrgsGetWebhookDeliveryError::Status422(github_response.to_json_async().await?).into()),
7573 code => Err(OrgsGetWebhookDeliveryError::Generic { code }.into()),
7574 }
7575 }
7576 }
7577
7578 #[cfg(not(target_arch = "wasm32"))]
7593 pub fn get_webhook_delivery(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result<HookDelivery, AdapterError> {
7594
7595 let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id);
7596
7597
7598 let req = GitHubRequest {
7599 uri: request_uri,
7600 body: None,
7601 method: "GET",
7602 headers: vec![]
7603 };
7604
7605 let request = self.client.build(req)?;
7606
7607 let github_response = self.client.fetch(request)?;
7610
7611 if github_response.is_success() {
7614 Ok(github_response.to_json()?)
7615 } else {
7616 match github_response.status_code() {
7617 400 => Err(OrgsGetWebhookDeliveryError::Status400(github_response.to_json()?).into()),
7618 422 => Err(OrgsGetWebhookDeliveryError::Status422(github_response.to_json()?).into()),
7619 code => Err(OrgsGetWebhookDeliveryError::Generic { code }.into()),
7620 }
7621 }
7622 }
7623
7624 pub async fn list_async(&self, query_params: Option<impl Into<OrgsListParams>>) -> Result<Vec<OrganizationSimple>, AdapterError> {
7637
7638 let mut request_uri = format!("{}/organizations", super::GITHUB_BASE_API_URL);
7639
7640 if let Some(params) = query_params {
7641 request_uri.push_str("?");
7642 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
7643 }
7644
7645 let req = GitHubRequest {
7646 uri: request_uri,
7647 body: None::<C::Body>,
7648 method: "GET",
7649 headers: vec![]
7650 };
7651
7652 let request = self.client.build(req)?;
7653
7654 let github_response = self.client.fetch_async(request).await?;
7657
7658 if github_response.is_success() {
7661 Ok(github_response.to_json_async().await?)
7662 } else {
7663 match github_response.status_code() {
7664 304 => Err(OrgsListError::Status304.into()),
7665 code => Err(OrgsListError::Generic { code }.into()),
7666 }
7667 }
7668 }
7669
7670 #[cfg(not(target_arch = "wasm32"))]
7683 pub fn list(&self, query_params: Option<impl Into<OrgsListParams>>) -> Result<Vec<OrganizationSimple>, AdapterError> {
7684
7685 let mut request_uri = format!("{}/organizations", super::GITHUB_BASE_API_URL);
7686
7687 if let Some(params) = query_params {
7688 request_uri.push_str("?");
7689 let qp: OrgsListParams = params.into();
7690 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7691 }
7692
7693 let req = GitHubRequest {
7694 uri: request_uri,
7695 body: None,
7696 method: "GET",
7697 headers: vec![]
7698 };
7699
7700 let request = self.client.build(req)?;
7701
7702 let github_response = self.client.fetch(request)?;
7705
7706 if github_response.is_success() {
7709 Ok(github_response.to_json()?)
7710 } else {
7711 match github_response.status_code() {
7712 304 => Err(OrgsListError::Status304.into()),
7713 code => Err(OrgsListError::Generic { code }.into()),
7714 }
7715 }
7716 }
7717
7718 pub async fn list_app_installations_async(&self, org: &str, query_params: Option<impl Into<OrgsListAppInstallationsParams>>) -> Result<GetAppsListInstallationsForAuthenticatedUserResponse200, AdapterError> {
7733
7734 let mut request_uri = format!("{}/orgs/{}/installations", super::GITHUB_BASE_API_URL, org);
7735
7736 if let Some(params) = query_params {
7737 request_uri.push_str("?");
7738 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
7739 }
7740
7741 let req = GitHubRequest {
7742 uri: request_uri,
7743 body: None::<C::Body>,
7744 method: "GET",
7745 headers: vec![]
7746 };
7747
7748 let request = self.client.build(req)?;
7749
7750 let github_response = self.client.fetch_async(request).await?;
7753
7754 if github_response.is_success() {
7757 Ok(github_response.to_json_async().await?)
7758 } else {
7759 match github_response.status_code() {
7760 code => Err(OrgsListAppInstallationsError::Generic { code }.into()),
7761 }
7762 }
7763 }
7764
7765 #[cfg(not(target_arch = "wasm32"))]
7780 pub fn list_app_installations(&self, org: &str, query_params: Option<impl Into<OrgsListAppInstallationsParams>>) -> Result<GetAppsListInstallationsForAuthenticatedUserResponse200, AdapterError> {
7781
7782 let mut request_uri = format!("{}/orgs/{}/installations", super::GITHUB_BASE_API_URL, org);
7783
7784 if let Some(params) = query_params {
7785 request_uri.push_str("?");
7786 let qp: OrgsListAppInstallationsParams = params.into();
7787 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7788 }
7789
7790 let req = GitHubRequest {
7791 uri: request_uri,
7792 body: None,
7793 method: "GET",
7794 headers: vec![]
7795 };
7796
7797 let request = self.client.build(req)?;
7798
7799 let github_response = self.client.fetch(request)?;
7802
7803 if github_response.is_success() {
7806 Ok(github_response.to_json()?)
7807 } else {
7808 match github_response.status_code() {
7809 code => Err(OrgsListAppInstallationsError::Generic { code }.into()),
7810 }
7811 }
7812 }
7813
7814 pub async fn list_attestations_async(&self, org: &str, subject_digest: &str, query_params: Option<impl Into<OrgsListAttestationsParams<'api>>>) -> Result<GetUsersListAttestationsResponse200, AdapterError> {
7828
7829 let mut request_uri = format!("{}/orgs/{}/attestations/{}", super::GITHUB_BASE_API_URL, org, subject_digest);
7830
7831 if let Some(params) = query_params {
7832 request_uri.push_str("?");
7833 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
7834 }
7835
7836 let req = GitHubRequest {
7837 uri: request_uri,
7838 body: None::<C::Body>,
7839 method: "GET",
7840 headers: vec![]
7841 };
7842
7843 let request = self.client.build(req)?;
7844
7845 let github_response = self.client.fetch_async(request).await?;
7848
7849 if github_response.is_success() {
7852 Ok(github_response.to_json_async().await?)
7853 } else {
7854 match github_response.status_code() {
7855 code => Err(OrgsListAttestationsError::Generic { code }.into()),
7856 }
7857 }
7858 }
7859
7860 #[cfg(not(target_arch = "wasm32"))]
7874 pub fn list_attestations(&self, org: &str, subject_digest: &str, query_params: Option<impl Into<OrgsListAttestationsParams<'api>>>) -> Result<GetUsersListAttestationsResponse200, AdapterError> {
7875
7876 let mut request_uri = format!("{}/orgs/{}/attestations/{}", super::GITHUB_BASE_API_URL, org, subject_digest);
7877
7878 if let Some(params) = query_params {
7879 request_uri.push_str("?");
7880 let qp: OrgsListAttestationsParams = params.into();
7881 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7882 }
7883
7884 let req = GitHubRequest {
7885 uri: request_uri,
7886 body: None,
7887 method: "GET",
7888 headers: vec![]
7889 };
7890
7891 let request = self.client.build(req)?;
7892
7893 let github_response = self.client.fetch(request)?;
7896
7897 if github_response.is_success() {
7900 Ok(github_response.to_json()?)
7901 } else {
7902 match github_response.status_code() {
7903 code => Err(OrgsListAttestationsError::Generic { code }.into()),
7904 }
7905 }
7906 }
7907
7908 pub async fn list_attestations_bulk_async(&self, org: &str, query_params: Option<impl Into<OrgsListAttestationsBulkParams<'api>>>, body: PostOrgsListAttestationsBulk) -> Result<PostOrgsListAttestationsBulkResponse200, AdapterError> {
7922
7923 let mut request_uri = format!("{}/orgs/{}/attestations/bulk-list", super::GITHUB_BASE_API_URL, org);
7924
7925 if let Some(params) = query_params {
7926 request_uri.push_str("?");
7927 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
7928 }
7929
7930 let req = GitHubRequest {
7931 uri: request_uri,
7932 body: Some(C::from_json::<PostOrgsListAttestationsBulk>(body)?),
7933 method: "POST",
7934 headers: vec![]
7935 };
7936
7937 let request = self.client.build(req)?;
7938
7939 let github_response = self.client.fetch_async(request).await?;
7942
7943 if github_response.is_success() {
7946 Ok(github_response.to_json_async().await?)
7947 } else {
7948 match github_response.status_code() {
7949 code => Err(OrgsListAttestationsBulkError::Generic { code }.into()),
7950 }
7951 }
7952 }
7953
7954 #[cfg(not(target_arch = "wasm32"))]
7968 pub fn list_attestations_bulk(&self, org: &str, query_params: Option<impl Into<OrgsListAttestationsBulkParams<'api>>>, body: PostOrgsListAttestationsBulk) -> Result<PostOrgsListAttestationsBulkResponse200, AdapterError> {
7969
7970 let mut request_uri = format!("{}/orgs/{}/attestations/bulk-list", super::GITHUB_BASE_API_URL, org);
7971
7972 if let Some(params) = query_params {
7973 request_uri.push_str("?");
7974 let qp: OrgsListAttestationsBulkParams = params.into();
7975 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
7976 }
7977
7978 let req = GitHubRequest {
7979 uri: request_uri,
7980 body: Some(C::from_json::<PostOrgsListAttestationsBulk>(body)?),
7981 method: "POST",
7982 headers: vec![]
7983 };
7984
7985 let request = self.client.build(req)?;
7986
7987 let github_response = self.client.fetch(request)?;
7990
7991 if github_response.is_success() {
7994 Ok(github_response.to_json()?)
7995 } else {
7996 match github_response.status_code() {
7997 code => Err(OrgsListAttestationsBulkError::Generic { code }.into()),
7998 }
7999 }
8000 }
8001
8002 pub async fn list_blocked_users_async(&self, org: &str, query_params: Option<impl Into<OrgsListBlockedUsersParams>>) -> Result<Vec<SimpleUser>, AdapterError> {
8012
8013 let mut request_uri = format!("{}/orgs/{}/blocks", super::GITHUB_BASE_API_URL, org);
8014
8015 if let Some(params) = query_params {
8016 request_uri.push_str("?");
8017 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8018 }
8019
8020 let req = GitHubRequest {
8021 uri: request_uri,
8022 body: None::<C::Body>,
8023 method: "GET",
8024 headers: vec![]
8025 };
8026
8027 let request = self.client.build(req)?;
8028
8029 let github_response = self.client.fetch_async(request).await?;
8032
8033 if github_response.is_success() {
8036 Ok(github_response.to_json_async().await?)
8037 } else {
8038 match github_response.status_code() {
8039 code => Err(OrgsListBlockedUsersError::Generic { code }.into()),
8040 }
8041 }
8042 }
8043
8044 #[cfg(not(target_arch = "wasm32"))]
8054 pub fn list_blocked_users(&self, org: &str, query_params: Option<impl Into<OrgsListBlockedUsersParams>>) -> Result<Vec<SimpleUser>, AdapterError> {
8055
8056 let mut request_uri = format!("{}/orgs/{}/blocks", super::GITHUB_BASE_API_URL, org);
8057
8058 if let Some(params) = query_params {
8059 request_uri.push_str("?");
8060 let qp: OrgsListBlockedUsersParams = params.into();
8061 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8062 }
8063
8064 let req = GitHubRequest {
8065 uri: request_uri,
8066 body: None,
8067 method: "GET",
8068 headers: vec![]
8069 };
8070
8071 let request = self.client.build(req)?;
8072
8073 let github_response = self.client.fetch(request)?;
8076
8077 if github_response.is_success() {
8080 Ok(github_response.to_json()?)
8081 } else {
8082 match github_response.status_code() {
8083 code => Err(OrgsListBlockedUsersError::Generic { code }.into()),
8084 }
8085 }
8086 }
8087
8088 pub async fn list_custom_properties_values_for_repos_async(&self, org: &str, query_params: Option<impl Into<OrgsListCustomPropertiesValuesForReposParams<'api>>>) -> Result<Vec<OrgRepoCustomPropertyValues>, AdapterError> {
8099
8100 let mut request_uri = format!("{}/orgs/{}/properties/values", super::GITHUB_BASE_API_URL, org);
8101
8102 if let Some(params) = query_params {
8103 request_uri.push_str("?");
8104 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8105 }
8106
8107 let req = GitHubRequest {
8108 uri: request_uri,
8109 body: None::<C::Body>,
8110 method: "GET",
8111 headers: vec![]
8112 };
8113
8114 let request = self.client.build(req)?;
8115
8116 let github_response = self.client.fetch_async(request).await?;
8119
8120 if github_response.is_success() {
8123 Ok(github_response.to_json_async().await?)
8124 } else {
8125 match github_response.status_code() {
8126 403 => Err(OrgsListCustomPropertiesValuesForReposError::Status403(github_response.to_json_async().await?).into()),
8127 404 => Err(OrgsListCustomPropertiesValuesForReposError::Status404(github_response.to_json_async().await?).into()),
8128 code => Err(OrgsListCustomPropertiesValuesForReposError::Generic { code }.into()),
8129 }
8130 }
8131 }
8132
8133 #[cfg(not(target_arch = "wasm32"))]
8144 pub fn list_custom_properties_values_for_repos(&self, org: &str, query_params: Option<impl Into<OrgsListCustomPropertiesValuesForReposParams<'api>>>) -> Result<Vec<OrgRepoCustomPropertyValues>, AdapterError> {
8145
8146 let mut request_uri = format!("{}/orgs/{}/properties/values", super::GITHUB_BASE_API_URL, org);
8147
8148 if let Some(params) = query_params {
8149 request_uri.push_str("?");
8150 let qp: OrgsListCustomPropertiesValuesForReposParams = params.into();
8151 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8152 }
8153
8154 let req = GitHubRequest {
8155 uri: request_uri,
8156 body: None,
8157 method: "GET",
8158 headers: vec![]
8159 };
8160
8161 let request = self.client.build(req)?;
8162
8163 let github_response = self.client.fetch(request)?;
8166
8167 if github_response.is_success() {
8170 Ok(github_response.to_json()?)
8171 } else {
8172 match github_response.status_code() {
8173 403 => Err(OrgsListCustomPropertiesValuesForReposError::Status403(github_response.to_json()?).into()),
8174 404 => Err(OrgsListCustomPropertiesValuesForReposError::Status404(github_response.to_json()?).into()),
8175 code => Err(OrgsListCustomPropertiesValuesForReposError::Generic { code }.into()),
8176 }
8177 }
8178 }
8179
8180 pub async fn list_failed_invitations_async(&self, org: &str, query_params: Option<impl Into<OrgsListFailedInvitationsParams>>) -> Result<Vec<OrganizationInvitation>, AdapterError> {
8190
8191 let mut request_uri = format!("{}/orgs/{}/failed_invitations", super::GITHUB_BASE_API_URL, org);
8192
8193 if let Some(params) = query_params {
8194 request_uri.push_str("?");
8195 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8196 }
8197
8198 let req = GitHubRequest {
8199 uri: request_uri,
8200 body: None::<C::Body>,
8201 method: "GET",
8202 headers: vec![]
8203 };
8204
8205 let request = self.client.build(req)?;
8206
8207 let github_response = self.client.fetch_async(request).await?;
8210
8211 if github_response.is_success() {
8214 Ok(github_response.to_json_async().await?)
8215 } else {
8216 match github_response.status_code() {
8217 404 => Err(OrgsListFailedInvitationsError::Status404(github_response.to_json_async().await?).into()),
8218 code => Err(OrgsListFailedInvitationsError::Generic { code }.into()),
8219 }
8220 }
8221 }
8222
8223 #[cfg(not(target_arch = "wasm32"))]
8233 pub fn list_failed_invitations(&self, org: &str, query_params: Option<impl Into<OrgsListFailedInvitationsParams>>) -> Result<Vec<OrganizationInvitation>, AdapterError> {
8234
8235 let mut request_uri = format!("{}/orgs/{}/failed_invitations", super::GITHUB_BASE_API_URL, org);
8236
8237 if let Some(params) = query_params {
8238 request_uri.push_str("?");
8239 let qp: OrgsListFailedInvitationsParams = params.into();
8240 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8241 }
8242
8243 let req = GitHubRequest {
8244 uri: request_uri,
8245 body: None,
8246 method: "GET",
8247 headers: vec![]
8248 };
8249
8250 let request = self.client.build(req)?;
8251
8252 let github_response = self.client.fetch(request)?;
8255
8256 if github_response.is_success() {
8259 Ok(github_response.to_json()?)
8260 } else {
8261 match github_response.status_code() {
8262 404 => Err(OrgsListFailedInvitationsError::Status404(github_response.to_json()?).into()),
8263 code => Err(OrgsListFailedInvitationsError::Generic { code }.into()),
8264 }
8265 }
8266 }
8267
8268 pub async fn list_for_authenticated_user_async(&self, query_params: Option<impl Into<OrgsListForAuthenticatedUserParams>>) -> Result<Vec<OrganizationSimple>, AdapterError> {
8283
8284 let mut request_uri = format!("{}/user/orgs", super::GITHUB_BASE_API_URL);
8285
8286 if let Some(params) = query_params {
8287 request_uri.push_str("?");
8288 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8289 }
8290
8291 let req = GitHubRequest {
8292 uri: request_uri,
8293 body: None::<C::Body>,
8294 method: "GET",
8295 headers: vec![]
8296 };
8297
8298 let request = self.client.build(req)?;
8299
8300 let github_response = self.client.fetch_async(request).await?;
8303
8304 if github_response.is_success() {
8307 Ok(github_response.to_json_async().await?)
8308 } else {
8309 match github_response.status_code() {
8310 304 => Err(OrgsListForAuthenticatedUserError::Status304.into()),
8311 403 => Err(OrgsListForAuthenticatedUserError::Status403(github_response.to_json_async().await?).into()),
8312 401 => Err(OrgsListForAuthenticatedUserError::Status401(github_response.to_json_async().await?).into()),
8313 code => Err(OrgsListForAuthenticatedUserError::Generic { code }.into()),
8314 }
8315 }
8316 }
8317
8318 #[cfg(not(target_arch = "wasm32"))]
8333 pub fn list_for_authenticated_user(&self, query_params: Option<impl Into<OrgsListForAuthenticatedUserParams>>) -> Result<Vec<OrganizationSimple>, AdapterError> {
8334
8335 let mut request_uri = format!("{}/user/orgs", super::GITHUB_BASE_API_URL);
8336
8337 if let Some(params) = query_params {
8338 request_uri.push_str("?");
8339 let qp: OrgsListForAuthenticatedUserParams = params.into();
8340 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8341 }
8342
8343 let req = GitHubRequest {
8344 uri: request_uri,
8345 body: None,
8346 method: "GET",
8347 headers: vec![]
8348 };
8349
8350 let request = self.client.build(req)?;
8351
8352 let github_response = self.client.fetch(request)?;
8355
8356 if github_response.is_success() {
8359 Ok(github_response.to_json()?)
8360 } else {
8361 match github_response.status_code() {
8362 304 => Err(OrgsListForAuthenticatedUserError::Status304.into()),
8363 403 => Err(OrgsListForAuthenticatedUserError::Status403(github_response.to_json()?).into()),
8364 401 => Err(OrgsListForAuthenticatedUserError::Status401(github_response.to_json()?).into()),
8365 code => Err(OrgsListForAuthenticatedUserError::Generic { code }.into()),
8366 }
8367 }
8368 }
8369
8370 pub async fn list_for_user_async(&self, username: &str, query_params: Option<impl Into<OrgsListForUserParams>>) -> Result<Vec<OrganizationSimple>, AdapterError> {
8382
8383 let mut request_uri = format!("{}/users/{}/orgs", super::GITHUB_BASE_API_URL, username);
8384
8385 if let Some(params) = query_params {
8386 request_uri.push_str("?");
8387 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8388 }
8389
8390 let req = GitHubRequest {
8391 uri: request_uri,
8392 body: None::<C::Body>,
8393 method: "GET",
8394 headers: vec![]
8395 };
8396
8397 let request = self.client.build(req)?;
8398
8399 let github_response = self.client.fetch_async(request).await?;
8402
8403 if github_response.is_success() {
8406 Ok(github_response.to_json_async().await?)
8407 } else {
8408 match github_response.status_code() {
8409 code => Err(OrgsListForUserError::Generic { code }.into()),
8410 }
8411 }
8412 }
8413
8414 #[cfg(not(target_arch = "wasm32"))]
8426 pub fn list_for_user(&self, username: &str, query_params: Option<impl Into<OrgsListForUserParams>>) -> Result<Vec<OrganizationSimple>, AdapterError> {
8427
8428 let mut request_uri = format!("{}/users/{}/orgs", super::GITHUB_BASE_API_URL, username);
8429
8430 if let Some(params) = query_params {
8431 request_uri.push_str("?");
8432 let qp: OrgsListForUserParams = params.into();
8433 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8434 }
8435
8436 let req = GitHubRequest {
8437 uri: request_uri,
8438 body: None,
8439 method: "GET",
8440 headers: vec![]
8441 };
8442
8443 let request = self.client.build(req)?;
8444
8445 let github_response = self.client.fetch(request)?;
8448
8449 if github_response.is_success() {
8452 Ok(github_response.to_json()?)
8453 } else {
8454 match github_response.status_code() {
8455 code => Err(OrgsListForUserError::Generic { code }.into()),
8456 }
8457 }
8458 }
8459
8460 pub async fn list_invitation_teams_async(&self, org: &str, invitation_id: i32, query_params: Option<impl Into<OrgsListInvitationTeamsParams>>) -> Result<Vec<Team>, AdapterError> {
8470
8471 let mut request_uri = format!("{}/orgs/{}/invitations/{}/teams", super::GITHUB_BASE_API_URL, org, invitation_id);
8472
8473 if let Some(params) = query_params {
8474 request_uri.push_str("?");
8475 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8476 }
8477
8478 let req = GitHubRequest {
8479 uri: request_uri,
8480 body: None::<C::Body>,
8481 method: "GET",
8482 headers: vec![]
8483 };
8484
8485 let request = self.client.build(req)?;
8486
8487 let github_response = self.client.fetch_async(request).await?;
8490
8491 if github_response.is_success() {
8494 Ok(github_response.to_json_async().await?)
8495 } else {
8496 match github_response.status_code() {
8497 404 => Err(OrgsListInvitationTeamsError::Status404(github_response.to_json_async().await?).into()),
8498 code => Err(OrgsListInvitationTeamsError::Generic { code }.into()),
8499 }
8500 }
8501 }
8502
8503 #[cfg(not(target_arch = "wasm32"))]
8513 pub fn list_invitation_teams(&self, org: &str, invitation_id: i32, query_params: Option<impl Into<OrgsListInvitationTeamsParams>>) -> Result<Vec<Team>, AdapterError> {
8514
8515 let mut request_uri = format!("{}/orgs/{}/invitations/{}/teams", super::GITHUB_BASE_API_URL, org, invitation_id);
8516
8517 if let Some(params) = query_params {
8518 request_uri.push_str("?");
8519 let qp: OrgsListInvitationTeamsParams = params.into();
8520 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8521 }
8522
8523 let req = GitHubRequest {
8524 uri: request_uri,
8525 body: None,
8526 method: "GET",
8527 headers: vec![]
8528 };
8529
8530 let request = self.client.build(req)?;
8531
8532 let github_response = self.client.fetch(request)?;
8535
8536 if github_response.is_success() {
8539 Ok(github_response.to_json()?)
8540 } else {
8541 match github_response.status_code() {
8542 404 => Err(OrgsListInvitationTeamsError::Status404(github_response.to_json()?).into()),
8543 code => Err(OrgsListInvitationTeamsError::Generic { code }.into()),
8544 }
8545 }
8546 }
8547
8548 pub async fn list_issue_types_async(&self, org: &str) -> Result<Vec<IssueType>, AdapterError> {
8558
8559 let request_uri = format!("{}/orgs/{}/issue-types", super::GITHUB_BASE_API_URL, org);
8560
8561
8562 let req = GitHubRequest {
8563 uri: request_uri,
8564 body: None::<C::Body>,
8565 method: "GET",
8566 headers: vec![]
8567 };
8568
8569 let request = self.client.build(req)?;
8570
8571 let github_response = self.client.fetch_async(request).await?;
8574
8575 if github_response.is_success() {
8578 Ok(github_response.to_json_async().await?)
8579 } else {
8580 match github_response.status_code() {
8581 404 => Err(OrgsListIssueTypesError::Status404(github_response.to_json_async().await?).into()),
8582 code => Err(OrgsListIssueTypesError::Generic { code }.into()),
8583 }
8584 }
8585 }
8586
8587 #[cfg(not(target_arch = "wasm32"))]
8597 pub fn list_issue_types(&self, org: &str) -> Result<Vec<IssueType>, AdapterError> {
8598
8599 let request_uri = format!("{}/orgs/{}/issue-types", super::GITHUB_BASE_API_URL, org);
8600
8601
8602 let req = GitHubRequest {
8603 uri: request_uri,
8604 body: None,
8605 method: "GET",
8606 headers: vec![]
8607 };
8608
8609 let request = self.client.build(req)?;
8610
8611 let github_response = self.client.fetch(request)?;
8614
8615 if github_response.is_success() {
8618 Ok(github_response.to_json()?)
8619 } else {
8620 match github_response.status_code() {
8621 404 => Err(OrgsListIssueTypesError::Status404(github_response.to_json()?).into()),
8622 code => Err(OrgsListIssueTypesError::Generic { code }.into()),
8623 }
8624 }
8625 }
8626
8627 pub async fn list_members_async(&self, org: &str, query_params: Option<impl Into<OrgsListMembersParams<'api>>>) -> Result<Vec<SimpleUser>, AdapterError> {
8637
8638 let mut request_uri = format!("{}/orgs/{}/members", super::GITHUB_BASE_API_URL, org);
8639
8640 if let Some(params) = query_params {
8641 request_uri.push_str("?");
8642 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8643 }
8644
8645 let req = GitHubRequest {
8646 uri: request_uri,
8647 body: None::<C::Body>,
8648 method: "GET",
8649 headers: vec![]
8650 };
8651
8652 let request = self.client.build(req)?;
8653
8654 let github_response = self.client.fetch_async(request).await?;
8657
8658 if github_response.is_success() {
8661 Ok(github_response.to_json_async().await?)
8662 } else {
8663 match github_response.status_code() {
8664 422 => Err(OrgsListMembersError::Status422(github_response.to_json_async().await?).into()),
8665 code => Err(OrgsListMembersError::Generic { code }.into()),
8666 }
8667 }
8668 }
8669
8670 #[cfg(not(target_arch = "wasm32"))]
8680 pub fn list_members(&self, org: &str, query_params: Option<impl Into<OrgsListMembersParams<'api>>>) -> Result<Vec<SimpleUser>, AdapterError> {
8681
8682 let mut request_uri = format!("{}/orgs/{}/members", super::GITHUB_BASE_API_URL, org);
8683
8684 if let Some(params) = query_params {
8685 request_uri.push_str("?");
8686 let qp: OrgsListMembersParams = params.into();
8687 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8688 }
8689
8690 let req = GitHubRequest {
8691 uri: request_uri,
8692 body: None,
8693 method: "GET",
8694 headers: vec![]
8695 };
8696
8697 let request = self.client.build(req)?;
8698
8699 let github_response = self.client.fetch(request)?;
8702
8703 if github_response.is_success() {
8706 Ok(github_response.to_json()?)
8707 } else {
8708 match github_response.status_code() {
8709 422 => Err(OrgsListMembersError::Status422(github_response.to_json()?).into()),
8710 code => Err(OrgsListMembersError::Generic { code }.into()),
8711 }
8712 }
8713 }
8714
8715 pub async fn list_memberships_for_authenticated_user_async(&self, query_params: Option<impl Into<OrgsListMembershipsForAuthenticatedUserParams<'api>>>) -> Result<Vec<OrgMembership>, AdapterError> {
8725
8726 let mut request_uri = format!("{}/user/memberships/orgs", super::GITHUB_BASE_API_URL);
8727
8728 if let Some(params) = query_params {
8729 request_uri.push_str("?");
8730 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8731 }
8732
8733 let req = GitHubRequest {
8734 uri: request_uri,
8735 body: None::<C::Body>,
8736 method: "GET",
8737 headers: vec![]
8738 };
8739
8740 let request = self.client.build(req)?;
8741
8742 let github_response = self.client.fetch_async(request).await?;
8745
8746 if github_response.is_success() {
8749 Ok(github_response.to_json_async().await?)
8750 } else {
8751 match github_response.status_code() {
8752 304 => Err(OrgsListMembershipsForAuthenticatedUserError::Status304.into()),
8753 403 => Err(OrgsListMembershipsForAuthenticatedUserError::Status403(github_response.to_json_async().await?).into()),
8754 401 => Err(OrgsListMembershipsForAuthenticatedUserError::Status401(github_response.to_json_async().await?).into()),
8755 422 => Err(OrgsListMembershipsForAuthenticatedUserError::Status422(github_response.to_json_async().await?).into()),
8756 code => Err(OrgsListMembershipsForAuthenticatedUserError::Generic { code }.into()),
8757 }
8758 }
8759 }
8760
8761 #[cfg(not(target_arch = "wasm32"))]
8771 pub fn list_memberships_for_authenticated_user(&self, query_params: Option<impl Into<OrgsListMembershipsForAuthenticatedUserParams<'api>>>) -> Result<Vec<OrgMembership>, AdapterError> {
8772
8773 let mut request_uri = format!("{}/user/memberships/orgs", super::GITHUB_BASE_API_URL);
8774
8775 if let Some(params) = query_params {
8776 request_uri.push_str("?");
8777 let qp: OrgsListMembershipsForAuthenticatedUserParams = params.into();
8778 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8779 }
8780
8781 let req = GitHubRequest {
8782 uri: request_uri,
8783 body: None,
8784 method: "GET",
8785 headers: vec![]
8786 };
8787
8788 let request = self.client.build(req)?;
8789
8790 let github_response = self.client.fetch(request)?;
8793
8794 if github_response.is_success() {
8797 Ok(github_response.to_json()?)
8798 } else {
8799 match github_response.status_code() {
8800 304 => Err(OrgsListMembershipsForAuthenticatedUserError::Status304.into()),
8801 403 => Err(OrgsListMembershipsForAuthenticatedUserError::Status403(github_response.to_json()?).into()),
8802 401 => Err(OrgsListMembershipsForAuthenticatedUserError::Status401(github_response.to_json()?).into()),
8803 422 => Err(OrgsListMembershipsForAuthenticatedUserError::Status422(github_response.to_json()?).into()),
8804 code => Err(OrgsListMembershipsForAuthenticatedUserError::Generic { code }.into()),
8805 }
8806 }
8807 }
8808
8809 pub async fn list_org_role_teams_async(&self, org: &str, role_id: i32, query_params: Option<impl Into<OrgsListOrgRoleTeamsParams>>) -> Result<Vec<TeamRoleAssignment>, AdapterError> {
8823
8824 let mut request_uri = format!("{}/orgs/{}/organization-roles/{}/teams", super::GITHUB_BASE_API_URL, org, role_id);
8825
8826 if let Some(params) = query_params {
8827 request_uri.push_str("?");
8828 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8829 }
8830
8831 let req = GitHubRequest {
8832 uri: request_uri,
8833 body: None::<C::Body>,
8834 method: "GET",
8835 headers: vec![]
8836 };
8837
8838 let request = self.client.build(req)?;
8839
8840 let github_response = self.client.fetch_async(request).await?;
8843
8844 if github_response.is_success() {
8847 Ok(github_response.to_json_async().await?)
8848 } else {
8849 match github_response.status_code() {
8850 404 => Err(OrgsListOrgRoleTeamsError::Status404.into()),
8851 422 => Err(OrgsListOrgRoleTeamsError::Status422.into()),
8852 code => Err(OrgsListOrgRoleTeamsError::Generic { code }.into()),
8853 }
8854 }
8855 }
8856
8857 #[cfg(not(target_arch = "wasm32"))]
8871 pub fn list_org_role_teams(&self, org: &str, role_id: i32, query_params: Option<impl Into<OrgsListOrgRoleTeamsParams>>) -> Result<Vec<TeamRoleAssignment>, AdapterError> {
8872
8873 let mut request_uri = format!("{}/orgs/{}/organization-roles/{}/teams", super::GITHUB_BASE_API_URL, org, role_id);
8874
8875 if let Some(params) = query_params {
8876 request_uri.push_str("?");
8877 let qp: OrgsListOrgRoleTeamsParams = params.into();
8878 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8879 }
8880
8881 let req = GitHubRequest {
8882 uri: request_uri,
8883 body: None,
8884 method: "GET",
8885 headers: vec![]
8886 };
8887
8888 let request = self.client.build(req)?;
8889
8890 let github_response = self.client.fetch(request)?;
8893
8894 if github_response.is_success() {
8897 Ok(github_response.to_json()?)
8898 } else {
8899 match github_response.status_code() {
8900 404 => Err(OrgsListOrgRoleTeamsError::Status404.into()),
8901 422 => Err(OrgsListOrgRoleTeamsError::Status422.into()),
8902 code => Err(OrgsListOrgRoleTeamsError::Generic { code }.into()),
8903 }
8904 }
8905 }
8906
8907 pub async fn list_org_role_users_async(&self, org: &str, role_id: i32, query_params: Option<impl Into<OrgsListOrgRoleUsersParams>>) -> Result<Vec<UserRoleAssignment>, AdapterError> {
8921
8922 let mut request_uri = format!("{}/orgs/{}/organization-roles/{}/users", super::GITHUB_BASE_API_URL, org, role_id);
8923
8924 if let Some(params) = query_params {
8925 request_uri.push_str("?");
8926 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
8927 }
8928
8929 let req = GitHubRequest {
8930 uri: request_uri,
8931 body: None::<C::Body>,
8932 method: "GET",
8933 headers: vec![]
8934 };
8935
8936 let request = self.client.build(req)?;
8937
8938 let github_response = self.client.fetch_async(request).await?;
8941
8942 if github_response.is_success() {
8945 Ok(github_response.to_json_async().await?)
8946 } else {
8947 match github_response.status_code() {
8948 404 => Err(OrgsListOrgRoleUsersError::Status404.into()),
8949 422 => Err(OrgsListOrgRoleUsersError::Status422.into()),
8950 code => Err(OrgsListOrgRoleUsersError::Generic { code }.into()),
8951 }
8952 }
8953 }
8954
8955 #[cfg(not(target_arch = "wasm32"))]
8969 pub fn list_org_role_users(&self, org: &str, role_id: i32, query_params: Option<impl Into<OrgsListOrgRoleUsersParams>>) -> Result<Vec<UserRoleAssignment>, AdapterError> {
8970
8971 let mut request_uri = format!("{}/orgs/{}/organization-roles/{}/users", super::GITHUB_BASE_API_URL, org, role_id);
8972
8973 if let Some(params) = query_params {
8974 request_uri.push_str("?");
8975 let qp: OrgsListOrgRoleUsersParams = params.into();
8976 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
8977 }
8978
8979 let req = GitHubRequest {
8980 uri: request_uri,
8981 body: None,
8982 method: "GET",
8983 headers: vec![]
8984 };
8985
8986 let request = self.client.build(req)?;
8987
8988 let github_response = self.client.fetch(request)?;
8991
8992 if github_response.is_success() {
8995 Ok(github_response.to_json()?)
8996 } else {
8997 match github_response.status_code() {
8998 404 => Err(OrgsListOrgRoleUsersError::Status404.into()),
8999 422 => Err(OrgsListOrgRoleUsersError::Status422.into()),
9000 code => Err(OrgsListOrgRoleUsersError::Generic { code }.into()),
9001 }
9002 }
9003 }
9004
9005 pub async fn list_org_roles_async(&self, org: &str) -> Result<GetOrgsListOrgRolesResponse200, AdapterError> {
9022
9023 let request_uri = format!("{}/orgs/{}/organization-roles", super::GITHUB_BASE_API_URL, org);
9024
9025
9026 let req = GitHubRequest {
9027 uri: request_uri,
9028 body: None::<C::Body>,
9029 method: "GET",
9030 headers: vec![]
9031 };
9032
9033 let request = self.client.build(req)?;
9034
9035 let github_response = self.client.fetch_async(request).await?;
9038
9039 if github_response.is_success() {
9042 Ok(github_response.to_json_async().await?)
9043 } else {
9044 match github_response.status_code() {
9045 404 => Err(OrgsListOrgRolesError::Status404(github_response.to_json_async().await?).into()),
9046 422 => Err(OrgsListOrgRolesError::Status422(github_response.to_json_async().await?).into()),
9047 code => Err(OrgsListOrgRolesError::Generic { code }.into()),
9048 }
9049 }
9050 }
9051
9052 #[cfg(not(target_arch = "wasm32"))]
9069 pub fn list_org_roles(&self, org: &str) -> Result<GetOrgsListOrgRolesResponse200, AdapterError> {
9070
9071 let request_uri = format!("{}/orgs/{}/organization-roles", super::GITHUB_BASE_API_URL, org);
9072
9073
9074 let req = GitHubRequest {
9075 uri: request_uri,
9076 body: None,
9077 method: "GET",
9078 headers: vec![]
9079 };
9080
9081 let request = self.client.build(req)?;
9082
9083 let github_response = self.client.fetch(request)?;
9086
9087 if github_response.is_success() {
9090 Ok(github_response.to_json()?)
9091 } else {
9092 match github_response.status_code() {
9093 404 => Err(OrgsListOrgRolesError::Status404(github_response.to_json()?).into()),
9094 422 => Err(OrgsListOrgRolesError::Status422(github_response.to_json()?).into()),
9095 code => Err(OrgsListOrgRolesError::Generic { code }.into()),
9096 }
9097 }
9098 }
9099
9100 pub async fn list_outside_collaborators_async(&self, org: &str, query_params: Option<impl Into<OrgsListOutsideCollaboratorsParams<'api>>>) -> Result<Vec<SimpleUser>, AdapterError> {
9110
9111 let mut request_uri = format!("{}/orgs/{}/outside_collaborators", super::GITHUB_BASE_API_URL, org);
9112
9113 if let Some(params) = query_params {
9114 request_uri.push_str("?");
9115 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9116 }
9117
9118 let req = GitHubRequest {
9119 uri: request_uri,
9120 body: None::<C::Body>,
9121 method: "GET",
9122 headers: vec![]
9123 };
9124
9125 let request = self.client.build(req)?;
9126
9127 let github_response = self.client.fetch_async(request).await?;
9130
9131 if github_response.is_success() {
9134 Ok(github_response.to_json_async().await?)
9135 } else {
9136 match github_response.status_code() {
9137 code => Err(OrgsListOutsideCollaboratorsError::Generic { code }.into()),
9138 }
9139 }
9140 }
9141
9142 #[cfg(not(target_arch = "wasm32"))]
9152 pub fn list_outside_collaborators(&self, org: &str, query_params: Option<impl Into<OrgsListOutsideCollaboratorsParams<'api>>>) -> Result<Vec<SimpleUser>, AdapterError> {
9153
9154 let mut request_uri = format!("{}/orgs/{}/outside_collaborators", super::GITHUB_BASE_API_URL, org);
9155
9156 if let Some(params) = query_params {
9157 request_uri.push_str("?");
9158 let qp: OrgsListOutsideCollaboratorsParams = params.into();
9159 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9160 }
9161
9162 let req = GitHubRequest {
9163 uri: request_uri,
9164 body: None,
9165 method: "GET",
9166 headers: vec![]
9167 };
9168
9169 let request = self.client.build(req)?;
9170
9171 let github_response = self.client.fetch(request)?;
9174
9175 if github_response.is_success() {
9178 Ok(github_response.to_json()?)
9179 } else {
9180 match github_response.status_code() {
9181 code => Err(OrgsListOutsideCollaboratorsError::Generic { code }.into()),
9182 }
9183 }
9184 }
9185
9186 pub async fn list_pat_grant_repositories_async(&self, org: &str, pat_id: i32, query_params: Option<impl Into<OrgsListPatGrantRepositoriesParams>>) -> Result<Vec<MinimalRepository>, AdapterError> {
9198
9199 let mut request_uri = format!("{}/orgs/{}/personal-access-tokens/{}/repositories", super::GITHUB_BASE_API_URL, org, pat_id);
9200
9201 if let Some(params) = query_params {
9202 request_uri.push_str("?");
9203 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9204 }
9205
9206 let req = GitHubRequest {
9207 uri: request_uri,
9208 body: None::<C::Body>,
9209 method: "GET",
9210 headers: vec![]
9211 };
9212
9213 let request = self.client.build(req)?;
9214
9215 let github_response = self.client.fetch_async(request).await?;
9218
9219 if github_response.is_success() {
9222 Ok(github_response.to_json_async().await?)
9223 } else {
9224 match github_response.status_code() {
9225 500 => Err(OrgsListPatGrantRepositoriesError::Status500(github_response.to_json_async().await?).into()),
9226 404 => Err(OrgsListPatGrantRepositoriesError::Status404(github_response.to_json_async().await?).into()),
9227 403 => Err(OrgsListPatGrantRepositoriesError::Status403(github_response.to_json_async().await?).into()),
9228 code => Err(OrgsListPatGrantRepositoriesError::Generic { code }.into()),
9229 }
9230 }
9231 }
9232
9233 #[cfg(not(target_arch = "wasm32"))]
9245 pub fn list_pat_grant_repositories(&self, org: &str, pat_id: i32, query_params: Option<impl Into<OrgsListPatGrantRepositoriesParams>>) -> Result<Vec<MinimalRepository>, AdapterError> {
9246
9247 let mut request_uri = format!("{}/orgs/{}/personal-access-tokens/{}/repositories", super::GITHUB_BASE_API_URL, org, pat_id);
9248
9249 if let Some(params) = query_params {
9250 request_uri.push_str("?");
9251 let qp: OrgsListPatGrantRepositoriesParams = params.into();
9252 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9253 }
9254
9255 let req = GitHubRequest {
9256 uri: request_uri,
9257 body: None,
9258 method: "GET",
9259 headers: vec![]
9260 };
9261
9262 let request = self.client.build(req)?;
9263
9264 let github_response = self.client.fetch(request)?;
9267
9268 if github_response.is_success() {
9271 Ok(github_response.to_json()?)
9272 } else {
9273 match github_response.status_code() {
9274 500 => Err(OrgsListPatGrantRepositoriesError::Status500(github_response.to_json()?).into()),
9275 404 => Err(OrgsListPatGrantRepositoriesError::Status404(github_response.to_json()?).into()),
9276 403 => Err(OrgsListPatGrantRepositoriesError::Status403(github_response.to_json()?).into()),
9277 code => Err(OrgsListPatGrantRepositoriesError::Generic { code }.into()),
9278 }
9279 }
9280 }
9281
9282 pub async fn list_pat_grant_request_repositories_async(&self, org: &str, pat_request_id: i32, query_params: Option<impl Into<OrgsListPatGrantRequestRepositoriesParams>>) -> Result<Vec<MinimalRepository>, AdapterError> {
9294
9295 let mut request_uri = format!("{}/orgs/{}/personal-access-token-requests/{}/repositories", super::GITHUB_BASE_API_URL, org, pat_request_id);
9296
9297 if let Some(params) = query_params {
9298 request_uri.push_str("?");
9299 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9300 }
9301
9302 let req = GitHubRequest {
9303 uri: request_uri,
9304 body: None::<C::Body>,
9305 method: "GET",
9306 headers: vec![]
9307 };
9308
9309 let request = self.client.build(req)?;
9310
9311 let github_response = self.client.fetch_async(request).await?;
9314
9315 if github_response.is_success() {
9318 Ok(github_response.to_json_async().await?)
9319 } else {
9320 match github_response.status_code() {
9321 500 => Err(OrgsListPatGrantRequestRepositoriesError::Status500(github_response.to_json_async().await?).into()),
9322 404 => Err(OrgsListPatGrantRequestRepositoriesError::Status404(github_response.to_json_async().await?).into()),
9323 403 => Err(OrgsListPatGrantRequestRepositoriesError::Status403(github_response.to_json_async().await?).into()),
9324 code => Err(OrgsListPatGrantRequestRepositoriesError::Generic { code }.into()),
9325 }
9326 }
9327 }
9328
9329 #[cfg(not(target_arch = "wasm32"))]
9341 pub fn list_pat_grant_request_repositories(&self, org: &str, pat_request_id: i32, query_params: Option<impl Into<OrgsListPatGrantRequestRepositoriesParams>>) -> Result<Vec<MinimalRepository>, AdapterError> {
9342
9343 let mut request_uri = format!("{}/orgs/{}/personal-access-token-requests/{}/repositories", super::GITHUB_BASE_API_URL, org, pat_request_id);
9344
9345 if let Some(params) = query_params {
9346 request_uri.push_str("?");
9347 let qp: OrgsListPatGrantRequestRepositoriesParams = params.into();
9348 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9349 }
9350
9351 let req = GitHubRequest {
9352 uri: request_uri,
9353 body: None,
9354 method: "GET",
9355 headers: vec![]
9356 };
9357
9358 let request = self.client.build(req)?;
9359
9360 let github_response = self.client.fetch(request)?;
9363
9364 if github_response.is_success() {
9367 Ok(github_response.to_json()?)
9368 } else {
9369 match github_response.status_code() {
9370 500 => Err(OrgsListPatGrantRequestRepositoriesError::Status500(github_response.to_json()?).into()),
9371 404 => Err(OrgsListPatGrantRequestRepositoriesError::Status404(github_response.to_json()?).into()),
9372 403 => Err(OrgsListPatGrantRequestRepositoriesError::Status403(github_response.to_json()?).into()),
9373 code => Err(OrgsListPatGrantRequestRepositoriesError::Generic { code }.into()),
9374 }
9375 }
9376 }
9377
9378 pub async fn list_pat_grant_requests_async(&self, org: &str, query_params: Option<impl Into<OrgsListPatGrantRequestsParams<'api>>>) -> Result<Vec<OrganizationProgrammaticAccessGrantRequest>, AdapterError> {
9390
9391 let mut request_uri = format!("{}/orgs/{}/personal-access-token-requests", super::GITHUB_BASE_API_URL, org);
9392
9393 if let Some(params) = query_params {
9394 request_uri.push_str("?");
9395 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9396 }
9397
9398 let req = GitHubRequest {
9399 uri: request_uri,
9400 body: None::<C::Body>,
9401 method: "GET",
9402 headers: vec![]
9403 };
9404
9405 let request = self.client.build(req)?;
9406
9407 let github_response = self.client.fetch_async(request).await?;
9410
9411 if github_response.is_success() {
9414 Ok(github_response.to_json_async().await?)
9415 } else {
9416 match github_response.status_code() {
9417 500 => Err(OrgsListPatGrantRequestsError::Status500(github_response.to_json_async().await?).into()),
9418 422 => Err(OrgsListPatGrantRequestsError::Status422(github_response.to_json_async().await?).into()),
9419 404 => Err(OrgsListPatGrantRequestsError::Status404(github_response.to_json_async().await?).into()),
9420 403 => Err(OrgsListPatGrantRequestsError::Status403(github_response.to_json_async().await?).into()),
9421 code => Err(OrgsListPatGrantRequestsError::Generic { code }.into()),
9422 }
9423 }
9424 }
9425
9426 #[cfg(not(target_arch = "wasm32"))]
9438 pub fn list_pat_grant_requests(&self, org: &str, query_params: Option<impl Into<OrgsListPatGrantRequestsParams<'api>>>) -> Result<Vec<OrganizationProgrammaticAccessGrantRequest>, AdapterError> {
9439
9440 let mut request_uri = format!("{}/orgs/{}/personal-access-token-requests", super::GITHUB_BASE_API_URL, org);
9441
9442 if let Some(params) = query_params {
9443 request_uri.push_str("?");
9444 let qp: OrgsListPatGrantRequestsParams = params.into();
9445 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9446 }
9447
9448 let req = GitHubRequest {
9449 uri: request_uri,
9450 body: None,
9451 method: "GET",
9452 headers: vec![]
9453 };
9454
9455 let request = self.client.build(req)?;
9456
9457 let github_response = self.client.fetch(request)?;
9460
9461 if github_response.is_success() {
9464 Ok(github_response.to_json()?)
9465 } else {
9466 match github_response.status_code() {
9467 500 => Err(OrgsListPatGrantRequestsError::Status500(github_response.to_json()?).into()),
9468 422 => Err(OrgsListPatGrantRequestsError::Status422(github_response.to_json()?).into()),
9469 404 => Err(OrgsListPatGrantRequestsError::Status404(github_response.to_json()?).into()),
9470 403 => Err(OrgsListPatGrantRequestsError::Status403(github_response.to_json()?).into()),
9471 code => Err(OrgsListPatGrantRequestsError::Generic { code }.into()),
9472 }
9473 }
9474 }
9475
9476 pub async fn list_pat_grants_async(&self, org: &str, query_params: Option<impl Into<OrgsListPatGrantsParams<'api>>>) -> Result<Vec<OrganizationProgrammaticAccessGrant>, AdapterError> {
9488
9489 let mut request_uri = format!("{}/orgs/{}/personal-access-tokens", super::GITHUB_BASE_API_URL, org);
9490
9491 if let Some(params) = query_params {
9492 request_uri.push_str("?");
9493 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9494 }
9495
9496 let req = GitHubRequest {
9497 uri: request_uri,
9498 body: None::<C::Body>,
9499 method: "GET",
9500 headers: vec![]
9501 };
9502
9503 let request = self.client.build(req)?;
9504
9505 let github_response = self.client.fetch_async(request).await?;
9508
9509 if github_response.is_success() {
9512 Ok(github_response.to_json_async().await?)
9513 } else {
9514 match github_response.status_code() {
9515 500 => Err(OrgsListPatGrantsError::Status500(github_response.to_json_async().await?).into()),
9516 422 => Err(OrgsListPatGrantsError::Status422(github_response.to_json_async().await?).into()),
9517 404 => Err(OrgsListPatGrantsError::Status404(github_response.to_json_async().await?).into()),
9518 403 => Err(OrgsListPatGrantsError::Status403(github_response.to_json_async().await?).into()),
9519 code => Err(OrgsListPatGrantsError::Generic { code }.into()),
9520 }
9521 }
9522 }
9523
9524 #[cfg(not(target_arch = "wasm32"))]
9536 pub fn list_pat_grants(&self, org: &str, query_params: Option<impl Into<OrgsListPatGrantsParams<'api>>>) -> Result<Vec<OrganizationProgrammaticAccessGrant>, AdapterError> {
9537
9538 let mut request_uri = format!("{}/orgs/{}/personal-access-tokens", super::GITHUB_BASE_API_URL, org);
9539
9540 if let Some(params) = query_params {
9541 request_uri.push_str("?");
9542 let qp: OrgsListPatGrantsParams = params.into();
9543 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9544 }
9545
9546 let req = GitHubRequest {
9547 uri: request_uri,
9548 body: None,
9549 method: "GET",
9550 headers: vec![]
9551 };
9552
9553 let request = self.client.build(req)?;
9554
9555 let github_response = self.client.fetch(request)?;
9558
9559 if github_response.is_success() {
9562 Ok(github_response.to_json()?)
9563 } else {
9564 match github_response.status_code() {
9565 500 => Err(OrgsListPatGrantsError::Status500(github_response.to_json()?).into()),
9566 422 => Err(OrgsListPatGrantsError::Status422(github_response.to_json()?).into()),
9567 404 => Err(OrgsListPatGrantsError::Status404(github_response.to_json()?).into()),
9568 403 => Err(OrgsListPatGrantsError::Status403(github_response.to_json()?).into()),
9569 code => Err(OrgsListPatGrantsError::Generic { code }.into()),
9570 }
9571 }
9572 }
9573
9574 pub async fn list_pending_invitations_async(&self, org: &str, query_params: Option<impl Into<OrgsListPendingInvitationsParams<'api>>>) -> Result<Vec<OrganizationInvitation>, AdapterError> {
9587
9588 let mut request_uri = format!("{}/orgs/{}/invitations", super::GITHUB_BASE_API_URL, org);
9589
9590 if let Some(params) = query_params {
9591 request_uri.push_str("?");
9592 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9593 }
9594
9595 let req = GitHubRequest {
9596 uri: request_uri,
9597 body: None::<C::Body>,
9598 method: "GET",
9599 headers: vec![]
9600 };
9601
9602 let request = self.client.build(req)?;
9603
9604 let github_response = self.client.fetch_async(request).await?;
9607
9608 if github_response.is_success() {
9611 Ok(github_response.to_json_async().await?)
9612 } else {
9613 match github_response.status_code() {
9614 404 => Err(OrgsListPendingInvitationsError::Status404(github_response.to_json_async().await?).into()),
9615 code => Err(OrgsListPendingInvitationsError::Generic { code }.into()),
9616 }
9617 }
9618 }
9619
9620 #[cfg(not(target_arch = "wasm32"))]
9633 pub fn list_pending_invitations(&self, org: &str, query_params: Option<impl Into<OrgsListPendingInvitationsParams<'api>>>) -> Result<Vec<OrganizationInvitation>, AdapterError> {
9634
9635 let mut request_uri = format!("{}/orgs/{}/invitations", super::GITHUB_BASE_API_URL, org);
9636
9637 if let Some(params) = query_params {
9638 request_uri.push_str("?");
9639 let qp: OrgsListPendingInvitationsParams = params.into();
9640 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9641 }
9642
9643 let req = GitHubRequest {
9644 uri: request_uri,
9645 body: None,
9646 method: "GET",
9647 headers: vec![]
9648 };
9649
9650 let request = self.client.build(req)?;
9651
9652 let github_response = self.client.fetch(request)?;
9655
9656 if github_response.is_success() {
9659 Ok(github_response.to_json()?)
9660 } else {
9661 match github_response.status_code() {
9662 404 => Err(OrgsListPendingInvitationsError::Status404(github_response.to_json()?).into()),
9663 code => Err(OrgsListPendingInvitationsError::Generic { code }.into()),
9664 }
9665 }
9666 }
9667
9668 pub async fn list_public_members_async(&self, org: &str, query_params: Option<impl Into<OrgsListPublicMembersParams>>) -> Result<Vec<SimpleUser>, AdapterError> {
9678
9679 let mut request_uri = format!("{}/orgs/{}/public_members", super::GITHUB_BASE_API_URL, org);
9680
9681 if let Some(params) = query_params {
9682 request_uri.push_str("?");
9683 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9684 }
9685
9686 let req = GitHubRequest {
9687 uri: request_uri,
9688 body: None::<C::Body>,
9689 method: "GET",
9690 headers: vec![]
9691 };
9692
9693 let request = self.client.build(req)?;
9694
9695 let github_response = self.client.fetch_async(request).await?;
9698
9699 if github_response.is_success() {
9702 Ok(github_response.to_json_async().await?)
9703 } else {
9704 match github_response.status_code() {
9705 code => Err(OrgsListPublicMembersError::Generic { code }.into()),
9706 }
9707 }
9708 }
9709
9710 #[cfg(not(target_arch = "wasm32"))]
9720 pub fn list_public_members(&self, org: &str, query_params: Option<impl Into<OrgsListPublicMembersParams>>) -> Result<Vec<SimpleUser>, AdapterError> {
9721
9722 let mut request_uri = format!("{}/orgs/{}/public_members", super::GITHUB_BASE_API_URL, org);
9723
9724 if let Some(params) = query_params {
9725 request_uri.push_str("?");
9726 let qp: OrgsListPublicMembersParams = params.into();
9727 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9728 }
9729
9730 let req = GitHubRequest {
9731 uri: request_uri,
9732 body: None,
9733 method: "GET",
9734 headers: vec![]
9735 };
9736
9737 let request = self.client.build(req)?;
9738
9739 let github_response = self.client.fetch(request)?;
9742
9743 if github_response.is_success() {
9746 Ok(github_response.to_json()?)
9747 } else {
9748 match github_response.status_code() {
9749 code => Err(OrgsListPublicMembersError::Generic { code }.into()),
9750 }
9751 }
9752 }
9753
9754 pub async fn list_security_manager_teams_async(&self, org: &str) -> Result<Vec<TeamSimple>, AdapterError> {
9765
9766 let request_uri = format!("{}/orgs/{}/security-managers", super::GITHUB_BASE_API_URL, org);
9767
9768
9769 let req = GitHubRequest {
9770 uri: request_uri,
9771 body: None::<C::Body>,
9772 method: "GET",
9773 headers: vec![]
9774 };
9775
9776 let request = self.client.build(req)?;
9777
9778 let github_response = self.client.fetch_async(request).await?;
9781
9782 if github_response.is_success() {
9785 Ok(github_response.to_json_async().await?)
9786 } else {
9787 match github_response.status_code() {
9788 code => Err(OrgsListSecurityManagerTeamsError::Generic { code }.into()),
9789 }
9790 }
9791 }
9792
9793 #[cfg(not(target_arch = "wasm32"))]
9804 pub fn list_security_manager_teams(&self, org: &str) -> Result<Vec<TeamSimple>, AdapterError> {
9805
9806 let request_uri = format!("{}/orgs/{}/security-managers", super::GITHUB_BASE_API_URL, org);
9807
9808
9809 let req = GitHubRequest {
9810 uri: request_uri,
9811 body: None,
9812 method: "GET",
9813 headers: vec![]
9814 };
9815
9816 let request = self.client.build(req)?;
9817
9818 let github_response = self.client.fetch(request)?;
9821
9822 if github_response.is_success() {
9825 Ok(github_response.to_json()?)
9826 } else {
9827 match github_response.status_code() {
9828 code => Err(OrgsListSecurityManagerTeamsError::Generic { code }.into()),
9829 }
9830 }
9831 }
9832
9833 pub async fn list_webhook_deliveries_async(&self, org: &str, hook_id: i32, query_params: Option<impl Into<OrgsListWebhookDeliveriesParams<'api>>>) -> Result<Vec<HookDeliveryItem>, AdapterError> {
9848
9849 let mut request_uri = format!("{}/orgs/{}/hooks/{}/deliveries", super::GITHUB_BASE_API_URL, org, hook_id);
9850
9851 if let Some(params) = query_params {
9852 request_uri.push_str("?");
9853 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9854 }
9855
9856 let req = GitHubRequest {
9857 uri: request_uri,
9858 body: None::<C::Body>,
9859 method: "GET",
9860 headers: vec![]
9861 };
9862
9863 let request = self.client.build(req)?;
9864
9865 let github_response = self.client.fetch_async(request).await?;
9868
9869 if github_response.is_success() {
9872 Ok(github_response.to_json_async().await?)
9873 } else {
9874 match github_response.status_code() {
9875 400 => Err(OrgsListWebhookDeliveriesError::Status400(github_response.to_json_async().await?).into()),
9876 422 => Err(OrgsListWebhookDeliveriesError::Status422(github_response.to_json_async().await?).into()),
9877 code => Err(OrgsListWebhookDeliveriesError::Generic { code }.into()),
9878 }
9879 }
9880 }
9881
9882 #[cfg(not(target_arch = "wasm32"))]
9897 pub fn list_webhook_deliveries(&self, org: &str, hook_id: i32, query_params: Option<impl Into<OrgsListWebhookDeliveriesParams<'api>>>) -> Result<Vec<HookDeliveryItem>, AdapterError> {
9898
9899 let mut request_uri = format!("{}/orgs/{}/hooks/{}/deliveries", super::GITHUB_BASE_API_URL, org, hook_id);
9900
9901 if let Some(params) = query_params {
9902 request_uri.push_str("?");
9903 let qp: OrgsListWebhookDeliveriesParams = params.into();
9904 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
9905 }
9906
9907 let req = GitHubRequest {
9908 uri: request_uri,
9909 body: None,
9910 method: "GET",
9911 headers: vec![]
9912 };
9913
9914 let request = self.client.build(req)?;
9915
9916 let github_response = self.client.fetch(request)?;
9919
9920 if github_response.is_success() {
9923 Ok(github_response.to_json()?)
9924 } else {
9925 match github_response.status_code() {
9926 400 => Err(OrgsListWebhookDeliveriesError::Status400(github_response.to_json()?).into()),
9927 422 => Err(OrgsListWebhookDeliveriesError::Status422(github_response.to_json()?).into()),
9928 code => Err(OrgsListWebhookDeliveriesError::Generic { code }.into()),
9929 }
9930 }
9931 }
9932
9933 pub async fn list_webhooks_async(&self, org: &str, query_params: Option<impl Into<OrgsListWebhooksParams>>) -> Result<Vec<OrgHook>, AdapterError> {
9948
9949 let mut request_uri = format!("{}/orgs/{}/hooks", super::GITHUB_BASE_API_URL, org);
9950
9951 if let Some(params) = query_params {
9952 request_uri.push_str("?");
9953 request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
9954 }
9955
9956 let req = GitHubRequest {
9957 uri: request_uri,
9958 body: None::<C::Body>,
9959 method: "GET",
9960 headers: vec![]
9961 };
9962
9963 let request = self.client.build(req)?;
9964
9965 let github_response = self.client.fetch_async(request).await?;
9968
9969 if github_response.is_success() {
9972 Ok(github_response.to_json_async().await?)
9973 } else {
9974 match github_response.status_code() {
9975 404 => Err(OrgsListWebhooksError::Status404(github_response.to_json_async().await?).into()),
9976 code => Err(OrgsListWebhooksError::Generic { code }.into()),
9977 }
9978 }
9979 }
9980
9981 #[cfg(not(target_arch = "wasm32"))]
9996 pub fn list_webhooks(&self, org: &str, query_params: Option<impl Into<OrgsListWebhooksParams>>) -> Result<Vec<OrgHook>, AdapterError> {
9997
9998 let mut request_uri = format!("{}/orgs/{}/hooks", super::GITHUB_BASE_API_URL, org);
9999
10000 if let Some(params) = query_params {
10001 request_uri.push_str("?");
10002 let qp: OrgsListWebhooksParams = params.into();
10003 request_uri.push_str(&serde_urlencoded::to_string(qp)?);
10004 }
10005
10006 let req = GitHubRequest {
10007 uri: request_uri,
10008 body: None,
10009 method: "GET",
10010 headers: vec![]
10011 };
10012
10013 let request = self.client.build(req)?;
10014
10015 let github_response = self.client.fetch(request)?;
10018
10019 if github_response.is_success() {
10022 Ok(github_response.to_json()?)
10023 } else {
10024 match github_response.status_code() {
10025 404 => Err(OrgsListWebhooksError::Status404(github_response.to_json()?).into()),
10026 code => Err(OrgsListWebhooksError::Generic { code }.into()),
10027 }
10028 }
10029 }
10030
10031 pub async fn ping_webhook_async(&self, org: &str, hook_id: i32) -> Result<(), AdapterError> {
10047
10048 let request_uri = format!("{}/orgs/{}/hooks/{}/pings", super::GITHUB_BASE_API_URL, org, hook_id);
10049
10050
10051 let req = GitHubRequest {
10052 uri: request_uri,
10053 body: None::<C::Body>,
10054 method: "POST",
10055 headers: vec![]
10056 };
10057
10058 let request = self.client.build(req)?;
10059
10060 let github_response = self.client.fetch_async(request).await?;
10063
10064 if github_response.is_success() {
10067 Ok(())
10068 } else {
10069 match github_response.status_code() {
10070 404 => Err(OrgsPingWebhookError::Status404(github_response.to_json_async().await?).into()),
10071 code => Err(OrgsPingWebhookError::Generic { code }.into()),
10072 }
10073 }
10074 }
10075
10076 #[cfg(not(target_arch = "wasm32"))]
10092 pub fn ping_webhook(&self, org: &str, hook_id: i32) -> Result<(), AdapterError> {
10093
10094 let request_uri = format!("{}/orgs/{}/hooks/{}/pings", super::GITHUB_BASE_API_URL, org, hook_id);
10095
10096
10097 let req = GitHubRequest {
10098 uri: request_uri,
10099 body: None,
10100 method: "POST",
10101 headers: vec![]
10102 };
10103
10104 let request = self.client.build(req)?;
10105
10106 let github_response = self.client.fetch(request)?;
10109
10110 if github_response.is_success() {
10113 Ok(())
10114 } else {
10115 match github_response.status_code() {
10116 404 => Err(OrgsPingWebhookError::Status404(github_response.to_json()?).into()),
10117 code => Err(OrgsPingWebhookError::Generic { code }.into()),
10118 }
10119 }
10120 }
10121
10122 pub async fn redeliver_webhook_delivery_async(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result<HashMap<String, Value>, AdapterError> {
10137
10138 let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id);
10139
10140
10141 let req = GitHubRequest {
10142 uri: request_uri,
10143 body: None::<C::Body>,
10144 method: "POST",
10145 headers: vec![]
10146 };
10147
10148 let request = self.client.build(req)?;
10149
10150 let github_response = self.client.fetch_async(request).await?;
10153
10154 if github_response.is_success() {
10157 Ok(github_response.to_json_async().await?)
10158 } else {
10159 match github_response.status_code() {
10160 400 => Err(OrgsRedeliverWebhookDeliveryError::Status400(github_response.to_json_async().await?).into()),
10161 422 => Err(OrgsRedeliverWebhookDeliveryError::Status422(github_response.to_json_async().await?).into()),
10162 code => Err(OrgsRedeliverWebhookDeliveryError::Generic { code }.into()),
10163 }
10164 }
10165 }
10166
10167 #[cfg(not(target_arch = "wasm32"))]
10182 pub fn redeliver_webhook_delivery(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result<HashMap<String, Value>, AdapterError> {
10183
10184 let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id);
10185
10186
10187 let req = GitHubRequest {
10188 uri: request_uri,
10189 body: None,
10190 method: "POST",
10191 headers: vec![]
10192 };
10193
10194 let request = self.client.build(req)?;
10195
10196 let github_response = self.client.fetch(request)?;
10199
10200 if github_response.is_success() {
10203 Ok(github_response.to_json()?)
10204 } else {
10205 match github_response.status_code() {
10206 400 => Err(OrgsRedeliverWebhookDeliveryError::Status400(github_response.to_json()?).into()),
10207 422 => Err(OrgsRedeliverWebhookDeliveryError::Status422(github_response.to_json()?).into()),
10208 code => Err(OrgsRedeliverWebhookDeliveryError::Generic { code }.into()),
10209 }
10210 }
10211 }
10212
10213 pub async fn remove_custom_property_async(&self, org: &str, custom_property_name: &str) -> Result<(), AdapterError> {
10227
10228 let request_uri = format!("{}/orgs/{}/properties/schema/{}", super::GITHUB_BASE_API_URL, org, custom_property_name);
10229
10230
10231 let req = GitHubRequest {
10232 uri: request_uri,
10233 body: None::<C::Body>,
10234 method: "DELETE",
10235 headers: vec![]
10236 };
10237
10238 let request = self.client.build(req)?;
10239
10240 let github_response = self.client.fetch_async(request).await?;
10243
10244 if github_response.is_success() {
10247 Ok(())
10248 } else {
10249 match github_response.status_code() {
10250 403 => Err(OrgsRemoveCustomPropertyError::Status403(github_response.to_json_async().await?).into()),
10251 404 => Err(OrgsRemoveCustomPropertyError::Status404(github_response.to_json_async().await?).into()),
10252 code => Err(OrgsRemoveCustomPropertyError::Generic { code }.into()),
10253 }
10254 }
10255 }
10256
10257 #[cfg(not(target_arch = "wasm32"))]
10271 pub fn remove_custom_property(&self, org: &str, custom_property_name: &str) -> Result<(), AdapterError> {
10272
10273 let request_uri = format!("{}/orgs/{}/properties/schema/{}", super::GITHUB_BASE_API_URL, org, custom_property_name);
10274
10275
10276 let req = GitHubRequest {
10277 uri: request_uri,
10278 body: None,
10279 method: "DELETE",
10280 headers: vec![]
10281 };
10282
10283 let request = self.client.build(req)?;
10284
10285 let github_response = self.client.fetch(request)?;
10288
10289 if github_response.is_success() {
10292 Ok(())
10293 } else {
10294 match github_response.status_code() {
10295 403 => Err(OrgsRemoveCustomPropertyError::Status403(github_response.to_json()?).into()),
10296 404 => Err(OrgsRemoveCustomPropertyError::Status404(github_response.to_json()?).into()),
10297 code => Err(OrgsRemoveCustomPropertyError::Generic { code }.into()),
10298 }
10299 }
10300 }
10301
10302 pub async fn remove_member_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10312
10313 let request_uri = format!("{}/orgs/{}/members/{}", super::GITHUB_BASE_API_URL, org, username);
10314
10315
10316 let req = GitHubRequest {
10317 uri: request_uri,
10318 body: None::<C::Body>,
10319 method: "DELETE",
10320 headers: vec![]
10321 };
10322
10323 let request = self.client.build(req)?;
10324
10325 let github_response = self.client.fetch_async(request).await?;
10328
10329 if github_response.is_success() {
10332 Ok(())
10333 } else {
10334 match github_response.status_code() {
10335 403 => Err(OrgsRemoveMemberError::Status403(github_response.to_json_async().await?).into()),
10336 code => Err(OrgsRemoveMemberError::Generic { code }.into()),
10337 }
10338 }
10339 }
10340
10341 #[cfg(not(target_arch = "wasm32"))]
10351 pub fn remove_member(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10352
10353 let request_uri = format!("{}/orgs/{}/members/{}", super::GITHUB_BASE_API_URL, org, username);
10354
10355
10356 let req = GitHubRequest {
10357 uri: request_uri,
10358 body: None,
10359 method: "DELETE",
10360 headers: vec![]
10361 };
10362
10363 let request = self.client.build(req)?;
10364
10365 let github_response = self.client.fetch(request)?;
10368
10369 if github_response.is_success() {
10372 Ok(())
10373 } else {
10374 match github_response.status_code() {
10375 403 => Err(OrgsRemoveMemberError::Status403(github_response.to_json()?).into()),
10376 code => Err(OrgsRemoveMemberError::Generic { code }.into()),
10377 }
10378 }
10379 }
10380
10381 pub async fn remove_membership_for_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10393
10394 let request_uri = format!("{}/orgs/{}/memberships/{}", super::GITHUB_BASE_API_URL, org, username);
10395
10396
10397 let req = GitHubRequest {
10398 uri: request_uri,
10399 body: None::<C::Body>,
10400 method: "DELETE",
10401 headers: vec![]
10402 };
10403
10404 let request = self.client.build(req)?;
10405
10406 let github_response = self.client.fetch_async(request).await?;
10409
10410 if github_response.is_success() {
10413 Ok(())
10414 } else {
10415 match github_response.status_code() {
10416 403 => Err(OrgsRemoveMembershipForUserError::Status403(github_response.to_json_async().await?).into()),
10417 404 => Err(OrgsRemoveMembershipForUserError::Status404(github_response.to_json_async().await?).into()),
10418 code => Err(OrgsRemoveMembershipForUserError::Generic { code }.into()),
10419 }
10420 }
10421 }
10422
10423 #[cfg(not(target_arch = "wasm32"))]
10435 pub fn remove_membership_for_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10436
10437 let request_uri = format!("{}/orgs/{}/memberships/{}", super::GITHUB_BASE_API_URL, org, username);
10438
10439
10440 let req = GitHubRequest {
10441 uri: request_uri,
10442 body: None,
10443 method: "DELETE",
10444 headers: vec![]
10445 };
10446
10447 let request = self.client.build(req)?;
10448
10449 let github_response = self.client.fetch(request)?;
10452
10453 if github_response.is_success() {
10456 Ok(())
10457 } else {
10458 match github_response.status_code() {
10459 403 => Err(OrgsRemoveMembershipForUserError::Status403(github_response.to_json()?).into()),
10460 404 => Err(OrgsRemoveMembershipForUserError::Status404(github_response.to_json()?).into()),
10461 code => Err(OrgsRemoveMembershipForUserError::Generic { code }.into()),
10462 }
10463 }
10464 }
10465
10466 pub async fn remove_outside_collaborator_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10476
10477 let request_uri = format!("{}/orgs/{}/outside_collaborators/{}", super::GITHUB_BASE_API_URL, org, username);
10478
10479
10480 let req = GitHubRequest {
10481 uri: request_uri,
10482 body: None::<C::Body>,
10483 method: "DELETE",
10484 headers: vec![]
10485 };
10486
10487 let request = self.client.build(req)?;
10488
10489 let github_response = self.client.fetch_async(request).await?;
10492
10493 if github_response.is_success() {
10496 Ok(())
10497 } else {
10498 match github_response.status_code() {
10499 422 => Err(OrgsRemoveOutsideCollaboratorError::Status422(github_response.to_json_async().await?).into()),
10500 code => Err(OrgsRemoveOutsideCollaboratorError::Generic { code }.into()),
10501 }
10502 }
10503 }
10504
10505 #[cfg(not(target_arch = "wasm32"))]
10515 pub fn remove_outside_collaborator(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10516
10517 let request_uri = format!("{}/orgs/{}/outside_collaborators/{}", super::GITHUB_BASE_API_URL, org, username);
10518
10519
10520 let req = GitHubRequest {
10521 uri: request_uri,
10522 body: None,
10523 method: "DELETE",
10524 headers: vec![]
10525 };
10526
10527 let request = self.client.build(req)?;
10528
10529 let github_response = self.client.fetch(request)?;
10532
10533 if github_response.is_success() {
10536 Ok(())
10537 } else {
10538 match github_response.status_code() {
10539 422 => Err(OrgsRemoveOutsideCollaboratorError::Status422(github_response.to_json()?).into()),
10540 code => Err(OrgsRemoveOutsideCollaboratorError::Generic { code }.into()),
10541 }
10542 }
10543 }
10544
10545 pub async fn remove_public_membership_for_authenticated_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10555
10556 let request_uri = format!("{}/orgs/{}/public_members/{}", super::GITHUB_BASE_API_URL, org, username);
10557
10558
10559 let req = GitHubRequest {
10560 uri: request_uri,
10561 body: None::<C::Body>,
10562 method: "DELETE",
10563 headers: vec![]
10564 };
10565
10566 let request = self.client.build(req)?;
10567
10568 let github_response = self.client.fetch_async(request).await?;
10571
10572 if github_response.is_success() {
10575 Ok(())
10576 } else {
10577 match github_response.status_code() {
10578 code => Err(OrgsRemovePublicMembershipForAuthenticatedUserError::Generic { code }.into()),
10579 }
10580 }
10581 }
10582
10583 #[cfg(not(target_arch = "wasm32"))]
10593 pub fn remove_public_membership_for_authenticated_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10594
10595 let request_uri = format!("{}/orgs/{}/public_members/{}", super::GITHUB_BASE_API_URL, org, username);
10596
10597
10598 let req = GitHubRequest {
10599 uri: request_uri,
10600 body: None,
10601 method: "DELETE",
10602 headers: vec![]
10603 };
10604
10605 let request = self.client.build(req)?;
10606
10607 let github_response = self.client.fetch(request)?;
10610
10611 if github_response.is_success() {
10614 Ok(())
10615 } else {
10616 match github_response.status_code() {
10617 code => Err(OrgsRemovePublicMembershipForAuthenticatedUserError::Generic { code }.into()),
10618 }
10619 }
10620 }
10621
10622 pub async fn remove_security_manager_team_async(&self, org: &str, team_slug: &str) -> Result<(), AdapterError> {
10633
10634 let request_uri = format!("{}/orgs/{}/security-managers/teams/{}", super::GITHUB_BASE_API_URL, org, team_slug);
10635
10636
10637 let req = GitHubRequest {
10638 uri: request_uri,
10639 body: None::<C::Body>,
10640 method: "DELETE",
10641 headers: vec![]
10642 };
10643
10644 let request = self.client.build(req)?;
10645
10646 let github_response = self.client.fetch_async(request).await?;
10649
10650 if github_response.is_success() {
10653 Ok(())
10654 } else {
10655 match github_response.status_code() {
10656 code => Err(OrgsRemoveSecurityManagerTeamError::Generic { code }.into()),
10657 }
10658 }
10659 }
10660
10661 #[cfg(not(target_arch = "wasm32"))]
10672 pub fn remove_security_manager_team(&self, org: &str, team_slug: &str) -> Result<(), AdapterError> {
10673
10674 let request_uri = format!("{}/orgs/{}/security-managers/teams/{}", super::GITHUB_BASE_API_URL, org, team_slug);
10675
10676
10677 let req = GitHubRequest {
10678 uri: request_uri,
10679 body: None,
10680 method: "DELETE",
10681 headers: vec![]
10682 };
10683
10684 let request = self.client.build(req)?;
10685
10686 let github_response = self.client.fetch(request)?;
10689
10690 if github_response.is_success() {
10693 Ok(())
10694 } else {
10695 match github_response.status_code() {
10696 code => Err(OrgsRemoveSecurityManagerTeamError::Generic { code }.into()),
10697 }
10698 }
10699 }
10700
10701 pub async fn review_pat_grant_request_async(&self, org: &str, pat_request_id: i32, body: PostOrgsReviewPatGrantRequest) -> Result<(), AdapterError> {
10713
10714 let request_uri = format!("{}/orgs/{}/personal-access-token-requests/{}", super::GITHUB_BASE_API_URL, org, pat_request_id);
10715
10716
10717 let req = GitHubRequest {
10718 uri: request_uri,
10719 body: Some(C::from_json::<PostOrgsReviewPatGrantRequest>(body)?),
10720 method: "POST",
10721 headers: vec![]
10722 };
10723
10724 let request = self.client.build(req)?;
10725
10726 let github_response = self.client.fetch_async(request).await?;
10729
10730 if github_response.is_success() {
10733 Ok(())
10734 } else {
10735 match github_response.status_code() {
10736 500 => Err(OrgsReviewPatGrantRequestError::Status500(github_response.to_json_async().await?).into()),
10737 422 => Err(OrgsReviewPatGrantRequestError::Status422(github_response.to_json_async().await?).into()),
10738 404 => Err(OrgsReviewPatGrantRequestError::Status404(github_response.to_json_async().await?).into()),
10739 403 => Err(OrgsReviewPatGrantRequestError::Status403(github_response.to_json_async().await?).into()),
10740 code => Err(OrgsReviewPatGrantRequestError::Generic { code }.into()),
10741 }
10742 }
10743 }
10744
10745 #[cfg(not(target_arch = "wasm32"))]
10757 pub fn review_pat_grant_request(&self, org: &str, pat_request_id: i32, body: PostOrgsReviewPatGrantRequest) -> Result<(), AdapterError> {
10758
10759 let request_uri = format!("{}/orgs/{}/personal-access-token-requests/{}", super::GITHUB_BASE_API_URL, org, pat_request_id);
10760
10761
10762 let req = GitHubRequest {
10763 uri: request_uri,
10764 body: Some(C::from_json::<PostOrgsReviewPatGrantRequest>(body)?),
10765 method: "POST",
10766 headers: vec![]
10767 };
10768
10769 let request = self.client.build(req)?;
10770
10771 let github_response = self.client.fetch(request)?;
10774
10775 if github_response.is_success() {
10778 Ok(())
10779 } else {
10780 match github_response.status_code() {
10781 500 => Err(OrgsReviewPatGrantRequestError::Status500(github_response.to_json()?).into()),
10782 422 => Err(OrgsReviewPatGrantRequestError::Status422(github_response.to_json()?).into()),
10783 404 => Err(OrgsReviewPatGrantRequestError::Status404(github_response.to_json()?).into()),
10784 403 => Err(OrgsReviewPatGrantRequestError::Status403(github_response.to_json()?).into()),
10785 code => Err(OrgsReviewPatGrantRequestError::Generic { code }.into()),
10786 }
10787 }
10788 }
10789
10790 pub async fn review_pat_grant_requests_in_bulk_async(&self, org: &str, body: PostOrgsReviewPatGrantRequestsInBulk) -> Result<HashMap<String, Value>, AdapterError> {
10802
10803 let request_uri = format!("{}/orgs/{}/personal-access-token-requests", super::GITHUB_BASE_API_URL, org);
10804
10805
10806 let req = GitHubRequest {
10807 uri: request_uri,
10808 body: Some(C::from_json::<PostOrgsReviewPatGrantRequestsInBulk>(body)?),
10809 method: "POST",
10810 headers: vec![]
10811 };
10812
10813 let request = self.client.build(req)?;
10814
10815 let github_response = self.client.fetch_async(request).await?;
10818
10819 if github_response.is_success() {
10822 Ok(github_response.to_json_async().await?)
10823 } else {
10824 match github_response.status_code() {
10825 500 => Err(OrgsReviewPatGrantRequestsInBulkError::Status500(github_response.to_json_async().await?).into()),
10826 422 => Err(OrgsReviewPatGrantRequestsInBulkError::Status422(github_response.to_json_async().await?).into()),
10827 404 => Err(OrgsReviewPatGrantRequestsInBulkError::Status404(github_response.to_json_async().await?).into()),
10828 403 => Err(OrgsReviewPatGrantRequestsInBulkError::Status403(github_response.to_json_async().await?).into()),
10829 code => Err(OrgsReviewPatGrantRequestsInBulkError::Generic { code }.into()),
10830 }
10831 }
10832 }
10833
10834 #[cfg(not(target_arch = "wasm32"))]
10846 pub fn review_pat_grant_requests_in_bulk(&self, org: &str, body: PostOrgsReviewPatGrantRequestsInBulk) -> Result<HashMap<String, Value>, AdapterError> {
10847
10848 let request_uri = format!("{}/orgs/{}/personal-access-token-requests", super::GITHUB_BASE_API_URL, org);
10849
10850
10851 let req = GitHubRequest {
10852 uri: request_uri,
10853 body: Some(C::from_json::<PostOrgsReviewPatGrantRequestsInBulk>(body)?),
10854 method: "POST",
10855 headers: vec![]
10856 };
10857
10858 let request = self.client.build(req)?;
10859
10860 let github_response = self.client.fetch(request)?;
10863
10864 if github_response.is_success() {
10867 Ok(github_response.to_json()?)
10868 } else {
10869 match github_response.status_code() {
10870 500 => Err(OrgsReviewPatGrantRequestsInBulkError::Status500(github_response.to_json()?).into()),
10871 422 => Err(OrgsReviewPatGrantRequestsInBulkError::Status422(github_response.to_json()?).into()),
10872 404 => Err(OrgsReviewPatGrantRequestsInBulkError::Status404(github_response.to_json()?).into()),
10873 403 => Err(OrgsReviewPatGrantRequestsInBulkError::Status403(github_response.to_json()?).into()),
10874 code => Err(OrgsReviewPatGrantRequestsInBulkError::Generic { code }.into()),
10875 }
10876 }
10877 }
10878
10879 pub async fn revoke_all_org_roles_team_async(&self, org: &str, team_slug: &str) -> Result<(), AdapterError> {
10893
10894 let request_uri = format!("{}/orgs/{}/organization-roles/teams/{}", super::GITHUB_BASE_API_URL, org, team_slug);
10895
10896
10897 let req = GitHubRequest {
10898 uri: request_uri,
10899 body: None::<C::Body>,
10900 method: "DELETE",
10901 headers: vec![]
10902 };
10903
10904 let request = self.client.build(req)?;
10905
10906 let github_response = self.client.fetch_async(request).await?;
10909
10910 if github_response.is_success() {
10913 Ok(())
10914 } else {
10915 match github_response.status_code() {
10916 code => Err(OrgsRevokeAllOrgRolesTeamError::Generic { code }.into()),
10917 }
10918 }
10919 }
10920
10921 #[cfg(not(target_arch = "wasm32"))]
10935 pub fn revoke_all_org_roles_team(&self, org: &str, team_slug: &str) -> Result<(), AdapterError> {
10936
10937 let request_uri = format!("{}/orgs/{}/organization-roles/teams/{}", super::GITHUB_BASE_API_URL, org, team_slug);
10938
10939
10940 let req = GitHubRequest {
10941 uri: request_uri,
10942 body: None,
10943 method: "DELETE",
10944 headers: vec![]
10945 };
10946
10947 let request = self.client.build(req)?;
10948
10949 let github_response = self.client.fetch(request)?;
10952
10953 if github_response.is_success() {
10956 Ok(())
10957 } else {
10958 match github_response.status_code() {
10959 code => Err(OrgsRevokeAllOrgRolesTeamError::Generic { code }.into()),
10960 }
10961 }
10962 }
10963
10964 pub async fn revoke_all_org_roles_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
10978
10979 let request_uri = format!("{}/orgs/{}/organization-roles/users/{}", super::GITHUB_BASE_API_URL, org, username);
10980
10981
10982 let req = GitHubRequest {
10983 uri: request_uri,
10984 body: None::<C::Body>,
10985 method: "DELETE",
10986 headers: vec![]
10987 };
10988
10989 let request = self.client.build(req)?;
10990
10991 let github_response = self.client.fetch_async(request).await?;
10994
10995 if github_response.is_success() {
10998 Ok(())
10999 } else {
11000 match github_response.status_code() {
11001 code => Err(OrgsRevokeAllOrgRolesUserError::Generic { code }.into()),
11002 }
11003 }
11004 }
11005
11006 #[cfg(not(target_arch = "wasm32"))]
11020 pub fn revoke_all_org_roles_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
11021
11022 let request_uri = format!("{}/orgs/{}/organization-roles/users/{}", super::GITHUB_BASE_API_URL, org, username);
11023
11024
11025 let req = GitHubRequest {
11026 uri: request_uri,
11027 body: None,
11028 method: "DELETE",
11029 headers: vec![]
11030 };
11031
11032 let request = self.client.build(req)?;
11033
11034 let github_response = self.client.fetch(request)?;
11037
11038 if github_response.is_success() {
11041 Ok(())
11042 } else {
11043 match github_response.status_code() {
11044 code => Err(OrgsRevokeAllOrgRolesUserError::Generic { code }.into()),
11045 }
11046 }
11047 }
11048
11049 pub async fn revoke_org_role_team_async(&self, org: &str, team_slug: &str, role_id: i32) -> Result<(), AdapterError> {
11063
11064 let request_uri = format!("{}/orgs/{}/organization-roles/teams/{}/{}", super::GITHUB_BASE_API_URL, org, team_slug, role_id);
11065
11066
11067 let req = GitHubRequest {
11068 uri: request_uri,
11069 body: None::<C::Body>,
11070 method: "DELETE",
11071 headers: vec![]
11072 };
11073
11074 let request = self.client.build(req)?;
11075
11076 let github_response = self.client.fetch_async(request).await?;
11079
11080 if github_response.is_success() {
11083 Ok(())
11084 } else {
11085 match github_response.status_code() {
11086 code => Err(OrgsRevokeOrgRoleTeamError::Generic { code }.into()),
11087 }
11088 }
11089 }
11090
11091 #[cfg(not(target_arch = "wasm32"))]
11105 pub fn revoke_org_role_team(&self, org: &str, team_slug: &str, role_id: i32) -> Result<(), AdapterError> {
11106
11107 let request_uri = format!("{}/orgs/{}/organization-roles/teams/{}/{}", super::GITHUB_BASE_API_URL, org, team_slug, role_id);
11108
11109
11110 let req = GitHubRequest {
11111 uri: request_uri,
11112 body: None,
11113 method: "DELETE",
11114 headers: vec![]
11115 };
11116
11117 let request = self.client.build(req)?;
11118
11119 let github_response = self.client.fetch(request)?;
11122
11123 if github_response.is_success() {
11126 Ok(())
11127 } else {
11128 match github_response.status_code() {
11129 code => Err(OrgsRevokeOrgRoleTeamError::Generic { code }.into()),
11130 }
11131 }
11132 }
11133
11134 pub async fn revoke_org_role_user_async(&self, org: &str, username: &str, role_id: i32) -> Result<(), AdapterError> {
11148
11149 let request_uri = format!("{}/orgs/{}/organization-roles/users/{}/{}", super::GITHUB_BASE_API_URL, org, username, role_id);
11150
11151
11152 let req = GitHubRequest {
11153 uri: request_uri,
11154 body: None::<C::Body>,
11155 method: "DELETE",
11156 headers: vec![]
11157 };
11158
11159 let request = self.client.build(req)?;
11160
11161 let github_response = self.client.fetch_async(request).await?;
11164
11165 if github_response.is_success() {
11168 Ok(())
11169 } else {
11170 match github_response.status_code() {
11171 code => Err(OrgsRevokeOrgRoleUserError::Generic { code }.into()),
11172 }
11173 }
11174 }
11175
11176 #[cfg(not(target_arch = "wasm32"))]
11190 pub fn revoke_org_role_user(&self, org: &str, username: &str, role_id: i32) -> Result<(), AdapterError> {
11191
11192 let request_uri = format!("{}/orgs/{}/organization-roles/users/{}/{}", super::GITHUB_BASE_API_URL, org, username, role_id);
11193
11194
11195 let req = GitHubRequest {
11196 uri: request_uri,
11197 body: None,
11198 method: "DELETE",
11199 headers: vec![]
11200 };
11201
11202 let request = self.client.build(req)?;
11203
11204 let github_response = self.client.fetch(request)?;
11207
11208 if github_response.is_success() {
11211 Ok(())
11212 } else {
11213 match github_response.status_code() {
11214 code => Err(OrgsRevokeOrgRoleUserError::Generic { code }.into()),
11215 }
11216 }
11217 }
11218
11219 pub async fn set_membership_for_user_async(&self, org: &str, username: &str, body: PutOrgsSetMembershipForUser) -> Result<OrgMembership, AdapterError> {
11237
11238 let request_uri = format!("{}/orgs/{}/memberships/{}", super::GITHUB_BASE_API_URL, org, username);
11239
11240
11241 let req = GitHubRequest {
11242 uri: request_uri,
11243 body: Some(C::from_json::<PutOrgsSetMembershipForUser>(body)?),
11244 method: "PUT",
11245 headers: vec![]
11246 };
11247
11248 let request = self.client.build(req)?;
11249
11250 let github_response = self.client.fetch_async(request).await?;
11253
11254 if github_response.is_success() {
11257 Ok(github_response.to_json_async().await?)
11258 } else {
11259 match github_response.status_code() {
11260 422 => Err(OrgsSetMembershipForUserError::Status422(github_response.to_json_async().await?).into()),
11261 403 => Err(OrgsSetMembershipForUserError::Status403(github_response.to_json_async().await?).into()),
11262 code => Err(OrgsSetMembershipForUserError::Generic { code }.into()),
11263 }
11264 }
11265 }
11266
11267 #[cfg(not(target_arch = "wasm32"))]
11285 pub fn set_membership_for_user(&self, org: &str, username: &str, body: PutOrgsSetMembershipForUser) -> Result<OrgMembership, AdapterError> {
11286
11287 let request_uri = format!("{}/orgs/{}/memberships/{}", super::GITHUB_BASE_API_URL, org, username);
11288
11289
11290 let req = GitHubRequest {
11291 uri: request_uri,
11292 body: Some(C::from_json::<PutOrgsSetMembershipForUser>(body)?),
11293 method: "PUT",
11294 headers: vec![]
11295 };
11296
11297 let request = self.client.build(req)?;
11298
11299 let github_response = self.client.fetch(request)?;
11302
11303 if github_response.is_success() {
11306 Ok(github_response.to_json()?)
11307 } else {
11308 match github_response.status_code() {
11309 422 => Err(OrgsSetMembershipForUserError::Status422(github_response.to_json()?).into()),
11310 403 => Err(OrgsSetMembershipForUserError::Status403(github_response.to_json()?).into()),
11311 code => Err(OrgsSetMembershipForUserError::Generic { code }.into()),
11312 }
11313 }
11314 }
11315
11316 pub async fn set_public_membership_for_authenticated_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
11328
11329 let request_uri = format!("{}/orgs/{}/public_members/{}", super::GITHUB_BASE_API_URL, org, username);
11330
11331
11332 let req = GitHubRequest {
11333 uri: request_uri,
11334 body: None::<C::Body>,
11335 method: "PUT",
11336 headers: vec![]
11337 };
11338
11339 let request = self.client.build(req)?;
11340
11341 let github_response = self.client.fetch_async(request).await?;
11344
11345 if github_response.is_success() {
11348 Ok(())
11349 } else {
11350 match github_response.status_code() {
11351 403 => Err(OrgsSetPublicMembershipForAuthenticatedUserError::Status403(github_response.to_json_async().await?).into()),
11352 code => Err(OrgsSetPublicMembershipForAuthenticatedUserError::Generic { code }.into()),
11353 }
11354 }
11355 }
11356
11357 #[cfg(not(target_arch = "wasm32"))]
11369 pub fn set_public_membership_for_authenticated_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
11370
11371 let request_uri = format!("{}/orgs/{}/public_members/{}", super::GITHUB_BASE_API_URL, org, username);
11372
11373
11374 let req = GitHubRequest {
11375 uri: request_uri,
11376 body: None,
11377 method: "PUT",
11378 headers: vec![]
11379 };
11380
11381 let request = self.client.build(req)?;
11382
11383 let github_response = self.client.fetch(request)?;
11386
11387 if github_response.is_success() {
11390 Ok(())
11391 } else {
11392 match github_response.status_code() {
11393 403 => Err(OrgsSetPublicMembershipForAuthenticatedUserError::Status403(github_response.to_json()?).into()),
11394 code => Err(OrgsSetPublicMembershipForAuthenticatedUserError::Generic { code }.into()),
11395 }
11396 }
11397 }
11398
11399 pub async fn unblock_user_async(&self, org: &str, username: &str) -> Result<(), AdapterError> {
11409
11410 let request_uri = format!("{}/orgs/{}/blocks/{}", super::GITHUB_BASE_API_URL, org, username);
11411
11412
11413 let req = GitHubRequest {
11414 uri: request_uri,
11415 body: None::<C::Body>,
11416 method: "DELETE",
11417 headers: vec![]
11418 };
11419
11420 let request = self.client.build(req)?;
11421
11422 let github_response = self.client.fetch_async(request).await?;
11425
11426 if github_response.is_success() {
11429 Ok(())
11430 } else {
11431 match github_response.status_code() {
11432 code => Err(OrgsUnblockUserError::Generic { code }.into()),
11433 }
11434 }
11435 }
11436
11437 #[cfg(not(target_arch = "wasm32"))]
11447 pub fn unblock_user(&self, org: &str, username: &str) -> Result<(), AdapterError> {
11448
11449 let request_uri = format!("{}/orgs/{}/blocks/{}", super::GITHUB_BASE_API_URL, org, username);
11450
11451
11452 let req = GitHubRequest {
11453 uri: request_uri,
11454 body: None,
11455 method: "DELETE",
11456 headers: vec![]
11457 };
11458
11459 let request = self.client.build(req)?;
11460
11461 let github_response = self.client.fetch(request)?;
11464
11465 if github_response.is_success() {
11468 Ok(())
11469 } else {
11470 match github_response.status_code() {
11471 code => Err(OrgsUnblockUserError::Generic { code }.into()),
11472 }
11473 }
11474 }
11475
11476 pub async fn update_async(&self, org: &str, body: PatchOrgsUpdate) -> Result<OrganizationFull, AdapterError> {
11496
11497 let request_uri = format!("{}/orgs/{}", super::GITHUB_BASE_API_URL, org);
11498
11499
11500 let req = GitHubRequest {
11501 uri: request_uri,
11502 body: Some(C::from_json::<PatchOrgsUpdate>(body)?),
11503 method: "PATCH",
11504 headers: vec![]
11505 };
11506
11507 let request = self.client.build(req)?;
11508
11509 let github_response = self.client.fetch_async(request).await?;
11512
11513 if github_response.is_success() {
11516 Ok(github_response.to_json_async().await?)
11517 } else {
11518 match github_response.status_code() {
11519 422 => Err(OrgsUpdateError::Status422(github_response.to_json_async().await?).into()),
11520 409 => Err(OrgsUpdateError::Status409(github_response.to_json_async().await?).into()),
11521 code => Err(OrgsUpdateError::Generic { code }.into()),
11522 }
11523 }
11524 }
11525
11526 #[cfg(not(target_arch = "wasm32"))]
11546 pub fn update(&self, org: &str, body: PatchOrgsUpdate) -> Result<OrganizationFull, AdapterError> {
11547
11548 let request_uri = format!("{}/orgs/{}", super::GITHUB_BASE_API_URL, org);
11549
11550
11551 let req = GitHubRequest {
11552 uri: request_uri,
11553 body: Some(C::from_json::<PatchOrgsUpdate>(body)?),
11554 method: "PATCH",
11555 headers: vec![]
11556 };
11557
11558 let request = self.client.build(req)?;
11559
11560 let github_response = self.client.fetch(request)?;
11563
11564 if github_response.is_success() {
11567 Ok(github_response.to_json()?)
11568 } else {
11569 match github_response.status_code() {
11570 422 => Err(OrgsUpdateError::Status422(github_response.to_json()?).into()),
11571 409 => Err(OrgsUpdateError::Status409(github_response.to_json()?).into()),
11572 code => Err(OrgsUpdateError::Generic { code }.into()),
11573 }
11574 }
11575 }
11576
11577 pub async fn update_issue_type_async(&self, org: &str, issue_type_id: i32, body: PutOrgsUpdateIssueType) -> Result<IssueType, AdapterError> {
11592
11593 let request_uri = format!("{}/orgs/{}/issue-types/{}", super::GITHUB_BASE_API_URL, org, issue_type_id);
11594
11595
11596 let req = GitHubRequest {
11597 uri: request_uri,
11598 body: Some(C::from_json::<PutOrgsUpdateIssueType>(body)?),
11599 method: "PUT",
11600 headers: vec![]
11601 };
11602
11603 let request = self.client.build(req)?;
11604
11605 let github_response = self.client.fetch_async(request).await?;
11608
11609 if github_response.is_success() {
11612 Ok(github_response.to_json_async().await?)
11613 } else {
11614 match github_response.status_code() {
11615 404 => Err(OrgsUpdateIssueTypeError::Status404(github_response.to_json_async().await?).into()),
11616 422 => Err(OrgsUpdateIssueTypeError::Status422(github_response.to_json_async().await?).into()),
11617 code => Err(OrgsUpdateIssueTypeError::Generic { code }.into()),
11618 }
11619 }
11620 }
11621
11622 #[cfg(not(target_arch = "wasm32"))]
11637 pub fn update_issue_type(&self, org: &str, issue_type_id: i32, body: PutOrgsUpdateIssueType) -> Result<IssueType, AdapterError> {
11638
11639 let request_uri = format!("{}/orgs/{}/issue-types/{}", super::GITHUB_BASE_API_URL, org, issue_type_id);
11640
11641
11642 let req = GitHubRequest {
11643 uri: request_uri,
11644 body: Some(C::from_json::<PutOrgsUpdateIssueType>(body)?),
11645 method: "PUT",
11646 headers: vec![]
11647 };
11648
11649 let request = self.client.build(req)?;
11650
11651 let github_response = self.client.fetch(request)?;
11654
11655 if github_response.is_success() {
11658 Ok(github_response.to_json()?)
11659 } else {
11660 match github_response.status_code() {
11661 404 => Err(OrgsUpdateIssueTypeError::Status404(github_response.to_json()?).into()),
11662 422 => Err(OrgsUpdateIssueTypeError::Status422(github_response.to_json()?).into()),
11663 code => Err(OrgsUpdateIssueTypeError::Generic { code }.into()),
11664 }
11665 }
11666 }
11667
11668 pub async fn update_membership_for_authenticated_user_async(&self, org: &str, body: PatchOrgsUpdateMembershipForAuthenticatedUser) -> Result<OrgMembership, AdapterError> {
11678
11679 let request_uri = format!("{}/user/memberships/orgs/{}", super::GITHUB_BASE_API_URL, org);
11680
11681
11682 let req = GitHubRequest {
11683 uri: request_uri,
11684 body: Some(C::from_json::<PatchOrgsUpdateMembershipForAuthenticatedUser>(body)?),
11685 method: "PATCH",
11686 headers: vec![]
11687 };
11688
11689 let request = self.client.build(req)?;
11690
11691 let github_response = self.client.fetch_async(request).await?;
11694
11695 if github_response.is_success() {
11698 Ok(github_response.to_json_async().await?)
11699 } else {
11700 match github_response.status_code() {
11701 403 => Err(OrgsUpdateMembershipForAuthenticatedUserError::Status403(github_response.to_json_async().await?).into()),
11702 404 => Err(OrgsUpdateMembershipForAuthenticatedUserError::Status404(github_response.to_json_async().await?).into()),
11703 422 => Err(OrgsUpdateMembershipForAuthenticatedUserError::Status422(github_response.to_json_async().await?).into()),
11704 code => Err(OrgsUpdateMembershipForAuthenticatedUserError::Generic { code }.into()),
11705 }
11706 }
11707 }
11708
11709 #[cfg(not(target_arch = "wasm32"))]
11719 pub fn update_membership_for_authenticated_user(&self, org: &str, body: PatchOrgsUpdateMembershipForAuthenticatedUser) -> Result<OrgMembership, AdapterError> {
11720
11721 let request_uri = format!("{}/user/memberships/orgs/{}", super::GITHUB_BASE_API_URL, org);
11722
11723
11724 let req = GitHubRequest {
11725 uri: request_uri,
11726 body: Some(C::from_json::<PatchOrgsUpdateMembershipForAuthenticatedUser>(body)?),
11727 method: "PATCH",
11728 headers: vec![]
11729 };
11730
11731 let request = self.client.build(req)?;
11732
11733 let github_response = self.client.fetch(request)?;
11736
11737 if github_response.is_success() {
11740 Ok(github_response.to_json()?)
11741 } else {
11742 match github_response.status_code() {
11743 403 => Err(OrgsUpdateMembershipForAuthenticatedUserError::Status403(github_response.to_json()?).into()),
11744 404 => Err(OrgsUpdateMembershipForAuthenticatedUserError::Status404(github_response.to_json()?).into()),
11745 422 => Err(OrgsUpdateMembershipForAuthenticatedUserError::Status422(github_response.to_json()?).into()),
11746 code => Err(OrgsUpdateMembershipForAuthenticatedUserError::Generic { code }.into()),
11747 }
11748 }
11749 }
11750
11751 pub async fn update_pat_access_async(&self, org: &str, pat_id: i32, body: PostOrgsUpdatePatAccess) -> Result<(), AdapterError> {
11763
11764 let request_uri = format!("{}/orgs/{}/personal-access-tokens/{}", super::GITHUB_BASE_API_URL, org, pat_id);
11765
11766
11767 let req = GitHubRequest {
11768 uri: request_uri,
11769 body: Some(C::from_json::<PostOrgsUpdatePatAccess>(body)?),
11770 method: "POST",
11771 headers: vec![]
11772 };
11773
11774 let request = self.client.build(req)?;
11775
11776 let github_response = self.client.fetch_async(request).await?;
11779
11780 if github_response.is_success() {
11783 Ok(())
11784 } else {
11785 match github_response.status_code() {
11786 500 => Err(OrgsUpdatePatAccessError::Status500(github_response.to_json_async().await?).into()),
11787 404 => Err(OrgsUpdatePatAccessError::Status404(github_response.to_json_async().await?).into()),
11788 403 => Err(OrgsUpdatePatAccessError::Status403(github_response.to_json_async().await?).into()),
11789 422 => Err(OrgsUpdatePatAccessError::Status422(github_response.to_json_async().await?).into()),
11790 code => Err(OrgsUpdatePatAccessError::Generic { code }.into()),
11791 }
11792 }
11793 }
11794
11795 #[cfg(not(target_arch = "wasm32"))]
11807 pub fn update_pat_access(&self, org: &str, pat_id: i32, body: PostOrgsUpdatePatAccess) -> Result<(), AdapterError> {
11808
11809 let request_uri = format!("{}/orgs/{}/personal-access-tokens/{}", super::GITHUB_BASE_API_URL, org, pat_id);
11810
11811
11812 let req = GitHubRequest {
11813 uri: request_uri,
11814 body: Some(C::from_json::<PostOrgsUpdatePatAccess>(body)?),
11815 method: "POST",
11816 headers: vec![]
11817 };
11818
11819 let request = self.client.build(req)?;
11820
11821 let github_response = self.client.fetch(request)?;
11824
11825 if github_response.is_success() {
11828 Ok(())
11829 } else {
11830 match github_response.status_code() {
11831 500 => Err(OrgsUpdatePatAccessError::Status500(github_response.to_json()?).into()),
11832 404 => Err(OrgsUpdatePatAccessError::Status404(github_response.to_json()?).into()),
11833 403 => Err(OrgsUpdatePatAccessError::Status403(github_response.to_json()?).into()),
11834 422 => Err(OrgsUpdatePatAccessError::Status422(github_response.to_json()?).into()),
11835 code => Err(OrgsUpdatePatAccessError::Generic { code }.into()),
11836 }
11837 }
11838 }
11839
11840 pub async fn update_pat_accesses_async(&self, org: &str, body: PostOrgsUpdatePatAccesses) -> Result<HashMap<String, Value>, AdapterError> {
11852
11853 let request_uri = format!("{}/orgs/{}/personal-access-tokens", super::GITHUB_BASE_API_URL, org);
11854
11855
11856 let req = GitHubRequest {
11857 uri: request_uri,
11858 body: Some(C::from_json::<PostOrgsUpdatePatAccesses>(body)?),
11859 method: "POST",
11860 headers: vec![]
11861 };
11862
11863 let request = self.client.build(req)?;
11864
11865 let github_response = self.client.fetch_async(request).await?;
11868
11869 if github_response.is_success() {
11872 Ok(github_response.to_json_async().await?)
11873 } else {
11874 match github_response.status_code() {
11875 500 => Err(OrgsUpdatePatAccessesError::Status500(github_response.to_json_async().await?).into()),
11876 404 => Err(OrgsUpdatePatAccessesError::Status404(github_response.to_json_async().await?).into()),
11877 403 => Err(OrgsUpdatePatAccessesError::Status403(github_response.to_json_async().await?).into()),
11878 422 => Err(OrgsUpdatePatAccessesError::Status422(github_response.to_json_async().await?).into()),
11879 code => Err(OrgsUpdatePatAccessesError::Generic { code }.into()),
11880 }
11881 }
11882 }
11883
11884 #[cfg(not(target_arch = "wasm32"))]
11896 pub fn update_pat_accesses(&self, org: &str, body: PostOrgsUpdatePatAccesses) -> Result<HashMap<String, Value>, AdapterError> {
11897
11898 let request_uri = format!("{}/orgs/{}/personal-access-tokens", super::GITHUB_BASE_API_URL, org);
11899
11900
11901 let req = GitHubRequest {
11902 uri: request_uri,
11903 body: Some(C::from_json::<PostOrgsUpdatePatAccesses>(body)?),
11904 method: "POST",
11905 headers: vec![]
11906 };
11907
11908 let request = self.client.build(req)?;
11909
11910 let github_response = self.client.fetch(request)?;
11913
11914 if github_response.is_success() {
11917 Ok(github_response.to_json()?)
11918 } else {
11919 match github_response.status_code() {
11920 500 => Err(OrgsUpdatePatAccessesError::Status500(github_response.to_json()?).into()),
11921 404 => Err(OrgsUpdatePatAccessesError::Status404(github_response.to_json()?).into()),
11922 403 => Err(OrgsUpdatePatAccessesError::Status403(github_response.to_json()?).into()),
11923 422 => Err(OrgsUpdatePatAccessesError::Status422(github_response.to_json()?).into()),
11924 code => Err(OrgsUpdatePatAccessesError::Generic { code }.into()),
11925 }
11926 }
11927 }
11928
11929 pub async fn update_webhook_async(&self, org: &str, hook_id: i32, body: PatchOrgsUpdateWebhook) -> Result<OrgHook, AdapterError> {
11948
11949 let request_uri = format!("{}/orgs/{}/hooks/{}", super::GITHUB_BASE_API_URL, org, hook_id);
11950
11951
11952 let req = GitHubRequest {
11953 uri: request_uri,
11954 body: Some(C::from_json::<PatchOrgsUpdateWebhook>(body)?),
11955 method: "PATCH",
11956 headers: vec![]
11957 };
11958
11959 let request = self.client.build(req)?;
11960
11961 let github_response = self.client.fetch_async(request).await?;
11964
11965 if github_response.is_success() {
11968 Ok(github_response.to_json_async().await?)
11969 } else {
11970 match github_response.status_code() {
11971 422 => Err(OrgsUpdateWebhookError::Status422(github_response.to_json_async().await?).into()),
11972 404 => Err(OrgsUpdateWebhookError::Status404(github_response.to_json_async().await?).into()),
11973 code => Err(OrgsUpdateWebhookError::Generic { code }.into()),
11974 }
11975 }
11976 }
11977
11978 #[cfg(not(target_arch = "wasm32"))]
11997 pub fn update_webhook(&self, org: &str, hook_id: i32, body: PatchOrgsUpdateWebhook) -> Result<OrgHook, AdapterError> {
11998
11999 let request_uri = format!("{}/orgs/{}/hooks/{}", super::GITHUB_BASE_API_URL, org, hook_id);
12000
12001
12002 let req = GitHubRequest {
12003 uri: request_uri,
12004 body: Some(C::from_json::<PatchOrgsUpdateWebhook>(body)?),
12005 method: "PATCH",
12006 headers: vec![]
12007 };
12008
12009 let request = self.client.build(req)?;
12010
12011 let github_response = self.client.fetch(request)?;
12014
12015 if github_response.is_success() {
12018 Ok(github_response.to_json()?)
12019 } else {
12020 match github_response.status_code() {
12021 422 => Err(OrgsUpdateWebhookError::Status422(github_response.to_json()?).into()),
12022 404 => Err(OrgsUpdateWebhookError::Status404(github_response.to_json()?).into()),
12023 code => Err(OrgsUpdateWebhookError::Generic { code }.into()),
12024 }
12025 }
12026 }
12027
12028 pub async fn update_webhook_config_for_org_async(&self, org: &str, hook_id: i32, body: PatchOrgsUpdateWebhookConfigForOrg) -> Result<WebhookConfig, AdapterError> {
12043
12044 let request_uri = format!("{}/orgs/{}/hooks/{}/config", super::GITHUB_BASE_API_URL, org, hook_id);
12045
12046
12047 let req = GitHubRequest {
12048 uri: request_uri,
12049 body: Some(C::from_json::<PatchOrgsUpdateWebhookConfigForOrg>(body)?),
12050 method: "PATCH",
12051 headers: vec![]
12052 };
12053
12054 let request = self.client.build(req)?;
12055
12056 let github_response = self.client.fetch_async(request).await?;
12059
12060 if github_response.is_success() {
12063 Ok(github_response.to_json_async().await?)
12064 } else {
12065 match github_response.status_code() {
12066 code => Err(OrgsUpdateWebhookConfigForOrgError::Generic { code }.into()),
12067 }
12068 }
12069 }
12070
12071 #[cfg(not(target_arch = "wasm32"))]
12086 pub fn update_webhook_config_for_org(&self, org: &str, hook_id: i32, body: PatchOrgsUpdateWebhookConfigForOrg) -> Result<WebhookConfig, AdapterError> {
12087
12088 let request_uri = format!("{}/orgs/{}/hooks/{}/config", super::GITHUB_BASE_API_URL, org, hook_id);
12089
12090
12091 let req = GitHubRequest {
12092 uri: request_uri,
12093 body: Some(C::from_json::<PatchOrgsUpdateWebhookConfigForOrg>(body)?),
12094 method: "PATCH",
12095 headers: vec![]
12096 };
12097
12098 let request = self.client.build(req)?;
12099
12100 let github_response = self.client.fetch(request)?;
12103
12104 if github_response.is_success() {
12107 Ok(github_response.to_json()?)
12108 } else {
12109 match github_response.status_code() {
12110 code => Err(OrgsUpdateWebhookConfigForOrgError::Generic { code }.into()),
12111 }
12112 }
12113 }
12114
12115}