gqlmodel

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package gqlmodel holds the hand-written Go types that back Githome's GraphQL object types and scalars. The api/graphql resolvers render into these structs so the presenter owns the GraphQL wire shape, mirroring how restmodel owns the REST wire shape. gqlgen autobinds object types to these structs and binds the custom scalars to the marshalers here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	IsActor()
}

Actor is the GraphQL Actor interface: an entity that can author issues, comments, and reviews. User is the only implementer today; gh's `... on User` inline fragments dispatch on the concrete type.

type AutoMergeRequest added in v0.1.3

type AutoMergeRequest struct {
	AuthorEmail    *string
	CommitBody     *string
	CommitHeadline *string
	EnabledAt      *DateTime
	EnabledBy      Actor
	MergeMethod    PullRequestMergeMethod
}

AutoMergeRequest is the auto-merge configuration on a pull request. GitHub sets it when auto-merge is enabled; Githome always returns null because it does not implement auto-merge queuing.

type Base64String added in v0.1.3

type Base64String string

Base64String is GitHub's Base64String scalar: a base64-encoded string, the type blob text and tarball payloads ride in.

func (Base64String) MarshalGQL added in v0.1.3

func (b Base64String) MarshalGQL(w io.Writer)

MarshalGQL writes the payload as a quoted string.

func (*Base64String) UnmarshalGQL added in v0.1.3

func (b *Base64String) UnmarshalGQL(v any) error

UnmarshalGQL reads a Base64String from a JSON string.

type BigInt added in v0.1.3

type BigInt string

BigInt is GitHub's BigInt scalar: an integer too wide for Int, carried as a JSON string. fullDatabaseId is typed with it.

func (BigInt) MarshalGQL added in v0.1.3

func (b BigInt) MarshalGQL(w io.Writer)

MarshalGQL writes the integer as a quoted string.

func (*BigInt) UnmarshalGQL added in v0.1.3

func (b *BigInt) UnmarshalGQL(v any) error

UnmarshalGQL reads a BigInt from a JSON string.

type Blob added in v0.1.3

type Blob struct {
	ID  string // the Blob node ID
	Oid GitObjectID
}

Blob is a git blob object.

func (Blob) AbbreviatedOid added in v0.1.3

func (b Blob) AbbreviatedOid() string

AbbreviatedOid is the short form of the blob's SHA.

func (Blob) GetID added in v0.1.3

func (b Blob) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Blob) IsGitObject added in v0.1.3

func (Blob) IsGitObject()

IsGitObject marks Blob as implementing the GitObject interface.

func (Blob) IsNode added in v0.1.3

func (Blob) IsNode()

IsNode marks Blob as implementing the Node interface.

type CheckConclusionState added in v0.1.3

type CheckConclusionState string

CheckConclusionState is the GraphQL enum for a completed check run's conclusion.

const (
	CheckConclusionStateActionRequired CheckConclusionState = "ACTION_REQUIRED"
	CheckConclusionStateTimedOut       CheckConclusionState = "TIMED_OUT"
	CheckConclusionStateCancelled      CheckConclusionState = "CANCELLED"
	CheckConclusionStateFailure        CheckConclusionState = "FAILURE"
	CheckConclusionStateSuccess        CheckConclusionState = "SUCCESS"
	CheckConclusionStateNeutral        CheckConclusionState = "NEUTRAL"
	CheckConclusionStateSkipped        CheckConclusionState = "SKIPPED"
	CheckConclusionStateStartupFailure CheckConclusionState = "STARTUP_FAILURE"
	CheckConclusionStateStale          CheckConclusionState = "STALE"
)

The CheckConclusionState values.

type CheckRun added in v0.1.3

type CheckRun struct {
	ID          string                // the CheckRun node ID
	Name        string                // the check run name
	Status      CheckStatusState      // the current status
	Conclusion  *CheckConclusionState // null until completed
	StartedAt   *DateTime
	CompletedAt *DateTime
	URL         URI
	DetailsURL  *URI
}

CheckRun is the GraphQL CheckRun type as a status check rollup context.

func (CheckRun) GetID added in v0.1.3

func (c CheckRun) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (CheckRun) IsNode added in v0.1.3

func (CheckRun) IsNode()

IsNode marks CheckRun as implementing the Node interface.

func (CheckRun) IsStatusCheckRollupContext added in v0.1.3

func (CheckRun) IsStatusCheckRollupContext()

IsStatusCheckRollupContext marks CheckRun as a union member.

type CheckStatusState added in v0.1.3

type CheckStatusState string

CheckStatusState is the GraphQL enum for a check run's status.

const (
	CheckStatusStateQueued     CheckStatusState = "QUEUED"
	CheckStatusStateInProgress CheckStatusState = "IN_PROGRESS"
	CheckStatusStateCompleted  CheckStatusState = "COMPLETED"
	CheckStatusStateWaiting    CheckStatusState = "WAITING"
	CheckStatusStatePending    CheckStatusState = "PENDING"
	CheckStatusStateRequested  CheckStatusState = "REQUESTED"
)

The CheckStatusState values.

type CommentAuthorAssociation added in v0.1.3

type CommentAuthorAssociation string

CommentAuthorAssociation is the GraphQL CommentAuthorAssociation enum: the comment author's relationship to the repository.

const (
	CommentAuthorAssociationMember               CommentAuthorAssociation = "MEMBER"
	CommentAuthorAssociationOwner                CommentAuthorAssociation = "OWNER"
	CommentAuthorAssociationMannequin            CommentAuthorAssociation = "MANNEQUIN"
	CommentAuthorAssociationCollaborator         CommentAuthorAssociation = "COLLABORATOR"
	CommentAuthorAssociationContributor          CommentAuthorAssociation = "CONTRIBUTOR"
	CommentAuthorAssociationFirstTimeContributor CommentAuthorAssociation = "FIRST_TIME_CONTRIBUTOR"
	CommentAuthorAssociationFirstTimer           CommentAuthorAssociation = "FIRST_TIMER"
	CommentAuthorAssociationNone                 CommentAuthorAssociation = "NONE"
)

