sailfork / t3code-github / packages/ source-control-github/ src/ server/ pullRequestBatches.graphql.ts

// Generated by @effect/graphql-generator from pullRequestBatches.graphql. Do not edit.
import { GraphQL, GraphQLGroup } from "effect/graphql"
import * as Schema from "effect/Schema"
import * as Shared from "../../schema/github.graphql.ts"

/** A user is an individual's account on GitHub that owns repositories and can make new content. */
export const User = Schema.Struct({
  __typename: Schema.Literal("User"),
  /** The username used to login. */
  login: Schema.String,
  /** A URL pointing to the user's public avatar. */
  avatarUrl: Shared.URI,
  /** The user's public profile name. */
  name: Schema.NullOr(Schema.String)
})
export interface User extends Schema.Struct.Type<typeof User.fields> {}

/** Represents an object which can take actions on GitHub. Typically a User or Bot. */
export const ActorOther = Schema.Struct({
  __typename: GraphQL.otherTypename<Shared.Typename.Actor>()(["User"]),
  /** The username of the actor. */
  login: Schema.String,
  /** A URL pointing to the actor's public avatar. */
  avatarUrl: Shared.URI
})
export interface ActorOther extends Schema.Struct.Type<typeof ActorOther.fields> {}

/** Represents an object which can take actions on GitHub. Typically a User or Bot. */
export const Actor = Schema.Struct({
  __typename: GraphQL.otherTypename<Shared.Typename.Actor>()([]),
  /** The username of the actor. */
  login: Schema.String
})
export interface Actor extends Schema.Struct.Type<typeof Actor.fields> {}

/** A review object for a given pull request. */
export const LatestReviewsNodesPullRequestReview = Schema.Struct({
  /** Identifies the current state of the pull request review. */
  state: GraphQL.enumLiterals(Shared.PullRequestReviewState.literals),
  /** The actor who authored the comment. */
  author: Schema.NullOr(Actor)
})
export interface LatestReviewsNodesPullRequestReview extends Schema.Struct.Type<typeof LatestReviewsNodesPullRequestReview.fields> {}

/** The connection type for PullRequestReview. */
export const LatestReviewsPullRequestReviewConnection = Schema.Struct({
  /** A list of nodes. */
  nodes: Schema.NullOr(Schema.Array(Schema.NullOr(LatestReviewsNodesPullRequestReview)))
})
export interface LatestReviewsPullRequestReviewConnection extends Schema.Struct.Type<typeof LatestReviewsPullRequestReviewConnection.fields> {}

/** Represents the rollup for both the check runs and status for a commit. */
export const PullRequestSummaryRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup = Schema.Struct({
  /** The combined status for the commit. */
  state: GraphQL.enumLiterals(Shared.StatusState.literals)
})
export interface PullRequestSummaryRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup extends Schema.Struct.Type<typeof PullRequestSummaryRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup.fields> {}

/** Represents a Git commit. */
export const PullRequestSummaryRepositoryPullRequestCommitsNodesCommitCommit = Schema.Struct({
  /** Check and Status rollup information for this commit. */
  statusCheckRollup: Schema.NullOr(PullRequestSummaryRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup)
})
export interface PullRequestSummaryRepositoryPullRequestCommitsNodesCommitCommit extends Schema.Struct.Type<typeof PullRequestSummaryRepositoryPullRequestCommitsNodesCommitCommit.fields> {}

/** Represents a Git commit part of a pull request. */
export const PullRequestSummaryRepositoryPullRequestCommitsNodesPullRequestCommit = Schema.Struct({
  /** The Git commit object */
  commit: PullRequestSummaryRepositoryPullRequestCommitsNodesCommitCommit
})
export interface PullRequestSummaryRepositoryPullRequestCommitsNodesPullRequestCommit extends Schema.Struct.Type<typeof PullRequestSummaryRepositoryPullRequestCommitsNodesPullRequestCommit.fields> {}

/** The connection type for PullRequestCommit. */
export const PullRequestSummaryRepositoryPullRequestCommitsPullRequestCommitConnection = Schema.Struct({
  /** A list of nodes. */
  nodes: Schema.NullOr(Schema.Array(Schema.NullOr(PullRequestSummaryRepositoryPullRequestCommitsNodesPullRequestCommit)))
})
export interface PullRequestSummaryRepositoryPullRequestCommitsPullRequestCommitConnection extends Schema.Struct.Type<typeof PullRequestSummaryRepositoryPullRequestCommitsPullRequestCommitConnection.fields> {}

