restmodel

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: 3 Imported by: 0

Documentation

Overview

Package restmodel holds the exact JSON wire structs Githome serves on the REST API. Field names, types, ordering of presence, and nullability all match GitHub; the json tags are the contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

type Blob struct {
	SHA      string `json:"sha"`
	NodeID   string `json:"node_id"`
	Size     int64  `json:"size"`
	URL      string `json:"url"`
	Content  string `json:"content"`
	Encoding string `json:"encoding"`
}

Blob is the body of GET /git/blobs/{sha}. Content is base64 wrapped at 60 columns; encoding is always "base64".

type Branch

type Branch struct {
	Name          string           `json:"name"`
	Commit        RepoCommit       `json:"commit"`
	Links         BranchLinks      `json:"_links"`
	Protected     bool             `json:"protected"`
	Protection    BranchProtection `json:"protection"`
	ProtectionURL string           `json:"protection_url"`
}

Branch is the body of GET /branches/{branch}: the named branch with its full head commit, navigation links, and protection state. Githome does not support branch protection yet, so an unprotected branch reports protection disabled.

type BranchLinks struct {
	HTML string `json:"html"`
	Self string `json:"self"`
}

BranchLinks is the _links block on a single branch.

type BranchProtection

type BranchProtection struct {
	Enabled              bool                       `json:"enabled"`
	RequiredStatusChecks BranchRequiredStatusChecks `json:"required_status_checks"`
}

BranchProtection is the protection summary on a single branch.

type BranchRequiredStatusChecks

type BranchRequiredStatusChecks struct {
	EnforcementLevel string   `json:"enforcement_level"`
	Contexts         []string `json:"contexts"`
	Checks           []string `json:"checks"`
}

BranchRequiredStatusChecks is the required-status-checks summary. With protection off the enforcement level is "off" and the lists are empty.

type BranchShort

type BranchShort struct {
	Name      string      `json:"name"`
	Commit    ShortCommit `json:"commit"`
	Protected bool        `json:"protected"`
}

BranchShort is one element of the GET /branches listing.

type CheckRun

type CheckRun struct {
	ID           int64            `json:"id"`
	NodeID       string           `json:"node_id"`
	HeadSHA      string           `json:"head_sha"`
	ExternalID   string           `json:"external_id"`
	URL          string           `json:"url"`
	HTMLURL      string           `json:"html_url"`
	DetailsURL   string           `json:"details_url"`
	Status       string           `json:"status"`
	Conclusion   *string          `json:"conclusion"`
	StartedAt    *Time            `json:"started_at"`
	CompletedAt  *Time            `json:"completed_at"`
	Output       CheckRunOutput   `json:"output"`
	Name         string           `json:"name"`
	CheckSuite   CheckSuiteRef    `json:"check_suite"`
	App          *any             `json:"app"`
	PullRequests []any            `json:"pull_requests"`
	Actions      []CheckRunAction `json:"actions,omitempty"`
}

CheckRun is the body of a single check run and an element of the list. Status is queued, in_progress, or completed; Conclusion is set once completed.

type CheckRunAction added in v0.1.3

type CheckRunAction struct {
	Label       string `json:"label"`
	Description string `json:"description"`
	Identifier  string `json:"identifier"`
}

CheckRunAction is one requested action button on a check run, echoed back as the reporter wrote it.

type CheckRunAnnotation added in v0.1.3

type CheckRunAnnotation struct {
	Path            string  `json:"path"`
	StartLine       int64   `json:"start_line"`
	EndLine         int64   `json:"end_line"`
	StartColumn     *int64  `json:"start_column"`
	EndColumn       *int64  `json:"end_column"`
	AnnotationLevel string  `json:"annotation_level"`
	Title           *string `json:"title"`
	Message         string  `json:"message"`
	RawDetails      *string `json:"raw_details"`
	BlobHRef        string  `json:"blob_href"`
}

CheckRunAnnotation is one element of GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations.

type CheckRunList

type CheckRunList struct {
	TotalCount int        `json:"total_count"`
	CheckRuns  []CheckRun `json:"check_runs"`
}

CheckRunList is the body of GET /repos/{owner}/{repo}/commits/{ref}/check-runs.

type CheckRunOutput

type CheckRunOutput struct {
	Title            *string `json:"title"`
	Summary          *string `json:"summary"`
	Text             *string `json:"text"`
	AnnotationsCount int     `json:"annotations_count"`
	AnnotationsURL   string  `json:"annotations_url"`
}

CheckRunOutput is the output block of a check run.

type CheckSuite

type CheckSuite struct {
	ID                   int64   `json:"id"`
	NodeID               string  `json:"node_id"`
	HeadSHA              string  `json:"head_sha"`
	Status               string  `json:"status"`
	Conclusion           *string `json:"conclusion"`
	URL                  string  `json:"url"`
	Before               *string `json:"before"`
	After                *string `json:"after"`
	App                  *any    `json:"app"`
	CreatedAt            Time    `json:"created_at"`
	UpdatedAt            Time    `json:"updated_at"`
	LatestCheckRunsCount int     `json:"latest_check_runs_count"`
}

CheckSuite is the per-app container the check runs against a head sha roll up into. Status is queued, in_progress, or completed; Conclusion is its verdict.

type CheckSuiteList

type CheckSuiteList struct {
	TotalCount  int          `json:"total_count"`
	CheckSuites []CheckSuite `json:"check_suites"`
}

CheckSuiteList is the body of GET /repos/{owner}/{repo}/commits/{ref}/check-suites.

type CheckSuiteRef

type CheckSuiteRef struct {
	ID int64 `json:"id"`
}

CheckSuiteRef is the trimmed suite a check run names: its id only.

type CodeSearchItem

type CodeSearchItem struct {
	Name        string      `json:"name"`
	Path        string      `json:"path"`
	SHA         string      `json:"sha"`
	URL         string      `json:"url"`
	GitURL      string      `json:"git_url"`
	HTMLURL     string      `json:"html_url"`
	Repository  Repository  `json:"repository"`
	Score       float64     `json:"score"`
	TextMatches []TextMatch `json:"text_matches,omitempty"`
}

CodeSearchItem is one matching file: its name and path within the head tree, the blob object id, the API and HTML URLs that address it, the repository it lives in, and the score.

type CodeownerError added in v0.1.3

type CodeownerError struct {
	Line       int    `json:"line"`
	Column     int    `json:"column"`
	Kind       string `json:"kind"`
	Source     string `json:"source"`
	Suggestion string `json:"suggestion"`
	Message    string `json:"message"`
	Path       string `json:"path"`
}

CodeownerError is one validation problem in a CODEOWNERS file.

type CodeownersErrors added in v0.1.3

type CodeownersErrors struct {
	Errors []CodeownerError `json:"errors"`
}

CodeownersErrors is the response of GET /repos/{owner}/{repo}/codeowners/errors.

type CombinedStatus

type CombinedStatus struct {
	State      string      `json:"state"`
	Statuses   []Status    `json:"statuses"`
	SHA        string      `json:"sha"`
	TotalCount int         `json:"total_count"`
	Repository MinimalRepo `json:"repository"`
	CommitURL  string      `json:"commit_url"`
	URL        string      `json:"url"`
}

CombinedStatus is the body of GET /repos/{owner}/{repo}/commits/{ref}/status: the folded state across the latest status per context, with the contributing statuses and a minimal repository.

type CommitParent

type CommitParent struct {
	SHA     string `json:"sha"`
	URL     string `json:"url"`
	HTMLURL string `json:"html_url"`
}

CommitParent is one parent pointer on a RepoCommit.

type CommunityFileLink struct {
	URL     string `json:"url"`
	HTMLURL string `json:"html_url"`
}

CommunityFileLink is one community-health file in the profile: the contents API url and the blob html_url GitHub points at. Githome reports the file's location only; it does not classify a license, so the license entry carries the same link shape rather than a fabricated SPDX object.

type CommunityFiles added in v0.1.3

type CommunityFiles struct {
	CodeOfConduct       *CommunityFileLink `json:"code_of_conduct"`
	CodeOfConductFile   *CommunityFileLink `json:"code_of_conduct_file"`
	Contributing        *CommunityFileLink `json:"contributing"`
	IssueTemplate       *CommunityFileLink `json:"issue_template"`
	PullRequestTemplate *CommunityFileLink `json:"pull_request_template"`
	License             *CommunityFileLink `json:"license"`
	Readme              *CommunityFileLink `json:"readme"`
}