The CommentAuthorAssociation values.

type Commit

type Commit struct {
	ID              string // the Commit node ID, may be empty until resolved
	Oid             GitObjectID
	Message         string
	MessageHeadline string

	// RepoOwner and RepoName carry the repository coordinates so the
	// statusCheckRollup field resolver can fold the commit's statuses and check
	// runs. They are not part of the GraphQL schema, so gqlgen ignores them; the
	// presenter fills them.
	RepoOwner string
	RepoName  string
}

Commit is the reduced GraphQL Commit: the object id and the message gh pr view reads. It implements GitObject and Node; the id is the repo-scoped commit node id, filled by the presenter when it knows the repository's database id and computed by the id field resolver otherwise.

func (Commit) AbbreviatedOid added in v0.1.3

func (c Commit) AbbreviatedOid() string

AbbreviatedOid is the short form of the commit's SHA.

func (Commit) GetID added in v0.1.3

func (c Commit) GetID() string

GetID satisfies the Node interface getter gqlgen requires. It is empty when the presenter could not compute the node id; the id field resolver answers the wire query in that case.

func (Commit) IsGitObject added in v0.1.3

func (Commit) IsGitObject()

IsGitObject marks Commit as implementing the GitObject interface.

func (Commit) IsNode added in v0.1.3

func (Commit) IsNode()

IsNode marks Commit as implementing the Node interface.

type Date added in v0.1.3

type Date struct{ T time.Time }

Date is GitHub's Date scalar: an ISO 8601 calendar date with no time part.

func (Date) MarshalGQL added in v0.1.3

func (d Date) MarshalGQL(w io.Writer)

MarshalGQL writes the date as a quoted YYYY-MM-DD string.

func (*Date) UnmarshalGQL added in v0.1.3

func (d *Date) UnmarshalGQL(v any) error

UnmarshalGQL parses a YYYY-MM-DD string.

type DateTime

type DateTime struct{ T time.Time }

DateTime is GitHub's DateTime scalar: an ISO 8601 instant in UTC. It marshals to a quoted Zulu string and is used for non-null timestamp fields; nullable timestamps use *DateTime.

func NewDateTime

func NewDateTime(t time.Time) DateTime

NewDateTime wraps t as a DateTime.

func (DateTime) MarshalGQL

func (d DateTime) MarshalGQL(w io.Writer)

MarshalGQL writes the timestamp as a quoted Zulu string.

func (*DateTime) UnmarshalGQL

func (d *DateTime) UnmarshalGQL(v any) error

UnmarshalGQL parses an ISO 8601 string back into a DateTime. GitHub accepts offset forms like 2011-10-05T14:48:00+07:00 on input and converts them to UTC, so the parse takes the full RFC 3339 grammar, not just the Zulu form the scalar renders.

type DiffSide added in v0.1.3

type DiffSide string

DiffSide is the side of a diff a review comment anchors to.

const (
	DiffSideLeft  DiffSide = "LEFT"
	DiffSideRight DiffSide = "RIGHT"
)

The DiffSide values.

type GitObject

type GitObject interface {
	IsGitObject()
}

GitObject is the interface a git object addressed by its SHA implements: Commit, Tree, Blob, and Tag. Ref.target carries it, so `... on Commit` inline fragments narrow it the way GitHub's schema allows.

type GitObjectID

type GitObjectID string

GitObjectID is GitHub's GitObjectID scalar: a git object's hex SHA.

func (GitObjectID) MarshalGQL

func (g GitObjectID) MarshalGQL(w io.Writer)

MarshalGQL writes the object id as a quoted string.

func (*GitObjectID) UnmarshalGQL

func (g *GitObjectID) UnmarshalGQL(v any) error

UnmarshalGQL reads a GitObjectID from a JSON string.

type GitSSHRemote added in v0.1.3

type GitSSHRemote string

GitSSHRemote is GitHub's GitSSHRemote scalar: a git SSH clone address like git@host:owner/name.git.

func (GitSSHRemote) MarshalGQL added in v0.1.3

func (g GitSSHRemote) MarshalGQL(w io.Writer)

MarshalGQL writes the remote as a quoted string.

func (*GitSSHRemote) UnmarshalGQL added in v0.1.3

func (g *GitSSHRemote) UnmarshalGQL(v any) error

UnmarshalGQL reads a GitSSHRemote from a JSON string.

type GitTimestamp added in v0.1.3

type GitTimestamp struct{ T time.Time }

GitTimestamp is GitHub's GitTimestamp scalar: an ISO 8601 instant that, unlike DateTime, keeps the offset the git object recorded instead of converting to UTC.

func (GitTimestamp) MarshalGQL added in v0.1.3

func (g GitTimestamp) MarshalGQL(w io.Writer)

MarshalGQL writes the timestamp as a quoted RFC 3339 string in its own zone.

func (*GitTimestamp) UnmarshalGQL added in v0.1.3

func (g *GitTimestamp) UnmarshalGQL(v any) error

UnmarshalGQL parses an ISO 8601 string, offset preserved.

type HTML added in v0.1.3

type HTML string

HTML is GitHub's HTML scalar: a string containing rendered HTML.

func (HTML) MarshalGQL added in v0.1.3

func (h HTML) MarshalGQL(w io.Writer)

MarshalGQL writes the HTML as a quoted string.

func (*HTML) UnmarshalGQL added in v0.1.3

func (h *HTML) UnmarshalGQL(v any) error

UnmarshalGQL reads an HTML value from a JSON string.

type Issue