/** A stack of PullRequests */
export const PullRequestStack = Schema.Struct({
  /** A number uniquely identifying the stack within its repository */
  number: Shared.Int,
  /** The total number of pull requests in the stack */
  size: Shared.Int,
  /** The branch that the stack's pull requests target */
  baseRefName: Schema.String
})
export interface PullRequestStack extends Schema.Struct.Type<typeof PullRequestStack.fields> {}

/** A member of a PullRequestStack */
export const PullRequestStackEntry = Schema.Struct({
  /** This entry's position in the stack, where 1 is the closest to the base branch, 2 is stacked on top of 1, etc. */
  position: Shared.Int
})
export interface PullRequestStackEntry extends Schema.Struct.Type<typeof PullRequestStackEntry.fields> {}

/** A repository pull request. */
export const PullRequestSummaryRepositoryPullRequestPullRequest = Schema.Struct({
  /** Identifies the pull request number. */
  number: Shared.Int,
  /** Identifies the pull request title. */
  title: Schema.String,
  /** The HTTP URL for this pull request. */
  url: Shared.URI,
  /** Identifies the state of the pull request. */
  state: GraphQL.enumLiterals(Shared.PullRequestState.literals),
  /** Identifies if the pull request is a draft. */
  isDraft: Schema.Boolean,
  /** Whether or not the pull request can be merged based on the existence of merge conflicts. */
  mergeable: GraphQL.enumLiterals(Shared.MergeableState.literals),
  /** The current status of this pull request with respect to code review. */
  reviewDecision: Schema.NullOr(GraphQL.enumLiterals(Shared.PullRequestReviewDecision.literals)),
  /** The number of additions in this pull request. */
  additions: Shared.Int,
  /** The number of deletions in this pull request. */
  deletions: Shared.Int,
  /** The number of changed files in this pull request. */
  changedFiles: Shared.Int,
  /** Identifies the date and time when the object was last updated. */
  updatedAt: Shared.DateTime,
  /** The date and time that the pull request was merged. */
  mergedAt: Schema.NullOr(Shared.DateTime),
  /** Identifies the date and time when the object was closed. */
  closedAt: Schema.NullOr(Shared.DateTime),
  /** Identifies the name of the head Ref associated with the pull request, even if the ref has been deleted. */
  headRefName: Schema.String,
  /** Identifies the name of the base Ref associated with the pull request, even if the ref has been deleted. */
  baseRefName: Schema.String,
  /** The actor who authored the comment. */
  author: Schema.NullOr(Schema.Union([
    User,
    ActorOther
  ])),
  /** A list of latest reviews per user associated with the pull request that are not also pending review. */
  latestReviews: Schema.NullOr(LatestReviewsPullRequestReviewConnection),
  /** A list of commits present in this pull request's head branch not present in the base branch. */
  commits: PullRequestSummaryRepositoryPullRequestCommitsPullRequestCommitConnection,
  /** The stack this Pull Request belongs to, or null if it is not part of a stack */
  stack: Schema.optionalKey(Schema.NullOr(PullRequestStack)),
  /** The stack entry for this Pull Request, or null if it is not part of a stack */
  stackEntry: Schema.optionalKey(Schema.NullOr(PullRequestStackEntry))
})
export interface PullRequestSummaryRepositoryPullRequestPullRequest extends Schema.Struct.Type<typeof PullRequestSummaryRepositoryPullRequestPullRequest.fields> {}

/** A repository contains the content for a project. */
export const PullRequestSummaryRepositoryRepository = Schema.Struct({
  /** Returns a single pull request from the current repository by number. */
  pullRequest: Schema.NullOr(PullRequestSummaryRepositoryPullRequestPullRequest)
})
export interface PullRequestSummaryRepositoryRepository extends Schema.Struct.Type<typeof PullRequestSummaryRepositoryRepository.fields> {}

