|
@@ -89,6 +89,7 @@ pub mod queries {
|
|
|
#[derive(cynic::QueryFragment, Debug)]
|
|
|
pub struct User {
|
|
|
pub login: String,
|
|
|
+ pub database_id: Option<i32>,
|
|
|
}
|
|
|
|
|
|
#[derive(cynic::QueryFragment, Debug)]
|
|
@@ -385,3 +386,44 @@ pub mod project_items {
|
|
|
pub date: Option<Date>,
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+/// Retrieve all pull requests waiting on review from T-compiler
|
|
|
+/// GraphQL query: see file github-graphql/PullRequestsOpen.gql
|
|
|
+pub mod pull_requests_open {
|
|
|
+ use crate::queries::{LabelConnection, PullRequestConnection, UserConnection};
|
|
|
+
|
|
|
+ use super::queries::DateTime;
|
|
|
+ use super::schema;
|
|
|
+
|
|
|
+ #[derive(cynic::QueryVariables, Clone, Debug)]
|
|
|
+ pub struct PullRequestsOpenVariables<'a> {
|
|
|
+ pub repo_owner: &'a str,
|
|
|
+ pub repo_name: &'a str,
|
|
|
+ pub after: Option<String>,
|
|
|
+ }
|
|
|
+
|
|
|
+ #[derive(cynic::QueryFragment, Debug)]
|
|
|
+ #[cynic(graphql_type = "Query", variables = "PullRequestsOpenVariables")]
|
|
|
+ pub struct PullRequestsOpen {
|
|
|
+ #[arguments(owner: $repo_owner, name: $repo_name)]
|
|
|
+ pub repository: Option<Repository>,
|
|
|
+ }
|
|
|
+
|
|
|
+ #[derive(cynic::QueryFragment, Debug)]
|
|
|
+ #[cynic(variables = "PullRequestsOpenVariables")]
|
|
|
+ pub struct Repository {
|
|
|
+ #[arguments(first: 100, after: $after, states: "OPEN")]
|
|
|
+ pub pull_requests: PullRequestConnection,
|
|
|
+ }
|
|
|
+
|
|
|
+ #[derive(cynic::QueryFragment, Debug)]
|
|
|
+ pub struct PullRequest {
|
|
|
+ pub number: i32,
|
|
|
+ pub updated_at: DateTime,
|
|
|
+ pub created_at: DateTime,
|
|
|
+ #[arguments(first: 10)]
|
|
|
+ pub assignees: UserConnection,
|
|
|
+ #[arguments(first: 5, orderBy: { direction: "DESC", field: "NAME" })]
|
|
|
+ pub labels: Option<LabelConnection>,
|
|
|
+ }
|
|
|
+}
|