// Generated by @effect/graphql-generator from pullRequestListings.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 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 user is an individual's account on GitHub that owns repositories and can make new content. */
export const AuthorUser = 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 AuthorUser extends Schema.Struct.Type<typeof AuthorUser.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 PullRequestReview = 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 PullRequestReview extends Schema.Struct.Type<typeof PullRequestReview.fields> {}
/** The connection type for PullRequestReview. */
export const PullRequestReviewConnection = Schema.Struct({
/** A list of nodes. */
nodes: Schema.NullOr(Schema.Array(Schema.NullOr(PullRequestReview)))
})
export interface PullRequestReviewConnection extends Schema.Struct.Type<typeof PullRequestReviewConnection.fields> {}
/** A repository contains the content for a project. */
export const PullRequestRowRepositoryRepository = Schema.Struct({
/** The repository's name with owner. */
nameWithOwner: Schema.String
})
export interface PullRequestRowRepositoryRepository extends Schema.Struct.Type<typeof PullRequestRowRepositoryRepository.fields> {}
/** A user is an individual's account on GitHub that owns repositories and can make new content. */
export const RequestedReviewerUser = Schema.Struct({
__typename: Schema.Literal("User"),
/** The username used to login. */
login: Schema.String
})
export interface RequestedReviewerUser extends Schema.Struct.Type<typeof RequestedReviewerUser.fields> {}
/** A team of users in an organization. */
export const Team = Schema.Struct({
__typename: Schema.Literal("Team"),
/** The slug corresponding to the team. */
slug: Schema.String
})
export interface Team extends Schema.Struct.Type<typeof Team.fields> {}
/** Types that can be requested reviewers. */
export const RequestedReviewerOther = Schema.Struct({
__typename: GraphQL.otherTypename<Shared.Typename.RequestedReviewer>()(["User", "Team"])
})
export interface RequestedReviewerOther extends Schema.Struct.Type<typeof RequestedReviewerOther.fields> {}
/** A request for a user to review a pull request. */
export const ReviewRequest = Schema.Struct({
/** The reviewer that is requested. */
requestedReviewer: Schema.NullOr(Schema.Union([
RequestedReviewerUser,
Team,
RequestedReviewerOther
]))
})
export interface ReviewRequest extends Schema.Struct.Type<typeof ReviewRequest.fields> {}
/** The connection type for ReviewRequest. */
export const ReviewRequestConnection = Schema.Struct({
/** A list of nodes. */
nodes: Schema.NullOr(Schema.Array(Schema.NullOr(ReviewRequest)))
})
export interface ReviewRequestConnection extends Schema.Struct.Type<typeof ReviewRequestConnection.fields> {}
/** A label for categorizing Issues, Pull Requests, Milestones, or Discussions with a given Repository. */
export const Label = Schema.Struct({
/** Identifies the label name. */
name: Schema.String,
/** Identifies the label color. */
color: Schema.String
})
export interface Label extends Schema.Struct.Type<typeof Label.fields> {}
/** The connection type for Label. */
export const LabelConnection = Schema.Struct({
/** A list of nodes. */
nodes: Schema.NullOr(Schema.Array(Schema.NullOr(Label)))
})
export interface LabelConnection extends Schema.Struct.Type<typeof LabelConnection.fields> {}
/** Represents the rollup for both the check runs and status for a commit. */
export const StatusCheckRollup = Schema.Struct({
/** The combined status for the commit. */
state: GraphQL.enumLiterals(Shared.StatusState.literals)
})
export interface StatusCheckRollup extends Schema.Struct.Type<typeof StatusCheckRollup.fields> {}
/** Represents a Git commit. */
export const Commit = Schema.Struct({
/** Check and Status rollup information for this commit. */
statusCheckRollup: Schema.NullOr(StatusCheckRollup)
})
export interface Commit extends Schema.Struct.Type<typeof Commit.fields> {}
/** Represents a Git commit part of a pull request. */
export const PullRequestCommit = Schema.Struct({
/** The Git commit object */
commit: Commit
})
export interface PullRequestCommit extends Schema.Struct.Type<typeof PullRequestCommit.fields> {}
/** The connection type for PullRequestCommit. */
export const PullRequestCommitConnection = Schema.Struct({
/** A list of nodes. */
nodes: Schema.NullOr(Schema.Array(Schema.NullOr(PullRequestCommit)))
})
export interface PullRequestCommitConnection extends Schema.Struct.Type<typeof PullRequestCommitConnection.fields> {}
/**
* `fragment PullRequestRow on PullRequest`
*
* A repository pull request.
*/
export const PullRequestRow = Schema.Struct({
/** 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)),
/** 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,
/** The actor who authored the comment. */
author: Schema.NullOr(Schema.Union([
AuthorUser,
ActorOther
])),
/** 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,
/** 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)),
/** A list of latest reviews per user associated with the pull request that are not also pending review. */
latestReviews: Schema.NullOr(PullRequestReviewConnection),
/** The number of additions in this pull request. */
additions: Schema.optionalKey(Shared.Int),
/** The number of deletions in this pull request. */
deletions: Schema.optionalKey(Shared.Int),
/** Identifies the date and time when the object was created. */
createdAt: Shared.DateTime,
/** 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),
/** The repository associated with this node. */
repository: PullRequestRowRepositoryRepository,
/** A list of review requests associated with the pull request. */
reviewRequests: Schema.NullOr(ReviewRequestConnection),
/** A list of labels associated with the object. */
labels: Schema.NullOr(LabelConnection),
/** A list of commits present in this pull request's head branch not present in the base branch. */
commits: PullRequestCommitConnection
})
export interface PullRequestRow extends Schema.Struct.Type<typeof PullRequestRow.fields> {}
/** Information about pagination in a connection. */
export const PageInfo = Schema.Struct({
/** When paginating forwards, are there more items? */
hasNextPage: Schema.Boolean,
/** When paginating forwards, the cursor to continue. */
endCursor: Schema.NullOr(Schema.String)
})
export interface PageInfo extends Schema.Struct.Type<typeof PageInfo.fields> {}
/** A repository pull request. */
export const PullRequest = Schema.Struct({
__typename: Schema.Literal("PullRequest"),
...PullRequestRow.fields
})
export interface PullRequest extends Schema.Struct.Type<typeof PullRequest.fields> {}
/** The results of a search. */
export const SearchResultItemOther = Schema.Struct({
__typename: GraphQL.otherTypename<Shared.Typename.SearchResultItem>()(["PullRequest"])
})
export interface SearchResultItemOther extends Schema.Struct.Type<typeof SearchResultItemOther.fields> {}
/**
* A list of results that matched against a search query. Regardless of the number
* of matches, a maximum of 1,000 results will be available across all types,
* potentially split across many pages.
*/
export const SearchResultItemConnection = Schema.Struct({
/** Information to aid in pagination. */
pageInfo: PageInfo,
/** A list of nodes. */
nodes: Schema.NullOr(Schema.Array(Schema.NullOr(Schema.Union([
PullRequest,
SearchResultItemOther
]))))
})
export interface SearchResultItemConnection extends Schema.Struct.Type<typeof SearchResultItemConnection.fields> {}
/** `query PullRequestSearch` */
export const PullRequestSearch = GraphQL.query("PullRequestSearch", {
document: {
variables: [
{ name: "q", body: "String!" },
{ name: "first", body: "Int!" },
{ name: "after", body: "String" },
{ name: "stacks", body: "Boolean!" },
{ name: "stats", body: "Boolean!" }
],
selections: [
{ name: "search", body: ["(query:$", "q", " type:ISSUE first:$", "first", " after:$", "after", "){pageInfo{hasNextPage endCursor}nodes{__typename...", "PullRequestRow", "}}"] }
],
fragments: [
{ name: "PullRequestRow", body: ["on PullRequest{stack@include(if:$", "stacks", "){number size baseRefName}stackEntry@include(if:$", "stacks", "){position}number title url author{__typename login avatarUrl...on User{name}}headRefName baseRefName state isDraft mergeable reviewDecision latestReviews(first:20){nodes{state author{__typename login}}}additions@include(if:$", "stats", ")deletions@include(if:$", "stats", ")createdAt updatedAt mergedAt repository{nameWithOwner}reviewRequests(first:20){nodes{requestedReviewer{__typename...on User{login}...on Team{slug}}}}labels(first:20){nodes{name color}}commits(last:1){nodes{commit{statusCheckRollup{state}}}}}"] }
]
},
variables: {
q: Schema.String,
first: Shared.Int,
after: Schema.optional(Schema.NullOr(Schema.String)),
stacks: Schema.Boolean,
stats: Schema.Boolean
},
result: Schema.Struct({
/** Perform a search across resources, returning a maximum of 1,000 results. */
search: SearchResultItemConnection
})
})
export declare namespace PullRequestSearch {
export type Variables = typeof PullRequestSearch.variables.Type
export type Result = typeof PullRequestSearch.result.Type
}
/** The connection type for PullRequest. */
export const PullRequestConnection = Schema.Struct({
/** Information to aid in pagination. */
pageInfo: PageInfo,
/** A list of nodes. */
nodes: Schema.NullOr(Schema.Array(Schema.NullOr(PullRequestRow)))
})
export interface PullRequestConnection extends Schema.Struct.Type<typeof PullRequestConnection.fields> {}
/** A repository contains the content for a project. */
export const PullRequestListRepositoryRepository = Schema.Struct({
/** A list of pull requests that have been opened in the repository. */
pullRequests: PullRequestConnection
})
export interface PullRequestListRepositoryRepository extends Schema.Struct.Type<typeof PullRequestListRepositoryRepository.fields> {}
/** `query PullRequestList` */
export const PullRequestList = GraphQL.query("PullRequestList", {
document: {
variables: [
{ name: "owner", body: "String!" },
{ name: "name", body: "String!" },
{ name: "states", body: "[PullRequestState!]" },
{ name: "first", body: "Int!" },
{ name: "after", body: "String" },
{ name: "stacks", body: "Boolean!" },
{ name: "stats", body: "Boolean!" }
],
selections: [
{ name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequests(first:$", "first", " after:$", "after", " states:$", "states", " orderBy:{field:CREATED_AT direction:DESC}){pageInfo{hasNextPage endCursor}nodes{...", "PullRequestRow", "}}}"] }
],
fragments: [
{ name: "PullRequestRow", body: ["on PullRequest{stack@include(if:$", "stacks", "){number size baseRefName}stackEntry@include(if:$", "stacks", "){position}number title url author{__typename login avatarUrl...on User{name}}headRefName baseRefName state isDraft mergeable reviewDecision latestReviews(first:20){nodes{state author{__typename login}}}additions@include(if:$", "stats", ")deletions@include(if:$", "stats", ")createdAt updatedAt mergedAt repository{nameWithOwner}reviewRequests(first:20){nodes{requestedReviewer{__typename...on User{login}...on Team{slug}}}}labels(first:20){nodes{name color}}commits(last:1){nodes{commit{statusCheckRollup{state}}}}}"] }
]
},
variables: {
owner: Schema.String,
name: Schema.String,
states: Schema.optional(Schema.NullOr(Schema.Array(Shared.PullRequestState))),
first: Shared.Int,
after: Schema.optional(Schema.NullOr(Schema.String)),
stacks: Schema.Boolean,
stats: Schema.Boolean
},
result: Schema.Struct({
/** Lookup a given repository by the owner and repository name. */
repository: Schema.NullOr(PullRequestListRepositoryRepository)
})
})
export declare namespace PullRequestList {
export type Variables = typeof PullRequestList.variables.Type
export type Result = typeof PullRequestList.result.Type
}
/** Every operation in pullRequestListings.graphql. */
export const PullRequestListingsGraphQLGroup = GraphQLGroup.make(PullRequestSearch, PullRequestList)