type Issue struct {
	ID             string            // the Issue node ID
	Number         int32             // the per-repository issue number
	Title          string            // the issue title
	Body           string            // the issue body, empty string when unset
	State          IssueState        // OPEN or CLOSED
	StateReason    *IssueStateReason // null until the issue has been closed
	URL            URI               // the issue's HTML URL
	Locked         bool              // whether the conversation is locked
	Closed         bool              // whether the issue is closed
	Author         Actor             // null for a ghost author (resolved by dataloader)
	CreatedAt      DateTime          // creation instant
	UpdatedAt      DateTime          // last-update instant
	ClosedAt       *DateTime         // null while open
	Labels         *LabelConnection  // the attached labels (resolved by dataloader)
	Assignees      *UserConnection   // the assignees (resolved on demand)
	Milestone      *Milestone        // the milestone (resolved on demand)
	Comments       *IssueCommentConnection
	ReactionGroups []ReactionGroup // emoji reaction counts; always non-nil (empty when none)

	// DatabaseID is the issue's integer database id (the legacy REST id),
	// served as databaseId by the resolver.
	DatabaseID int64
	// ActiveLockReason is GitHub's raw lock-reason string, nil when unlocked or
	// locked without a reason; the resolver maps it onto the LockReason enum.
	ActiveLockReason *string
	// IsPinned reports whether the issue is pinned to the repository. Githome
	// does not model pinned issues yet, so it is always false.
	IsPinned bool

	// RepoOwner and RepoName carry the repository coordinates so the comments
	// field resolver can page the issue's comments. They are not part of the
	// GraphQL schema, so gqlgen ignores them; the presenter fills them.
	RepoOwner string
	RepoName  string

	// PK and UserPK are not part of the GraphQL schema. They carry the database
	// primary keys the per-request dataloaders use to look up Author and Labels
	// without re-hitting the pre-assembled domain data.
	PK     int64
	UserPK int64
}

Issue is the GraphQL Issue object, reduced to the fields gh issue view and gh issue list select.

func (Issue) GetID added in v0.1.3

func (i Issue) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Issue) IsAssignableNode added in v0.1.3

func (Issue) IsAssignableNode()

IsAssignableNode marks Issue as a member of the AssignableNode union type.

func (Issue) IsLabelableNode added in v0.1.3

func (Issue) IsLabelableNode()

IsLabelableNode marks Issue as a member of the LabelableNode union type.

func (Issue) IsNode added in v0.1.3

func (Issue) IsNode()

IsNode marks Issue as implementing the Node interface.

func (Issue) IsSearchResultItem added in v0.1.3

func (Issue) IsSearchResultItem()

IsSearchResultItem marks Issue as a member of the SearchResultItem union.

type IssueComment

type IssueComment struct {
	ID                  string                   // the IssueComment node ID
	Body                string                   // the comment body
	Author              Actor                    // null for a ghost author
	AuthorAssociation   CommentAuthorAssociation // the author's repository association
	IncludesCreatedEdit bool                     // whether the body has been edited
	IsMinimized         bool                     // always false; Githome does not minimize
	MinimizedReason     *string                  // always null
	ReactionGroups      []ReactionGroup          // emoji reaction counts; non-nil
	URL                 URI                      // the comment's HTML URL
	CreatedAt           DateTime                 // creation instant
	UpdatedAt           DateTime                 // last-update instant

	// AuthorPK is not part of the GraphQL schema. It carries the author's
	// database key so the viewerDidAuthor resolver can compare it with the
	// request's viewer.
	AuthorPK int64
}

IssueComment is the GraphQL IssueComment object.

func (IssueComment) GetID added in v0.1.3

func (c IssueComment) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (IssueComment) IsNode added in v0.1.3

func (IssueComment) IsNode()

IsNode marks IssueComment as implementing the Node interface.

type IssueCommentConnection

type IssueCommentConnection struct {
	Nodes      []*IssueComment
	PageInfo   *PageInfo
	TotalCount int32
}

IssueCommentConnection is the connection over an issue's comments.

type IssueConnection

type IssueConnection struct {
	Nodes      []*Issue
	Edges      []*IssueEdge
	PageInfo   *PageInfo
	TotalCount int32
}

IssueConnection is the Relay connection over a repository's issues.

type IssueEdge

type IssueEdge struct {
	Cursor string
	Node   *Issue
}

IssueEdge pairs an issue with its opaque pagination cursor.

type IssueState

type IssueState string

IssueState is the GraphQL IssueState enum: an issue is OPEN or CLOSED.

const (
	IssueStateOpen   IssueState = "OPEN"
	IssueStateClosed IssueState = "CLOSED"
)

The IssueState values.

type IssueStateReason

type IssueStateReason string

IssueStateReason is the GraphQL enum for why an issue is in its state. It is null for an open issue that has never been closed.

const (
	IssueStateReasonCompleted  IssueStateReason = "COMPLETED"
	IssueStateReasonNotPlanned IssueStateReason = "NOT_PLANNED"
	IssueStateReasonReopened   IssueStateReason = "REOPENED"
)

The IssueStateReason values.

type IssueTemplate added in v0.1.3

type IssueTemplate struct {
	Name  string
	Title *string
	Body  *string
	About *string
}

IssueTemplate is an issue template configured in a repository.

type IssueTimelineItemsEdge added in v0.1.3

type IssueTimelineItemsEdge struct {
	Cursor string
	Node   *IssueComment
}

IssueTimelineItemsEdge is one edge of an issue's timeline. Githome models the timeline as the comment stream, so the node is an IssueComment.

type Label

type Label struct {
	ID          string   // the Label node ID
	Name        string   // the label name
	Color       string   // the six-hex color, no leading hash
	Description *string  // null when unset
	IsDefault   bool     // whether the label is one GitHub seeds new repos with
	URL         URI      // the label's HTML URL (the filtered issue list)
	CreatedAt   DateTime // creation instant
	UpdatedAt   DateTime // last rename/recolor; mirrors CreatedAt when untracked
}

Label is the GraphQL Label object.

func (Label) GetID added in v0.1.3

func (l Label) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Label) IsNode added in v0.1.3

func (Label) IsNode()

IsNode marks Label as implementing the Node interface.

type LabelConnection

type LabelConnection struct {
	Edges      []*LabelEdge
	Nodes      []*Label
	PageInfo   *PageInfo
	TotalCount int32
}

LabelConnection is the connection over an issue's or repository's labels.

type LabelEdge added in v0.1.3

