123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- //! Definitions for GitHub GraphQL.
- //!
- //! See <https://docs.github.com/en/graphql> for more GitHub's GraphQL API.
- // This schema can be downloaded from https://docs.github.com/public/schema.docs.graphql
- #[cynic::schema_for_derives(file = "src/github.graphql", module = "schema")]
- pub mod queries {
- use super::schema;
- pub type DateTime = chrono::DateTime<chrono::Utc>;
- cynic::impl_scalar!(DateTime, schema::DateTime);
- #[derive(cynic::QueryVariables, Debug, Clone)]
- pub struct LeastRecentlyReviewedPullRequestsArguments {
- pub repository_owner: String,
- pub repository_name: String,
- pub after: Option<String>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(
- graphql_type = "Query",
- variables = "LeastRecentlyReviewedPullRequestsArguments"
- )]
- pub struct LeastRecentlyReviewedPullRequests {
- #[arguments(owner: $repository_owner, name: $repository_name)]
- pub repository: Option<Repository>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(variables = "LeastRecentlyReviewedPullRequestsArguments")]
- pub struct Repository {
- #[arguments(
- states: "OPEN",
- first: 100,
- after: $after,
- labels: ["S-waiting-on-review"],
- orderBy: {direction: "ASC", field: "UPDATED_AT"}
- )]
- pub pull_requests: PullRequestConnection,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequestConnection {
- pub total_count: i32,
- pub page_info: PageInfo,
- #[cynic(flatten)]
- pub nodes: Vec<PullRequest>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequest {
- pub number: i32,
- pub created_at: DateTime,
- pub url: Uri,
- pub title: String,
- #[arguments(first = 100)]
- pub labels: Option<LabelConnection>,
- pub is_draft: bool,
- #[arguments(first = 100)]
- pub assignees: UserConnection,
- #[arguments(first = 100, orderBy: { direction: "DESC", field: "UPDATED_AT" })]
- pub comments: IssueCommentConnection,
- #[arguments(last = 20)]
- pub latest_reviews: Option<PullRequestReviewConnection>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequestReviewConnection {
- pub total_count: i32,
- #[cynic(flatten)]
- pub nodes: Vec<PullRequestReview>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequestReview {
- pub author: Option<Actor>,
- pub created_at: DateTime,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct UserConnection {
- #[cynic(flatten)]
- pub nodes: Vec<User>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct User {
- pub login: String,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PageInfo {
- pub has_next_page: bool,
- pub end_cursor: Option<String>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct LabelConnection {
- #[cynic(flatten)]
- pub nodes: Vec<Label>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Label {
- pub name: String,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct IssueCommentConnection {
- pub total_count: i32,
- #[cynic(flatten)]
- pub nodes: Vec<IssueComment>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct IssueComment {
- pub author: Option<Actor>,
- pub created_at: DateTime,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Actor {
- pub login: String,
- }
- #[derive(cynic::Scalar, Debug, Clone)]
- #[cynic(graphql_type = "URI")]
- pub struct Uri(pub String);
- }
- #[cynic::schema_for_derives(file = "src/github.graphql", module = "schema")]
- pub mod docs_update_queries {
- use super::queries::{DateTime, PageInfo};
- use super::schema;
- #[derive(cynic::QueryVariables, Clone, Debug)]
- pub struct RecentCommitsArguments {
- pub branch: String,
- pub name: String,
- pub owner: String,
- pub after: Option<String>,
- }
- /// Query for fetching recent commits and their associated PRs.
- ///
- /// This query is built from:
- ///
- /// ```text
- /// query RecentCommits($name: String!, $owner: String!, $branch: String!, $after: String) {
- /// repository(name: $name, owner: $owner) {
- /// ref(qualifiedName: $branch) {
- /// target {
- /// ... on Commit {
- /// history(first: 100, after: $after) {
- /// totalCount
- /// pageInfo {
- /// hasNextPage
- /// endCursor
- /// }
- /// nodes {
- /// oid
- /// parents(first: 1) {
- /// nodes {
- /// oid
- /// }
- /// }
- /// committedDate
- /// messageHeadline
- /// associatedPullRequests(first: 1) {
- /// nodes {
- /// number
- /// title
- /// }
- /// }
- /// }
- /// }
- /// }
- /// }
- /// }
- /// }
- /// }
- /// ```
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(graphql_type = "Query", variables = "RecentCommitsArguments")]
- pub struct RecentCommits {
- #[arguments(name: $name, owner: $owner)]
- pub repository: Option<Repository>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(variables = "RecentCommitsArguments")]
- pub struct Repository {
- #[arguments(qualifiedName: $branch)]
- #[cynic(rename = "ref")]
- pub ref_: Option<Ref>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(variables = "RecentCommitsArguments")]
- pub struct Ref {
- pub target: Option<GitObject>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(variables = "RecentCommitsArguments")]
- pub struct Commit {
- #[arguments(first: 100, after: $after)]
- pub history: CommitHistoryConnection,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct CommitHistoryConnection {
- pub total_count: i32,
- pub page_info: PageInfo,
- #[cynic(flatten)]
- pub nodes: Vec<Commit2>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(graphql_type = "Commit")]
- pub struct Commit2 {
- pub oid: GitObjectID,
- #[arguments(first = 1)]
- pub parents: CommitConnection,
- pub committed_date: DateTime,
- pub message_headline: String,
- #[arguments(first = 1)]
- pub associated_pull_requests: Option<PullRequestConnection>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequestConnection {
- #[cynic(flatten)]
- pub nodes: Vec<PullRequest>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequest {
- pub number: i32,
- pub title: String,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct CommitConnection {
- #[cynic(flatten)]
- pub nodes: Vec<Commit3>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(graphql_type = "Commit")]
- pub struct Commit3 {
- pub oid: GitObjectID,
- }
- #[derive(cynic::InlineFragments, Debug)]
- #[cynic(variables = "RecentCommitsArguments")]
- pub enum GitObject {
- Commit(Commit),
- #[cynic(fallback)]
- Other,
- }
- #[derive(cynic::Scalar, Debug, Clone)]
- pub struct GitObjectID(pub String);
- }
- #[allow(non_snake_case, non_camel_case_types)]
- mod schema {
- cynic::use_schema!("src/github.graphql");
- }
|