@@ -83,59 +83,108 @@ public async Task<Page<PullRequestListItemModel>> ReadPullRequests(
8383 {
8484 if ( readPullRequests == null )
8585 {
86- readPullRequests = new Query ( )
87- . Repository ( Var ( nameof ( owner ) ) , Var ( nameof ( name ) ) )
88- . PullRequests (
89- first : 100 ,
90- after : Var ( nameof ( after ) ) ,
91- orderBy : new IssueOrder { Direction = OrderDirection . Desc , Field = IssueOrderField . CreatedAt } ,
92- states : Var ( nameof ( states ) ) )
93- . Select ( page => new Page < PullRequestListItemModel >
94- {
95- EndCursor = page . PageInfo . EndCursor ,
96- HasNextPage = page . PageInfo . HasNextPage ,
97- TotalCount = page . TotalCount ,
98- Items = page . Nodes . Select ( pr => new ListItemAdapter
86+ if ( address . IsGitHubDotCom ( ) )
87+ {
88+ readPullRequests = new Query ( )
89+ . Repository ( Var ( nameof ( owner ) ) , Var ( nameof ( name ) ) )
90+ . PullRequests (
91+ first : 100 ,
92+ after : Var ( nameof ( after ) ) ,
93+ orderBy : new IssueOrder { Direction = OrderDirection . Desc , Field = IssueOrderField . CreatedAt } ,
94+ states : Var ( nameof ( states ) ) )
95+ . Select ( page => new Page < PullRequestListItemModel >
9996 {
100- Id = pr . Id . Value ,
101- LastCommit = pr . Commits ( null , null , 1 , null ) . Nodes . Select ( commit =>
102- new LastCommitSummaryModel
103- {
104- CheckSuites = commit . Commit . CheckSuites ( null , null , null , null , null ) . AllPages ( 10 )
105- . Select ( suite => new CheckSuiteSummaryModel
106- {
107- CheckRuns = suite . CheckRuns ( null , null , null , null , null ) . AllPages ( 10 )
108- . Select ( run => new CheckRunSummaryModel
109- {
110- Conclusion = run . Conclusion . FromGraphQl ( ) ,
111- Status = run . Status . FromGraphQl ( )
112- } ) . ToList ( )
113- } ) . ToList ( ) ,
114- Statuses = commit . Commit . Status
115- . Select ( context =>
116- context . Contexts . Select ( statusContext => new StatusSummaryModel
117- {
118- State = statusContext . State . FromGraphQl ( ) ,
119- } ) . ToList ( )
120- ) . SingleOrDefault ( )
121- } ) . ToList ( ) . FirstOrDefault ( ) ,
122- Author = new ActorModel
97+ EndCursor = page . PageInfo . EndCursor ,
98+ HasNextPage = page . PageInfo . HasNextPage ,
99+ TotalCount = page . TotalCount ,
100+ Items = page . Nodes . Select ( pr => new ListItemAdapter
123101 {
124- Login = pr . Author . Login ,
125- AvatarUrl = pr . Author . AvatarUrl ( null ) ,
126- } ,
127- CommentCount = pr . Comments ( 0 , null , null , null ) . TotalCount ,
128- Number = pr . Number ,
129- Reviews = pr . Reviews ( null , null , null , null , null , null ) . AllPages ( ) . Select ( review => new ReviewAdapter
102+ Id = pr . Id . Value ,
103+ LastCommit = pr . Commits ( null , null , 1 , null ) . Nodes . Select ( commit =>
104+ new LastCommitSummaryAdapter
105+ {
106+ CheckSuites = commit . Commit . CheckSuites ( null , null , null , null , null ) . AllPages ( 10 )
107+ . Select ( suite => new CheckSuiteSummaryModel
108+ {
109+ CheckRuns = suite . CheckRuns ( null , null , null , null , null ) . AllPages ( 10 )
110+ . Select ( run => new CheckRunSummaryModel
111+ {
112+ Conclusion = run . Conclusion . FromGraphQl ( ) ,
113+ Status = run . Status . FromGraphQl ( )
114+ } ) . ToList ( )
115+ } ) . ToList ( ) ,
116+ Statuses = commit . Commit . Status
117+ . Select ( context =>
118+ context . Contexts . Select ( statusContext => new StatusSummaryModel
119+ {
120+ State = statusContext . State . FromGraphQl ( ) ,
121+ } ) . ToList ( )
122+ ) . SingleOrDefault ( )
123+ } ) . ToList ( ) . FirstOrDefault ( ) ,
124+ Author = new ActorModel
125+ {
126+ Login = pr . Author . Login ,
127+ AvatarUrl = pr . Author . AvatarUrl ( null ) ,
128+ } ,
129+ CommentCount = pr . Comments ( 0 , null , null , null ) . TotalCount ,
130+ Number = pr . Number ,
131+ Reviews = pr . Reviews ( null , null , null , null , null , null ) . AllPages ( ) . Select ( review => new ReviewAdapter
132+ {
133+ Body = review . Body ,
134+ CommentCount = review . Comments ( null , null , null , null ) . TotalCount ,
135+ } ) . ToList ( ) ,
136+ State = pr . State . FromGraphQl ( ) ,
137+ Title = pr . Title ,
138+ UpdatedAt = pr . UpdatedAt ,
139+ } ) . ToList ( ) ,
140+ } ) . Compile ( ) ;
141+ }
142+ else
143+ {
144+ readPullRequests = new Query ( )
145+ . Repository ( Var ( nameof ( owner ) ) , Var ( nameof ( name ) ) )
146+ . PullRequests (
147+ first : 100 ,
148+ after : Var ( nameof ( after ) ) ,
149+ orderBy : new IssueOrder { Direction = OrderDirection . Desc , Field = IssueOrderField . CreatedAt } ,
150+ states : Var ( nameof ( states ) ) )
151+ . Select ( page => new Page < PullRequestListItemModel >
152+ {
153+ EndCursor = page . PageInfo . EndCursor ,
154+ HasNextPage = page . PageInfo . HasNextPage ,
155+ TotalCount = page . TotalCount ,
156+ Items = page . Nodes . Select ( pr => new ListItemAdapter
130157 {
131- Body = review . Body ,
132- CommentCount = review . Comments ( null , null , null , null ) . TotalCount ,
158+ Id = pr . Id . Value ,
159+ LastCommit = pr . Commits ( null , null , 1 , null ) . Nodes . Select ( commit =>
160+ new LastCommitSummaryAdapter
161+ {
162+ Statuses = commit . Commit . Status
163+ . Select ( context =>
164+ context . Contexts . Select ( statusContext => new StatusSummaryModel
165+ {
166+ State = statusContext . State . FromGraphQl ( ) ,
167+ } ) . ToList ( )
168+ ) . SingleOrDefault ( )
169+ } ) . ToList ( ) . FirstOrDefault ( ) ,
170+ Author = new ActorModel
171+ {
172+ Login = pr . Author . Login ,
173+ AvatarUrl = pr . Author . AvatarUrl ( null ) ,
174+ } ,
175+ CommentCount = pr . Comments ( 0 , null , null , null ) . TotalCount ,
176+ Number = pr . Number ,
177+ Reviews = pr . Reviews ( null , null , null , null , null , null ) . AllPages ( ) . Select ( review => new ReviewAdapter
178+ {
179+ Body = review . Body ,
180+ CommentCount = review . Comments ( null , null , null , null ) . TotalCount ,
181+ } ) . ToList ( ) ,
182+ State = pr . State . FromGraphQl ( ) ,
183+ Title = pr . Title ,
184+ UpdatedAt = pr . UpdatedAt ,
133185 } ) . ToList ( ) ,
134- State = pr . State . FromGraphQl ( ) ,
135- Title = pr . Title ,
136- UpdatedAt = pr . UpdatedAt ,
137- } ) . ToList ( ) ,
138- } ) . Compile ( ) ;
186+ } ) . Compile ( ) ;
187+ }
139188 }
140189
141190 var graphql = await graphqlFactory . CreateConnection ( address ) ;
@@ -940,7 +989,7 @@ class ListItemAdapter : PullRequestListItemModel
940989 {
941990 public IList < ReviewAdapter > Reviews { get ; set ; }
942991
943- public LastCommitSummaryModel LastCommit { get ; set ; }
992+ public LastCommitSummaryAdapter LastCommit { get ; set ; }
944993 }
945994
946995 class ReviewAdapter
@@ -950,7 +999,7 @@ class ReviewAdapter
950999 public int Count => CommentCount + ( ! string . IsNullOrWhiteSpace ( Body ) ? 1 : 0 ) ;
9511000 }
9521001
953- class LastCommitSummaryModel
1002+ class LastCommitSummaryAdapter
9541003 {
9551004 public List < CheckSuiteSummaryModel > CheckSuites { get ; set ; }
9561005
0 commit comments