type LabelEdge struct {
	Cursor string
	Node   *Label
}

LabelEdge is one edge of a LabelConnection, pairing a label with its cursor.

type Language added in v0.1.3

type Language struct {
	Name string
}

Language is a programming language detected in a repository.

type LanguageConnection added in v0.1.3

type LanguageConnection struct {
	Edges      []*LanguageEdge
	Nodes      []*Language
	PageInfo   *PageInfo
	TotalCount int32
	TotalSize  int32
}

LanguageConnection is the connection over the languages in a repository.

type LanguageEdge added in v0.1.3

type LanguageEdge struct {
	Cursor string
	Node   *Language
	Size   int32
}

LanguageEdge pairs a language with the number of bytes written in it.

type License added in v0.1.3

type License struct {
	Key      string
	Name     string
	Nickname *string
	SpdxID   *string
	URL      *URI
	Body     string
}

License is an open-source license detected in a repository.

type MergeStateStatus

type MergeStateStatus string

MergeStateStatus is the GraphQL MergeStateStatus enum, GitHub's richer view of why a pull request can or cannot merge. Githome resolves CLEAN, DIRTY, BEHIND, DRAFT, and UNKNOWN today; BLOCKED, UNSTABLE, and HAS_HOOKS arrive with the review and check milestones that produce them.

const (
	MergeStateStatusBehind   MergeStateStatus = "BEHIND"
	MergeStateStatusBlocked  MergeStateStatus = "BLOCKED"
	MergeStateStatusClean    MergeStateStatus = "CLEAN"
	MergeStateStatusDirty    MergeStateStatus = "DIRTY"
	MergeStateStatusDraft    MergeStateStatus = "DRAFT"
	MergeStateStatusHasHooks MergeStateStatus = "HAS_HOOKS"
	MergeStateStatusUnknown  MergeStateStatus = "UNKNOWN"
	MergeStateStatusUnstable MergeStateStatus = "UNSTABLE"
)

The MergeStateStatus values.

type MergeableState

type MergeableState string

MergeableState is the GraphQL MergeableState enum, the tri-state the worker resolves: MERGEABLE for a clean test merge, CONFLICTING for one that conflicts, and UNKNOWN while the recompute has not yet run.

const (
	MergeableStateMergeable   MergeableState = "MERGEABLE"
	MergeableStateConflicting MergeableState = "CONFLICTING"
	MergeableStateUnknown     MergeableState = "UNKNOWN"
)

The MergeableState values.

type Milestone added in v0.1.3

type Milestone struct {
	ID          string    // the Milestone node ID
	Number      int32     // the per-repository milestone number
	Title       string    // the milestone title
	Description *string   // null when unset
	DueOn       *DateTime // the due date, null when unset
	State       string    // "open" or "closed"
	URL         URI       // the milestone's HTML URL
}

Milestone is the GraphQL Milestone object: the milestone an issue or pull request is attached to. The fields are the subset gh issue view selects.

func (Milestone) GetID added in v0.1.3

func (m Milestone) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Milestone) IsNode added in v0.1.3

func (Milestone) IsNode()

IsNode marks Milestone as implementing the Node interface.

type MilestoneConnection added in v0.1.3

type MilestoneConnection struct {
	Nodes      []*Milestone
	PageInfo   *PageInfo
	TotalCount int32
}

MilestoneConnection is the connection over a repository's milestones.

type Organization added in v0.1.3

type Organization struct {
	ID              string
	Login           string
	Name            *string
	Description     *string
	Email           *string
	Location        *string
	WebsiteURL      *URI
	TwitterUsername *string
	DatabaseID      *int32
	URL             URI
	AvatarURL       URI
	ResourcePath    URI
	CreatedAt       DateTime
	UpdatedAt       DateTime
}

Organization is the GraphQL Organization object. Githome does not model organizations yet, so the type is never instantiated; it exists so gh's `... on Organization` inline fragments validate.

func (Organization) GetID added in v0.1.3

func (o Organization) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Organization) IsActor added in v0.1.3

func (Organization) IsActor()

IsActor marks Organization as implementing the Actor interface.

func (Organization) IsNode added in v0.1.3

func (Organization) IsNode()

IsNode marks Organization as implementing the Node interface.

func (Organization) IsRepositoryOwner added in v0.1.3

func (Organization) IsRepositoryOwner()

IsRepositoryOwner marks Organization as implementing the RepositoryOwner interface.

type PageInfo

type PageInfo struct {
	HasNextPage     bool
	HasPreviousPage bool
	StartCursor     *string
	EndCursor       *string
}

PageInfo is the Relay page-info shared by every connection.

type PatchStatus

type PatchStatus string

PatchStatus is the GraphQL PatchStatus enum: how a file changed across a pull request's diff.

const (
	PatchStatusAdded    PatchStatus = "ADDED"
	PatchStatusDeleted  PatchStatus = "DELETED"
	PatchStatusModified PatchStatus = "MODIFIED"
	PatchStatusRenamed  PatchStatus = "RENAMED"
	PatchStatusCopied   PatchStatus = "COPIED"
	PatchStatusChanged  PatchStatus = "CHANGED"
)

The PatchStatus values.

type PullRequest