CommunityFiles is the files block of the community profile. Each member is null when the repository has no such file at its default branch.

type CommunityProfile added in v0.1.3

type CommunityProfile struct {
	HealthPercentage      int            `json:"health_percentage"`
	Description           *string        `json:"description"`
	Documentation         *string        `json:"documentation"`
	Files                 CommunityFiles `json:"files"`
	UpdatedAt             *string        `json:"updated_at"`
	ContentReportsEnabled bool           `json:"content_reports_enabled"`
}

CommunityProfile is the response of GET /repos/{owner}/{repo}/community/profile: the health percentage over the recommended files, the description, and the files block. documentation and updated_at are null and content_reports_enabled is false, matching a self-hosted forge without those subsystems.

type Content

type Content struct {
	Type        string       `json:"type"`
	Encoding    string       `json:"encoding,omitempty"`
	Size        int64        `json:"size"`
	Name        string       `json:"name"`
	Path        string       `json:"path"`
	Content     string       `json:"content,omitempty"`
	SHA         string       `json:"sha"`
	URL         string       `json:"url"`
	GitURL      *string      `json:"git_url"`
	HTMLURL     *string      `json:"html_url"`
	DownloadURL *string      `json:"download_url"`
	Links       ContentLinks `json:"_links"`
}

Content is one entry in a contents response. A file carries encoding and content; a directory listing is an array of entries with those two omitted. download_url is the raw URL for a file and null for a directory.

type ContentLinks struct {
	Git  *string `json:"git"`
	Self string  `json:"self"`
	HTML *string `json:"html"`
}

ContentLinks is the _links block on a content entry. GitHub orders the keys git, self, html.

type CreateEventPayload added in v0.1.3

type CreateEventPayload struct {
	Ref          string `json:"ref"`
	RefType      string `json:"ref_type"`
	MasterBranch string `json:"master_branch"`
	Description  string `json:"description"`
}

CreateEventPayload is the Events-API payload for a CreateEvent.

type DeleteEventPayload added in v0.1.3

type DeleteEventPayload struct {
	Ref     string `json:"ref"`
	RefType string `json:"ref_type"`
}

DeleteEventPayload is the Events-API payload for a DeleteEvent.

type Event

type Event struct {
	ID        string          `json:"id"`
	Type      string          `json:"type"`
	Actor     EventActor      `json:"actor"`
	Repo      EventRepo       `json:"repo"`
	Payload   json.RawMessage `json:"payload"`
	Public    bool            `json:"public"`
	CreatedAt Time            `json:"created_at"`
}

Event is one entry in the activity feed the Events API serves. id is a string of the database id, type is the GitHub event type (PushEvent, IssuesEvent, and so on), and payload is the type-specific object the fan-out worker rendered and stored on the event.

type EventActor

type EventActor struct {
	ID           int64  `json:"id"`
	Login        string `json:"login"`
	DisplayLogin string `json:"display_login"`
	GravatarID   string `json:"gravatar_id"`
	URL          string `json:"url"`
	AvatarURL    string `json:"avatar_url"`
}

EventActor is the compact actor object an Event embeds. display_login is the login as typed; Githome has no separate display form, so it equals login.

type EventRepo

type EventRepo struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

EventRepo is the compact repository reference an Event embeds: id, the owner/name pair, and the API URL.

type GeneratedNotes added in v0.1.3

type GeneratedNotes struct {
	Name string `json:"name"`
	Body string `json:"body"`
}

GeneratedNotes is the body of POST /releases/generate-notes: a suggested name and markdown body for a release.

type Gist added in v0.1.3

type Gist struct {
	ID          string              `json:"id"`
	NodeID      string              `json:"node_id"`
	Description string              `json:"description"`
	Public      bool                `json:"public"`
	Owner       SimpleUser          `json:"owner"`
	User        *SimpleUser         `json:"user"`
	Files       map[string]GistFile `json:"files"`
	Forks       []any               `json:"forks"`
	History     []any               `json:"history"`
	Truncated   bool                `json:"truncated"`
	Comments    int                 `json:"comments"`
	GitPullURL  string              `json:"git_pull_url"`
	GitPushURL  string              `json:"git_push_url"`
	HTMLURL     string              `json:"html_url"`
	CommitsURL  string              `json:"commits_url"`
	ForksURL    string              `json:"forks_url"`
	CommentsURL string              `json:"comments_url"`
	CreatedAt   Time                `json:"created_at"`
	UpdatedAt   Time                `json:"updated_at"`
}

Gist is the body returned by every gist endpoint.

type GistComment added in v0.1.3

type GistComment struct {
	ID        int64      `json:"id"`
	NodeID    string     `json:"node_id"`
	Body      string     `json:"body"`
	User      SimpleUser `json:"user"`
	CreatedAt Time       `json:"created_at"`
	UpdatedAt Time       `json:"updated_at"`
}

GistComment is the body returned by gist comment endpoints.

type GistFile added in v0.1.3

type GistFile struct {
	Filename  string  `json:"filename"`
	Type      string  `json:"type"`
	Language  *string `json:"language"`
	RawURL    string  `json:"raw_url"`
	Size      int     `json:"size"`
	Truncated bool    `json:"truncated"`
	Content   *string `json:"content,omitempty"`
}

GistFile is the wire shape for one file inside a gist.

type GitCommit

type GitCommit struct {
	SHA          string       `json:"sha"`
	NodeID       string       `json:"node_id"`
	URL          string       `json:"url"`
	HTMLURL      string       `json:"html_url"`
	Author       GitIdentity  `json:"author"`
	Committer    GitIdentity  `json:"committer"`
	Message      string       `json:"message"`
	Tree         GitRef       `json:"tree"`
	Parents      []GitRef     `json:"parents"`
	Verification Verification `json:"verification"`
}

GitCommit is the body of GET /git/commits/{sha}, the git-database view of a commit.

type GitIdentity

type GitIdentity struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Date  Time   `json:"date"`
}

GitIdentity is the name/email/date triple a git commit or tag records. The date is RFC3339 in UTC with a trailing Z.

type GitRef

type GitRef struct {
	SHA string `json:"sha"`
	URL string `json:"url"`
}

GitRef is the {sha, url} pointer git-data objects use for a tree or parent.

type GitRefObject

type GitRefObject struct {
	Ref    string       `json:"ref"`
	NodeID string       `json:"node_id"`
	URL    string       `json:"url"`
	Object GitRefTarget `json:"object"`
}

GitRefObject is the body of GET /git/ref/{ref} and one element of the GET /git/refs listing.

type GitRefTarget

type GitRefTarget struct {
	SHA  string `json:"sha"`
	Type string `json:"type"`
	URL  string `json:"url"`
}

GitRefTarget is the object a ref points at. Type is "commit" for a branch or lightweight tag and "tag" for an annotated tag.

type Hook

type Hook struct {
	Type          string       `json:"type"`
	ID            int64        `json:"id"`
	Name          string       `json:"name"`
	Active        bool         `json:"active"`
	Events        []string     `json:"events"`
	Config        HookConfig   `json:"config"`
	UpdatedAt     Time         `json:"updated_at"`
	CreatedAt     Time         `json:"created_at"`
	URL           string       `json:"url"`
	TestURL       string       `json:"test_url,omitempty"`
	PingURL       string       `json:"ping_url"`
	DeliveriesURL string       `json:"deliveries_url"`
	LastResponse  HookResponse `json:"last_response"`
}

Hook is the REST representation of a webhook; the /repos/{owner}/{repo}/hooks and /orgs/{org}/hooks surfaces both return it. The signing secret is never emitted; config.secret is rendered as a fixed mask when one is set and omitted when it is not, matching github.com. test_url only exists on repository hooks, so it drops out of org hook bodies.

type HookConfig

type HookConfig struct {
	ContentType string  `json:"content_type"`
	InsecureSSL string  `json:"insecure_ssl"`
	URL         string  `json:"url"`
	Secret      *string `json:"secret,omitempty"`
}

