gogs

package
v0.2.2-0...-f19841c Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGogsClient

func NewGogsClient(url, token string, skipVerify bool) *gogs.Client

NewClient initializes and returns a API client.

Types

type Gogs

type Gogs struct {
	URL         string
	Open        bool
	PrivateMode bool
	SkipVerify  bool
}

func Load

func Load(env envconfig.Env) *Gogs

func (*Gogs) Activate

func (g *Gogs) Activate(u *model.User, r *model.Repo, k *model.Key, link string) error

Activate activates a repository by creating the post-commit hook and adding the SSH deploy key, if applicable.

func (*Gogs) Auth

func (g *Gogs) Auth(token, secret string) (string, error)

Auth authenticates the session and returns the remote user login for the given token and secret

func (*Gogs) Deactivate

func (g *Gogs) Deactivate(u *model.User, r *model.Repo, link string) error

Deactivate removes a repository by removing all the post-commit hooks which are equal to link and removing the SSH deploy key.

func (*Gogs) Hook

func (g *Gogs) Hook(r *http.Request) (*model.Repo, *model.Build, error)

Hook parses the post-commit hook from the Request body and returns the required data in a standard format.

func (*Gogs) Login

func (g *Gogs) Login(res http.ResponseWriter, req *http.Request) (*model.User, bool, error)

Login authenticates the session and returns the remote user details.

func (*Gogs) Netrc

func (g *Gogs) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)

Netrc returns a .netrc file that can be used to clone private repositories from a remote system.

func (*Gogs) Perm

func (g *Gogs) Perm(u *model.User, owner, name string) (*model.Perm, error)

Perm fetches the named repository permissions from the remote system for the specified user.

func (*Gogs) Repo

func (g *Gogs) Repo(u *model.User, owner, name string) (*model.Repo, error)

Repo fetches the named repository from the remote system.

func (*Gogs) Repos

func (g *Gogs) Repos(u *model.User) ([]*model.RepoLite, error)

Repos fetches a list of repos from the remote system.

func (*Gogs) Script

func (g *Gogs) Script(u *model.User, r *model.Repo, b *model.Build) ([]byte, []byte, error)

Script fetches the build script (.drone.yml) from the remote repository and returns in string format.

func (*Gogs) Status

func (g *Gogs) Status(u *model.User, r *model.Repo, b *model.Build, link string) error

Status sends the commit status to the remote system. An example would be the GitHub pull request status.

func (*Gogs) String

func (g *Gogs) String() string

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

Jump to

Keyboard shortcuts

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