type PullRequest struct {
	ID                  string                   // the PullRequest node ID
	Number              int32                    // the per-repository pull request number
	Title               string                   // the pull request title
	Body                string                   // the body, empty string when unset
	State               PullRequestState         // OPEN, CLOSED, or MERGED
	URL                 URI                      // the pull request's HTML URL
	Locked              bool                     // whether the conversation is locked
	Closed              bool                     // whether the pull request is closed or merged
	IsDraft             bool                     // whether the pull request is a draft
	Merged              bool                     // whether the pull request has merged
	MergedAt            *DateTime                // null while unmerged
	MergeCommitOID      string                   // the merge commit sha; empty while unmerged
	Mergeable           MergeableState           // the tri-state mergeable
	MergeStateStatus    MergeStateStatus         // the richer merge state
	Author              Actor                    // null for a ghost author
	AuthorAssociation   CommentAuthorAssociation // the author's repository association
	BaseRefName         string                   // the base branch name
	HeadRefName         string                   // the head branch name
	BaseRefOid          GitObjectID              // the recorded base tip
	HeadRefOid          GitObjectID              // the recorded head tip
	IsCrossRepository   bool                     // whether the head lives in another repository
	MaintainerCanModify bool                     // whether maintainers can push the head branch
	HeadRepository      *Repository              // the head repository; null when the fork is gone
	HeadRepositoryOwner RepositoryOwner          // the head repository's owner
	FullDatabaseID      *BigInt                  // the BigInt twin of the REST id
	MergedBy            Actor                    // who merged the pull request; null while unmerged
	Additions           int32                    // lines added across the diff
	Deletions           int32                    // lines removed across the diff
	ChangedFiles        int32                    // files touched by the diff
	CreatedAt           DateTime                 // creation instant
	UpdatedAt           DateTime                 // last-update instant
	ClosedAt            *DateTime                // null while open
	Labels              *LabelConnection         // resolved on demand
	Assignees           *UserConnection          // resolved on demand
	Milestone           *Milestone               // resolved on demand
	BaseRef             *Ref                     // resolved on demand (carries the Ref node ID)
	HeadRef             *Ref                     // resolved on demand (carries the Ref node ID)
	AutoMergeRequest    *AutoMergeRequest        // null unless auto-merge is enabled
	IsInMergeQueue      bool                     // always false; Githome has no merge queue
	ReactionGroups      []ReactionGroup          // emoji reaction counts; always non-nil (empty when none)

	// RepoOwner and RepoName carry the repository coordinates so the files and
	// commits field resolvers can read them through the domain. They are not part
	// of the GraphQL schema, so gqlgen ignores them; the presenter fills them.
	RepoOwner string
	RepoName  string

	// IssuePK is the database primary key of the underlying issue row; it is not
	// part of the GraphQL schema but is used by the assignees/labels/milestone
	// field resolvers to avoid re-querying the domain for the same data.
	IssuePK int64

	// CommentsCount is the cached count of issue-level comments; used by the
	// comments resolver to return the correct totalCount without a second query.
	CommentsCount int32

	// CommitsCount is the cached count of the pull request's own commits, the
	// commits_count column the mergeability recompute maintains alongside
	// additions/deletions/changedFiles. The commits resolver answers a
	// count-only selection from it without forking git.
	CommitsCount int32
}

PullRequest is the GraphQL PullRequest object, reduced to the fields gh pr view and gh pr diff select. mergeable and mergeStateStatus are the worker-resolved merge view; until the recompute runs mergeable is UNKNOWN and mergeStateStatus is UNKNOWN.

func (PullRequest) GetID added in v0.1.3

func (p PullRequest) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (PullRequest) IsAssignableNode added in v0.1.3

func (PullRequest) IsAssignableNode()

IsAssignableNode marks PullRequest as a member of the AssignableNode union type.

func (PullRequest) IsLabelableNode added in v0.1.3

func (PullRequest) IsLabelableNode()

IsLabelableNode marks PullRequest as a member of the LabelableNode union type.

func (PullRequest) IsNode added in v0.1.3

func (PullRequest) IsNode()

IsNode marks PullRequest as implementing the Node interface.

func (PullRequest) IsSearchResultItem added in v0.1.3

func (PullRequest) IsSearchResultItem()

IsSearchResultItem marks PullRequest as a member of the SearchResultItem union.

type PullRequestChangedFile

type PullRequestChangedFile struct {
	Path       string
	Additions  int32
	Deletions  int32
	ChangeType PatchStatus
}

PullRequestChangedFile is one file's change in a pull request's diff.

type PullRequestChangedFileConnection

type PullRequestChangedFileConnection struct {
	Nodes      []*PullRequestChangedFile
	PageInfo   *PageInfo
	TotalCount int32
}

PullRequestChangedFileConnection is the connection over a pull request's changed files.

type PullRequestCommit

type PullRequestCommit struct {
	URL    URI
	Commit *Commit
}

PullRequestCommit is one commit on a pull request, wrapping the underlying git commit the way GitHub's schema nests it.

type PullRequestCommitConnection

type PullRequestCommitConnection struct {
	Nodes      []*PullRequestCommit
	PageInfo   *PageInfo
	TotalCount int32
}

PullRequestCommitConnection is the connection over a pull request's commits.

type PullRequestConnection

type PullRequestConnection struct {
	Nodes      []*PullRequest
	Edges      []*PullRequestEdge
	PageInfo   *PageInfo
	TotalCount int32
}

PullRequestConnection is the Relay connection over a repository's pull requests.

type PullRequestEdge

type PullRequestEdge struct {
	Cursor string
	Node   *PullRequest
}

PullRequestEdge pairs a pull request with its opaque pagination cursor.

type PullRequestMergeMethod added in v0.1.3

type PullRequestMergeMethod string

PullRequestMergeMethod is the GraphQL enum of supported merge strategies.

const (
	PullRequestMergeMethodMerge  PullRequestMergeMethod = "MERGE"
	PullRequestMergeMethodSquash PullRequestMergeMethod = "SQUASH"
	PullRequestMergeMethodRebase PullRequestMergeMethod = "REBASE"
)

The PullRequestMergeMethod values.

type PullRequestReviewComment

type PullRequestReviewComment struct {
	ID        string // the PullRequestReviewComment node ID
	Body      string // the comment body
	Path      string // the file the comment anchors to
	Author    Actor  // null for a ghost author
	Outdated  bool   // whether the anchored line left the diff
	URL       URI    // the comment's HTML URL
	CreatedAt DateTime
}

PullRequestReviewComment is the GraphQL view of one inline review comment.

type PullRequestReviewCommentConnection

type PullRequestReviewCommentConnection struct {
	Nodes      []*PullRequestReviewComment
	TotalCount int32
}

PullRequestReviewCommentConnection is the connection over a thread's comments.