HookConfig is the transport configuration of a webhook. insecure_ssl is a string ("0" or "1") the way GitHub serializes it, not a bool.

type HookDelivery

type HookDelivery struct {
	ID             int64                 `json:"id"`
	GUID           string                `json:"guid"`
	DeliveredAt    Time                  `json:"delivered_at"`
	Redelivery     bool                  `json:"redelivery"`
	Duration       float64               `json:"duration"`
	Status         string                `json:"status"`
	StatusCode     int                   `json:"status_code"`
	Event          string                `json:"event"`
	Action         *string               `json:"action"`
	InstallationID *int64                `json:"installation_id"`
	RepositoryID   *int64                `json:"repository_id"`
	URL            string                `json:"url,omitempty"`
	Request        *HookDeliveryRequest  `json:"request,omitempty"`
	Response       *HookDeliveryResponse `json:"response,omitempty"`
}

HookDelivery is one recorded delivery attempt. The list shape omits the request and response bodies; the single-delivery GET includes them, so those two fields and url are emitted only when set.

type HookDeliveryRequest

type HookDeliveryRequest struct {
	Headers map[string]string `json:"headers"`
	Payload json.RawMessage   `json:"payload"`
}

HookDeliveryRequest is the request half of a delivery's full record: the headers Githome sent and the JSON body it posted.

type HookDeliveryResponse

type HookDeliveryResponse struct {
	Headers map[string]string `json:"headers"`
	Payload string            `json:"payload"`
}

HookDeliveryResponse is the response half: the headers the receiver returned and its body as a string.

type HookResponse

type HookResponse struct {
	Code    *int    `json:"code"`
	Status  string  `json:"status"`
	Message *string `json:"message"`
}

HookResponse is the summary of a webhook's most recent delivery. Before any delivery the status is "unused" and the code and message are null.

type Issue

type Issue struct {
	ID                int64          `json:"id"`
	NodeID            string         `json:"node_id"`
	URL               string         `json:"url"`
	RepositoryURL     string         `json:"repository_url"`
	LabelsURL         string         `json:"labels_url"`
	CommentsURL       string         `json:"comments_url"`
	EventsURL         string         `json:"events_url"`
	HTMLURL           string         `json:"html_url"`
	Number            int64          `json:"number"`
	State             string         `json:"state"`
	StateReason       *string        `json:"state_reason"`
	Title             string         `json:"title"`
	Body              *string        `json:"body"`
	User              SimpleUser     `json:"user"`
	Labels            []Label        `json:"labels"`
	Assignee          *SimpleUser    `json:"assignee"`
	Assignees         []SimpleUser   `json:"assignees"`
	Milestone         *Milestone     `json:"milestone"`
	Locked            bool           `json:"locked"`
	ActiveLockReason  *string        `json:"active_lock_reason"`
	Comments          int            `json:"comments"`
	PullRequest       *IssuePRLink   `json:"pull_request,omitempty"`
	ClosedAt          *Time          `json:"closed_at"`
	CreatedAt         Time           `json:"created_at"`
	UpdatedAt         Time           `json:"updated_at"`
	ClosedBy          *SimpleUser    `json:"closed_by"`
	AuthorAssociation string         `json:"author_association"`
	Reactions         ReactionRollup `json:"reactions"`
	TimelineURL       string         `json:"timeline_url"`
	PerformedViaApp   *string        `json:"performed_via_github_app"`
}

Issue is the object GET /repos/{owner}/{repo}/issues/{number} returns and the element type of the issues list. A pull request is an issue with a pull_request member; M4 renders issues only, so PullRequest stays nil.

type IssueComment

type IssueComment struct {
	ID                int64          `json:"id"`
	NodeID            string         `json:"node_id"`
	URL               string         `json:"url"`
	HTMLURL           string         `json:"html_url"`
	Body              string         `json:"body"`
	User              SimpleUser     `json:"user"`
	CreatedAt         Time           `json:"created_at"`
	UpdatedAt         Time           `json:"updated_at"`
	IssueURL          string         `json:"issue_url"`
	AuthorAssociation string         `json:"author_association"`
	Reactions         ReactionRollup `json:"reactions"`
	PerformedViaApp   *string        `json:"performed_via_github_app"`
}

IssueComment is the object the comment endpoints return.

type IssueCommentEventPayload added in v0.1.3

type IssueCommentEventPayload struct {
	Action  string       `json:"action"`
	Issue   Issue        `json:"issue"`
	Comment IssueComment `json:"comment"`
}

IssueCommentEventPayload is the Events-API payload object for an IssueCommentEvent.

type IssueEvent added in v0.1.3

type IssueEvent struct {
	ID        int64       `json:"id"`
	NodeID    string      `json:"node_id"`
	URL       string      `json:"url"`
	Actor     *SimpleUser `json:"actor"`
	Event     string      `json:"event"`
	CommitID  *string     `json:"commit_id"`
	CommitURL *string     `json:"commit_url"`
	CreatedAt Time        `json:"created_at"`
}

IssueEvent is one entry of an issue's event log, as the events and timeline endpoints return it. commit_id/commit_url are present-but-null for the action events githome records (none of them reference a commit).

type IssuePRLink struct {
	URL      string `json:"url"`
	HTMLURL  string `json:"html_url"`
	DiffURL  string `json:"diff_url"`
	PatchURL string `json:"patch_url"`
	MergedAt *Time  `json:"merged_at"`
}

IssuePRLink is the pull_request member present on issues that are pull requests. It is reserved for the pull request milestone.

type IssueSearchItem

type IssueSearchItem struct {
	Issue
	Score       float64     `json:"score"`
	TextMatches []TextMatch `json:"text_matches,omitempty"`
}

IssueSearchItem is one issue or pull request hit: the full issue object plus its score.

type IssuesEventPayload

type IssuesEventPayload struct {
	Action string `json:"action"`
	Issue  Issue  `json:"issue"`
}

IssuesEventPayload is the Events-API payload object for an IssuesEvent.

type Label

type Label struct {
	ID          int64   `json:"id"`
	NodeID      string  `json:"node_id"`
	URL         string  `json:"url"`
	Name        string  `json:"name"`
	Color       string  `json:"color"`
	Default     bool    `json:"default"`
	Description *string `json:"description"`
}

Label is a repository label as embedded on issues and returned by the labels endpoints. Color is six hex digits with no leading hash.

type LicenseSimple

type LicenseSimple struct {
	Key     string  `json:"key"`
	Name    string  `json:"name"`
	URL     *string `json:"url"`
	SPDXID  *string `json:"spdx_id"`
	NodeID  string  `json:"node_id"`
	HTMLURL string  `json:"html_url"`
}

LicenseSimple is the embedded license object. Githome does not detect licenses yet, so Repository.License is always null; the type exists so the value is matchable once detection lands.

type Link struct {
	HRef string `json:"href"`
}

Link is one href member of a _links block.

type Meta

type Meta struct {
	VerifiablePasswordAuthentication bool              `json:"verifiable_password_authentication"`
	InstalledVersion                 string            `json:"installed_version"`
	SSHKeyFingerprints               map[string]string `json:"ssh_key_fingerprints"`
	SSHKeys                          []string          `json:"ssh_keys"`
	Hooks                            []string          `json:"hooks"`
	Web                              []string          `json:"web"`
	API                              []string          `json:"api"`
	Git                              []string          `json:"git"`
	Packages                         []string          `json:"packages"`
	Pages                            []string          `json:"pages"`
	Importer                         []string          `json:"importer"`
	Actions                          []string          `json:"actions"`
	Dependabot                       []string          `json:"dependabot"`
}

Meta is the body of GET /meta. The address arrays describe the network ranges a deployment serves from; a self-hosted instance reports its own (often empty) ranges rather than github.com's. Arrays are always present, never null. InstalledVersion is the Githome version string; gh uses it for version-gated features and Renovate reads it for capability detection.

type Milestone

