Skip to content

Commit 02baf47

Browse files
Merge pull request #1675 from ehuss/fix-recent-pagination
Fix recent_commits pagination.
2 parents 35a3ea9 + 5bebe93 commit 02baf47

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

github-graphql/src/lib.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,45 @@ pub mod docs_update_queries {
168168
pub after: Option<String>,
169169
}
170170

171+
/// Query for fetching recent commits and their associated PRs.
172+
///
173+
/// This query is built from:
174+
///
175+
/// ```text
176+
/// query RecentCommits($name: String!, $owner: String!, $branch: String!, $after: String) {
177+
/// repository(name: $name, owner: $owner) {
178+
/// ref(qualifiedName: $branch) {
179+
/// target {
180+
/// ... on Commit {
181+
/// history(first: 100, after: $after) {
182+
/// totalCount
183+
/// pageInfo {
184+
/// hasNextPage
185+
/// endCursor
186+
/// }
187+
/// nodes {
188+
/// oid
189+
/// parents(first: 1) {
190+
/// nodes {
191+
/// oid
192+
/// }
193+
/// }
194+
/// committedDate
195+
/// messageHeadline
196+
/// associatedPullRequests(first: 1) {
197+
/// nodes {
198+
/// number
199+
/// title
200+
/// }
201+
/// }
202+
/// }
203+
/// }
204+
/// }
205+
/// }
206+
/// }
207+
/// }
208+
/// }
209+
/// ```
171210
#[derive(cynic::QueryFragment, Debug)]
172211
#[cynic(graphql_type = "Query", argument_struct = "RecentCommitsArguments")]
173212
pub struct RecentCommits {
@@ -184,13 +223,15 @@ pub mod docs_update_queries {
184223
}
185224

186225
#[derive(cynic::QueryFragment, Debug)]
226+
#[cynic(argument_struct = "RecentCommitsArguments")]
187227
pub struct Ref {
188228
pub target: Option<GitObject>,
189229
}
190230

191231
#[derive(cynic::QueryFragment, Debug)]
232+
#[cynic(argument_struct = "RecentCommitsArguments")]
192233
pub struct Commit {
193-
#[arguments(first = 100)]
234+
#[arguments(first = 100, after = &args.after)]
194235
pub history: CommitHistoryConnection,
195236
}
196237

@@ -236,6 +277,7 @@ pub mod docs_update_queries {
236277
}
237278

238279
#[derive(cynic::InlineFragments, Debug)]
280+
#[cynic(argument_struct = "RecentCommitsArguments")]
239281
pub enum GitObject {
240282
Commit(Commit),
241283
// These three variants are here just to pacify cynic. I don't know

0 commit comments

Comments
 (0)