type PullRequestReviewDecision

type PullRequestReviewDecision string

PullRequestReviewDecision is the GraphQL enum for a pull request's derived review state. Githome computes APPROVED and CHANGES_REQUESTED from the reviews; REVIEW_REQUIRED needs branch protection and arrives with that milestone.

const (
	PullRequestReviewDecisionChangesRequested PullRequestReviewDecision = "CHANGES_REQUESTED"
	PullRequestReviewDecisionApproved         PullRequestReviewDecision = "APPROVED"
	PullRequestReviewDecisionReviewRequired   PullRequestReviewDecision = "REVIEW_REQUIRED"
)

The PullRequestReviewDecision values.

type PullRequestReviewEvent added in v0.1.3

type PullRequestReviewEvent string

PullRequestReviewEvent is the GraphQL enum of review events: the action that a submitted review carries.

const (
	PullRequestReviewEventApprove        PullRequestReviewEvent = "APPROVE"
	PullRequestReviewEventComment        PullRequestReviewEvent = "COMMENT"
	PullRequestReviewEventRequestChanges PullRequestReviewEvent = "REQUEST_CHANGES"
	PullRequestReviewEventDismiss        PullRequestReviewEvent = "DISMISS"
)

The PullRequestReviewEvent values.

type PullRequestReviewThread

type PullRequestReviewThread struct {
	ID         string // the PullRequestReviewThread node ID
	IsResolved bool   // whether the conversation is resolved
	IsOutdated bool   // whether the anchored line left the diff
	Path       string // the file the thread anchors to
	Line       *int32 // the anchored line, null when the thread is file-level
	Comments   *PullRequestReviewCommentConnection
}

PullRequestReviewThread is the GraphQL view of a review conversation: a root comment and its replies. ID is the thread node id; the comments field is paged by its own resolver, so the presenter fills the connection the resolver returns.

func (PullRequestReviewThread) GetID added in v0.1.3

func (t PullRequestReviewThread) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (PullRequestReviewThread) IsNode added in v0.1.3

func (PullRequestReviewThread) IsNode()

IsNode marks PullRequestReviewThread as implementing the Node interface.

type PullRequestReviewThreadConnection

type PullRequestReviewThreadConnection struct {
	Nodes      []*PullRequestReviewThread
	TotalCount int32
}

PullRequestReviewThreadConnection is the connection over a pull request's review threads.

type PullRequestState

type PullRequestState string

PullRequestState is the GraphQL PullRequestState enum: a pull request is OPEN, CLOSED, or MERGED. A merged pull request reports MERGED even though its issue is closed, the distinction GitHub draws.

const (
	PullRequestStateOpen   PullRequestState = "OPEN"
	PullRequestStateClosed PullRequestState = "CLOSED"
	PullRequestStateMerged PullRequestState = "MERGED"
)

The PullRequestState values.

type PullRequestTemplate added in v0.1.3

type PullRequestTemplate struct {
	Filename *string
	Body     *string
}

PullRequestTemplate is a pull-request template configured in a repository.

type RateLimit added in v0.1.3

type RateLimit struct {
	Limit     int32
	Cost      int32
	Remaining int32
	ResetAt   DateTime
	NodeCount int32
	Used      int32
}

RateLimit is the rate-limit state for the viewer.

type ReactingUserConnection added in v0.1.3

type ReactingUserConnection struct {
	TotalCount int32
}

ReactingUserConnection is the slim connection gh reads for reaction counts.

type Reaction added in v0.1.3

type Reaction struct {
	ID        string          // the Reaction node ID
	Content   ReactionContent // the emoji
	User      *User           // who reacted; null for a ghost user
	CreatedAt DateTime        // when the reaction was added
}

Reaction is a single emoji reaction a user left on a reactable subject, the node addReaction and removeReaction return.

func (Reaction) GetID added in v0.1.3

func (r Reaction) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Reaction) IsNode added in v0.1.3

func (Reaction) IsNode()

IsNode marks Reaction as implementing the Node interface.

type ReactionContent added in v0.1.3

type ReactionContent string

ReactionContent is the GraphQL ReactionContent enum.

const (
	ReactionContentThumbsUp   ReactionContent = "THUMBS_UP"
	ReactionContentThumbsDown ReactionContent = "THUMBS_DOWN"
	ReactionContentLaugh      ReactionContent = "LAUGH"
	ReactionContentHooray     ReactionContent = "HOORAY"
	ReactionContentConfused   ReactionContent = "CONFUSED"
	ReactionContentHeart      ReactionContent = "HEART"
	ReactionContentRocket     ReactionContent = "ROCKET"
	ReactionContentEyes       ReactionContent = "EYES"
)

The ReactionContent values.

type ReactionGroup added in v0.1.3

type ReactionGroup struct {
	Content ReactionContent
	Users   ReactingUserConnection
}

ReactionGroup summarizes how many users reacted with a given emoji on an issue.

type Ref

type Ref struct {
	ID     string    // the Ref node ID
	Name   string    // the short ref name, such as main
	Prefix string    // the full prefix, e.g. "refs/heads/"
	Target GitObject // the object the ref names
}

Ref is a git reference. The id field carries the opaque node ID clients pass to deleteRef. Prefix is the full prefix (refs/heads/ or refs/tags/).

func (Ref) GetID added in v0.1.3

func (r Ref) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Ref) IsNode added in v0.1.3

func (Ref) IsNode()

IsNode marks Ref as implementing the Node interface.

type Release added in v0.1.3

type Release struct {
	ID           string
	Name         *string
	TagName      string
	URL          URI
	CreatedAt    DateTime
	PublishedAt  *DateTime
	IsLatest     bool
	IsPrerelease bool
	IsDraft      bool
}

Release is a published release of a repository.

func (Release) GetID added in v0.1.3

func (r Release) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Release) IsNode added in v0.1.3

func (Release) IsNode()

IsNode marks Release as implementing the Node interface.

type Repository