type Milestone struct {
	URL          string      `json:"url"`
	HTMLURL      string      `json:"html_url"`
	LabelsURL    string      `json:"labels_url"`
	ID           int64       `json:"id"`
	NodeID       string      `json:"node_id"`
	Number       int64       `json:"number"`
	State        string      `json:"state"`
	Title        string      `json:"title"`
	Description  *string     `json:"description"`
	Creator      *SimpleUser `json:"creator"`
	OpenIssues   int         `json:"open_issues"`
	ClosedIssues int         `json:"closed_issues"`
	CreatedAt    Time        `json:"created_at"`
	UpdatedAt    Time        `json:"updated_at"`
	ClosedAt     *Time       `json:"closed_at"`
	DueOn        *Time       `json:"due_on"`
}

Milestone is the milestone object embedded on issues and returned by the milestones endpoints. open_issues and closed_issues are computed counts.

type MinimalRepo

type MinimalRepo struct {
	ID       int64      `json:"id"`
	NodeID   string     `json:"node_id"`
	Name     string     `json:"name"`
	FullName string     `json:"full_name"`
	Owner    SimpleUser `json:"owner"`
	Private  bool       `json:"private"`
	HTMLURL  string     `json:"html_url"`
	URL      string     `json:"url"`
}

MinimalRepo is the trimmed repository the combined status embeds: enough to identify it without the full repository object.

type NotificationSubject added in v0.1.3

type NotificationSubject struct {
	Title            string `json:"title"`
	URL              string `json:"url"`
	LatestCommentURL string `json:"latest_comment_url"`
	Type             string `json:"type"`
}

NotificationSubject names what the thread is about: the issue or pull request title plus the API URLs a client follows to show it.

type NotificationSubscription added in v0.1.3

type NotificationSubscription struct {
	Subscribed bool    `json:"subscribed"`
	Ignored    bool    `json:"ignored"`
	Reason     *string `json:"reason"`
	CreatedAt  Time    `json:"created_at"`
	URL        string  `json:"url"`
	ThreadURL  string  `json:"thread_url"`
}

NotificationSubscription is the body of the thread subscription endpoints. Reason is always null for a thread subscription, matching GitHub.

type NotificationThread added in v0.1.3

type NotificationThread struct {
	ID              string              `json:"id"`
	Repository      MinimalRepo         `json:"repository"`
	Subject         NotificationSubject `json:"subject"`
	Reason          string              `json:"reason"`
	Unread          bool                `json:"unread"`
	UpdatedAt       Time                `json:"updated_at"`
	LastReadAt      *Time               `json:"last_read_at"`
	URL             string              `json:"url"`
	SubscriptionURL string              `json:"subscription_url"`
}

NotificationThread is one element of GET /notifications and the body of GET /notifications/threads/{id}. GitHub renders the thread id as a string, unlike every other numeric id on the surface.

type OrgMembership added in v0.1.3

type OrgMembership struct {
	URL             string             `json:"url"`
	State           string             `json:"state"`
	Role            string             `json:"role"`
	OrganizationURL string             `json:"organization_url"`
	Organization    OrganizationSimple `json:"organization"`
	User            SimpleUser         `json:"user"`
}

OrgMembership is the membership shape GitHub returns from GET /user/memberships/orgs and GET /user/memberships/orgs/{org}.

type Organization added in v0.1.3

type Organization struct {
	Login            string  `json:"login"`
	ID               int64   `json:"id"`
	NodeID           string  `json:"node_id"`
	URL              string  `json:"url"`
	ReposURL         string  `json:"repos_url"`
	EventsURL        string  `json:"events_url"`
	HooksURL         string  `json:"hooks_url"`
	IssuesURL        string  `json:"issues_url"`
	MembersURL       string  `json:"members_url"`
	PublicMembersURL string  `json:"public_members_url"`
	AvatarURL        string  `json:"avatar_url"`
	Description      *string `json:"description"`
	Name             *string `json:"name"`
	Company          *string `json:"company"`
	Blog             string  `json:"blog"`
	Location         *string `json:"location"`
	Email            *string `json:"email"`
	TwitterUsername  *string `json:"twitter_username"`
	IsVerified       bool    `json:"is_verified"`
	HasOrgProjects   bool    `json:"has_organization_projects"`
	HasRepoProjects  bool    `json:"has_repository_projects"`
	PublicRepos      int     `json:"public_repos"`
	PublicGists      int     `json:"public_gists"`
	Followers        int     `json:"followers"`
	Following        int     `json:"following"`
	HTMLURL          string  `json:"html_url"`
	CreatedAt        Time    `json:"created_at"`
	UpdatedAt        Time    `json:"updated_at"`
	ArchivedAt       *Time   `json:"archived_at"`
	Type             string  `json:"type"`
}

Organization is the org profile returned by GET /orgs/{org}. In Githome organizations share the users table, so the profile fields mirror User; the URLs and type are the org-flavored ones GitHub serves.

type OrganizationSimple added in v0.1.3

type OrganizationSimple struct {
	Login            string  `json:"login"`
	ID               int64   `json:"id"`
	NodeID           string  `json:"node_id"`
	URL              string  `json:"url"`
	ReposURL         string  `json:"repos_url"`
	EventsURL        string  `json:"events_url"`
	HooksURL         string  `json:"hooks_url"`
	IssuesURL        string  `json:"issues_url"`
	MembersURL       string  `json:"members_url"`
	PublicMembersURL string  `json:"public_members_url"`
	AvatarURL        string  `json:"avatar_url"`
	Description      *string `json:"description"`
}

OrganizationSimple is the trimmed org shape GitHub returns inside list payloads such as GET /user/orgs and GET /orgs/{org}/memberships.

type PullRequest

type PullRequest struct {
	URL                 string           `json:"url"`
	ID                  int64            `json:"id"`
	NodeID              string           `json:"node_id"`
	HTMLURL             string           `json:"html_url"`
	DiffURL             string           `json:"diff_url"`
	PatchURL            string           `json:"patch_url"`
	IssueURL            string           `json:"issue_url"`
	CommitsURL          string           `json:"commits_url"`
	ReviewCommentsURL   string           `json:"review_comments_url"`
	ReviewCommentURL    string           `json:"review_comment_url"`
	CommentsURL         string           `json:"comments_url"`
	StatusesURL         string           `json:"statuses_url"`
	Number              int64            `json:"number"`
	State               string           `json:"state"`
	Locked              bool             `json:"locked"`
	Title               string           `json:"title"`
	User                SimpleUser       `json:"user"`
	Body                *string          `json:"body"`
	Labels              []Label          `json:"labels"`
	Milestone           *Milestone       `json:"milestone"`
	ActiveLockReason    *string          `json:"active_lock_reason"`
	CreatedAt           Time             `json:"created_at"`
	UpdatedAt           Time             `json:"updated_at"`
	ClosedAt            *Time            `json:"closed_at"`
	MergedAt            *Time            `json:"merged_at"`
	MergeCommitSHA      *string          `json:"merge_commit_sha"`
	Assignee            *SimpleUser      `json:"assignee"`
	Assignees           []SimpleUser     `json:"assignees"`
	RequestedReviewers  []SimpleUser     `json:"requested_reviewers"`
	RequestedTeams      []any            `json:"requested_teams"`
	Head                PullRequestRef   `json:"head"`
	Base                PullRequestRef   `json:"base"`
	Links               PullRequestLinks `json:"_links"`
	AuthorAssociation   string           `json:"author_association"`
	AutoMerge           *any             `json:"auto_merge"`
	Draft               bool             `json:"draft"`
	MaintainerCanModify bool             `json:"maintainer_can_modify"`

	// The merge view fields. The list endpoint leaves them out; the single-pull
	// view fills them, with the mergeable triplet null until the worker runs.
	Merged         *bool       `json:"merged,omitempty"`
	Mergeable      *bool       `json:"mergeable,omitempty"`
	Rebaseable     *bool       `json:"rebaseable,omitempty"`
	MergeableState string      `json:"mergeable_state,omitempty"`
	MergedBy       *SimpleUser `json:"merged_by,omitempty"`
	Comments       *int        `json:"comments,omitempty"`
	ReviewComments *int        `json:"review_comments,omitempty"`
	Commits        *int        `json:"commits,omitempty"`
	Additions      *int        `json:"additions,omitempty"`
	Deletions      *int        `json:"deletions,omitempty"`
	ChangedFiles   *int        `json:"changed_files,omitempty"`
}

