123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- //! 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::FragmentArguments, Debug)]
- pub struct LeastRecentlyReviewedPullRequestsArguments {
- pub repository_owner: String,
- pub repository_name: String,
- pub after: Option<String>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(
- graphql_type = "Query",
- argument_struct = "LeastRecentlyReviewedPullRequestsArguments"
- )]
- pub struct LeastRecentlyReviewedPullRequests {
- #[arguments(owner = &args.repository_owner, name = &args.repository_name)]
- pub repository: Option<Repository>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(argument_struct = "LeastRecentlyReviewedPullRequestsArguments")]
- pub struct Repository {
- #[arguments(states = Some(vec![PullRequestState::Open]), first = 100, after = &args.after, labels = Some(vec!["S-waiting-on-review".to_string()]), order_by = IssueOrder { direction: OrderDirection::Asc, field: IssueOrderField::UpdatedAt })]
- pub pull_requests: PullRequestConnection,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequestConnection {
- pub total_count: i32,
- pub page_info: PageInfo,
- pub nodes: Option<Vec<Option<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, order_by = IssueCommentOrder { direction: OrderDirection::Desc, field: IssueCommentOrderField::UpdatedAt })]
- pub comments: IssueCommentConnection,
- #[arguments(last = 20)]
- pub latest_reviews: Option<PullRequestReviewConnection>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequestReviewConnection {
- pub total_count: i32,
- pub nodes: Option<Vec<Option<PullRequestReview>>>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequestReview {
- pub author: Option<Actor>,
- pub created_at: DateTime,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct UserConnection {
- pub nodes: Option<Vec<Option<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 {
- pub nodes: Option<Vec<Option<Label>>>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Label {
- pub name: String,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct IssueCommentConnection {
- pub total_count: i32,
- pub nodes: Option<Vec<Option<IssueComment>>>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct IssueComment {
- pub author: Option<Actor>,
- pub created_at: DateTime,
- }
- #[derive(cynic::Enum, Clone, Copy, Debug)]
- pub enum IssueCommentOrderField {
- UpdatedAt,
- }
- #[derive(cynic::Enum, Clone, Copy, Debug)]
- pub enum IssueOrderField {
- Comments,
- CreatedAt,
- UpdatedAt,
- }
- #[derive(cynic::Enum, Clone, Copy, Debug)]
- pub enum OrderDirection {
- Asc,
- Desc,
- }
- #[derive(cynic::Enum, Clone, Copy, Debug)]
- pub enum PullRequestState {
- Closed,
- Merged,
- Open,
- }
- #[derive(cynic::InputObject, Debug)]
- pub struct IssueOrder {
- pub direction: OrderDirection,
- pub field: IssueOrderField,
- }
- #[derive(cynic::InputObject, Debug)]
- pub struct IssueCommentOrder {
- pub direction: OrderDirection,
- pub field: IssueCommentOrderField,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Actor {
- pub login: String,
- }
- #[derive(cynic::Scalar, Debug, Clone)]
- 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::FragmentArguments, Debug)]
- pub struct RecentCommitsArguments {
- pub branch: String,
- pub name: String,
- pub owner: String,
- pub after: Option<String>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(graphql_type = "Query", argument_struct = "RecentCommitsArguments")]
- pub struct RecentCommits {
- #[arguments(name = &args.name, owner = &args.owner)]
- pub repository: Option<Repository>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(argument_struct = "RecentCommitsArguments")]
- pub struct Repository {
- #[arguments(qualified_name = &args.branch)]
- #[cynic(rename = "ref")]
- pub ref_: Option<Ref>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Ref {
- pub target: Option<GitObject>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Commit {
- #[arguments(first = 100)]
- pub history: CommitHistoryConnection,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct CommitHistoryConnection {
- pub total_count: i32,
- pub page_info: PageInfo,
- pub nodes: Option<Vec<Option<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 {
- pub nodes: Option<Vec<Option<PullRequest>>>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct PullRequest {
- pub number: i32,
- pub title: String,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct CommitConnection {
- pub nodes: Option<Vec<Option<Commit3>>>,
- }
- #[derive(cynic::QueryFragment, Debug)]
- #[cynic(graphql_type = "Commit")]
- pub struct Commit3 {
- pub oid: GitObjectID,
- }
- #[derive(cynic::InlineFragments, Debug)]
- pub enum GitObject {
- Commit(Commit),
- // These three variants are here just to pacify cynic. I don't know
- // why it fails to compile without them.
- Tree(Tree),
- Tag(Tag),
- Blob(Blob),
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Tree {
- pub id: cynic::Id,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Tag {
- pub id: cynic::Id,
- }
- #[derive(cynic::QueryFragment, Debug)]
- pub struct Blob {
- pub id: cynic::Id,
- }
- #[derive(cynic::Scalar, Debug, Clone)]
- pub struct GitObjectID(pub String);
- }
- mod schema {
- cynic::use_schema!("src/github.graphql");
- }
|