Documentation
¶
Overview ¶
Package github is a fake of the GitHub REST API subset Steadmesh uses: personal access tokens, a GitHub App (RS256 JWTs, scoped installation tokens, revocation), repositories, pull requests and issue comments. Installation tokens are enforced: each works only for its repositories and permissions, until it expires or is revoked.
Test endpoints:
GET /_test/state tokens, pull requests, comments and recorded requests
POST /_test/app {"app_id","installation_id","public_key"} configures the App
POST /_test/tokens {"valid":[...]} replaces the accepted PATs
POST /_test/reset clears everything but the configuration
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct {
ID int `json:"id"`
Repo string `json:"repo"`
Number int `json:"number"`
Body string `json:"body"`
}
Comment is an issue comment.
type Pull ¶
type Pull struct {
Repo string `json:"repo"`
Number int `json:"number"`
Title string `json:"title"`
Head string `json:"head"`
Base string `json:"base"`
Body string `json:"body"`
State string `json:"state"`
Author string `json:"author"`
}
Pull is a pull request.
type Request ¶
type Request struct {
Method string `json:"method"`
Path string `json:"path"`
Auth string `json:"auth"` // pat:<token>, app, inst:<token>, or none
Status int `json:"status"`
}
Request is a recorded API request.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the fake.
func (*Server) SetInstallationOwner ¶ added in v0.7.0
SetInstallationOwner overrides the installation account's login. By default it is the owner of the first configured repository.
type State ¶
type State struct {
Tokens []Token `json:"tokens"`
Pulls []Pull `json:"pulls"`
Comments []Comment `json:"comments"`
Requests []Request `json:"requests"`
}
State is the full fake state.
type Token ¶
type Token struct {
Token string `json:"token"`
Repos []string `json:"repos,omitempty"` // names; empty: every installation repository
Permissions map[string]string `json:"permissions,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
Revoked bool `json:"revoked"`
}
Token is an issued installation token.