/** `query PullRequestSummary` */
export const PullRequestSummary = GraphQL.query("PullRequestSummary", {
  document: {
    variables: [
      { name: "owner", body: "String!" },
      { name: "name", body: "String!" },
      { name: "number", body: "Int!" },
      { name: "stacks", body: "Boolean!" }
    ],
    selections: [
      { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){number title url state isDraft mergeable reviewDecision additions deletions changedFiles updatedAt mergedAt closedAt headRefName baseRefName author{__typename login avatarUrl...on User{name}}latestReviews(first:20){nodes{state author{__typename login}}}commits(last:1){nodes{commit{statusCheckRollup{state}}}}stack@include(if:$", "stacks", "){number size baseRefName}stackEntry@include(if:$", "stacks", "){position}}}"] }
    ],
    fragments: []
  },
  variables: {
    owner: Schema.String,
    name: Schema.String,
    number: Shared.Int,
    stacks: Schema.Boolean
  },
  result: Schema.Struct({
    /** Lookup a given repository by the owner and repository name. */
    repository: Schema.NullOr(PullRequestSummaryRepositoryRepository)
  })
})
export declare namespace PullRequestSummary {
  export type Variables = typeof PullRequestSummary.variables.Type
  export type Result = typeof PullRequestSummary.result.Type
}

/** A repository pull request. */
export const PullRequestStatsRepositoryPullRequestPullRequest = Schema.Struct({
  /** The number of additions in this pull request. */
  additions: Shared.Int,
  /** The number of deletions in this pull request. */
  deletions: Shared.Int
})
export interface PullRequestStatsRepositoryPullRequestPullRequest extends Schema.Struct.Type<typeof PullRequestStatsRepositoryPullRequestPullRequest.fields> {}

/** A repository contains the content for a project. */
export const PullRequestStatsRepositoryRepository = Schema.Struct({
  /** Returns a single pull request from the current repository by number. */
  pullRequest: Schema.NullOr(PullRequestStatsRepositoryPullRequestPullRequest)
})
export interface PullRequestStatsRepositoryRepository extends Schema.Struct.Type<typeof PullRequestStatsRepositoryRepository.fields> {}

/** `query PullRequestStats` */
export const PullRequestStats = GraphQL.query("PullRequestStats", {
  document: {
    variables: [
      { name: "owner", body: "String!" },
      { name: "name", body: "String!" },
      { name: "number", body: "Int!" }
    ],
    selections: [
      { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){additions deletions}}"] }
    ],
    fragments: []
  },
  variables: {
    owner: Schema.String,
    name: Schema.String,
    number: Shared.Int
  },
  result: Schema.Struct({
    /** Lookup a given repository by the owner and repository name. */
    repository: Schema.NullOr(PullRequestStatsRepositoryRepository)
  })
})
export declare namespace PullRequestStats {
  export type Variables = typeof PullRequestStats.variables.Type
  export type Result = typeof PullRequestStats.result.Type
}

/** A repository pull request. */
export const PullRequestStackMembershipRepositoryPullRequestPullRequest = Schema.Struct({
  /** The stack this Pull Request belongs to, or null if it is not part of a stack */
  stack: Schema.NullOr(PullRequestStack),
  /** The stack entry for this Pull Request, or null if it is not part of a stack */
  stackEntry: Schema.NullOr(PullRequestStackEntry)
})
export interface PullRequestStackMembershipRepositoryPullRequestPullRequest extends Schema.Struct.Type<typeof PullRequestStackMembershipRepositoryPullRequestPullRequest.fields> {}

/** A repository contains the content for a project. */
export const PullRequestStackMembershipRepositoryRepository = Schema.Struct({
  /** Returns a single pull request from the current repository by number. */
  pullRequest: Schema.NullOr(PullRequestStackMembershipRepositoryPullRequestPullRequest)
})
export interface PullRequestStackMembershipRepositoryRepository extends Schema.Struct.Type<typeof PullRequestStackMembershipRepositoryRepository.fields> {}

