{"modulePath":"github.com/Coding/drone","version":"v0.4.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package remote\n\n## Functions\n\n```go\nfunc Activate(c context.Context, u *model.User, r *model.Repo, k *model.Key, link string) error\n```\nActivate activates a repository by creating the post-commit hook and adding the SSH deploy key, if applicable.\n\n```go\nfunc Auth(c context.Context, token, secret string) (string, error)\n```\nAuth authenticates the session and returns the remote user login for the given token and secret\n\n```go\nfunc Deactivate(c context.Context, u *model.User, r *model.Repo, link string) error\n```\nDeactivate removes a repository by removing all the post-commit hooks which are equal to link and removing the SSH deploy key.\n\n```go\nfunc File(c context.Context, u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error)\n```\nFile fetches a file from the remote repository and returns in string format.\n\n```go\nfunc Hook(c context.Context, r *http.Request) (*model.Repo, *model.Build, error)\n```\nHook parses the post-commit hook from the Request body and returns the required data in a standard format.\n\n```go\nfunc Login(c context.Context, w http.ResponseWriter, r *http.Request) (*model.User, bool, error)\n```\nLogin authenticates the session and returns the remote user details.\n\n```go\nfunc Netrc(c context.Context, u *model.User, r *model.Repo) (*model.Netrc, error)\n```\nNetrc returns a .netrc file that can be used to clone private repositories from a remote system.\n\n```go\nfunc Perm(c context.Context, u *model.User, owner, repo string) (*model.Perm, error)\n```\nPerm fetches the named repository permissions from the remote system for the specified user.\n\n```go\nfunc Refresh(c context.Context, u *model.User) (bool, error)\n```\nRefresh 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.\n\n```go\nfunc Repo(c context.Context, u *model.User, owner, repo string) (*model.Repo, error)\n```\nRepo fetches the named repository from the remote system.\n\n```go\nfunc Repos(c context.Context, u *model.User) ([]*model.RepoLite, error)\n```\nRepos fetches a list of repos from the remote system.\n\n```go\nfunc Status(c context.Context, u *model.User, r *model.Repo, b *model.Build, link string) error\n```\nStatus sends the commit status to the remote system. An example would be the GitHub pull request status.\n\n```go\nfunc ToContext(c Setter, r Remote)\n```\nToContext adds the Remote to this context if it supports the Setter interface.\n\n## Types\n\n```go\ntype Refresher interface {\n\t// Refresh refreshes an oauth token and expiration for the given\n\t// user. It returns true if the token was refreshed, false if the\n\t// token was not refreshed, and error if it failed to refersh.\n\tRefresh(*model.User) (bool, error)\n}\n```\n\n```go\ntype Remote interface {\n\t// Login authenticates the session and returns the\n\t// remote user details.\n\tLogin(w http.ResponseWriter, r *http.Request) (*model.User, bool, error)\n\n\t// Auth authenticates the session and returns the remote user\n\t// login for the given token and secret\n\tAuth(token, secret string) (string, error)\n\n\t// Repo fetches the named repository from the remote system.\n\tRepo(u *model.User, owner, repo string) (*model.Repo, error)\n\n\t// Repos fetches a list of repos from the remote system.\n\tRepos(u *model.User) ([]*model.RepoLite, error)\n\n\t// Perm fetches the named repository permissions from\n\t// the remote system for the specified user.\n\tPerm(u *model.User, owner, repo string) (*model.Perm, error)\n\n\t// File fetches a file from the remote repository and returns in string\n\t// format.\n\tFile(u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error)\n\n\t// Status sends the commit status to the remote system.\n\t// An example would be the GitHub pull request status.\n\tStatus(u *model.User, r *model.Repo, b *model.Build, link string) error\n\n\t// Netrc returns a .netrc file that can be used to clone\n\t// private repositories from a remote system.\n\tNetrc(u *model.User, r *model.Repo) (*model.Netrc, error)\n\n\t// Activate activates a repository by creating the post-commit hook and\n\t// adding the SSH deploy key, if applicable.\n\tActivate(u *model.User, r *model.Repo, k *model.Key, link string) error\n\n\t// Deactivate removes a repository by removing all the post-commit hooks\n\t// which are equal to link and removing the SSH deploy key.\n\tDeactivate(u *model.User, r *model.Repo, link string) error\n\n\t// Hook parses the post-commit hook from the Request body\n\t// and returns the required data in a standard format.\n\tHook(r *http.Request) (*model.Repo, *model.Build, error)\n}\n```\n\n```go\nfunc FromContext(c context.Context) Remote\n```\nFromContext returns the Remote associated with this context.\n\n```go\ntype Setter interface {\n\tSet(string, interface{})\n}\n```\nSetter defines a context that enables setting values.\n\n","path":"github.com/Coding/drone/remote","name":"remote","synopsis":"","isRedistributable":true}
