Documentation ¶
Index ¶
- func NewGogsClient(url, token string, skipVerify bool) *gogs.Client
- type Gogs
- func (g *Gogs) Activate(u *model.User, r *model.Repo, k *model.Key, link string) error
- func (g *Gogs) Auth(token, secret string) (string, error)
- func (g *Gogs) Deactivate(u *model.User, r *model.Repo, link string) error
- func (g *Gogs) File(u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error)
- func (g *Gogs) Hook(r *http.Request) (*model.Repo, *model.Build, error)
- func (g *Gogs) Login(res http.ResponseWriter, req *http.Request) (*model.User, bool, error)
- func (g *Gogs) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)
- func (g *Gogs) Perm(u *model.User, owner, name string) (*model.Perm, error)
- func (g *Gogs) Repo(u *model.User, owner, name string) (*model.Repo, error)
- func (g *Gogs) Repos(u *model.User) ([]*model.RepoLite, error)
- func (g *Gogs) Status(u *model.User, r *model.Repo, b *model.Build, link string) error
- func (g *Gogs) String() string
- type PushHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGogsClient ¶ added in v0.4.2
NewClient initializes and returns a API client.
Types ¶
type Gogs ¶
func (*Gogs) Activate ¶
Activate activates a repository by creating the post-commit hook and adding the SSH deploy key, if applicable.
func (*Gogs) Auth ¶
Auth authenticates the session and returns the remote user login for the given token and secret
func (*Gogs) Deactivate ¶
Deactivate removes a repository by removing all the post-commit hooks which are equal to link and removing the SSH deploy key.
func (*Gogs) File ¶ added in v0.4.2
File fetches a file from the remote repository and returns in string format.
func (*Gogs) Hook ¶
Hook parses the post-commit hook from the Request body and returns the required data in a standard format.
func (*Gogs) Netrc ¶
Netrc returns a .netrc file that can be used to clone private repositories from a remote system.
func (*Gogs) Perm ¶
Perm fetches the named repository permissions from the remote system for the specified user.
type PushHook ¶
type PushHook struct { Ref string `json:"ref"` Before string `json:"before"` After string `json:"after"` Compare string `json:"compare_url"` Pusher struct { Name string `json:"name"` Email string `json:"email"` Username string `json:"username"` } `json:"pusher"` Repo struct { ID int64 `json:"id"` Name string `json:"name"` Url string `json:"url"` Private bool `json:"private"` Owner struct { Name string `json:"name"` Email string `json:"email"` Username string `json:"username"` } `json:"owner"` } `json:"repository"` Commits []struct { ID string `json:"id"` Message string `json:"message"` Url string `json:"url"` } `json:"commits"` Sender struct { ID int64 `json:"id"` Login string `json:"login"` Avatar string `json:"avatar_url"` } `json:"sender"` }