/** `query PullRequestStackMembership` */
export const PullRequestStackMembership = GraphQL.query("PullRequestStackMembership", {
  document: {
    variables: [
      { name: "owner", body: "String!" },
      { name: "name", body: "String!" },
      { name: "number", body: "Int!" }
    ],
    selections: [
      { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){stack{number size baseRefName}stackEntry{position}}}"] }
    ],
    fragments: []
  },
  variables: {
    owner: Schema.String,
    name: Schema.String,
    number: Shared.Int
  },
  result: Schema.Struct({
    /** Lookup a given repository by the owner and repository name. */
    repository: Schema.NullOr(PullRequestStackMembershipRepositoryRepository)
  })
})
export declare namespace PullRequestStackMembership {
  export type Variables = typeof PullRequestStackMembership.variables.Type
  export type Result = typeof PullRequestStackMembership.result.Type
}

/** Represents a comment on an Issue. */
export const IssueComment = Schema.Struct({
  /** The moment the editor made the last edit */
  lastEditedAt: Schema.NullOr(Shared.DateTime)
})
export interface IssueComment extends Schema.Struct.Type<typeof IssueComment.fields> {}

/** The connection type for IssueComment. */
export const IssueCommentConnection = Schema.Struct({
  /** Identifies the total count of items in the connection. */
  totalCount: Shared.Int,
  /** A list of nodes. */
  nodes: Schema.NullOr(Schema.Array(Schema.NullOr(IssueComment)))
})
export interface IssueCommentConnection extends Schema.Struct.Type<typeof IssueCommentConnection.fields> {}

/** A review object for a given pull request. */
export const ReviewsNodesPullRequestReview = Schema.Struct({
  /** The moment the editor made the last edit */
  lastEditedAt: Schema.NullOr(Shared.DateTime)
})
export interface ReviewsNodesPullRequestReview extends Schema.Struct.Type<typeof ReviewsNodesPullRequestReview.fields> {}

/** The connection type for PullRequestReview. */
export const ReviewsPullRequestReviewConnection = Schema.Struct({
  /** Identifies the total count of items in the connection. */
  totalCount: Shared.Int,
  /** A list of nodes. */
  nodes: Schema.NullOr(Schema.Array(Schema.NullOr(ReviewsNodesPullRequestReview)))
})
export interface ReviewsPullRequestReviewConnection extends Schema.Struct.Type<typeof ReviewsPullRequestReviewConnection.fields> {}

/** Review comment threads for a pull request review. */
export const PullRequestReviewThreadConnection = Schema.Struct({
  /** Identifies the total count of items in the connection. */
  totalCount: Shared.Int
})
export interface PullRequestReviewThreadConnection extends Schema.Struct.Type<typeof PullRequestReviewThreadConnection.fields> {}

/** Represents a count of the state of a check run. */
export const CheckRunStateCount = Schema.Struct({
  /** The state of a check run. */
  state: GraphQL.enumLiterals(Shared.CheckRunState.literals),
  /** The number of check runs with this state. */
  count: Shared.Int
})
export interface CheckRunStateCount extends Schema.Struct.Type<typeof CheckRunStateCount.fields> {}

/** Represents a count of the state of a status context. */
export const StatusContextStateCount = Schema.Struct({
  /** The state of a status context. */
  state: GraphQL.enumLiterals(Shared.StatusState.literals),
  /** The number of statuses with this state. */
  count: Shared.Int
})
export interface StatusContextStateCount extends Schema.Struct.Type<typeof StatusContextStateCount.fields> {}

/** The connection type for StatusCheckRollupContext. */
export const StatusCheckRollupContextConnection = Schema.Struct({
  /** Counts of check runs by state. */
  checkRunCountsByState: Schema.NullOr(Schema.Array(CheckRunStateCount)),
  /** Counts of status contexts by state. */
  statusContextCountsByState: Schema.NullOr(Schema.Array(StatusContextStateCount))
})
export interface StatusCheckRollupContextConnection extends Schema.Struct.Type<typeof StatusCheckRollupContextConnection.fields> {}

/** Represents the rollup for both the check runs and status for a commit. */
export const PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup = Schema.Struct({
  /** A list of status contexts and check runs for this commit. */
  contexts: StatusCheckRollupContextConnection
})
export interface PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup extends Schema.Struct.Type<typeof PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup.fields> {}

/** Represents a Git commit. */
export const PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitCommit = Schema.Struct({
  /** Check and Status rollup information for this commit. */
  statusCheckRollup: Schema.NullOr(PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitStatusCheckRollupStatusCheckRollup)
})
export interface PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitCommit extends Schema.Struct.Type<typeof PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitCommit.fields> {}