type Repository struct {
	ID                       string                     // the Repository node ID
	Name                     string                     // the short repository name
	NameWithOwner            string                     // owner login + "/" + name
	Description              *string                    // null when unset
	IsPrivate                bool                       // visibility
	IsFork                   bool                       // whether this is a fork
	IsArchived               bool                       // whether this is archived
	IsEmpty                  bool                       // true when the repository has no commits
	IsInOrganization         bool                       // true when owner is an org
	ForkCount                int32                      // number of forks
	StargazerCount           int32                      // number of stars
	DiskUsage                *int32                     // disk usage in KB, null when unavailable
	HomepageURL              *URI                       // null when unset
	CreatedAt                DateTime                   // creation instant
	UpdatedAt                DateTime                   // last metadata update
	PushedAt                 *DateTime                  // last push, null for a repository with no commits
	URL                      URI                        // the repository's HTML URL
	SSHURL                   GitSSHRemote               // the SSH clone URL, GitHub's GitSSHRemote scalar
	DatabaseID               *int32                     // the integer database id REST calls id
	Visibility               RepositoryVisibility       // PUBLIC, PRIVATE, or INTERNAL
	ViewerPermission         *RepositoryPermission      // viewer's permission, null for anonymous
	ViewerCanAdminister      bool                       // whether the viewer can administer the repository
	ViewerDefaultMergeMethod PullRequestMergeMethod     // the viewer's default merge method
	HasIssuesEnabled         bool                       // whether the repository accepts issues
	HasWikiEnabled           bool                       // whether the repository has a wiki
	HasProjectsEnabled       bool                       // whether the repository has projects
	HasDiscussionsEnabled    bool                       // whether the repository has discussions (always false)
	IsTemplate               bool                       // whether the repository is a template
	IsMirror                 bool                       // whether the repository is a mirror (always false)
	MirrorURL                *URI                       // the mirror source URL (always null)
	DeleteBranchOnMerge      bool                       // whether head branches are deleted on merge
	AutoMergeAllowed         bool                       // whether auto-merge can be enabled (always true)
	MergeCommitAllowed       bool                       // whether merge commits are allowed (always true)
	SquashMergeAllowed       bool                       // whether squash merges are allowed (always true)
	RebaseMergeAllowed       bool                       // whether rebase merges are allowed (always true)
	DefaultBranchRef         *Ref                       // the head branch, null for an empty repository
	RepositoryTopics         *RepositoryTopicConnection // the repository's topics
	Watchers                 *UserConnection            // the users watching the repository
	Languages                *LanguageConnection        // detected languages (always empty)
	IssueTemplates           []*IssueTemplate           // configured issue templates (always null)
	PullRequestTemplates     []*PullRequestTemplate     // configured PR templates (always null)

	// RepoOwner, RepoName, and ForkParentID carry the repository coordinates for
	// resolvers that look up ref, milestone, release, or parent data on demand.
	// They are not part of the GraphQL schema.
	RepoOwner    string
	RepoName     string
	ForkParentPK *int64 // internal pk of the parent repo, nil for a non-fork
}

Repository is the GraphQL Repository object. It carries the fields the gh CLI selects for repo view, repo list, and the pull request create flow. Nullable GraphQL fields use Go pointers so gqlgen renders null rather than a zero value.

func (Repository) GetID added in v0.1.3

func (r Repository) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Repository) IsNode added in v0.1.3

func (Repository) IsNode()

IsNode marks Repository as implementing the Node interface.

func (Repository) IsSearchResultItem added in v0.1.3

func (Repository) IsSearchResultItem()

IsSearchResultItem marks Repository as a member of the SearchResultItem union.

type RepositoryConnection added in v0.1.3

type RepositoryConnection struct {
	Nodes      []*Repository
	PageInfo   *PageInfo
	TotalCount int32
}

RepositoryConnection is the Relay connection over a set of repositories.

type RepositoryOwner added in v0.1.3

type RepositoryOwner interface {
	IsRepositoryOwner()
}

RepositoryOwner is the GraphQL RepositoryOwner interface: the owner of a repository, and the return type of the repositoryOwner(login) root query. User is the only implementer today.

type RepositoryPermission added in v0.1.3

type RepositoryPermission string

RepositoryPermission is the viewer's effective permission level on a repository.

const (
	RepositoryPermissionAdmin    RepositoryPermission = "ADMIN"
	RepositoryPermissionMaintain RepositoryPermission = "MAINTAIN"
	RepositoryPermissionWrite    RepositoryPermission = "WRITE"
	RepositoryPermissionTriage   RepositoryPermission = "TRIAGE"
	RepositoryPermissionRead     RepositoryPermission = "READ"
)

The RepositoryPermission values.

type RepositoryTopic added in v0.1.3

type RepositoryTopic struct {
	ID    string
	Topic *Topic
	URL   URI
}

RepositoryTopic pairs a topic with the repository it is applied to.

func (RepositoryTopic) GetID added in v0.1.3

func (r RepositoryTopic) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (RepositoryTopic) IsNode added in v0.1.3

func (RepositoryTopic) IsNode()

IsNode marks RepositoryTopic as implementing the Node interface.

type RepositoryTopicConnection added in v0.1.3

type RepositoryTopicConnection struct {
	Nodes      []*RepositoryTopic
	PageInfo   *PageInfo
	TotalCount int32
}

RepositoryTopicConnection is the connection over a repository's topics.

type RepositoryVisibility added in v0.1.3

type RepositoryVisibility string

RepositoryVisibility is a repository's visibility level.

const (
	RepositoryVisibilityPublic   RepositoryVisibility = "PUBLIC"
	RepositoryVisibilityPrivate  RepositoryVisibility = "PRIVATE"
	RepositoryVisibilityInternal RepositoryVisibility = "INTERNAL"
)

The RepositoryVisibility values.

type StatusCheckRollup

type StatusCheckRollup struct {
	State     StatusState
	RepoOwner string // not a schema field; used by contexts resolver
	RepoName  string // not a schema field; used by contexts resolver
	SHA       string // not a schema field; used by contexts resolver
}

