@@ -106,15 +106,15 @@ public async Task<Page<PullRequestListItemModel>> ReadPullRequests(
106106 CheckRuns = suite . CheckRuns ( null , null , null , null , null ) . AllPages ( 10 )
107107 . Select ( run => new CheckRunSummaryModel
108108 {
109- Conclusion = ( CheckConclusionState ? ) run . Conclusion ,
110- Status = ( CheckStatusState ) run . Status
109+ Conclusion = FromGraphQl ( run . Conclusion ) ,
110+ Status = FromGraphQl ( run . Status )
111111 } ) . ToList ( )
112112 } ) . ToList ( ) ,
113113 Statuses = commit . Commit . Status
114114 . Select ( context =>
115115 context . Contexts . Select ( statusContext => new StatusSummaryModel
116116 {
117- State = ( StatusState ) statusContext . State ,
117+ State = FromGraphQl ( statusContext . State ) ,
118118 } ) . ToList ( )
119119 ) . SingleOrDefault ( )
120120 } ) . ToList ( ) . FirstOrDefault ( ) ,
@@ -130,7 +130,7 @@ public async Task<Page<PullRequestListItemModel>> ReadPullRequests(
130130 Body = review . Body ,
131131 CommentCount = review . Comments ( null , null , null , null ) . TotalCount ,
132132 } ) . ToList ( ) ,
133- State = ( PullRequestStateEnum ) pr . State ,
133+ State = FromGraphQl ( pr . State ) ,
134134 Title = pr . Title ,
135135 UpdatedAt = pr . UpdatedAt ,
136136 } ) . ToList ( ) ,
@@ -934,6 +934,80 @@ static Tuple<string, int> ParseGHfVSConfigKeyValue(string value)
934934 return null ;
935935 }
936936
937+ static PullRequestStateEnum FromGraphQl ( PullRequestState value )
938+ {
939+ switch ( value )
940+ {
941+ case PullRequestState . Open :
942+ return PullRequestStateEnum . Open ;
943+ case PullRequestState . Closed :
944+ return PullRequestStateEnum . Closed ;
945+ case PullRequestState . Merged :
946+ return PullRequestStateEnum . Merged ;
947+ default :
948+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
949+ }
950+ }
951+
952+ static StatusState FromGraphQl ( Octokit . GraphQL . Model . StatusState value )
953+ {
954+ switch ( value )
955+ {
956+ case Octokit . GraphQL . Model . StatusState . Expected :
957+ return StatusState . Expected ;
958+ case Octokit . GraphQL . Model . StatusState . Error :
959+ return StatusState . Error ;
960+ case Octokit . GraphQL . Model . StatusState . Failure :
961+ return StatusState . Failure ;
962+ case Octokit . GraphQL . Model . StatusState . Pending :
963+ return StatusState . Pending ;
964+ case Octokit . GraphQL . Model . StatusState . Success :
965+ return StatusState . Success ;
966+ default :
967+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
968+ }
969+ }
970+
971+ static CheckStatusState FromGraphQl ( Octokit . GraphQL . Model . CheckStatusState value )
972+ {
973+ switch ( value )
974+ {
975+ case Octokit . GraphQL . Model . CheckStatusState . Queued :
976+ return CheckStatusState . Queued ;
977+ case Octokit . GraphQL . Model . CheckStatusState . InProgress :
978+ return CheckStatusState . InProgress ;
979+ case Octokit . GraphQL . Model . CheckStatusState . Completed :
980+ return CheckStatusState . Completed ;
981+ case Octokit . GraphQL . Model . CheckStatusState . Requested :
982+ return CheckStatusState . Requested ;
983+ default :
984+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
985+ }
986+ }
987+
988+ static CheckConclusionState ? FromGraphQl ( Octokit . GraphQL . Model . CheckConclusionState ? value )
989+ {
990+ switch ( value )
991+ {
992+ case null :
993+ return null ;
994+ case Octokit . GraphQL . Model . CheckConclusionState . ActionRequired :
995+ return CheckConclusionState . ActionRequired ;
996+ case Octokit . GraphQL . Model . CheckConclusionState . TimedOut :
997+ return CheckConclusionState . TimedOut ;
998+ case Octokit . GraphQL . Model . CheckConclusionState . Cancelled :
999+ return CheckConclusionState . Cancelled ;
1000+ case Octokit . GraphQL . Model . CheckConclusionState . Failure :
1001+ return CheckConclusionState . Failure ;
1002+ case Octokit . GraphQL . Model . CheckConclusionState . Success :
1003+ return CheckConclusionState . Success ;
1004+ case Octokit . GraphQL . Model . CheckConclusionState . Neutral :
1005+ return CheckConclusionState . Neutral ;
1006+ default :
1007+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , null ) ;
1008+ }
1009+ }
1010+
9371011 class ListItemAdapter : PullRequestListItemModel
9381012 {
9391013 public IList < ReviewAdapter > Reviews { get ; set ; }
0 commit comments