/** Represents a Git commit part of a pull request. */
export const PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesPullRequestCommit = Schema.Struct({
  /** The Git commit object */
  commit: PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesCommitCommit
})
export interface PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesPullRequestCommit extends Schema.Struct.Type<typeof PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesPullRequestCommit.fields> {}

/** The connection type for PullRequestCommit. */
export const PullRequestWatchFingerprintRepositoryPullRequestCommitsPullRequestCommitConnection = Schema.Struct({
  /** A list of nodes. */
  nodes: Schema.NullOr(Schema.Array(Schema.NullOr(PullRequestWatchFingerprintRepositoryPullRequestCommitsNodesPullRequestCommit)))
})
export interface PullRequestWatchFingerprintRepositoryPullRequestCommitsPullRequestCommitConnection extends Schema.Struct.Type<typeof PullRequestWatchFingerprintRepositoryPullRequestCommitsPullRequestCommitConnection.fields> {}

/** A repository pull request. */
export const PullRequestWatchFingerprintRepositoryPullRequestPullRequest = Schema.Struct({
  /** Identifies the state of the pull request. */
  state: GraphQL.enumLiterals(Shared.PullRequestState.literals),
  /** Whether or not the pull request can be merged based on the existence of merge conflicts. */
  mergeable: GraphQL.enumLiterals(Shared.MergeableState.literals),
  /** Identifies the oid of the head ref associated with the pull request, even if the ref has been deleted. */
  headRefOid: Shared.GitObjectID,
  /** A list of comments associated with the pull request. */
  comments: IssueCommentConnection,
  /** A list of reviews associated with the pull request. */
  reviews: Schema.NullOr(ReviewsPullRequestReviewConnection),
  /** The list of all review threads for this pull request. */
  reviewThreads: PullRequestReviewThreadConnection,
  /** A list of commits present in this pull request's head branch not present in the base branch. */
  commits: PullRequestWatchFingerprintRepositoryPullRequestCommitsPullRequestCommitConnection
})
export interface PullRequestWatchFingerprintRepositoryPullRequestPullRequest extends Schema.Struct.Type<typeof PullRequestWatchFingerprintRepositoryPullRequestPullRequest.fields> {}

/** A repository contains the content for a project. */
export const PullRequestWatchFingerprintRepositoryRepository = Schema.Struct({
  /** Returns a single pull request from the current repository by number. */
  pullRequest: Schema.NullOr(PullRequestWatchFingerprintRepositoryPullRequestPullRequest)
})
export interface PullRequestWatchFingerprintRepositoryRepository extends Schema.Struct.Type<typeof PullRequestWatchFingerprintRepositoryRepository.fields> {}

/** `query PullRequestWatchFingerprint` */
export const PullRequestWatchFingerprint = GraphQL.query("PullRequestWatchFingerprint", {
  document: {
    variables: [
      { name: "owner", body: "String!" },
      { name: "name", body: "String!" },
      { name: "number", body: "Int!" }
    ],
    selections: [
      { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){state mergeable headRefOid comments(first:100 orderBy:{field:UPDATED_AT direction:DESC}){totalCount nodes{lastEditedAt}}reviews(last:100){totalCount nodes{lastEditedAt}}reviewThreads{totalCount}commits(last:1){nodes{commit{statusCheckRollup{contexts{checkRunCountsByState{state count}statusContextCountsByState{state count}}}}}}}}"] }
    ],
    fragments: []
  },
  variables: {
    owner: Schema.String,
    name: Schema.String,
    number: Shared.Int
  },
  result: Schema.Struct({
    /** Lookup a given repository by the owner and repository name. */
    repository: Schema.NullOr(PullRequestWatchFingerprintRepositoryRepository)
  })
})
export declare namespace PullRequestWatchFingerprint {
  export type Variables = typeof PullRequestWatchFingerprint.variables.Type
  export type Result = typeof PullRequestWatchFingerprint.result.Type
}

/** Every operation in pullRequestBatches.graphql. */
export const PullRequestBatchesGraphQLGroup = GraphQLGroup.make(PullRequestSummary, PullRequestStats, PullRequestStackMembership, PullRequestWatchFingerprint)