PullRequest is the object GET /repos/{owner}/{repo}/pulls/{number} returns and the element type of the pulls list. A pull request shares its id space, number, title, body, and state with the issue that backs it; the merge fields below are null until the mergeability worker computes them, the null-then-value contract a poll resolves. The list endpoint omits the diff stats and the mergeable triplet, which only the single-pull view fills.

type PullRequestEventPayload

type PullRequestEventPayload struct {
	Action      string      `json:"action"`
	Number      int64       `json:"number"`
	PullRequest PullRequest `json:"pull_request"`
}

PullRequestEventPayload is the Events-API payload object for a PullRequestEvent.

type PullRequestFile

type PullRequestFile struct {
	SHA              string  `json:"sha"`
	Filename         string  `json:"filename"`
	Status           string  `json:"status"`
	Additions        int     `json:"additions"`
	Deletions        int     `json:"deletions"`
	Changes          int     `json:"changes"`
	BlobURL          string  `json:"blob_url"`
	RawURL           string  `json:"raw_url"`
	ContentsURL      string  `json:"contents_url"`
	Patch            string  `json:"patch,omitempty"`
	PreviousFilename *string `json:"previous_filename,omitempty"`
}

PullRequestFile is one element of GET /pulls/{number}/files: a file's diff over the pull request range. Changes is additions plus deletions. PreviousFilename is present only for a rename or copy. Patch is the unified hunk text, omitted for a binary file.

type PullRequestLinks struct {
	Self           Link `json:"self"`
	HTML           Link `json:"html"`
	Issue          Link `json:"issue"`
	Comments       Link `json:"comments"`
	ReviewComments Link `json:"review_comments"`
	ReviewComment  Link `json:"review_comment"`
	Commits        Link `json:"commits"`
	Statuses       Link `json:"statuses"`
}

PullRequestLinks is the _links block of a pull request, the hypermedia pointers to its related collections.

type PullRequestMergeResult

type PullRequestMergeResult struct {
	SHA     string `json:"sha"`
	Merged  bool   `json:"merged"`
	Message string `json:"message"`
}

PullRequestMergeResult is the body of a successful PUT /pulls/{number}/merge: the merge commit sha, the merged flag, and the message.

type PullRequestRef

type PullRequestRef struct {
	Label string      `json:"label"`
	Ref   string      `json:"ref"`
	SHA   string      `json:"sha"`
	User  *SimpleUser `json:"user"`
	Repo  *Repository `json:"repo"`
}

PullRequestRef is one side of a pull request, a base or a head. Label is the "owner:branch" form; Ref is the short branch name; SHA is the recorded tip. Repo is the repository the ref lives in, present for a same-repository pull request and null only for a head whose fork was deleted.

type PullRequestReviewCommentEventPayload added in v0.1.3

type PullRequestReviewCommentEventPayload struct {
	Action      string        `json:"action"`
	Comment     ReviewComment `json:"comment"`
	PullRequest PullRequest   `json:"pull_request"`
}

PullRequestReviewCommentEventPayload is the Events-API payload object for a PullRequestReviewCommentEvent.

type PullRequestReviewEventPayload added in v0.1.3

type PullRequestReviewEventPayload struct {
	Action      string      `json:"action"`
	Review      Review      `json:"review"`
	PullRequest PullRequest `json:"pull_request"`
}

PullRequestReviewEventPayload is the Events-API payload object for a PullRequestReviewEvent.

type PushEventCommit added in v0.1.3

type PushEventCommit struct {
	SHA      string               `json:"sha"`
	Author   PushEventCommitIdent `json:"author"`
	Message  string               `json:"message"`
	Distinct bool                 `json:"distinct"`
	URL      string               `json:"url"`
}

PushEventCommit is the compact commit object a PushEvent feed entry carries.

type PushEventCommitIdent added in v0.1.3

type PushEventCommitIdent struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

PushEventCommitIdent is the email/name pair on a feed commit.

type PushEventPayload

type PushEventPayload struct {
	PushID       int64             `json:"push_id"`
	Size         int               `json:"size"`
	DistinctSize int               `json:"distinct_size"`
	Ref          string            `json:"ref"`
	Head         string            `json:"head"`
	Before       string            `json:"before"`
	Commits      []PushEventCommit `json:"commits"`
}

PushEventPayload is the Events-API payload object for a PushEvent. It mirrors the push delivery's moved tips in the feed's compact form.

type RateLimit

type RateLimit struct {
	Resources RateLimitResources `json:"resources"`
	Rate      RateLimitBucket    `json:"rate"`
}

RateLimit is the body of GET /rate_limit. The rate field mirrors resources.core and is retained for backward compatibility, exactly as GitHub does.

type RateLimitBucket

type RateLimitBucket struct {
	Limit     int    `json:"limit"`
	Remaining int    `json:"remaining"`
	Reset     int64  `json:"reset"`
	Used      int    `json:"used"`
	Resource  string `json:"resource"`
}

RateLimitBucket is one rate-limit window. Reset is a Unix epoch in seconds.

type RateLimitResources

type RateLimitResources struct {
	Core                      RateLimitBucket `json:"core"`
	Search                    RateLimitBucket `json:"search"`
	GraphQL                   RateLimitBucket `json:"graphql"`
	IntegrationManifest       RateLimitBucket `json:"integration_manifest"`
	SourceImport              RateLimitBucket `json:"source_import"`
	CodeScanningUpload        RateLimitBucket `json:"code_scanning_upload"`
	ActionsRunnerRegistration RateLimitBucket `json:"actions_runner_registration"`
	SCIM                      RateLimitBucket `json:"scim"`
	DependencySnapshots       RateLimitBucket `json:"dependency_snapshots"`
	CodeSearch                RateLimitBucket `json:"code_search"`
	AuditLog                  RateLimitBucket `json:"audit_log"`
}

RateLimitResources is the set of named rate-limit buckets. The buckets Githome does not meter are still reported, at their full configured budget, so a client that reads a specific resource (go-github exposes every one) never sees a missing key.

type Reaction

type Reaction struct {
	ID        int64      `json:"id"`
	NodeID    string     `json:"node_id"`
	User      SimpleUser `json:"user"`
	Content   string     `json:"content"`
	CreatedAt Time       `json:"created_at"`
}

Reaction is a single reaction as returned by the reactions list and create endpoints.

type ReactionRollup

type ReactionRollup struct {
	URL        string `json:"url"`
	TotalCount int    `json:"total_count"`
	PlusOne    int    `json:"+1"`
	MinusOne   int    `json:"-1"`
	Laugh      int    `json:"laugh"`
	Hooray     int    `json:"hooray"`
	Confused   int    `json:"confused"`
	Heart      int    `json:"heart"`
	Rocket     int    `json:"rocket"`
	Eyes       int    `json:"eyes"`
}

ReactionRollup is the per-content reaction summary embedded on reactable objects. The +1/-1 keys carry their literal names; the JSON omits none.

type Release added in v0.1.3

type Release struct {
	URL             string         `json:"url"`
	HTMLURL         string         `json:"html_url"`
	AssetsURL       string         `json:"assets_url"`
	UploadURL       string         `json:"upload_url"`
	TarballURL      string         `json:"tarball_url"`
	ZipballURL      string         `json:"zipball_url"`
	ID              int64          `json:"id"`
	NodeID          string         `json:"node_id"`
	TagName         string         `json:"tag_name"`
	TargetCommitish string         `json:"target_commitish"`
	Name            *string        `json:"name"`
	Body            *string        `json:"body"`
	Draft           bool           `json:"draft"`
	Prerelease      bool           `json:"prerelease"`
	CreatedAt       Time           `json:"created_at"`
	PublishedAt     *Time          `json:"published_at"`
	Author          SimpleUser     `json:"author"`
	Assets          []ReleaseAsset `json:"assets"`
}

Release is the body returned by every release endpoint. All pointer fields may be null; all array fields are always present (never null).

type ReleaseAsset added in v0.1.3

type ReleaseAsset struct {
	URL                string     `json:"url"`
	BrowserDownloadURL string     `json:"browser_download_url"`
	ID                 int64      `json:"id"`
	NodeID             string     `json:"node_id"`
	Name               string     `json:"name"`
	Label              *string    `json:"label"`
	State              string     `json:"state"`
	ContentType        string     `json:"content_type"`
	Size               int64      `json:"size"`
	DownloadCount      int64      `json:"download_count"`
	CreatedAt          Time       `json:"created_at"`
	UpdatedAt          Time       `json:"updated_at"`
	Uploader           SimpleUser `json:"uploader"`
}

