restmodel

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 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"`
}

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 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"`
}

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 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 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 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 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"`
	PingURL       string       `json:"ping_url"`
	DeliveriesURL string       `json:"deliveries_url"`
	LastResponse  HookResponse `json:"last_response"`
}

Hook is the REST representation of a repository webhook: GET, POST, and PATCH on /repos/{owner}/{repo}/hooks all 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.

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 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"`
}

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"`
	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.

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 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"`

	// 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 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      []any  `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"`
	CodeScanningUpload  RateLimitBucket `json:"code_scanning_upload"`
	CodeSearch          RateLimitBucket `json:"code_search"`
}

RateLimitResources is the set of named rate-limit buckets.

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 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"`
}

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

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"`
}

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.

Settings Githome does not track yet (merge options, subscriber and network counts) are not part of this shape; they arrive with the repository-settings milestone. 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 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 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 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 WebhookIssues

type WebhookIssues struct {
	Action     string     `json:"action"`
	Issue      Issue      `json:"issue"`
	Repository Repository `json:"repository"`
	Sender     SimpleUser `json:"sender"`
}

WebhookIssues is the body of an issues delivery.

type WebhookPullRequest

type WebhookPullRequest struct {
	Action      string      `json:"action"`
	Number      int64       `json:"number"`
	PullRequest PullRequest `json:"pull_request"`
	Repository  Repository  `json:"repository"`
	Sender      SimpleUser  `json:"sender"`
}

WebhookPullRequest is the body of a pull_request delivery.

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    []any         `json:"commits"`
	HeadCommit *any          `json:"head_commit"`
	Repository Repository    `json:"repository"`
	Pusher     WebhookPusher `json:"pusher"`
	Sender     SimpleUser    `json:"sender"`
}

WebhookPush is the body of a push delivery. Githome does not walk the pushed range, so commits is empty and head_commit is null; before and after carry the moved tips, the fields 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.

Jump to

Keyboard shortcuts

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