1
+ using System ;
2
+ using GitHub . Models ;
3
+ using Octokit . GraphQL . Model ;
4
+ using CheckConclusionState = GitHub . Models . CheckConclusionState ;
5
+ using CheckStatusState = GitHub . Models . CheckStatusState ;
6
+ using PullRequestReviewState = GitHub . Models . PullRequestReviewState ;
7
+ using StatusState = GitHub . Models . StatusState ;
8
+
9
+ namespace GitHub . Services
10
+ {
11
+ public static class FromGraphQlExtensions
12
+ {
13
+ public static CheckConclusionState ? FromGraphQl ( this Octokit . GraphQL . Model . CheckConclusionState ? value )
14
+ {
15
+ switch ( value )
16
+ {
17
+ case null :
18
+ return null ;
19
+ case Octokit . GraphQL . Model . CheckConclusionState . ActionRequired :
20
+ return CheckConclusionState . ActionRequired ;
21
+ case Octokit . GraphQL . Model . CheckConclusionState . TimedOut :
22
+ return CheckConclusionState . TimedOut ;
23
+ case Octokit . GraphQL . Model . CheckConclusionState . Cancelled :
24
+ return CheckConclusionState . Cancelled ;
25
+ case Octokit . GraphQL . Model . CheckConclusionState . Failure :
26
+ return CheckConclusionState . Failure ;
27
+ case Octokit . GraphQL . Model . CheckConclusionState . Success :
28
+ return CheckConclusionState . Success ;
29
+ case Octokit . GraphQL . Model . CheckConclusionState . Neutral :
30
+ return CheckConclusionState . Neutral ;
31
+ default :
32
+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
33
+ }
34
+ }
35
+
36
+ public static PullRequestStateEnum FromGraphQl ( this PullRequestState value )
37
+ {
38
+ switch ( value )
39
+ {
40
+ case PullRequestState . Open :
41
+ return PullRequestStateEnum . Open ;
42
+ case PullRequestState . Closed :
43
+ return PullRequestStateEnum . Closed ;
44
+ case PullRequestState . Merged :
45
+ return PullRequestStateEnum . Merged ;
46
+ default :
47
+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
48
+ }
49
+ }
50
+
51
+ public static StatusState FromGraphQl ( this Octokit . GraphQL . Model . StatusState value )
52
+ {
53
+ switch ( value )
54
+ {
55
+ case Octokit . GraphQL . Model . StatusState . Expected :
56
+ return StatusState . Expected ;
57
+ case Octokit . GraphQL . Model . StatusState . Error :
58
+ return StatusState . Error ;
59
+ case Octokit . GraphQL . Model . StatusState . Failure :
60
+ return StatusState . Failure ;
61
+ case Octokit . GraphQL . Model . StatusState . Pending :
62
+ return StatusState . Pending ;
63
+ case Octokit . GraphQL . Model . StatusState . Success :
64
+ return StatusState . Success ;
65
+ default :
66
+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
67
+ }
68
+ }
69
+
70
+ public static CheckStatusState FromGraphQl ( this Octokit . GraphQL . Model . CheckStatusState value )
71
+ {
72
+ switch ( value )
73
+ {
74
+ case Octokit . GraphQL . Model . CheckStatusState . Queued :
75
+ return CheckStatusState . Queued ;
76
+ case Octokit . GraphQL . Model . CheckStatusState . InProgress :
77
+ return CheckStatusState . InProgress ;
78
+ case Octokit . GraphQL . Model . CheckStatusState . Completed :
79
+ return CheckStatusState . Completed ;
80
+ case Octokit . GraphQL . Model . CheckStatusState . Requested :
81
+ return CheckStatusState . Requested ;
82
+ default :
83
+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
84
+ }
85
+ }
86
+
87
+ public static GitHub . Models . PullRequestReviewState FromGraphQl ( this Octokit . GraphQL . Model . PullRequestReviewState value )
88
+ {
89
+ switch ( value ) {
90
+ case Octokit . GraphQL . Model . PullRequestReviewState . Pending :
91
+ return PullRequestReviewState . Pending ;
92
+ case Octokit . GraphQL . Model . PullRequestReviewState . Commented :
93
+ return PullRequestReviewState . Commented ;
94
+ case Octokit . GraphQL . Model . PullRequestReviewState . Approved :
95
+ return PullRequestReviewState . Approved ;
96
+ case Octokit . GraphQL . Model . PullRequestReviewState . ChangesRequested :
97
+ return PullRequestReviewState . ChangesRequested ;
98
+ case Octokit . GraphQL . Model . PullRequestReviewState . Dismissed :
99
+ return PullRequestReviewState . Dismissed ;
100
+ default :
101
+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
102
+ }
103
+ }
104
+ }
105
+ }
0 commit comments