StatusCheckRollup is the GraphQL view of a head commit's combined status and check state. The contexts field is resolved lazily; RepoOwner, RepoName, and SHA carry the coordinates the contexts resolver uses to fetch check details.

type StatusContext added in v0.1.3

type StatusContext struct {
	Context     string      // the status context name
	State       StatusState // the status state
	TargetURL   *URI
	Description *string
	CreatedAt   DateTime // when the status was first reported
}

StatusContext is the GraphQL StatusContext type as a status check rollup context.

func (StatusContext) IsStatusCheckRollupContext added in v0.1.3

func (StatusContext) IsStatusCheckRollupContext()

IsStatusCheckRollupContext marks StatusContext as a union member.

type StatusState

type StatusState string

StatusState is the GraphQL enum for a rollup or status state, worst first.

const (
	StatusStateError    StatusState = "ERROR"
	StatusStateExpected StatusState = "EXPECTED"
	StatusStateFailure  StatusState = "FAILURE"
	StatusStatePending  StatusState = "PENDING"
	StatusStateSuccess  StatusState = "SUCCESS"
)

The StatusState values.

type Tag added in v0.1.3

type Tag struct {
	ID     string // the Tag node ID
	Oid    GitObjectID
	Name   string    // the tag name
	Target GitObject // the object the tag points at
}

Tag is an annotated git tag object.

func (Tag) AbbreviatedOid added in v0.1.3

func (t Tag) AbbreviatedOid() string

AbbreviatedOid is the short form of the tag object's SHA.

func (Tag) GetID added in v0.1.3

func (t Tag) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Tag) IsGitObject added in v0.1.3

func (Tag) IsGitObject()

IsGitObject marks Tag as implementing the GitObject interface.

func (Tag) IsNode added in v0.1.3

func (Tag) IsNode()

IsNode marks Tag as implementing the Node interface.

type Topic added in v0.1.3

type Topic struct {
	ID   string
	Name string
}

Topic is a repository topic.

func (Topic) GetID added in v0.1.3

func (t Topic) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Topic) IsNode added in v0.1.3

func (Topic) IsNode()

IsNode marks Topic as implementing the Node interface.

type Tree added in v0.1.3

type Tree struct {
	ID  string // the Tree node ID
	Oid GitObjectID
}

Tree is a git tree object.

func (Tree) AbbreviatedOid added in v0.1.3

func (t Tree) AbbreviatedOid() string

AbbreviatedOid is the short form of the tree's SHA.

func (Tree) GetID added in v0.1.3

func (t Tree) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (Tree) IsGitObject added in v0.1.3

func (Tree) IsGitObject()

IsGitObject marks Tree as implementing the GitObject interface.

func (Tree) IsNode added in v0.1.3

func (Tree) IsNode()

IsNode marks Tree as implementing the Node interface.

type URI

type URI string

URI is GitHub's URI scalar: an absolute URL rendered as a JSON string.

func (URI) MarshalGQL

func (u URI) MarshalGQL(w io.Writer)

MarshalGQL writes the URI as a quoted string.

func (*URI) UnmarshalGQL

func (u *URI) UnmarshalGQL(v any) error

UnmarshalGQL reads a URI from a JSON string.

type User added in v0.1.3

type User struct {
	ID              string      // the User node ID
	Login           string      // the user's login
	Name            *string     // display name, null when unset
	Email           *string     // public email, null when unset
	Bio             *string     // profile bio, null when unset
	Company         *string     // profile company, null when unset
	Location        *string     // profile location, null when unset
	WebsiteURL      *URI        // profile blog/website URL, null when unset
	TwitterUsername *string     // Twitter/X handle without the @, null when unset
	DatabaseID      *int32      // the integer database id (REST id)
	URL             URI         // the user's profile HTML URL
	AvatarURL       URI         // the user's avatar URL; the size arg appends ?s=
	ResourcePath    URI         // the path part of the profile URL, e.g. /octocat
	Status          *UserStatus // the user's set status; always null today
	CreatedAt       DateTime    // account creation instant
	UpdatedAt       DateTime    // last-update instant
}

User is the GraphQL User object, carrying the fields gh api and gh auth status select. It grows toward the full GitHub User type milestone by milestone.

func (User) GetID added in v0.1.3

func (u User) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (User) IsActor added in v0.1.3

func (User) IsActor()

IsActor marks User as implementing the Actor interface.

func (User) IsNode added in v0.1.3

func (User) IsNode()

IsNode marks User as implementing the Node interface.

func (User) IsRepositoryOwner added in v0.1.3

func (User) IsRepositoryOwner()

IsRepositoryOwner marks User as implementing the RepositoryOwner interface.

func (User) IsRequestedReviewer added in v0.1.3

func (User) IsRequestedReviewer()

IsRequestedReviewer marks User as a member of the RequestedReviewer union.

func (User) IsSearchResultItem added in v0.1.3

func (User) IsSearchResultItem()

IsSearchResultItem marks User as a member of the SearchResultItem union.

type UserConnection added in v0.1.3

type UserConnection struct {
	Nodes      []*User
	PageInfo   *PageInfo
	TotalCount int32
}

UserConnection is the Relay connection over a set of users (assignees, etc.).

type UserEdge added in v0.1.3

type UserEdge struct {
	Cursor string
	Node   *User
}

UserEdge is one edge of a user connection, pairing a user with its cursor.

type UserStatus added in v0.1.3

type UserStatus struct {
	ID                           string
	Emoji                        *string
	Message                      *string
	IndicatesLimitedAvailability bool
	CreatedAt                    DateTime
	UpdatedAt                    DateTime
	ExpiresAt                    *DateTime
}

UserStatus is a user's set status. Githome does not model statuses, so the type is never instantiated; it exists for schema validation.

func (UserStatus) GetID added in v0.1.3

func (s UserStatus) GetID() string

GetID satisfies the Node interface getter gqlgen requires.

func (UserStatus) IsNode added in v0.1.3

func (UserStatus) IsNode()

IsNode marks UserStatus as implementing the Node interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL