remote

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthError

type AuthError struct {
	Err         string
	Description string
	URI         string
}

AuthError represents remote authentication error.

func (*AuthError) Error

func (ae *AuthError) Error() string

Error implements error interface.

type ByName

type ByName []*FileMeta

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type FileMeta

type FileMeta struct {
	Name string
	Data []byte
}

FileMeta represents a file in version control

type Refresher

type Refresher interface {
	Refresh(context.Context, *model.User) (bool, error)
}

Refresher 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.

type Remote

type Remote interface {
	// Login authenticates the session and returns the
	// remote user details.
	Login(ctx context.Context, w http.ResponseWriter, r *http.Request) (*model.User, error)

	// Auth authenticates the session and returns the remote user
	// login for the given token and secret
	Auth(ctx context.Context, token, secret string) (string, error)

	// Teams fetches a list of team memberships from the remote system.
	Teams(ctx context.Context, u *model.User) ([]*model.Team, error)

	// Repo fetches the named repository from the remote system.
	Repo(ctx context.Context, u *model.User, owner, name string) (*model.Repo, error)

	// Repos fetches a list of repos from the remote system.
	Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)

	// Perm fetches the named repository permissions from
	// the remote system for the specified user.
	Perm(ctx context.Context, u *model.User, r *model.Repo) (*model.Perm, error)

	// File fetches a file from the remote repository and returns in string
	// format.
	File(ctx context.Context, u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error)

	// Dir fetches a folder from the remote repository
	Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Build, f string) ([]*FileMeta, error)

	// Status sends the commit status to the remote system.
	// An example would be the GitHub pull request status.
	Status(ctx context.Context, u *model.User, r *model.Repo, b *model.Build, p *model.Proc) error

	// Netrc returns a .netrc file that can be used to clone
	// private repositories from a remote system.
	Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)

	// Activate activates a repository by creating the post-commit hook.
	Activate(ctx context.Context, 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.
	Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error

	// Branches returns the names of all branches for the named repository.
	Branches(ctx context.Context, u *model.User, r *model.Repo) ([]string, error)

	// Hook parses the post-commit hook from the Request body and returns the
	// required data in a standard format.
	Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Build, error)
}

Jump to

Keyboard shortcuts

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