ReleaseAsset is one downloadable file attached to a release.

type ReleaseEventPayload added in v0.1.3

type ReleaseEventPayload struct {
	Action  string  `json:"action"`
	Release Release `json:"release"`
}

ReleaseEventPayload is the Events-API payload object for a ReleaseEvent.

type RepoCommit

type RepoCommit struct {
	SHA         string         `json:"sha"`
	NodeID      string         `json:"node_id"`
	Commit      RepoCommitBody `json:"commit"`
	URL         string         `json:"url"`
	HTMLURL     string         `json:"html_url"`
	CommentsURL string         `json:"comments_url"`
	Author      *SimpleUser    `json:"author"`
	Committer   *SimpleUser    `json:"committer"`
	Parents     []CommitParent `json:"parents"`
}

RepoCommit is one element of the GET /commits listing and the commit object a single branch embeds. Author and Committer are the matched accounts, or null when the commit's email maps to no Githome user; M2 does not map emails yet, so they are null.

type RepoCommitBody

type RepoCommitBody struct {
	Author       GitIdentity  `json:"author"`
	Committer    GitIdentity  `json:"committer"`
	Message      string       `json:"message"`
	Tree         GitRef       `json:"tree"`
	URL          string       `json:"url"`
	CommentCount int          `json:"comment_count"`
	Verification Verification `json:"verification"`
}

RepoCommitBody is the nested "commit" object on a RepoCommit.

type RepoPermissions

type RepoPermissions struct {
	Admin    bool `json:"admin"`
	Maintain bool `json:"maintain"`
	Push     bool `json:"push"`
	Triage   bool `json:"triage"`
	Pull     bool `json:"pull"`
}

RepoPermissions is the actor's effective access on a repository. GitHub includes it on authenticated requests; it is omitted for anonymous ones.

type RepoSearchItem

type RepoSearchItem struct {
	Repository
	Score       float64     `json:"score"`
	TextMatches []TextMatch `json:"text_matches,omitempty"`
}

RepoSearchItem is one repository hit: the full repository object plus its score.

type RepoSubscription added in v0.1.3

type RepoSubscription struct {
	Subscribed    bool    `json:"subscribed"`
	Ignored       bool    `json:"ignored"`
	Reason        *string `json:"reason"`
	CreatedAt     Time    `json:"created_at"`
	URL           string  `json:"url"`
	RepositoryURL string  `json:"repository_url"`
}

RepoSubscription is the body of the repository subscription endpoints (GET/PUT/DELETE /repos/{owner}/{repo}/subscription). Reason is always null, matching GitHub, which only sets it on notification thread subscriptions.

type Repository

type Repository struct {
	ID       int64      `json:"id"`
	NodeID   string     `json:"node_id"`
	Name     string     `json:"name"`
	FullName string     `json:"full_name"`
	Owner    SimpleUser `json:"owner"`
	Private  bool       `json:"private"`
	HTMLURL  string     `json:"html_url"`
	Desc     *string    `json:"description"`
	Fork     bool       `json:"fork"`
	URL      string     `json:"url"`

	ForksURL         string `json:"forks_url"`
	KeysURL          string `json:"keys_url"`
	CollaboratorsURL string `json:"collaborators_url"`
	TeamsURL         string `json:"teams_url"`
	HooksURL         string `json:"hooks_url"`
	IssueEventsURL   string `json:"issue_events_url"`
	EventsURL        string `json:"events_url"`
	AssigneesURL     string `json:"assignees_url"`
	BranchesURL      string `json:"branches_url"`
	TagsURL          string `json:"tags_url"`
	BlobsURL         string `json:"blobs_url"`
	GitTagsURL       string `json:"git_tags_url"`
	GitRefsURL       string `json:"git_refs_url"`
	TreesURL         string `json:"trees_url"`
	StatusesURL      string `json:"statuses_url"`
	LanguagesURL     string `json:"languages_url"`
	StargazersURL    string `json:"stargazers_url"`
	ContributorsURL  string `json:"contributors_url"`
	SubscribersURL   string `json:"subscribers_url"`
	SubscriptionURL  string `json:"subscription_url"`
	CommitsURL       string `json:"commits_url"`
	GitCommitsURL    string `json:"git_commits_url"`
	CommentsURL      string `json:"comments_url"`
	IssueCommentURL  string `json:"issue_comment_url"`
	ContentsURL      string `json:"contents_url"`
	CompareURL       string `json:"compare_url"`
	MergesURL        string `json:"merges_url"`
	ArchiveURL       string `json:"archive_url"`
	DownloadsURL     string `json:"downloads_url"`
	IssuesURL        string `json:"issues_url"`
	PullsURL         string `json:"pulls_url"`
	MilestonesURL    string `json:"milestones_url"`
	NotificationsURL string `json:"notifications_url"`
	LabelsURL        string `json:"labels_url"`
	ReleasesURL      string `json:"releases_url"`
	DeploymentsURL   string `json:"deployments_url"`

	CreatedAt Time  `json:"created_at"`
	UpdatedAt Time  `json:"updated_at"`
	PushedAt  *Time `json:"pushed_at"`

	GitURL   string `json:"git_url"`
	SSHURL   string `json:"ssh_url"`
	CloneURL string `json:"clone_url"`
	SVNURL   string `json:"svn_url"`

	Homepage        *string `json:"homepage"`
	Size            int     `json:"size"`
	StargazersCount int     `json:"stargazers_count"`
	WatchersCount   int     `json:"watchers_count"`
	Language        *string `json:"language"`

	HasIssues      bool `json:"has_issues"`
	HasProjects    bool `json:"has_projects"`
	HasDownloads   bool `json:"has_downloads"`
	HasWiki        bool `json:"has_wiki"`
	HasPages       bool `json:"has_pages"`
	HasDiscussions bool `json:"has_discussions"`

	ForksCount      int            `json:"forks_count"`
	MirrorURL       *string        `json:"mirror_url"`
	Archived        bool           `json:"archived"`
	Disabled        bool           `json:"disabled"`
	OpenIssuesCount int            `json:"open_issues_count"`
	License         *LicenseSimple `json:"license"`

	AllowForking             bool     `json:"allow_forking"`
	IsTemplate               bool     `json:"is_template"`
	WebCommitSignoffRequired bool     `json:"web_commit_signoff_required"`
	Topics                   []string `json:"topics"`
	Visibility               string   `json:"visibility"`

	Forks         int    `json:"forks"`
	OpenIssues    int    `json:"open_issues"`
	Watchers      int    `json:"watchers"`
	DefaultBranch string `json:"default_branch"`

	Permissions *RepoPermissions `json:"permissions,omitempty"`

	// TempCloneToken is always null: githome has no temporary clone tokens.
	// It is json.RawMessage so the full shape can render an explicit null
	// while list items omit the key.
	TempCloneToken json.RawMessage `json:"temp_clone_token,omitempty"`

	// The merge-policy settings. GitHub returns them only when the caller
	// administers the repository.
	AllowSquashMerge    *bool `json:"allow_squash_merge,omitempty"`
	AllowMergeCommit    *bool `json:"allow_merge_commit,omitempty"`
	AllowRebaseMerge    *bool `json:"allow_rebase_merge,omitempty"`
	AllowAutoMerge      *bool `json:"allow_auto_merge,omitempty"`
	DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"`
	AllowUpdateBranch   *bool `json:"allow_update_branch,omitempty"`

	// Organization mirrors the owner when the owner is an organization.
	Organization *SimpleUser `json:"organization,omitempty"`

	// Parent is the repository this one was forked from; Source is the root
	// of the fork network. Both are list-shaped repository objects.
	Parent *Repository `json:"parent,omitempty"`
	Source *Repository `json:"source,omitempty"`

	NetworkCount     *int `json:"network_count,omitempty"`
	SubscribersCount *int `json:"subscribers_count,omitempty"`
}

