coding

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Opts) (remote.Remote, error)

New returns a Remote implementation that integrates with a Coding Platform or Coding Enterprise version control hosting provider.

Types

type Coding

type Coding struct {
	URL        string
	Client     string
	Secret     string
	Scopes     []string
	Machine    string
	Username   string
	Password   string
	SkipVerify bool
}

func (*Coding) Activate

func (c *Coding) Activate(u *model.User, r *model.Repo, link string) error

Activate activates a repository by creating the post-commit hook.

func (*Coding) Auth

func (c *Coding) Auth(token, secret string) (string, error)

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

func (*Coding) Deactivate

func (c *Coding) Deactivate(u *model.User, r *model.Repo, link string) error

Deactivate deactivates a repository by removing all previously created post-commit hooks matching the given link.

func (*Coding) File

func (c *Coding) File(u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error)

File fetches a file from the remote repository and returns in string format.

func (*Coding) FileRef

func (c *Coding) FileRef(u *model.User, r *model.Repo, ref, f string) ([]byte, error)

FileRef fetches a file from the remote repository for the given ref and returns in string format.

func (*Coding) Hook

func (c *Coding) 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 (*Coding) Login

func (c *Coding) Login(res http.ResponseWriter, req *http.Request) (*model.User, error)

Login authenticates the session and returns the remote user details.

func (*Coding) Netrc

func (c *Coding) 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 (*Coding) Perm

func (c *Coding) Perm(u *model.User, owner, repo string) (*model.Perm, error)

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

func (*Coding) Refresh

func (c *Coding) Refresh(u *model.User) (bool, error)

Refresh refreshes an oauth token and expiration for the given user. It returns true if the token was refreshed, false if the token was not refreshed, and error if it failed to refersh.

func (*Coding) Repo

func (c *Coding) Repo(u *model.User, owner, repo string) (*model.Repo, error)

Repo fetches the named repository from the remote system.

func (*Coding) Repos

func (c *Coding) Repos(u *model.User) ([]*model.Repo, error)

Repos fetches a list of repos from the remote system.

func (*Coding) Status

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

Status sends the commit status to the remote system.

func (*Coding) TeamPerm

func (c *Coding) TeamPerm(u *model.User, org string) (*model.Perm, error)

TeamPerm fetches the named organization permissions from the remote system for the specified user.

func (*Coding) Teams

func (c *Coding) Teams(u *model.User) ([]*model.Team, error)

Teams fetches a list of team memberships from the remote system.

type Commit

type Commit struct {
	SHA          string     `json:"sha"`
	ShortMessage string     `json:"short_message"`
	Committer    *Committer `json:"committer"`
}

type Committer

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

type MergeRequest

type MergeRequest struct {
	SourceBranch string  `json:"source_branch"`
	TargetBranch string  `json:"target_branch"`
	CommitSHA    string  `json:"merge_commit_sha"`
	Status       string  `json:"status"`
	Action       string  `json:"action"`
	Number       float64 `json:"number"`
	Title        string  `json:"title"`
	Body         string  `json:"body"`
	WebURL       string  `json:"web_url"`
	User         *User   `json:"user"`
}

type MergeRequestHook

type MergeRequestHook struct {
	Event        string        `json:"event"`
	Repository   *Repository   `json:"repository"`
	MergeRequest *MergeRequest `json:"merge_request"`
}

type Opts

type Opts struct {
	URL        string   // Coding server url.
	Client     string   // Coding oauth client id.
	Secret     string   // Coding oauth client secret.
	Scopes     []string // Coding oauth scopes.
	Machine    string   // Optional machine name.
	Username   string   // Optional machine account username.
	Password   string   // Optional machine account password.
	SkipVerify bool     // Skip ssl verification.
}

Opts defines configuration options.

type PullRequest

type PullRequest MergeRequest

type PullRequestHook

type PullRequestHook struct {
	Event       string       `json:"event"`
	Repository  *Repository  `json:"repository"`
	PullRequest *PullRequest `json:"pull_request"`
}

type PushHook

type PushHook struct {
	Event      string      `json:"event"`
	Repository *Repository `json:"repository"`
	Ref        string      `json:"ref"`
	Before     string      `json:"before"`
	After      string      `json:"after"`
	Commits    []*Commit   `json:"commits"`
	User       *User       `json:"user"`
}

type Repository

type Repository struct {
	Name     string `json:"name"`
	HttpsURL string `json:"https_url"`
	SshURL   string `json:"ssh_url"`
	WebURL   string `json:"web_url"`
	Owner    *User  `json:"owner"`
}

type User

type User struct {
	GlobalKey string `json:"global_key"`
	Avatar    string `json:"avatar"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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