Repository is the wire shape GitHub serves for a repository. The field set, order of presence, types, and nullability match github.com's repository object as returned by GET /repos/{owner}/{repo} and embedded in listings. The large url family carries RFC 6570 templates (the {/sha}, {+path}, {?since} suffixes) exactly as GitHub emits them, so clients that expand the templates build the same paths.

The merge options, network and subscriber counts, organization, and fork parent/source live at the end of the struct and render only on the single-repository shape, the way GitHub scopes them. Language is always null until language detection lands; license is always null until license detection lands.

type Review

type Review struct {
	ID                int64       `json:"id"`
	NodeID            string      `json:"node_id"`
	User              SimpleUser  `json:"user"`
	Body              string      `json:"body"`
	State             string      `json:"state"`
	HTMLURL           string      `json:"html_url"`
	PullRequestURL    string      `json:"pull_request_url"`
	Links             ReviewLinks `json:"_links"`
	SubmittedAt       *Time       `json:"submitted_at"`
	CommitID          string      `json:"commit_id"`
	AuthorAssociation string      `json:"author_association"`
}

Review is one element of GET /repos/{owner}/{repo}/pulls/{number}/reviews and the body of a single review. State is APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED, or PENDING (a pending draft is visible only to its author). SubmittedAt is null while a review is still a draft.

type ReviewComment

type ReviewComment struct {
	URL                 string             `json:"url"`
	PullRequestReviewID int64              `json:"pull_request_review_id"`
	ID                  int64              `json:"id"`
	NodeID              string             `json:"node_id"`
	DiffHunk            string             `json:"diff_hunk"`
	Path                string             `json:"path"`
	Position            *int64             `json:"position"`
	OriginalPosition    *int64             `json:"original_position"`
	CommitID            string             `json:"commit_id"`
	OriginalCommitID    string             `json:"original_commit_id"`
	InReplyToID         *int64             `json:"in_reply_to_id,omitempty"`
	User                SimpleUser         `json:"user"`
	Body                string             `json:"body"`
	CreatedAt           Time               `json:"created_at"`
	UpdatedAt           Time               `json:"updated_at"`
	HTMLURL             string             `json:"html_url"`
	PullRequestURL      string             `json:"pull_request_url"`
	AuthorAssociation   string             `json:"author_association"`
	Links               ReviewCommentLinks `json:"_links"`
	StartLine           *int64             `json:"start_line"`
	OriginalStartLine   *int64             `json:"original_start_line"`
	StartSide           *string            `json:"start_side"`
	Line                *int64             `json:"line"`
	OriginalLine        *int64             `json:"original_line"`
	Side                string             `json:"side"`
	SubjectType         string             `json:"subject_type"`
}

ReviewComment is one element of the pull request comments collection and the body of a single review comment. The line/side anchor and the legacy position are both filled. Position and Line are null when the comment is outdated, the anchor no longer present in the diff. InReplyToID is set on a reply.

type ReviewCommentLinks struct {
	Self        Link `json:"self"`
	HTML        Link `json:"html"`
	PullRequest Link `json:"pull_request"`
}

ReviewCommentLinks is the _links block of a review comment.

type ReviewLinks struct {
	HTML        Link `json:"html"`
	PullRequest Link `json:"pull_request"`
}

ReviewLinks is the _links block of a review: its html page and its pull request.

type SearchCode

type SearchCode struct {
	TotalCount        int              `json:"total_count"`
	IncompleteResults bool             `json:"incomplete_results"`
	Items             []CodeSearchItem `json:"items"`
}

SearchCode is the GET /search/code body.

type SearchIssues

type SearchIssues struct {
	TotalCount        int               `json:"total_count"`
	IncompleteResults bool              `json:"incomplete_results"`
	Items             []IssueSearchItem `json:"items"`
}

SearchIssues is the GET /search/issues body.

type SearchRepositories

type SearchRepositories struct {
	TotalCount        int              `json:"total_count"`
	IncompleteResults bool             `json:"incomplete_results"`
	Items             []RepoSearchItem `json:"items"`
}

SearchRepositories is the GET /search/repositories body.

type SearchUsers added in v0.1.3

type SearchUsers struct {
	TotalCount        int              `json:"total_count"`
	IncompleteResults bool             `json:"incomplete_results"`
	Items             []UserSearchItem `json:"items"`
}

SearchUsers is the GET /search/users body.

type ShortCommit

type ShortCommit struct {
	SHA string `json:"sha"`
	URL string `json:"url"`
}

ShortCommit is the {sha, url} commit pointer the branch and tag listings use.

type SimpleUser

type SimpleUser struct {
	Login             string  `json:"login"`
	ID                int64   `json:"id"`
	NodeID            string  `json:"node_id"`
	AvatarURL         string  `json:"avatar_url"`
	GravatarID        *string `json:"gravatar_id"`
	URL               string  `json:"url"`
	HTMLURL           string  `json:"html_url"`
	FollowersURL      string  `json:"followers_url"`
	FollowingURL      string  `json:"following_url"`
	GistsURL          string  `json:"gists_url"`
	StarredURL        string  `json:"starred_url"`
	SubscriptionsURL  string  `json:"subscriptions_url"`
	OrganizationsURL  string  `json:"organizations_url"`
	ReposURL          string  `json:"repos_url"`
	EventsURL         string  `json:"events_url"`
	ReceivedEventsURL string  `json:"received_events_url"`
	Type              string  `json:"type"`
	SiteAdmin         bool    `json:"site_admin"`
	StarredAt         *Time   `json:"starred_at,omitempty"`
	UserViewType      *string `json:"user_view_type,omitempty"`
}

SimpleUser is the embedded actor representation used everywhere an actor is referenced (owner, author, assignee, and so on). Every field is present on github.com; none are omitted except the two that only appear in specific listing contexts. gravatar_id is modeled as *string only so a future null is matchable; the presenter always sets it to a pointer to "".

type Status

type Status struct {
	URL         string      `json:"url"`
	AvatarURL   *string     `json:"avatar_url"`
	ID          int64       `json:"id"`
	NodeID      string      `json:"node_id"`
	State       string      `json:"state"`
	Description *string     `json:"description"`
	TargetURL   *string     `json:"target_url"`
	Context     string      `json:"context"`
	CreatedAt   Time        `json:"created_at"`
	UpdatedAt   Time        `json:"updated_at"`
	Creator     *SimpleUser `json:"creator"`
}

Status is one element of GET /repos/{owner}/{repo}/commits/{ref}/statuses: a single external report against a sha under a context.

type Tag

type Tag struct {
	Name       string      `json:"name"`
	Commit     ShortCommit `json:"commit"`
	ZipballURL string      `json:"zipball_url"`
	TarballURL string      `json:"tarball_url"`
	NodeID     string      `json:"node_id"`
}

Tag is one element of the GET /tags listing.

type TextMatch added in v0.1.3

type TextMatch struct {
	ObjectURL  string             `json:"object_url"`
	ObjectType *string            `json:"object_type"`
	Property   string             `json:"property"`
	Fragment   string             `json:"fragment"`
	Matches    []TextMatchElement `json:"matches"`
}

TextMatch is one text-match metadata entry GitHub attaches to a search hit when the request asks for application/vnd.github.text-match+json. It names the matched property, the fragment of it that contained the match, and the matched substrings with their rune offsets into the fragment.

type TextMatchElement added in v0.1.3

type TextMatchElement struct {
	Text    string `json:"text"`
	Indices []int  `json:"indices"`
}

TextMatchElement is one matched substring inside a fragment: the matched text and its [start, end) rune offsets.

type Time

type Time struct {
	time.Time
}

Time is the timestamp scalar the REST API emits. GitHub renders timestamps as RFC3339 in UTC with a trailing Z and no fractional seconds (for example "2024-01-15T10:00:00Z"). A zero Time marshals to null so optional timestamps round-trip correctly.

func NewTime

func NewTime(t time.Time) Time

NewTime wraps t for wire rendering.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON renders the timestamp in GitHub's exact format, or null when zero.

type Tree

type Tree struct {
	SHA       string      `json:"sha"`
	URL       string      `json:"url"`
	Tree      []TreeEntry `json:"tree"`
	Truncated bool        `json:"truncated"`
}

Tree is the body of GET /git/trees/{sha}. Truncated reports that the recursive walk hit the entry ceiling.

type TreeEntry

type TreeEntry struct {
	Path string  `json:"path"`
	Mode string  `json:"mode"`
	Type string  `json:"type"`
	SHA  string  `json:"sha"`
	Size *int64  `json:"size,omitempty"`
	URL  *string `json:"url,omitempty"`
}

TreeEntry is one node in a tree. Subtree and submodule entries carry no size, and submodule entries no url, so both are omitted when absent.

type User

type User struct {
	SimpleUser
	Name            *string `json:"name"`
	Company         *string `json:"company"`
	Blog            string  `json:"blog"`
	Location        *string `json:"location"`
	Email           *string `json:"email"`
	Hireable        *bool   `json:"hireable"`
	Bio             *string `json:"bio"`
	TwitterUsername *string `json:"twitter_username"`
	PublicRepos     int     `json:"public_repos"`
	PublicGists     int     `json:"public_gists"`
	Followers       int     `json:"followers"`
	Following       int     `json:"following"`
	CreatedAt       Time    `json:"created_at"`
	UpdatedAt       Time    `json:"updated_at"`

	// Authenticated-user-only fields; omitted when rendering another user.
	PrivateGists            *int  `json:"private_gists,omitempty"`
	TotalPrivateRepos       *int  `json:"total_private_repos,omitempty"`
	OwnedPrivateRepos       *int  `json:"owned_private_repos,omitempty"`
	DiskUsage               *int  `json:"disk_usage,omitempty"`
	Collaborators           *int  `json:"collaborators,omitempty"`
	TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"`
}

User is the full profile returned by GET /users/{login} and GET /user. It embeds SimpleUser and adds the profile fields. The authenticated-user view (GET /user) additionally carries the private counters, which are omitted for other users.

type UserSearchItem added in v0.1.3

type UserSearchItem struct {
	SimpleUser
	Score float64 `json:"score"`
}

UserSearchItem is one account hit: the SimpleUser object plus its score.

type Verification

type Verification struct {
	Verified   bool    `json:"verified"`
	Reason     string  `json:"reason"`
	Signature  *string `json:"signature"`
	Payload    *string `json:"payload"`
	VerifiedAt *string `json:"verified_at"`
}

Verification is the commit/tag signature block. Until Githome verifies signatures every object is reported unsigned.

type WebhookCommit added in v0.1.3

type WebhookCommit struct {
	ID        string            `json:"id"`
	TreeID    string            `json:"tree_id"`
	Distinct  bool              `json:"distinct"`
	Message   string            `json:"message"`
	Timestamp Time              `json:"timestamp"`
	URL       string            `json:"url"`
	Author    WebhookCommitUser `json:"author"`
	Committer WebhookCommitUser `json:"committer"`
	Added     []string          `json:"added"`
	Removed   []string          `json:"removed"`
	Modified  []string          `json:"modified"`
}

WebhookCommit is one commit in a push delivery's commits list and its head_commit field: the commit coordinates plus the per-file change lists.

type WebhookCommitUser added in v0.1.3

type WebhookCommitUser struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Username string `json:"username,omitempty"`
}

WebhookCommitUser is the git identity on a webhook commit. username is the matched account login and is omitted when the identity matches no account.

type WebhookCreate added in v0.1.3

type WebhookCreate struct {
	Ref          string     `json:"ref"`
	RefType      string     `json:"ref_type"` // "branch" or "tag"
	MasterBranch string     `json:"master_branch"`
	Description  *string    `json:"description"`
	PusherType   string     `json:"pusher_type"`
	Repository   Repository `json:"repository"`
	Sender       SimpleUser `json:"sender"`
}

WebhookCreate is the body of a create delivery (branch or tag created).

type WebhookDelete added in v0.1.3

type WebhookDelete struct {
	Ref        string     `json:"ref"`
	RefType    string     `json:"ref_type"` // "branch" or "tag"
	PusherType string     `json:"pusher_type"`
	Repository Repository `json:"repository"`
	Sender     SimpleUser `json:"sender"`
}

WebhookDelete is the body of a delete delivery (branch or tag deleted).

type WebhookIssueComment added in v0.1.3

type WebhookIssueComment struct {
	Action     string       `json:"action"`
	Issue      Issue        `json:"issue"`
	Comment    IssueComment `json:"comment"`
	Repository Repository   `json:"repository"`
	Sender     SimpleUser   `json:"sender"`
}

WebhookIssueComment is the body of an issue_comment delivery: the comment alongside the issue it landed on.

type WebhookIssues

type WebhookIssues struct {
	Action     string     `json:"action"`
	Issue      Issue      `json:"issue"`
	Label      *Label     `json:"label,omitempty"`
	Repository Repository `json:"repository"`
	Sender     SimpleUser `json:"sender"`
}

WebhookIssues is the body of an issues delivery. label is set only on labeled and unlabeled actions, naming the label the action moved.

type WebhookPing added in v0.1.3

type WebhookPing struct {
	Zen        string      `json:"zen"`
	HookID     int64       `json:"hook_id"`
	Hook       Hook        `json:"hook"`
	Repository *Repository `json:"repository,omitempty"`
	Sender     SimpleUser  `json:"sender"`
}

WebhookPing is the body of a ping delivery: the zen line, the hook's id, the hook object itself, and the repository and sender like every other delivery. An org hook's ping has no repository, so the field drops out when nil.

type WebhookPullRequest

type WebhookPullRequest struct {
	Action      string      `json:"action"`
	Number      int64       `json:"number"`
	Before      string      `json:"before,omitempty"`
	After       string      `json:"after,omitempty"`
	PullRequest PullRequest `json:"pull_request"`
	Label       *Label      `json:"label,omitempty"`
	Repository  Repository  `json:"repository"`
	Sender      SimpleUser  `json:"sender"`
}

WebhookPullRequest is the body of a pull_request delivery. before and after carry the moved head shas on a synchronize delivery and are omitted on every other action, matching github.com.

type WebhookPullRequestReview added in v0.1.3

type WebhookPullRequestReview struct {
	Action      string      `json:"action"`
	Review      Review      `json:"review"`
	PullRequest PullRequest `json:"pull_request"`
	Repository  Repository  `json:"repository"`
	Sender      SimpleUser  `json:"sender"`
}

WebhookPullRequestReview is the body of a pull_request_review delivery: the review alongside the pull request it was left on.

type WebhookPullRequestReviewComment added in v0.1.3

type WebhookPullRequestReviewComment struct {
	Action      string        `json:"action"`
	Comment     ReviewComment `json:"comment"`
	PullRequest PullRequest   `json:"pull_request"`
	Repository  Repository    `json:"repository"`
	Sender      SimpleUser    `json:"sender"`
}

WebhookPullRequestReviewComment is the body of a pull_request_review_comment delivery: the inline comment alongside its pull request.

type WebhookPush

type WebhookPush struct {
	Ref        string          `json:"ref"`
	Before     string          `json:"before"`
	After      string          `json:"after"`
	Created    bool            `json:"created"`
	Deleted    bool            `json:"deleted"`
	Forced     bool            `json:"forced"`
	BaseRef    *string         `json:"base_ref"`
	Compare    string          `json:"compare"`
	Commits    []WebhookCommit `json:"commits"`
	HeadCommit *WebhookCommit  `json:"head_commit"`
	Repository Repository      `json:"repository"`
	Pusher     WebhookPusher   `json:"pusher"`
	Sender     SimpleUser      `json:"sender"`
}

WebhookPush is the body of a push delivery. commits carries the pushed range walked from the git layer, capped at twenty like GitHub, and head_commit is the new tip; before and after carry the moved shas a receiver keys synchronization off.

type WebhookPusher

type WebhookPusher struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

WebhookPusher is the name/email pair a push delivery names the pusher by, the git identity form rather than the full user object the sender carries.

type WebhookRelease added in v0.1.3

type WebhookRelease struct {
	Action     string     `json:"action"`
	Release    Release    `json:"release"`
	Repository Repository `json:"repository"`
	Sender     SimpleUser `json:"sender"`
}

WebhookRelease is the body of a release delivery: the release object that went live alongside the repository and sender.

Jump to

Keyboard shortcuts

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