{"modulePath":"github.com/generaltso/gogs","version":"v0.7.33","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package models\n\n## Constants\n\n```go\nconst (\n\tDIFF_LINE_PLAIN = iota + 1\n\tDIFF_LINE_ADD\n\tDIFF_LINE_DEL\n\tDIFF_LINE_SECTION\n)\n```\nDiff line types.\n\n```go\nconst (\n\tDIFF_FILE_ADD = iota + 1\n\tDIFF_FILE_CHANGE\n\tDIFF_FILE_DEL\n\tDIFF_FILE_RENAME\n)\n```\n\n```go\nconst (\n\tIS_OPEN = iota + 1\n\tIS_CLOSE\n)\n```\n\n```go\nconst (\n\tFM_ALL = iota\n\tFM_ASSIGN\n\tFM_CREATE\n\tFM_MENTION\n)\n```\nFilter modes.\n\n```go\nconst (\n\tSMTP_PLAIN = \"PLAIN\"\n\tSMTP_LOGIN = \"LOGIN\"\n)\n```\n\n```go\nconst (\n\tKEY_TYPE_USER = iota + 1\n\tKEY_TYPE_DEPLOY\n)\n```\n\n```go\nconst (\n\tHOOK_STATUS_NONE = iota\n\tHOOK_STATUS_SUCCEED\n\tHOOK_STATUS_FAILED\n)\n```\n\n```go\nconst DIFF_HEAD = \"diff --git \"\n```\n\n```go\nconst OWNER_TEAM = \"Owners\"\n```\n\n## Variables\n\n```go\nvar (\n\t// Same as Github. See https://help.github.com/articles/closing-issues-via-commit-messages\n\tIssueCloseKeywords  = []string{\"close\", \"closes\", \"closed\", \"fix\", \"fixes\", \"fixed\", \"resolve\", \"resolves\", \"resolved\"}\n\tIssueReopenKeywords = []string{\"reopen\", \"reopens\", \"reopened\"}\n\n\tIssueCloseKeywordsPat, IssueReopenKeywordsPat *regexp.Regexp\n\tIssueReferenceKeywordsPat                     *regexp.Regexp\n)\n```\n\n```go\nvar (\n\tErrWrongIssueCounter   = errors.New(\"Invalid number of issues for this milestone\")\n\tErrAttachmentNotLinked = errors.New(\"Attachment does not belong to this issue\")\n\tErrMissingIssueNumber  = errors.New(\"No issue number specified\")\n)\n```\n\n```go\nvar (\n\tErrAuthenticationAlreadyExist = errors.New(\"Authentication already exist\")\n\tErrAuthenticationUserUsed     = errors.New(\"Authentication has been used by some users\")\n)\n```\n\n```go\nvar (\n\tHasEngine bool\n\n\tDbCfg struct {\n\t\tType, Host, Name, User, Passwd, Path, SSLMode string\n\t}\n\n\tEnableSQLite3 bool\n\tEnableTidb    bool\n)\n```\n\n```go\nvar (\n\tErrOrgNotExist      = errors.New(\"Organization does not exist\")\n\tErrTeamAlreadyExist = errors.New(\"Team already exist\")\n\tErrTeamNotExist     = errors.New(\"Team does not exist\")\n\tErrTeamNameIllegal  = errors.New(\"Team name contains illegal characters\")\n)\n```\n\n```go\nvar (\n\tErrRepoFileNotExist  = errors.New(\"Repository file does not exist\")\n\tErrRepoFileNotLoaded = errors.New(\"Repository file not loaded\")\n\tErrMirrorNotExist    = errors.New(\"Mirror does not exist\")\n\tErrInvalidReference  = errors.New(\"Invalid reference specified\")\n\tErrNameEmpty         = errors.New(\"Name is empty\")\n)\n```\n\n```go\nvar (\n\tGitignores, Licenses, Readmes []string\n\n\t// Maximum items per page in forks, watchers and stars of a repo\n\tItemsPerPage = 40\n)\n```\n\n```go\nvar (\n\tErrUserNotKeyOwner       = errors.New(\"User does not the owner of public key\")\n\tErrEmailNotExist         = errors.New(\"E-mail does not exist\")\n\tErrEmailNotActivated     = errors.New(\"E-mail address has not been activated\")\n\tErrUserNameIllegal       = errors.New(\"User name contains illegal characters\")\n\tErrLoginSourceNotExist   = errors.New(\"Login source does not exist\")\n\tErrLoginSourceNotActived = errors.New(\"Login source is not actived\")\n\tErrUnsupportedLoginType  = errors.New(\"Login source is unknown\")\n)\n```\n\n```go\nvar (\n\tDescPattern = regexp.MustCompile(`https?://\\S+`)\n)\n```\n\n```go\nvar (\n\tErrNotImplemented = errors.New(\"Not implemented yet\")\n)\n```\n\n```go\nvar HookQueue = NewUniqueQueue(setting.Webhook.QueueLength)\n```\n\n```go\nvar LoginNames = map[LoginType]string{\n\tLDAP:  \"LDAP (via BindDN)\",\n\tDLDAP: \"LDAP (simple auth)\",\n\tSMTP:  \"SMTP\",\n\tPAM:   \"PAM\",\n}\n```\n\n```go\nvar PullRequestQueue = NewUniqueQueue(setting.Repository.PullRequestQueueLength)\n```\n\n```go\nvar SMTPAuths = []string{SMTP_PLAIN, SMTP_LOGIN}\n```\n\n```go\nvar SSHPath string // SSH directory.\n\n```\n\n## Functions\n\n```go\nfunc AddEmailAddress(email *EmailAddress) error\n```\n\n```go\nfunc AddOrgUser(orgId, uid int64) error\n```\nAddOrgUser adds new user to given organization.\n\n```go\nfunc AddTeamMember(orgId, teamId, uid int64) error\n```\nAddTeamMember adds new member to given team of given organization.\n\n```go\nfunc AddTeamRepo(orgID, teamID, repoID int64) error\n```\nAddTeamRepo adds new repository relation to team.\n\n```go\nfunc AddTestPullRequestTask(repoID int64, branch string)\n```\nAddTestPullRequestTask adds new test tasks by given head/base repository and head/base branch, and generate new patch for testing as needed.\n\n```go\nfunc AddUpdateTask(task *UpdateTask) error\n```\n\n```go\nfunc AttachmentLocalPath(uuid string) string\n```\nAttachmentLocalPath returns where attachment is stored in local file system based on given UUID.\n\n```go\nfunc ChangeMilestoneAssign(oldMid int64, issue *Issue) (err error)\n```\nChangeMilestoneAssign changes assignment of milestone for issue.\n\n```go\nfunc ChangeMilestoneIssueStats(issue *Issue) (err error)\n```\nChangeMilestoneIssueStats updates the open/closed issues counter and progress for the milestone associated with the given issue.\n\n```go\nfunc ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error)\n```\nChangeMilestoneStatus changes the milestone open/closed status.\n\n```go\nfunc ChangeOrgUserStatus(orgId, uid int64, public bool) error\n```\nChangeOrgUserStatus changes public or private membership status.\n\n```go\nfunc ChangeRepositoryName(u *User, oldRepoName, newRepoName string) (err error)\n```\nChangeRepositoryName changes all corresponding setting from old repository name to new one.\n\n```go\nfunc ChangeUserName(u *User, newUserName string) (err error)\n```\nChangeUserName changes all corresponding setting from old user name to new one.\n\n```go\nfunc CheckPublicKeyString(content string) (_ string, err error)\n```\nCheckPublicKeyString checks if the given public key string is recognized by SSH.\n\n```go\nfunc CheckRepoStats()\n```\n\n```go\nfunc CommitRepoAction(\n\tuserID, repoUserID int64,\n\tuserName, actEmail string,\n\trepoID int64,\n\trepoUserName, repoName string,\n\trefFullName string,\n\tcommit *PushCommits,\n\toldCommitID string, newCommitID string) error\n```\nCommitRepoAction adds new action for committing repository.\n\n```go\nfunc CountLoginSources() int64\n```\nCountLoginSources returns number of login sources.\n\n```go\nfunc CountNotices() int64\n```\nCountNotices returns number of notices.\n\n```go\nfunc CountOrganizations() int64\n```\nCountOrganizations returns number of organizations.\n\n```go\nfunc CountPublicRepositories() int64\n```\nCountPublicRepositories returns number of public repositories.\n\n```go\nfunc CountRepoClosedMilestones(repoID int64) int64\n```\nCountRepoClosedMilestones returns number of closed milestones in given repository.\n\n```go\nfunc CountRepoMilestones(repoID int64) int64\n```\nCountRepoMilestones returns number of milestones in given repository.\n\n```go\nfunc CountRepositories() int64\n```\nCountRepositories returns number of repositories.\n\n```go\nfunc CountUsers() int64\n```\nCountUsers returns number of users.\n\n```go\nfunc CreateHookTask(t *HookTask) error\n```\nCreateHookTask creates a new hook task, it handles conversion from Payload to PayloadContent.\n\n```go\nfunc CreateNotice(tp NoticeType, desc string) error\n```\nCreateNotice creates new system notice.\n\n```go\nfunc CreateOrganization(org, owner *User) (err error)\n```\nCreateOrganization creates record of a new organization.\n\n```go\nfunc CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commitSHA string) error\n```\nCreateRefComment creates a commit reference comment to issue.\n\n```go\nfunc CreateRelease(gitRepo *git.Repository, rel *Release) error\n```\nCreateRelease creates a new release of repository.\n\n```go\nfunc CreateRepositoryNotice(desc string) error\n```\nCreateRepositoryNotice creates new system notice with type NOTICE\\_REPOSITORY.\n\n```go\nfunc CreateSource(source *LoginSource) error\n```\n\n```go\nfunc CreateUser(u *User) (err error)\n```\nCreateUser creates record of a new user.\n\n```go\nfunc CreateWebhook(w *Webhook) error\n```\nCreateWebhook creates a new web hook.\n\n```go\nfunc DeleteAccessTokenByID(id int64) error\n```\nDeleteAccessTokenByID deletes access token by given ID.\n\n```go\nfunc DeleteAttachment(a *Attachment, remove bool) error\n```\nDeleteAttachment deletes the given attachment and optionally the associated file.\n\n```go\nfunc DeleteAttachments(attachments []*Attachment, remove bool) (int, error)\n```\nDeleteAttachments deletes the given attachments and optionally the associated files.\n\n```go\nfunc DeleteAttachmentsByComment(commentId int64, remove bool) (int, error)\n```\nDeleteAttachmentsByComment deletes all attachments associated with the given comment.\n\n```go\nfunc DeleteAttachmentsByIssue(issueId int64, remove bool) (int, error)\n```\nDeleteAttachmentsByIssue deletes all attachments associated with the given issue.\n\n```go\nfunc DeleteDeployKey(doer *User, id int64) error\n```\nDeleteDeployKey deletes deploy key from its repository authorized\\_keys file if needed.\n\n```go\nfunc DeleteEmailAddress(email *EmailAddress) error\n```\n\n```go\nfunc DeleteInactivateUsers() (err error)\n```\nDeleteInactivateUsers deletes all inactivate users and email addresses.\n\n```go\nfunc DeleteIssueLabel(issue *Issue, label *Label) (err error)\n```\nDeleteIssueLabel deletes issue-label relation.\n\n```go\nfunc DeleteLabel(repoID, labelID int64) error\n```\nDeleteLabel delete a label of given repository.\n\n```go\nfunc DeleteMilestoneByID(id int64) error\n```\nDeleteMilestoneByID deletes a milestone by given ID.\n\n```go\nfunc DeleteMissingRepositories() error\n```\nDeleteMissingRepositories deletes all repository records that lost Git files.\n\n```go\nfunc DeleteNotice(id int64) error\n```\nDeleteNotice deletes a system notice by given ID.\n\n```go\nfunc DeleteNotices(start, end int64) error\n```\nDeleteNotices deletes all notices with ID from start to end (inclusive).\n\n```go\nfunc DeleteNoticesByIDs(ids []int64) error\n```\nDeleteNoticesByIDs deletes notices by given IDs.\n\n```go\nfunc DeleteOrganization(org *User) (err error)\n```\nDeleteOrganization completely and permanently deletes everything of organization.\n\n```go\nfunc DeletePublicKey(doer *User, id int64) (err error)\n```\nDeletePublicKey deletes SSH key information both in database and authorized\\_keys file.\n\n```go\nfunc DeleteReleaseByID(id int64) error\n```\nDeleteReleaseByID deletes a release and corresponding Git tag by given ID.\n\n```go\nfunc DeleteRepository(uid, repoID int64) error\n```\nDeleteRepository deletes a repository for a user or organization.\n\n```go\nfunc DeleteRepositoryArchives() error\n```\nDeleteRepositoryArchives deletes all repositories' archives.\n\n```go\nfunc DeleteSource(source *LoginSource) error\n```\n\n```go\nfunc DeleteTeam(t *Team) error\n```\nDeleteTeam deletes given team. It's caller's responsibility to assign organization ID.\n\n```go\nfunc DeleteUpdateTaskByUUID(uuid string) error\n```\n\n```go\nfunc DeleteUser(u *User) (err error)\n```\nDeleteUser completely and permanently deletes everything of a user, but issues/comments/pulls will be kept and shown as someone has been deleted.\n\n```go\nfunc DeleteWebhook(id int64) (err error)\n```\nDeleteWebhook deletes webhook of repository.\n\n```go\nfunc DeliverHooks()\n```\nDeliverHooks checks and delivers undelivered hooks. TODO: shoot more hooks at same time.\n\n```go\nfunc DumpDatabase(filePath string) error\n```\nDumpDatabase dumps all data from database to file system.\n\n```go\nfunc FollowUser(userId int64, followId int64) (err error)\n```\nFollowUser marks someone be another's follower.\n\n```go\nfunc GetIssueCountByPoster(uid, rid int64, isClosed bool) int64\n```\nGetIssueCountByPoster returns number of issues of repository by poster.\n\n```go\nfunc GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64)\n```\nGetRepoIssueStats returns number of open and closed repository issues by given filter mode.\n\n```go\nfunc GetRepositoryCount(u *User) (int64, error)\n```\nGetRepositoryCount returns the total number of repositories of user.\n\n```go\nfunc GetUserEmailsByNames(names []string) []string\n```\nGetUserEmailsByNames returns a list of e-mails corresponds to names.\n\n```go\nfunc GetUserIdsByNames(names []string) []int64\n```\nGetUserIdsByNames returns a slice of ids corresponds to names.\n\n```go\nfunc GetUserSalt() string\n```\nGetUserSalt returns a ramdom user salt token.\n\n```go\nfunc GitFsck()\n```\nGitFsck calls 'git fsck' to check repository health.\n\n```go\nfunc GitGcRepos() error\n```\n\n```go\nfunc HasAccess(u *User, repo *Repository, testMode AccessMode) (bool, error)\n```\nHasAccess returns true if someone has the request access level. User can be nil!\n\n```go\nfunc HasDeployKey(keyID, repoID int64) bool\n```\nHasDeployKey returns true if public key is a deploy key of given repository.\n\n```go\nfunc HasIssueLabel(issueID, labelID int64) bool\n```\nHasIssueLabel returns true if issue has been labeled.\n\n```go\nfunc HasTeamRepo(orgID, teamID, repoID int64) bool\n```\nHasTeamRepo returns true if given repository belongs to team.\n\n```go\nfunc InitDeliverHooks()\n```\n\n```go\nfunc InitTestPullRequests()\n```\n\n```go\nfunc IsEmailUsed(email string) (bool, error)\n```\nIsEmailUsed returns true if the e-mail has been used.\n\n```go\nfunc IsErrAccessTokenNotExist(err error) bool\n```\n\n```go\nfunc IsErrAttachmentNotExist(err error) bool\n```\n\n```go\nfunc IsErrAuthenticationNotExist(err error) bool\n```\n\n```go\nfunc IsErrCommentNotExist(err error) bool\n```\n\n```go\nfunc IsErrDeployKeyAlreadyExist(err error) bool\n```\n\n```go\nfunc IsErrDeployKeyNameAlreadyUsed(err error) bool\n```\n\n```go\nfunc IsErrDeployKeyNotExist(err error) bool\n```\n\n```go\nfunc IsErrEmailAlreadyUsed(err error) bool\n```\n\n```go\nfunc IsErrInvalidCloneAddr(err error) bool\n```\n\n```go\nfunc IsErrIssueNotExist(err error) bool\n```\n\n```go\nfunc IsErrKeyAccessDenied(err error) bool\n```\n\n```go\nfunc IsErrKeyAlreadyExist(err error) bool\n```\n\n```go\nfunc IsErrKeyNameAlreadyUsed(err error) bool\n```\n\n```go\nfunc IsErrKeyNotExist(err error) bool\n```\n\n```go\nfunc IsErrKeyUnableVerify(err error) bool\n```\n\n```go\nfunc IsErrLabelNotExist(err error) bool\n```\n\n```go\nfunc IsErrLastOrgOwner(err error) bool\n```\n\n```go\nfunc IsErrMilestoneNotExist(err error) bool\n```\n\n```go\nfunc IsErrNamePatternNotAllowed(err error) bool\n```\n\n```go\nfunc IsErrNameReserved(err error) bool\n```\n\n```go\nfunc IsErrPullRequestNotExist(err error) bool\n```\n\n```go\nfunc IsErrReleaseAlreadyExist(err error) bool\n```\n\n```go\nfunc IsErrReleaseNotExist(err error) bool\n```\n\n```go\nfunc IsErrRepoAlreadyExist(err error) bool\n```\n\n```go\nfunc IsErrRepoNotExist(err error) bool\n```\n\n```go\nfunc IsErrUpdateTaskNotExist(err error) bool\n```\n\n```go\nfunc IsErrUserAlreadyExist(err error) bool\n```\n\n```go\nfunc IsErrUserHasOrgs(err error) bool\n```\n\n```go\nfunc IsErrUserNotExist(err error) bool\n```\n\n```go\nfunc IsErrUserOwnRepos(err error) bool\n```\n\n```go\nfunc IsErrWebhookNotExist(err error) bool\n```\n\n```go\nfunc IsErrWikiAlreadyExist(err error) bool\n```\n\n```go\nfunc IsOrganizationMember(orgId, uid int64) bool\n```\nIsOrganizationMember returns true if given user is member of organization.\n\n```go\nfunc IsOrganizationOwner(orgId, uid int64) bool\n```\nIsOrganizationOwner returns true if given user is in the owner team.\n\n```go\nfunc IsPublicMembership(orgId, uid int64) bool\n```\nIsPublicMembership returns true if given user public his/her membership.\n\n```go\nfunc IsReleaseExist(repoID int64, tagName string) (bool, error)\n```\nIsReleaseExist returns true if release with given tag name already exists.\n\n```go\nfunc IsRepositoryExist(u *User, repoName string) (bool, error)\n```\nIsRepositoryExist returns true if the repository with given name under user has already existed.\n\n```go\nfunc IsStaring(uid, repoId int64) bool\n```\nIsStaring checks if user has starred given repository.\n\n```go\nfunc IsTeamMember(orgID, teamID, uid int64) bool\n```\nIsTeamMember returns true if given user is a member of team.\n\n```go\nfunc IsUsableName(name string) error\n```\nIsUsableName checks if name is reserved or pattern of name is not allowed.\n\n```go\nfunc IsUserExist(uid int64, name string) (bool, error)\n```\nIsUserExist checks if given user name exist, the user name should be noncased unique. If uid is presented, then check will rule out that one, it is used when update a user name in settings page.\n\n```go\nfunc IsValidHookContentType(name string) bool\n```\nIsValidHookContentType returns true if given name is a valid hook content type.\n\n```go\nfunc IsValidHookTaskType(name string) bool\n```\nIsValidHookTaskType returns true if given name is a valid hook task type.\n\n```go\nfunc IsWatching(uid, repoId int64) bool\n```\nIsWatching checks if user has watched given repository.\n\n```go\nfunc LoadConfigs()\n```\n\n```go\nfunc LoadRepoConfig()\n```\n\n```go\nfunc LoginAuth(username, password string) smtp.Auth\n```\n\n```go\nfunc MakeEmailPrimary(email *EmailAddress) error\n```\n\n```go\nfunc MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error\n```\nMergePullRequestAction adds new action for merging pull request.\n\n```go\nfunc MilestoneStats(repoID int64) (open int64, closed int64)\n```\nMilestoneStats returns number of open and closed milestones of given repository.\n\n```go\nfunc MirrorRepository(repoId int64, userName, repoName, repoPath, url string) error\n```\nMirrorRepository creates a mirror repository from source.\n\n```go\nfunc MirrorUpdate()\n```\nMirrorUpdate checks and updates mirror repositories.\n\n```go\nfunc NewAccessToken(t *AccessToken) error\n```\nNewAccessToken creates new access token.\n\n```go\nfunc NewEngine() (err error)\n```\n\n```go\nfunc NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) (err error)\n```\nNewIssue creates new issue with labels for repository.\n\n```go\nfunc NewIssueLabel(issue *Issue, label *Label) (err error)\n```\nNewIssueLabel creates a new issue-label relation.\n\n```go\nfunc NewIssueUsers(repo *Repository, issue *Issue) (err error)\n```\nNewIssueUsers adds new issue-user relations for new issue of repository.\n\n```go\nfunc NewLabel(l *Label) error\n```\nNewLabel creates new label of repository.\n\n```go\nfunc NewMilestone(m *Milestone) (err error)\n```\nNewMilestone creates new milestone of repository.\n\n```go\nfunc NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []string, pr *PullRequest, patch []byte) (err error)\n```\nNewPullRequest creates new pull request with labels for repository.\n\n```go\nfunc NewRepoAction(u *User, repo *Repository) (err error)\n```\nNewRepoAction adds new action for creating repository.\n\n```go\nfunc NewRepoContext()\n```\n\n```go\nfunc NewTeam(t *Team) (err error)\n```\nNewTeam creates a record of new team. It's caller's responsibility to assign organization ID.\n\n```go\nfunc NewTestEngine(x *xorm.Engine) (err error)\n```\n\n```go\nfunc NotifyWatchers(act *Action) error\n```\nNotifyWatchers creates batch of actions for every watcher.\n\n```go\nfunc PairsContains(ius []*IssueUser, issueId, uid int64) int\n```\nPairsContains returns true when pairs list contains given issue.\n\n```go\nfunc Ping() error\n```\n\n```go\nfunc PrepareWebhooks(repo *Repository, event HookEventType, p api.Payloader) error\n```\nPrepareWebhooks adds new webhooks to task queue for given payload.\n\n```go\nfunc RemoveOrgRepo(orgID, repoID int64) error\n```\nRemoveOrgRepo removes all team-repository relations of given organization.\n\n```go\nfunc RemoveOrgUser(orgId, uid int64) error\n```\nRemoveOrgUser removes user from given organization.\n\n```go\nfunc RemoveTeamMember(orgId, teamId, uid int64) error\n```\nRemoveTeamMember removes member from given team of given organization.\n\n```go\nfunc RemoveTeamRepo(teamID, repoID int64) error\n```\nRemoveTeamRepo deletes repository relation to team.\n\n```go\nfunc RenameRepoAction(actUser *User, oldRepoName string, repo *Repository) error\n```\nRenameRepoAction adds new action for renaming a repository.\n\n```go\nfunc RepoPath(userName, repoName string) string\n```\nRepoPath returns repository path by given user and repository name.\n\n```go\nfunc RewriteAllPublicKeys() error\n```\nRewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.\n\n```go\nfunc RewriteRepositoryUpdateHook() error\n```\nRewriteRepositoryUpdateHook rewrites all repositories' update hook.\n\n```go\nfunc SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error\n```\n\n```go\nfunc SetEngine() (err error)\n```\n\n```go\nfunc SlackLinkFormatter(url string, text string) string\n```\n\n```go\nfunc SlackTextFormatter(s string) string\n```\nsee: [https://api.slack.com/docs/formatting](https://api.slack.com/docs/formatting)\n\n```go\nfunc SortReleases(rels []*Release)\n```\nSortReleases sorts releases by number of commits and created time.\n\n```go\nfunc StarRepo(uid, repoId int64, star bool) (err error)\n```\nStar or unstar repository.\n\n```go\nfunc TestPullRequests()\n```\nTestPullRequests checks and tests untested patches of pull requests. TODO: test more pull requests at same time.\n\n```go\nfunc ToWikiPageName(name string) string\n```\nToWikiPageName formats a URL back to corresponding wiki page name.\n\n```go\nfunc ToWikiPageURL(name string) string\n```\nToWikiPageURL formats a string to corresponding wiki URL name.\n\n```go\nfunc TransferOwnership(u *User, newOwnerName string, repo *Repository) error\n```\nTransferOwnership transfers all corresponding setting from old user to new one.\n\n```go\nfunc TransferRepoAction(actUser, oldOwner, newOwner *User, repo *Repository) error\n```\nTransferRepoAction adds new action for transferring repository.\n\n```go\nfunc UnFollowUser(userId int64, unFollowId int64) (err error)\n```\nUnFollowUser unmarks someone be another's follower.\n\n```go\nfunc Update(refName, oldCommitID, newCommitID, userName, repoUserName, repoName string, userID int64) error\n```\n\n```go\nfunc UpdateAccessToekn(t *AccessToken) error\n```\nUpdateAccessToekn updates information of access token.\n\n```go\nfunc UpdateComment(c *Comment) error\n```\nUpdateComment updates information of comment.\n\n```go\nfunc UpdateDeployKey(key *DeployKey) error\n```\nUpdateDeployKey updates deploy key information.\n\n```go\nfunc UpdateHookTask(t *HookTask) error\n```\nUpdateHookTask updates information of hook task.\n\n```go\nfunc UpdateIssue(issue *Issue) error\n```\nUpdateIssue updates all fields of given issue.\n\n```go\nfunc UpdateIssueUserByAssignee(issue *Issue) (err error)\n```\nUpdateIssueUserByAssignee updates issue-user relation for assignee.\n\n```go\nfunc UpdateIssueUserByRead(uid, issueID int64) error\n```\nUpdateIssueUserByRead updates issue-user relation for reading.\n\n```go\nfunc UpdateIssueUsersByMentions(uids []int64, iid int64) error\n```\nUpdateIssueUsersByMentions updates issue-user pairs by mentioning.\n\n```go\nfunc UpdateIssueUsersByStatus(issueID int64, isClosed bool) error\n```\nUpdateIssueUsersByStatus updates issue-user relations by issue status.\n\n```go\nfunc UpdateLabel(l *Label) error\n```\nUpdateLabel updates label information.\n\n```go\nfunc UpdateMentions(userNames []string, issueId int64) error\n```\n\n```go\nfunc UpdateMilestone(m *Milestone) error\n```\nUpdateMilestone updates information of given milestone.\n\n```go\nfunc UpdateMirror(m *Mirror) error\n```\n\n```go\nfunc UpdatePublicKey(key *PublicKey) error\n```\nUpdatePublicKey updates given public key.\n\n```go\nfunc UpdateRelease(gitRepo *git.Repository, rel *Release) (err error)\n```\nUpdateRelease updates information of a release.\n\n```go\nfunc UpdateRepository(repo *Repository, visibilityChanged bool) (err error)\n```\n\n```go\nfunc UpdateSource(source *LoginSource) error\n```\n\n```go\nfunc UpdateTeam(t *Team, authChanged bool) (err error)\n```\nUpdateTeam updates information of team.\n\n```go\nfunc UpdateUser(u *User) error\n```\nUpdateUser updates user's information.\n\n```go\nfunc UpdateWebhook(w *Webhook) error\n```\nUpdateWebhook updates information of webhook.\n\n```go\nfunc UserPath(userName string) string\n```\nUserPath returns the path absolute path of user repositories.\n\n```go\nfunc ValidateCommitsWithEmails(oldCommits *list.List) *list.List\n```\nValidateCommitsWithEmails checks if authors' e-mails of commits are corresponding to users.\n\n```go\nfunc WatchRepo(uid, repoId int64, watch bool) (err error)\n```\nWatch or unwatch repository.\n\n```go\nfunc WikiPath(userName, repoName string) string\n```\nWikiPath returns wiki data path by given user and repository name.\n\n## Types\n\n```go\ntype Access struct {\n\tID     int64 `xorm:\"pk autoincr\"`\n\tUserID int64 `xorm:\"UNIQUE(s)\"`\n\tRepoID int64 `xorm:\"UNIQUE(s)\"`\n\tMode   AccessMode\n}\n```\nAccess represents the highest access level of a user to the repository. The only access type that is not in this table is the real owner of a repository. In case of an organization repository, the members of the owners team are in this table.\n\n```go\ntype AccessMode int\n```\n\n```go\nconst (\n\tACCESS_MODE_NONE AccessMode = iota\n\tACCESS_MODE_READ\n\tACCESS_MODE_WRITE\n\tACCESS_MODE_ADMIN\n\tACCESS_MODE_OWNER\n)\n```\n\n```go\nfunc AccessLevel(u *User, repo *Repository) (AccessMode, error)\n```\nAccessLevel returns the Access a user has to a repository. Will return NoneAccess if the user does not have access. User can be nil!\n\n```go\ntype AccessToken struct {\n\tID                int64 `xorm:\"pk autoincr\"`\n\tUID               int64 `xorm:\"INDEX\"`\n\tName              string\n\tSha1              string    `xorm:\"UNIQUE VARCHAR(40)\"`\n\tCreated           time.Time `xorm:\"CREATED\"`\n\tUpdated           time.Time\n\tHasRecentActivity bool `xorm:\"-\"`\n\tHasUsed           bool `xorm:\"-\"`\n}\n```\nAccessToken represents a personal access token.\n\n```go\nfunc GetAccessTokenBySHA(sha string) (*AccessToken, error)\n```\nGetAccessTokenBySHA returns access token by given sha1.\n\n```go\nfunc ListAccessTokens(uid int64) ([]*AccessToken, error)\n```\nListAccessTokens returns a list of access tokens belongs to given user.\n\n```go\ntype Action struct {\n\tID           int64 `xorm:\"pk autoincr\"`\n\tUserID       int64 // Receiver user id.\n\tOpType       ActionType\n\tActUserID    int64  // Action user id.\n\tActUserName  string // Action user name.\n\tActEmail     string\n\tActAvatar    string `xorm:\"-\"`\n\tRepoID       int64\n\tRepoUserName string\n\tRepoName     string\n\tRefName      string\n\tIsPrivate    bool      `xorm:\"NOT NULL DEFAULT false\"`\n\tContent      string    `xorm:\"TEXT\"`\n\tCreated      time.Time `xorm:\"created\"`\n}\n```\nAction represents user operation type and other information to repository., it implemented interface base.Actioner so that can be used in template render.\n\n```go\nfunc GetFeeds(uid, offset int64, isProfile bool) ([]*Action, error)\n```\nGetFeeds returns action list of given user in given context.\n\n```go\nfunc (a *Action) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (a Action) GetActEmail() string\n```\n\n```go\nfunc (a Action) GetActUserName() string\n```\n\n```go\nfunc (a Action) GetBranch() string\n```\n\n```go\nfunc (a Action) GetContent() string\n```\n\n```go\nfunc (a Action) GetCreate() time.Time\n```\n\n```go\nfunc (a Action) GetIssueContent() string\n```\n\n```go\nfunc (a Action) GetIssueInfos() []string\n```\n\n```go\nfunc (a Action) GetIssueTitle() string\n```\n\n```go\nfunc (a Action) GetOpType() int\n```\n\n```go\nfunc (a Action) GetRepoLink() string\n```\n\n```go\nfunc (a Action) GetRepoName() string\n```\n\n```go\nfunc (a Action) GetRepoPath() string\n```\n\n```go\nfunc (a Action) GetRepoUserName() string\n```\n\n```go\ntype ActionType int\n```\n\n```go\nconst (\n\tCREATE_REPO         ActionType = iota + 1 // 1\n\tRENAME_REPO                               // 2\n\tSTAR_REPO                                 // 3\n\tFOLLOW_REPO                               // 4\n\tCOMMIT_REPO                               // 5\n\tCREATE_ISSUE                              // 6\n\tCREATE_PULL_REQUEST                       // 7\n\tTRANSFER_REPO                             // 8\n\tPUSH_TAG                                  // 9\n\tCOMMENT_ISSUE                             // 10\n\tMERGE_PULL_REQUEST                        // 11\n)\n```\n\n```go\ntype Attachment struct {\n\tID        int64  `xorm:\"pk autoincr\"`\n\tUUID      string `xorm:\"uuid UNIQUE\"`\n\tIssueID   int64  `xorm:\"INDEX\"`\n\tCommentID int64\n\tReleaseID int64 `xorm:\"INDEX\"`\n\tName      string\n\tCreated   time.Time `xorm:\"CREATED\"`\n}\n```\nAttachment represent a attachment of issue/comment/release.\n\n```go\nfunc GetAttachmentByUUID(uuid string) (*Attachment, error)\n```\nGetAttachmentByUUID returns attachment by given UUID.\n\n```go\nfunc GetAttachmentsByCommentID(commentID int64) ([]*Attachment, error)\n```\nGetAttachmentsByCommentID returns all attachments if comment by given ID.\n\n```go\nfunc GetAttachmentsByIssueID(issueID int64) ([]*Attachment, error)\n```\nGetAttachmentsByIssueID returns all attachments for given issue by ID.\n\n```go\nfunc NewAttachment(name string, buf []byte, file multipart.File) (_ *Attachment, err error)\n```\nNewAttachment creates a new attachment object.\n\n```go\nfunc (attach *Attachment) LocalPath() string\n```\nLocalPath returns where attachment is stored in local file system.\n\n```go\ntype CloneLink struct {\n\tSSH   string\n\tHTTPS string\n\tGit   string\n}\n```\nCloneLink represents different types of clone URLs of repository.\n\n```go\ntype Collaboration struct {\n\tID      int64     `xorm:\"pk autoincr\"`\n\tRepoID  int64     `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tUserID  int64     `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tCreated time.Time `xorm:\"CREATED\"`\n}\n```\nA Collaboration is a relation between an individual and a repository\n\n```go\ntype Comment struct {\n\tID              int64 `xorm:\"pk autoincr\"`\n\tType            CommentType\n\tPosterID        int64\n\tPoster          *User `xorm:\"-\"`\n\tIssueID         int64 `xorm:\"INDEX\"`\n\tCommitID        int64\n\tLine            int64\n\tContent         string    `xorm:\"TEXT\"`\n\tRenderedContent string    `xorm:\"-\"`\n\tCreated         time.Time `xorm:\"CREATED\"`\n\n\t// Reference issue in commit message\n\tCommitSHA string `xorm:\"VARCHAR(40)\"`\n\n\tAttachments []*Attachment `xorm:\"-\"`\n\n\t// For view issue page.\n\tShowTag CommentTag `xorm:\"-\"`\n}\n```\nComment represents a comment in commit and issue page.\n\n```go\nfunc CreateComment(doer *User, repo *Repository, issue *Issue, commitID, line int64, cmtType CommentType, content, commitSHA string, attachments []string) (comment *Comment, err error)\n```\nCreateComment creates comment of issue or commit.\n\n```go\nfunc CreateIssueComment(doer *User, repo *Repository, issue *Issue, content string, attachments []string) (*Comment, error)\n```\nCreateIssueComment creates a plain issue comment.\n\n```go\nfunc GetCommentByID(id int64) (*Comment, error)\n```\nGetCommentByID returns the comment by given ID.\n\n```go\nfunc GetCommentsByIssueID(issueID int64) ([]*Comment, error)\n```\nGetCommentsByIssueID returns all comments of issue by given ID.\n\n```go\nfunc (c *Comment) AfterDelete()\n```\n\n```go\nfunc (c *Comment) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (c *Comment) EventTag() string\n```\nEventTag returns unique event hash tag for comment.\n\n```go\nfunc (c *Comment) HashTag() string\n```\nHashTag returns unique hash tag for comment.\n\n```go\ntype CommentTag int\n```\n\n```go\nconst (\n\tCOMMENT_TAG_NONE CommentTag = iota\n\tCOMMENT_TAG_POSTER\n\tCOMMENT_TAG_ADMIN\n\tCOMMENT_TAG_OWNER\n)\n```\n\n```go\ntype CommentType int\n```\nCommentType defines whether a comment is just a simple comment, an action (like close) or a reference.\n\n```go\nconst (\n\t// Plain comment, can be associated with a commit (CommitId \u003e 0) and a line (Line \u003e 0)\n\tCOMMENT_TYPE_COMMENT CommentType = iota\n\tCOMMENT_TYPE_REOPEN\n\tCOMMENT_TYPE_CLOSE\n\n\t// References.\n\tCOMMENT_TYPE_ISSUE_REF\n\t// Reference from a commit (not part of a pull request)\n\tCOMMENT_TYPE_COMMIT_REF\n\t// Reference from a comment\n\tCOMMENT_TYPE_COMMENT_REF\n\t// Reference from a pull request\n\tCOMMENT_TYPE_PULL_REF\n)\n```\n\n```go\ntype CreateRepoOptions struct {\n\tName        string\n\tDescription string\n\tGitignores  string\n\tLicense     string\n\tReadme      string\n\tIsPrivate   bool\n\tIsMirror    bool\n\tAutoInit    bool\n}\n```\n\n```go\ntype DeployKey struct {\n\tID                int64 `xorm:\"pk autoincr\"`\n\tKeyID             int64 `xorm:\"UNIQUE(s) INDEX\"`\n\tRepoID            int64 `xorm:\"UNIQUE(s) INDEX\"`\n\tName              string\n\tFingerprint       string\n\tContent           string    `xorm:\"-\"`\n\tCreated           time.Time `xorm:\"CREATED\"`\n\tUpdated           time.Time // Note: Updated must below Created for AfterSet.\n\tHasRecentActivity bool      `xorm:\"-\"`\n\tHasUsed           bool      `xorm:\"-\"`\n}\n```\nDeployKey represents deploy key information and its relation with repository.\n\n```go\nfunc AddDeployKey(repoID int64, name, content string) (*DeployKey, error)\n```\nAddDeployKey add new deploy key to database and authorized\\_keys file.\n\n```go\nfunc GetDeployKeyByID(id int64) (*DeployKey, error)\n```\nGetDeployKeyByID returns deploy key by given ID.\n\n```go\nfunc GetDeployKeyByRepo(keyID, repoID int64) (*DeployKey, error)\n```\nGetDeployKeyByRepo returns deploy key by given public key ID and repository ID.\n\n```go\nfunc ListDeployKeys(repoID int64) ([]*DeployKey, error)\n```\nListDeployKeys returns all deploy keys by given repository ID.\n\n```go\nfunc (k *DeployKey) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (k *DeployKey) GetContent() error\n```\nGetContent gets associated public key content.\n\n```go\ntype Diff struct {\n\tTotalAddition, TotalDeletion int\n\tFiles                        []*DiffFile\n}\n```\n\n```go\nfunc GetDiffCommit(repoPath, commitId string, maxlines int) (*Diff, error)\n```\n\n```go\nfunc GetDiffRange(repoPath, beforeCommitID string, afterCommitID string, maxlines int) (*Diff, error)\n```\n\n```go\nfunc ParsePatch(maxlines int, reader io.Reader) (*Diff, error)\n```\n\n```go\nfunc (diff *Diff) NumFiles() int\n```\n\n```go\ntype DiffFile struct {\n\tName               string\n\tOldName            string\n\tIndex              int\n\tAddition, Deletion int\n\tType               int\n\tIsCreated          bool\n\tIsDeleted          bool\n\tIsBin              bool\n\tIsRenamed          bool\n\tSections           []*DiffSection\n}\n```\n\n```go\ntype DiffLine struct {\n\tLeftIdx  int\n\tRightIdx int\n\tType     int\n\tContent  string\n}\n```\n\n```go\nfunc (d DiffLine) GetType() int\n```\n\n```go\ntype DiffSection struct {\n\tName  string\n\tLines []*DiffLine\n}\n```\n\n```go\ntype EmailAddress struct {\n\tID          int64  `xorm:\"pk autoincr\"`\n\tUID         int64  `xorm:\"INDEX NOT NULL\"`\n\tEmail       string `xorm:\"UNIQUE NOT NULL\"`\n\tIsActivated bool\n\tIsPrimary   bool `xorm:\"-\"`\n}\n```\nEmailAdresses is the list of all email addresses of a user. Can contain the primary email address, but is not obligatory\n\n```go\nfunc GetEmailAddresses(uid int64) ([]*EmailAddress, error)\n```\nGetEmailAddresses returns all e-mail addresses belongs to given user.\n\n```go\nfunc VerifyActiveEmailCode(code, email string) *EmailAddress\n```\nverify active code when active account\n\n```go\nfunc (email *EmailAddress) Activate() error\n```\n\n```go\ntype Engine interface {\n\tDelete(interface{}) (int64, error)\n\tExec(string, ...interface{}) (sql.Result, error)\n\tFind(interface{}, ...interface{}) error\n\tGet(interface{}) (bool, error)\n\tInsert(...interface{}) (int64, error)\n\tInsertOne(interface{}) (int64, error)\n\tId(interface{}) *xorm.Session\n\tSql(string, ...interface{}) *xorm.Session\n\tWhere(string, ...interface{}) *xorm.Session\n}\n```\nEngine represents a xorm engine or session.\n\n```go\ntype ErrAccessTokenNotExist struct {\n\tSHA string\n}\n```\n\n```go\nfunc (err ErrAccessTokenNotExist) Error() string\n```\n\n```go\ntype ErrAttachmentNotExist struct {\n\tID   int64\n\tUUID string\n}\n```\n\n```go\nfunc (err ErrAttachmentNotExist) Error() string\n```\n\n```go\ntype ErrAuthenticationNotExist struct {\n\tID int64\n}\n```\n\n```go\nfunc (err ErrAuthenticationNotExist) Error() string\n```\n\n```go\ntype ErrCommentNotExist struct {\n\tID int64\n}\n```\n\n```go\nfunc (err ErrCommentNotExist) Error() string\n```\n\n```go\ntype ErrDeployKeyAlreadyExist struct {\n\tKeyID  int64\n\tRepoID int64\n}\n```\n\n```go\nfunc (err ErrDeployKeyAlreadyExist) Error() string\n```\n\n```go\ntype ErrDeployKeyNameAlreadyUsed struct {\n\tRepoID int64\n\tName   string\n}\n```\n\n```go\nfunc (err ErrDeployKeyNameAlreadyUsed) Error() string\n```\n\n```go\ntype ErrDeployKeyNotExist struct {\n\tID     int64\n\tKeyID  int64\n\tRepoID int64\n}\n```\n\n```go\nfunc (err ErrDeployKeyNotExist) Error() string\n```\n\n```go\ntype ErrEmailAlreadyUsed struct {\n\tEmail string\n}\n```\n\n```go\nfunc (err ErrEmailAlreadyUsed) Error() string\n```\n\n```go\ntype ErrInvalidCloneAddr struct {\n\tIsURLError         bool\n\tIsInvalidPath      bool\n\tIsPermissionDenied bool\n}\n```\n\n```go\nfunc (err ErrInvalidCloneAddr) Error() string\n```\n\n```go\ntype ErrIssueNotExist struct {\n\tID     int64\n\tRepoID int64\n\tIndex  int64\n}\n```\n\n```go\nfunc (err ErrIssueNotExist) Error() string\n```\n\n```go\ntype ErrKeyAccessDenied struct {\n\tUserID int64\n\tKeyID  int64\n\tNote   string\n}\n```\n\n```go\nfunc (err ErrKeyAccessDenied) Error() string\n```\n\n```go\ntype ErrKeyAlreadyExist struct {\n\tOwnerID int64\n\tContent string\n}\n```\n\n```go\nfunc (err ErrKeyAlreadyExist) Error() string\n```\n\n```go\ntype ErrKeyNameAlreadyUsed struct {\n\tOwnerID int64\n\tName    string\n}\n```\n\n```go\nfunc (err ErrKeyNameAlreadyUsed) Error() string\n```\n\n```go\ntype ErrKeyNotExist struct {\n\tID int64\n}\n```\n\n```go\nfunc (err ErrKeyNotExist) Error() string\n```\n\n```go\ntype ErrKeyUnableVerify struct {\n\tResult string\n}\n```\n\n```go\nfunc (err ErrKeyUnableVerify) Error() string\n```\n\n```go\ntype ErrLabelNotExist struct {\n\tID int64\n}\n```\n\n```go\nfunc (err ErrLabelNotExist) Error() string\n```\n\n```go\ntype ErrLastOrgOwner struct {\n\tUID int64\n}\n```\n\n```go\nfunc (err ErrLastOrgOwner) Error() string\n```\n\n```go\ntype ErrMilestoneNotExist struct {\n\tID     int64\n\tRepoID int64\n}\n```\n\n```go\nfunc (err ErrMilestoneNotExist) Error() string\n```\n\n```go\ntype ErrNamePatternNotAllowed struct {\n\tPattern string\n}\n```\n\n```go\nfunc (err ErrNamePatternNotAllowed) Error() string\n```\n\n```go\ntype ErrNameReserved struct {\n\tName string\n}\n```\n\n```go\nfunc (err ErrNameReserved) Error() string\n```\n\n```go\ntype ErrPullRequestNotExist struct {\n\tID         int64\n\tIssueID    int64\n\tHeadRepoID int64\n\tBaseRepoID int64\n\tHeadBarcnh string\n\tBaseBranch string\n}\n```\n\n```go\nfunc (err ErrPullRequestNotExist) Error() string\n```\n\n```go\ntype ErrReleaseAlreadyExist struct {\n\tTagName string\n}\n```\n\n```go\nfunc (err ErrReleaseAlreadyExist) Error() string\n```\n\n```go\ntype ErrReleaseNotExist struct {\n\tID      int64\n\tTagName string\n}\n```\n\n```go\nfunc (err ErrReleaseNotExist) Error() string\n```\n\n```go\ntype ErrRepoAlreadyExist struct {\n\tUname string\n\tName  string\n}\n```\n\n```go\nfunc (err ErrRepoAlreadyExist) Error() string\n```\n\n```go\ntype ErrRepoNotExist struct {\n\tID   int64\n\tUID  int64\n\tName string\n}\n```\n\n```go\nfunc (err ErrRepoNotExist) Error() string\n```\n\n```go\ntype ErrUpdateTaskNotExist struct {\n\tUUID string\n}\n```\n\n```go\nfunc (err ErrUpdateTaskNotExist) Error() string\n```\n\n```go\ntype ErrUserAlreadyExist struct {\n\tName string\n}\n```\n\n```go\nfunc (err ErrUserAlreadyExist) Error() string\n```\n\n```go\ntype ErrUserHasOrgs struct {\n\tUID int64\n}\n```\n\n```go\nfunc (err ErrUserHasOrgs) Error() string\n```\n\n```go\ntype ErrUserNotExist struct {\n\tUID  int64\n\tName string\n}\n```\n\n```go\nfunc (err ErrUserNotExist) Error() string\n```\n\n```go\ntype ErrUserOwnRepos struct {\n\tUID int64\n}\n```\n\n```go\nfunc (err ErrUserOwnRepos) Error() string\n```\n\n```go\ntype ErrWebhookNotExist struct {\n\tID int64\n}\n```\n\n```go\nfunc (err ErrWebhookNotExist) Error() string\n```\n\n```go\ntype ErrWikiAlreadyExist struct {\n\tTitle string\n}\n```\n\n```go\nfunc (err ErrWikiAlreadyExist) Error() string\n```\n\n```go\ntype Follow struct {\n\tID       int64 `xorm:\"pk autoincr\"`\n\tUserID   int64 `xorm:\"UNIQUE(follow)\"`\n\tFollowID int64 `xorm:\"UNIQUE(follow)\"`\n}\n```\nFollow is connection request for receiving user notification.\n\n```go\ntype HookContentType int\n```\n\n```go\nconst (\n\tJSON HookContentType = iota + 1\n\tFORM\n)\n```\n\n```go\nfunc ToHookContentType(name string) HookContentType\n```\nToHookContentType returns HookContentType by given name.\n\n```go\nfunc (t HookContentType) Name() string\n```\n\n```go\ntype HookEvent struct {\n\tPushOnly       bool `json:\"push_only\"`\n\tSendEverything bool `json:\"send_everything\"`\n\tChooseEvents   bool `json:\"choose_events\"`\n\n\tHookEvents `json:\"events\"`\n}\n```\nHookEvent represents events that will delivery hook.\n\n```go\ntype HookEventType string\n```\n\n```go\nconst (\n\tHOOK_EVENT_CREATE HookEventType = \"create\"\n\tHOOK_EVENT_PUSH   HookEventType = \"push\"\n)\n```\n\n```go\ntype HookEvents struct {\n\tCreate bool `json:\"create\"`\n\tPush   bool `json:\"push\"`\n}\n```\n\n```go\ntype HookRequest struct {\n\tHeaders map[string]string `json:\"headers\"`\n}\n```\nHookRequest represents hook task request information.\n\n```go\ntype HookResponse struct {\n\tStatus  int               `json:\"status\"`\n\tHeaders map[string]string `json:\"headers\"`\n\tBody    string            `json:\"body\"`\n}\n```\nHookResponse represents hook task response information.\n\n```go\ntype HookStatus int\n```\n\n```go\ntype HookTask struct {\n\tID              int64 `xorm:\"pk autoincr\"`\n\tRepoID          int64 `xorm:\"INDEX\"`\n\tHookID          int64\n\tUUID            string\n\tType            HookTaskType\n\tURL             string\n\tapi.Payloader   `xorm:\"-\"`\n\tPayloadContent  string `xorm:\"TEXT\"`\n\tContentType     HookContentType\n\tEventType       HookEventType\n\tIsSSL           bool\n\tIsDelivered     bool\n\tDelivered       int64\n\tDeliveredString string `xorm:\"-\"`\n\n\t// History info.\n\tIsSucceed       bool\n\tRequestContent  string        `xorm:\"TEXT\"`\n\tRequestInfo     *HookRequest  `xorm:\"-\"`\n\tResponseContent string        `xorm:\"TEXT\"`\n\tResponseInfo    *HookResponse `xorm:\"-\"`\n}\n```\nHookTask represents a hook task.\n\n```go\nfunc HookTasks(hookID int64, page int) ([]*HookTask, error)\n```\nHookTasks returns a list of hook tasks by given conditions.\n\n```go\nfunc (t *HookTask) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (t *HookTask) BeforeUpdate()\n```\n\n```go\nfunc (t *HookTask) MarshalJSON(v interface{}) string\n```\n\n```go\ntype HookTaskType int\n```\n\n```go\nconst (\n\tGOGS HookTaskType = iota + 1\n\tSLACK\n)\n```\n\n```go\nfunc ToHookTaskType(name string) HookTaskType\n```\nToHookTaskType returns HookTaskType by given name.\n\n```go\nfunc (t HookTaskType) Name() string\n```\n\n```go\ntype Issue struct {\n\tID              int64 `xorm:\"pk autoincr\"`\n\tRepoID          int64 `xorm:\"INDEX\"`\n\tIndex           int64 // Index in one repository.\n\tName            string\n\tRepo            *Repository `xorm:\"-\"`\n\tPosterID        int64\n\tPoster          *User    `xorm:\"-\"`\n\tLabels          []*Label `xorm:\"-\"`\n\tMilestoneID     int64\n\tMilestone       *Milestone `xorm:\"-\"`\n\tAssigneeID      int64\n\tAssignee        *User `xorm:\"-\"`\n\tIsRead          bool  `xorm:\"-\"`\n\tIsPull          bool  // Indicates whether is a pull request or not.\n\t*PullRequest    `xorm:\"-\"`\n\tIsClosed        bool\n\tContent         string `xorm:\"TEXT\"`\n\tRenderedContent string `xorm:\"-\"`\n\tPriority        int\n\tNumComments     int\n\tDeadline        time.Time\n\tCreated         time.Time `xorm:\"CREATED\"`\n\tUpdated         time.Time `xorm:\"UPDATED\"`\n\n\tAttachments []*Attachment `xorm:\"-\"`\n\tComments    []*Comment    `xorm:\"-\"`\n}\n```\nIssue represents an issue or pull request of repository.\n\n```go\nfunc GetIssueByID(id int64) (*Issue, error)\n```\nGetIssueByID returns an issue by given ID.\n\n```go\nfunc GetIssueByIndex(repoID, index int64) (*Issue, error)\n```\nGetIssueByIndex returns issue by given index in repository.\n\n```go\nfunc GetIssueByRef(ref string) (*Issue, error)\n```\nGetIssueByRef returns an Issue specified by a GFM reference. See [https://help.github.com/articles/writing-on-github#references](https://help.github.com/articles/writing-on-github#references) for more information on the syntax.\n\n```go\nfunc Issues(opts *IssuesOptions) ([]*Issue, error)\n```\nIssues returns a list of issues by given conditions.\n\n```go\nfunc (i *Issue) AddLabel(label *Label) (err error)\n```\nAddLabel adds new label to issue by given ID.\n\n```go\nfunc (i *Issue) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (i *Issue) ChangeStatus(doer *User, isClosed bool) (err error)\n```\nChangeStatus changes issue status to open/closed.\n\n```go\nfunc (i *Issue) ClearLabels() (err error)\n```\n\n```go\nfunc (i *Issue) GetAssignee() (err error)\n```\n\n```go\nfunc (i *Issue) GetLabels() error\n```\nGetLabels retrieves all labels of issue and assign to corresponding field.\n\n```go\nfunc (i *Issue) GetPoster() (err error)\n```\n\n```go\nfunc (i *Issue) GetPullRequest() (err error)\n```\n\n```go\nfunc (i *Issue) HasLabel(labelID int64) bool\n```\nHasLabel returns true if issue has been labeled by given ID.\n\n```go\nfunc (i *Issue) HashTag() string\n```\nHashTag returns unique hash tag for issue.\n\n```go\nfunc (i *Issue) IsPoster(uid int64) bool\n```\nIsPoster returns true if given user by ID is the poster.\n\n```go\nfunc (i *Issue) ReadBy(uid int64) error\n```\nReadBy sets issue to be read by given user.\n\n```go\nfunc (i *Issue) RemoveLabel(label *Label) (err error)\n```\nRemoveLabel removes a label from issue by given ID.\n\n```go\ntype IssueLabel struct {\n\tID      int64 `xorm:\"pk autoincr\"`\n\tIssueID int64 `xorm:\"UNIQUE(s)\"`\n\tLabelID int64 `xorm:\"UNIQUE(s)\"`\n}\n```\nIssueLabel represetns an issue-lable relation.\n\n```go\nfunc GetIssueLabels(issueID int64) ([]*IssueLabel, error)\n```\nGetIssueLabels returns all issue-label relations of given issue by ID.\n\n```go\ntype IssueStats struct {\n\tOpenCount, ClosedCount int64\n\tAllCount               int64\n\tAssignCount            int64\n\tCreateCount            int64\n\tMentionCount           int64\n}\n```\nIssueStats represents issue statistic information.\n\n```go\nfunc GetIssueStats(opts *IssueStatsOptions) *IssueStats\n```\nGetIssueStats returns issue statistic information by given conditions.\n\n```go\nfunc GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPull bool) *IssueStats\n```\nGetUserIssueStats returns issue statistic information for dashboard by given conditions.\n\n```go\ntype IssueStatsOptions struct {\n\tRepoID      int64\n\tUserID      int64\n\tLabelID     int64\n\tMilestoneID int64\n\tAssigneeID  int64\n\tFilterMode  int\n\tIsPull      bool\n}\n```\n\n```go\ntype IssueStatus int\n```\n\n```go\ntype IssueUser struct {\n\tID          int64 `xorm:\"pk autoincr\"`\n\tUID         int64 `xorm:\"INDEX\"` // User ID.\n\tIssueID     int64\n\tRepoID      int64 `xorm:\"INDEX\"`\n\tMilestoneID int64\n\tIsRead      bool\n\tIsAssigned  bool\n\tIsMentioned bool\n\tIsPoster    bool\n\tIsClosed    bool\n}\n```\nIssueUser represents an issue-user relation.\n\n```go\nfunc GetIssueUserPairsByMode(uid, rid int64, isClosed bool, page, filterMode int) ([]*IssueUser, error)\n```\nGetIssueUserPairsByMode returns issue-user pairs by given repository and user.\n\n```go\nfunc GetIssueUserPairsByRepoIds(rids []int64, isClosed bool, page int) ([]*IssueUser, error)\n```\nGetIssueUserPairsByRepoIds returns issue-user pairs by given repository IDs.\n\n```go\nfunc GetIssueUsers(rid, uid int64, isClosed bool) ([]*IssueUser, error)\n```\nGetIssueUsers returns issue-user pairs by given repository and user.\n\n```go\ntype IssuesOptions struct {\n\tUserID      int64\n\tAssigneeID  int64\n\tRepoID      int64\n\tPosterID    int64\n\tMilestoneID int64\n\tRepoIDs     []int64\n\tPage        int\n\tIsClosed    bool\n\tIsMention   bool\n\tIsPull      bool\n\tLabels      string\n\tSortType    string\n}\n```\n\n```go\ntype KeyType int\n```\n\n```go\ntype LDAPConfig struct {\n\t*ldap.Source\n}\n```\n\n```go\nfunc (cfg *LDAPConfig) FromDB(bs []byte) error\n```\n\n```go\nfunc (cfg *LDAPConfig) ToDB() ([]byte, error)\n```\n\n```go\ntype Label struct {\n\tID              int64 `xorm:\"pk autoincr\"`\n\tRepoID          int64 `xorm:\"INDEX\"`\n\tName            string\n\tColor           string `xorm:\"VARCHAR(7)\"`\n\tNumIssues       int\n\tNumClosedIssues int\n\tNumOpenIssues   int  `xorm:\"-\"`\n\tIsChecked       bool `xorm:\"-\"`\n}\n```\nLabel represents a label of repository for issues.\n\n```go\nfunc GetLabelByID(id int64) (*Label, error)\n```\nGetLabelByID returns a label by given ID.\n\n```go\nfunc GetLabelsByIssueID(issueID int64) ([]*Label, error)\n```\nGetLabelsByIssueID returns all labels that belong to given issue by ID.\n\n```go\nfunc GetLabelsByRepoID(repoID int64) ([]*Label, error)\n```\nGetLabelsByRepoID returns all labels that belong to given repository by ID.\n\n```go\nfunc (m *Label) CalOpenIssues()\n```\nCalOpenIssues calculates the open issues of label.\n\n```go\ntype LoginSource struct {\n\tID        int64 `xorm:\"pk autoincr\"`\n\tType      LoginType\n\tName      string          `xorm:\"UNIQUE\"`\n\tIsActived bool            `xorm:\"NOT NULL DEFAULT false\"`\n\tCfg       core.Conversion `xorm:\"TEXT\"`\n\tCreated   time.Time       `xorm:\"CREATED\"`\n\tUpdated   time.Time       `xorm:\"UPDATED\"`\n}\n```\n\n```go\nfunc GetLoginSourceByID(id int64) (*LoginSource, error)\n```\nGetLoginSourceByID returns login source by given ID.\n\n```go\nfunc LoginSources() ([]*LoginSource, error)\n```\n\n```go\nfunc (source *LoginSource) BeforeSet(colName string, val xorm.Cell)\n```\n\n```go\nfunc (source *LoginSource) IsDLDAP() bool\n```\n\n```go\nfunc (source *LoginSource) IsLDAP() bool\n```\n\n```go\nfunc (source *LoginSource) IsPAM() bool\n```\n\n```go\nfunc (source *LoginSource) IsSMTP() bool\n```\n\n```go\nfunc (source *LoginSource) LDAP() *LDAPConfig\n```\n\n```go\nfunc (source *LoginSource) PAM() *PAMConfig\n```\n\n```go\nfunc (source *LoginSource) SMTP() *SMTPConfig\n```\n\n```go\nfunc (source *LoginSource) SkipVerify() bool\n```\n\n```go\nfunc (source *LoginSource) TypeName() string\n```\n\n```go\nfunc (source *LoginSource) UseTLS() bool\n```\n\n```go\ntype LoginType int\n```\n\n```go\nconst (\n\tNOTYPE LoginType = iota\n\tPLAIN\n\tLDAP\n\tSMTP\n\tPAM\n\tDLDAP\n)\n```\nNote: new type must be added at the end of list to maintain compatibility.\n\n```go\ntype MigrateRepoOptions struct {\n\tName        string\n\tDescription string\n\tIsPrivate   bool\n\tIsMirror    bool\n\tRemoteAddr  string\n}\n```\n\n```go\ntype Milestone struct {\n\tID              int64 `xorm:\"pk autoincr\"`\n\tRepoID          int64 `xorm:\"INDEX\"`\n\tName            string\n\tContent         string `xorm:\"TEXT\"`\n\tRenderedContent string `xorm:\"-\"`\n\tIsClosed        bool\n\tNumIssues       int\n\tNumClosedIssues int\n\tNumOpenIssues   int `xorm:\"-\"`\n\tCompleteness    int // Percentage(1-100).\n\tDeadline        time.Time\n\tDeadlineString  string `xorm:\"-\"`\n\tIsOverDue       bool   `xorm:\"-\"`\n\tClosedDate      time.Time\n}\n```\nMilestone represents a milestone of repository.\n\n```go\nfunc GetAllRepoMilestones(repoID int64) ([]*Milestone, error)\n```\nGetAllRepoMilestones returns all milestones of given repository.\n\n```go\nfunc GetMilestoneByID(id int64) (*Milestone, error)\n```\nGetMilestoneByID returns the milestone of given ID.\n\n```go\nfunc GetMilestones(repoID int64, page int, isClosed bool) ([]*Milestone, error)\n```\nGetMilestones returns a list of milestones of given repository and status.\n\n```go\nfunc GetRepoMilestoneByID(repoID, milestoneID int64) (*Milestone, error)\n```\nGetRepoMilestoneByID returns the milestone of given ID and repository.\n\n```go\nfunc (m *Milestone) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (m *Milestone) BeforeUpdate()\n```\n\n```go\nfunc (m *Milestone) CalOpenIssues()\n```\nCalOpenIssues calculates the open issues of milestone.\n\n```go\ntype Mirror struct {\n\tID         int64 `xorm:\"pk autoincr\"`\n\tRepoID     int64\n\tRepo       *Repository `xorm:\"-\"`\n\tInterval   int         // Hour.\n\tUpdated    time.Time   `xorm:\"UPDATED\"`\n\tNextUpdate time.Time\n}\n```\nMirror represents a mirror information of repository.\n\n```go\nfunc GetMirror(repoId int64) (*Mirror, error)\n```\nGetMirror returns mirror object by given repository ID.\n\n```go\nfunc (m *Mirror) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\ntype Notice struct {\n\tID          int64 `xorm:\"pk autoincr\"`\n\tType        NoticeType\n\tDescription string    `xorm:\"TEXT\"`\n\tCreated     time.Time `xorm:\"CREATED\"`\n}\n```\nNotice represents a system notice for admin.\n\n```go\nfunc Notices(page, pageSize int) ([]*Notice, error)\n```\nNotices returns number of notices in given page.\n\n```go\nfunc (n *Notice) TrStr() string\n```\nTrStr returns a translation format string.\n\n```go\ntype NoticeType int\n```\n\n```go\nconst (\n\tNOTICE_REPOSITORY NoticeType = iota + 1\n)\n```\n\n```go\ntype OrgUser struct {\n\tID       int64 `xorm:\"pk autoincr\"`\n\tUid      int64 `xorm:\"INDEX UNIQUE(s)\"`\n\tOrgID    int64 `xorm:\"INDEX UNIQUE(s)\"`\n\tIsPublic bool\n\tIsOwner  bool\n\tNumTeams int\n}\n```\nOrgUser represents an organization-user relation.\n\n```go\nfunc GetOrgUsersByOrgId(orgId int64) ([]*OrgUser, error)\n```\nGetOrgUsersByOrgId returns all organization-user relations by organization ID.\n\n```go\nfunc GetOrgUsersByUserId(uid int64) ([]*OrgUser, error)\n```\nGetOrgUsersByUserId returns all organization-user relations by user ID.\n\n```go\ntype PAMConfig struct {\n\tServiceName string // pam service (e.g. system-auth)\n}\n```\n\n```go\nfunc (cfg *PAMConfig) FromDB(bs []byte) error\n```\n\n```go\nfunc (cfg *PAMConfig) ToDB() ([]byte, error)\n```\n\n```go\ntype PublicKey struct {\n\tID                int64      `xorm:\"pk autoincr\"`\n\tOwnerID           int64      `xorm:\"INDEX NOT NULL\"`\n\tName              string     `xorm:\"NOT NULL\"`\n\tFingerprint       string     `xorm:\"NOT NULL\"`\n\tContent           string     `xorm:\"TEXT NOT NULL\"`\n\tMode              AccessMode `xorm:\"NOT NULL DEFAULT 2\"`\n\tType              KeyType    `xorm:\"NOT NULL DEFAULT 1\"`\n\tCreated           time.Time  `xorm:\"CREATED\"`\n\tUpdated           time.Time  // Note: Updated must below Created for AfterSet.\n\tHasRecentActivity bool       `xorm:\"-\"`\n\tHasUsed           bool       `xorm:\"-\"`\n}\n```\nPublicKey represents a SSH or deploy key.\n\n```go\nfunc AddPublicKey(ownerID int64, name, content string) (*PublicKey, error)\n```\nAddPublicKey adds new public key to database and authorized\\_keys file.\n\n```go\nfunc GetPublicKeyByID(keyID int64) (*PublicKey, error)\n```\nGetPublicKeyByID returns public key by given ID.\n\n```go\nfunc ListPublicKeys(uid int64) ([]*PublicKey, error)\n```\nListPublicKeys returns a list of public keys belongs to given user.\n\n```go\nfunc SearchPublicKeyByContent(content string) (*PublicKey, error)\n```\nSearchPublicKeyByContent searches content as prefix (leak e-mail part) and returns public key found.\n\n```go\nfunc (k *PublicKey) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (key *PublicKey) GetAuthorizedString() string\n```\nGetAuthorizedString generates and returns formatted public key string for authorized\\_keys file.\n\n```go\nfunc (k *PublicKey) OmitEmail() string\n```\nOmitEmail returns content of public key but without e-mail address.\n\n```go\ntype PullRequest struct {\n\tID     int64 `xorm:\"pk autoincr\"`\n\tType   PullRequestType\n\tStatus PullRequestStatus\n\n\tIssueID int64  `xorm:\"INDEX\"`\n\tIssue   *Issue `xorm:\"-\"`\n\tIndex   int64\n\n\tHeadRepoID   int64\n\tHeadRepo     *Repository `xorm:\"-\"`\n\tBaseRepoID   int64\n\tBaseRepo     *Repository `xorm:\"-\"`\n\tHeadUserName string\n\tHeadBranch   string\n\tBaseBranch   string\n\tMergeBase    string `xorm:\"VARCHAR(40)\"`\n\n\tHasMerged      bool\n\tMergedCommitID string `xorm:\"VARCHAR(40)\"`\n\tMerged         time.Time\n\tMergerID       int64\n\tMerger         *User `xorm:\"-\"`\n}\n```\nPullRequest represents relation between pull request and repositories.\n\n```go\nfunc GetPullRequestByID(id int64) (*PullRequest, error)\n```\nGetPullRequestByID returns a pull request by given ID.\n\n```go\nfunc GetPullRequestByIssueID(issueID int64) (*PullRequest, error)\n```\nGetPullRequestByIssueID returns pull request by given issue ID.\n\n```go\nfunc GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error)\n```\nGetUnmergedPullRequest returnss a pull request that is open and has not been merged by given head/base and repo/branch.\n\n```go\nfunc GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error)\n```\nGetUnmergedPullRequestsByBaseInfo returnss all pull requests that are open and has not been merged by given base information (repo and branch).\n\n```go\nfunc GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error)\n```\nGetUnmergedPullRequestsByHeadInfo returnss all pull requests that are open and has not been merged by given head information (repo and branch).\n\n```go\nfunc (pr *PullRequest) AddToTaskQueue()\n```\nAddToTaskQueue adds itself to pull request test task queue.\n\n```go\nfunc (pr *PullRequest) AfterSet(colName string, _ xorm.Cell)\n```\nNote: don't try to get Pull because will end up recursive querying.\n\n```go\nfunc (pr *PullRequest) CanAutoMerge() bool\n```\nCanAutoMerge returns true if this pull request can be merged automatically.\n\n```go\nfunc (pr *PullRequest) GetBaseRepo() (err error)\n```\n\n```go\nfunc (pr *PullRequest) GetHeadRepo() (err error)\n```\n\n```go\nfunc (pr *PullRequest) GetMerger() (err error)\n```\n\n```go\nfunc (pr *PullRequest) IsChecking() bool\n```\nIsChecking returns true if this pull request is still checking conflict.\n\n```go\nfunc (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error)\n```\nMerge merges pull request to base repository.\n\n```go\nfunc (pr *PullRequest) Update() error\n```\nUpdate updates all fields of pull request.\n\n```go\nfunc (pr *PullRequest) UpdateCols(cols ...string) error\n```\nUpdate updates specific fields of pull request.\n\n```go\nfunc (pr *PullRequest) UpdatePatch() (err error)\n```\nUpdatePatch generates and saves a new patch.\n\n```go\ntype PullRequestStatus int\n```\n\n```go\nconst (\n\tPULL_REQUEST_STATUS_CONFLICT PullRequestStatus = iota\n\tPULL_REQUEST_STATUS_CHECKING\n\tPULL_REQUEST_STATUS_MERGEABLE\n)\n```\n\n```go\ntype PullRequestType int\n```\n\n```go\nconst (\n\tPULL_REQUEST_GOGS PullRequestType = iota\n\tPLLL_ERQUEST_GIT\n)\n```\n\n```go\ntype PushCommit struct {\n\tSha1        string\n\tMessage     string\n\tAuthorEmail string\n\tAuthorName  string\n}\n```\n\n```go\ntype PushCommits struct {\n\tLen        int\n\tCommits    []*PushCommit\n\tCompareUrl string\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewPushCommits() *PushCommits\n```\n\n```go\nfunc (push *PushCommits) AvatarLink(email string) string\n```\nAvatarLink tries to match user in database with e-mail in order to show custom avatar, and falls back to general avatar link.\n\n```go\ntype Release struct {\n\tID               int64 `xorm:\"pk autoincr\"`\n\tRepoID           int64\n\tPublisherID      int64\n\tPublisher        *User `xorm:\"-\"`\n\tTagName          string\n\tLowerTagName     string\n\tTarget           string\n\tTitle            string\n\tSha1             string `xorm:\"VARCHAR(40)\"`\n\tNumCommits       int\n\tNumCommitsBehind int    `xorm:\"-\"`\n\tNote             string `xorm:\"TEXT\"`\n\tIsDraft          bool   `xorm:\"NOT NULL DEFAULT false\"`\n\tIsPrerelease     bool\n\tCreated          time.Time `xorm:\"CREATED\"`\n}\n```\nRelease represents a release of repository.\n\n```go\nfunc GetRelease(repoID int64, tagName string) (*Release, error)\n```\nGetRelease returns release by given ID.\n\n```go\nfunc GetReleaseByID(id int64) (*Release, error)\n```\nGetReleaseByID returns release with given ID.\n\n```go\nfunc GetReleasesByRepoID(repoID int64) (rels []*Release, err error)\n```\nGetReleasesByRepoID returns a list of releases of repository.\n\n```go\nfunc (r *Release) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\ntype ReleaseSorter struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (rs *ReleaseSorter) Len() int\n```\n\n```go\nfunc (rs *ReleaseSorter) Less(i, j int) bool\n```\n\n```go\nfunc (rs *ReleaseSorter) Swap(i, j int)\n```\n\n```go\ntype Repository struct {\n\tID            int64  `xorm:\"pk autoincr\"`\n\tOwnerID       int64  `xorm:\"UNIQUE(s)\"`\n\tOwner         *User  `xorm:\"-\"`\n\tLowerName     string `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tName          string `xorm:\"INDEX NOT NULL\"`\n\tDescription   string\n\tWebsite       string\n\tDefaultBranch string\n\n\tNumWatches          int\n\tNumStars            int\n\tNumForks            int\n\tNumIssues           int\n\tNumClosedIssues     int\n\tNumOpenIssues       int `xorm:\"-\"`\n\tNumPulls            int\n\tNumClosedPulls      int\n\tNumOpenPulls        int `xorm:\"-\"`\n\tNumMilestones       int `xorm:\"NOT NULL DEFAULT 0\"`\n\tNumClosedMilestones int `xorm:\"NOT NULL DEFAULT 0\"`\n\tNumOpenMilestones   int `xorm:\"-\"`\n\tNumTags             int `xorm:\"-\"`\n\n\tIsPrivate bool\n\tIsBare    bool\n\n\tIsMirror bool\n\t*Mirror  `xorm:\"-\"`\n\n\t// Advanced settings\n\tEnableWiki            bool `xorm:\"NOT NULL DEFAULT true\"`\n\tEnableIssues          bool `xorm:\"NOT NULL DEFAULT true\"`\n\tEnableExternalTracker bool\n\tExternalTrackerFormat string\n\tExternalMetas         map[string]string `xorm:\"-\"`\n\tEnablePulls           bool              `xorm:\"NOT NULL DEFAULT true\"`\n\n\tIsFork   bool `xorm:\"NOT NULL DEFAULT false\"`\n\tForkID   int64\n\tBaseRepo *Repository `xorm:\"-\"`\n\n\tCreated time.Time `xorm:\"CREATED\"`\n\tUpdated time.Time `xorm:\"UPDATED\"`\n}\n```\nRepository represents a git repository.\n\n```go\nfunc CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error)\n```\nCreateRepository creates a repository for given user or organization.\n\n```go\nfunc ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error)\n```\n\n```go\nfunc GetRecentUpdatedRepositories(page int) (repos []*Repository, err error)\n```\nGetRecentUpdatedRepositories returns the list of repositories that are recently updated.\n\n```go\nfunc GetRepositories(uid int64, private bool) ([]*Repository, error)\n```\nGetRepositories returns a list of repositories of given user.\n\n```go\nfunc GetRepositoriesByForkID(forkID int64) ([]*Repository, error)\n```\nGetRepositoriesByForkID returns all repositories with given fork ID.\n\n```go\nfunc GetRepositoryByID(id int64) (*Repository, error)\n```\nGetRepositoryByID returns the repository by given id if exists.\n\n```go\nfunc GetRepositoryByName(uid int64, repoName string) (*Repository, error)\n```\nGetRepositoryByName returns the repository by given name under user if exists.\n\n```go\nfunc GetRepositoryByRef(ref string) (*Repository, error)\n```\nGetRepositoryByRef returns a Repository specified by a GFM reference. See [https://help.github.com/articles/writing-on-github#references](https://help.github.com/articles/writing-on-github#references) for more information on the syntax.\n\n```go\nfunc HasForkedRepo(ownerID, repoID int64) (*Repository, bool)\n```\nHasForkedRepo checks if given user has already forked a repository with given ID.\n\n```go\nfunc MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error)\n```\nMigrateRepository migrates a existing repository from other project hosting.\n\n```go\nfunc RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error)\n```\nRepositoriesWithUsers returns number of repos in given page.\n\n```go\nfunc SearchRepositoryByName(opt SearchOption) (repos []*Repository, err error)\n```\nSearchRepositoryByName returns given number of repositories whose name contains keyword.\n\n```go\nfunc (repo *Repository) AddCollaborator(u *User) error\n```\nAdd collaborator and accompanying access\n\n```go\nfunc (repo *Repository) AddWikiPage(doer *User, title, content, message string) error\n```\n\n```go\nfunc (repo *Repository) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (repo *Repository) CanBeForked() bool\n```\nCanBeForked returns true if repository meets the requirements of being forked.\n\n```go\nfunc (repo *Repository) CloneLink() (cl *CloneLink)\n```\nCloneLink returns clone URLs of repository.\n\n```go\nfunc (repo *Repository) ComposeMetas() map[string]string\n```\nComposeMetas composes a map of metas for rendering external issue tracker URL.\n\n```go\nfunc (repo *Repository) ComposePayload() *api.PayloadRepo\n```\nComposePayload composes and returns \\*api.PayloadRepo corresponding to the repository.\n\n```go\nfunc (repo *Repository) DeleteCollaborator(u *User) (err error)\n```\nDelete collaborator and accompanying access\n\n```go\nfunc (repo *Repository) DescriptionHtml() template.HTML\n```\nDescriptionHtml does special handles to description and return HTML string.\n\n```go\nfunc (repo *Repository) EditWikiPage(doer *User, oldTitle, title, content, message string) error\n```\n\n```go\nfunc (repo *Repository) GetAssigneeByID(userID int64) (*User, error)\n```\nGetAssigneeByID returns the user that has write access of repository by given ID.\n\n```go\nfunc (repo *Repository) GetAssignees() (_ []*User, err error)\n```\nGetAssignees returns all users that have write access of repository.\n\n```go\nfunc (repo *Repository) GetBaseRepo() (err error)\n```\n\n```go\nfunc (repo *Repository) GetCollaborators() ([]*User, error)\n```\nGetCollaborators returns the collaborators for a repository\n\n```go\nfunc (repo *Repository) GetForks() ([]*Repository, error)\n```\n\n```go\nfunc (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error)\n```\nGetMilestoneByID returns the milestone belongs to repository by given ID.\n\n```go\nfunc (repo *Repository) GetMirror() (err error)\n```\n\n```go\nfunc (repo *Repository) GetOwner() error\n```\n\n```go\nfunc (repo *Repository) GetStargazers(page int) ([]*User, error)\n```\n\n```go\nfunc (repo *Repository) GetWatchers(page int) ([]*User, error)\n```\nRepository.GetWatchers returns range of users watching given repository.\n\n```go\nfunc (repo *Repository) HasAccess(u *User) bool\n```\n\n```go\nfunc (repo *Repository) HasWiki() bool\n```\nHasWiki returns true if repository has wiki.\n\n```go\nfunc (repo *Repository) InitWiki() error\n```\nInitWiki initializes a wiki for repository, it does nothing when repository already has wiki.\n\n```go\nfunc (repo *Repository) IsOwnedBy(userID int64) bool\n```\n\n```go\nfunc (repo *Repository) IssueStats(uid int64, filterMode int, isPull bool) (int64, int64)\n```\nIssueStats returns number of open and closed repository issues by given filter mode.\n\n```go\nfunc (repo *Repository) LocalCopyPath() string\n```\n\n```go\nfunc (repo *Repository) LocalWikiPath() string\n```\n\n```go\nfunc (repo *Repository) MustOwner() *User\n```\nMustOwner always returns a valid \\*User object to avoid conceptually impossible error handling. It creates a fake object that contains error deftail when error occurs.\n\n```go\nfunc (repo *Repository) NextIssueIndex() int64\n```\n\n```go\nfunc (repo *Repository) PatchPath(index int64) (string, error)\n```\nPatchPath returns corresponding patch file path of repository by given issue ID.\n\n```go\nfunc (r *Repository) RecalculateAccesses() error\n```\nRecalculateAccesses recalculates all accesses for repository.\n\n```go\nfunc (repo *Repository) RepoLink() string\n```\n\n```go\nfunc (repo *Repository) RepoPath() string\n```\n\n```go\nfunc (repo *Repository) SavePatch(index int64, patch []byte) error\n```\nSavePatch saves patch data to corresponding location by given issue ID.\n\n```go\nfunc (repo *Repository) UpdateLocalCopy() error\n```\nUpdateLocalCopy makes sure the local copy of repository is up-to-date.\n\n```go\nfunc (repo *Repository) UpdateLocalWiki() error\n```\nUpdateLocalWiki makes sure the local copy of repository wiki is up-to-date.\n\n```go\nfunc (repo *Repository) WikiCloneLink() (cl *CloneLink)\n```\nWikiCloneLink returns clone URLs of repository wiki.\n\n```go\nfunc (repo *Repository) WikiPath() string\n```\n\n```go\ntype SMTPConfig struct {\n\tAuth           string\n\tHost           string\n\tPort           int\n\tAllowedDomains string `xorm:\"TEXT\"`\n\tTLS            bool\n\tSkipVerify     bool\n}\n```\n\n```go\nfunc (cfg *SMTPConfig) FromDB(bs []byte) error\n```\n\n```go\nfunc (cfg *SMTPConfig) ToDB() ([]byte, error)\n```\n\n```go\ntype SearchOption struct {\n\tKeyword string\n\tUid     int64\n\tLimit   int\n\tPrivate bool\n}\n```\n\n```go\ntype SlackAttachment struct {\n\tFallback string `json:\"fallback\"`\n\tColor    string `json:\"color\"`\n\tText     string `json:\"text\"`\n}\n```\n\n```go\ntype SlackMeta struct {\n\tChannel  string `json:\"channel\"`\n\tUsername string `json:\"username\"`\n\tIconURL  string `json:\"icon_url\"`\n\tColor    string `json:\"color\"`\n}\n```\n\n```go\ntype SlackPayload struct {\n\tChannel     string            `json:\"channel\"`\n\tText        string            `json:\"text\"`\n\tUsername    string            `json:\"username\"`\n\tIconURL     string            `json:\"icon_url\"`\n\tUnfurlLinks int               `json:\"unfurl_links\"`\n\tLinkNames   int               `json:\"link_names\"`\n\tAttachments []SlackAttachment `json:\"attachments\"`\n}\n```\n\n```go\nfunc GetSlackPayload(p api.Payloader, event HookEventType, meta string) (*SlackPayload, error)\n```\n\n```go\nfunc (p *SlackPayload) JSONPayload() ([]byte, error)\n```\n\n```go\nfunc (p *SlackPayload) SetSecret(_ string)\n```\n\n```go\ntype Star struct {\n\tID     int64 `xorm:\"pk autoincr\"`\n\tUID    int64 `xorm:\"UNIQUE(s)\"`\n\tRepoID int64 `xorm:\"UNIQUE(s)\"`\n}\n```\n\n```go\ntype Statistic struct {\n\tCounter struct {\n\t\tUser, Org, PublicKey,\n\t\tRepo, Watch, Star, Action, Access,\n\t\tIssue, Comment, Oauth, Follow,\n\t\tMirror, Release, LoginSource, Webhook,\n\t\tMilestone, Label, HookTask,\n\t\tTeam, UpdateTask, Attachment int64\n\t}\n}\n```\n\n```go\nfunc GetStatistic() (stats Statistic)\n```\n\n```go\ntype Team struct {\n\tID          int64 `xorm:\"pk autoincr\"`\n\tOrgID       int64 `xorm:\"INDEX\"`\n\tLowerName   string\n\tName        string\n\tDescription string\n\tAuthorize   AccessMode\n\tRepos       []*Repository `xorm:\"-\"`\n\tMembers     []*User       `xorm:\"-\"`\n\tNumRepos    int\n\tNumMembers  int\n}\n```\nTeam represents a organization team.\n\n```go\nfunc GetTeam(orgId int64, name string) (*Team, error)\n```\nGetTeam returns team by given team name and organization.\n\n```go\nfunc GetTeamById(teamId int64) (*Team, error)\n```\nGetTeamById returns team by given ID.\n\n```go\nfunc GetUserTeams(orgId, uid int64) ([]*Team, error)\n```\nGetUserTeams returns all teams that user belongs to in given organization.\n\n```go\nfunc (t *Team) AddMember(uid int64) error\n```\nAddMember adds new member to team of organization.\n\n```go\nfunc (t *Team) AddRepository(repo *Repository) (err error)\n```\nAddRepository adds new repository to team of organization.\n\n```go\nfunc (t *Team) GetMembers() (err error)\n```\nGetMembers returns all members in team of organization.\n\n```go\nfunc (t *Team) GetRepositories() error\n```\nGetRepositories returns all repositories in team of organization.\n\n```go\nfunc (t *Team) HasRepository(repoID int64) bool\n```\nHasRepository returns true if given repository belong to team.\n\n```go\nfunc (t *Team) IsMember(uid int64) bool\n```\nIsTeamMember returns true if given user is a member of team.\n\n```go\nfunc (t *Team) IsOwnerTeam() bool\n```\nIsOwnerTeam returns true if team is owner team.\n\n```go\nfunc (t *Team) RemoveMember(uid int64) error\n```\nRemoveMember removes member from team of organization.\n\n```go\nfunc (t *Team) RemoveRepository(repoID int64) error\n```\nRemoveRepository removes repository from team of organization.\n\n```go\ntype TeamRepo struct {\n\tID     int64 `xorm:\"pk autoincr\"`\n\tOrgID  int64 `xorm:\"INDEX\"`\n\tTeamID int64 `xorm:\"UNIQUE(s)\"`\n\tRepoID int64 `xorm:\"UNIQUE(s)\"`\n}\n```\nTeamRepo represents an team-repository relation.\n\n```go\ntype TeamUser struct {\n\tID     int64 `xorm:\"pk autoincr\"`\n\tOrgID  int64 `xorm:\"INDEX\"`\n\tTeamID int64 `xorm:\"UNIQUE(s)\"`\n\tUid    int64 `xorm:\"UNIQUE(s)\"`\n}\n```\nTeamUser represents an team-user relation.\n\n```go\ntype UniqueQueue struct {\n\t// contains filtered or unexported fields\n}\n```\nUniqueQueue represents a queue that guarantees only one instance of same ID is in the line.\n\n```go\nfunc NewUniqueQueue(queueLength int) *UniqueQueue\n```\n\n```go\nfunc (q *UniqueQueue) Add(id interface{})\n```\n\n```go\nfunc (q *UniqueQueue) AddFunc(id interface{}, fn func())\n```\n\n```go\nfunc (q *UniqueQueue) Exist(id interface{}) bool\n```\n\n```go\nfunc (q *UniqueQueue) Queue() \u003c-chan string\n```\n\n```go\nfunc (q *UniqueQueue) Remove(id interface{})\n```\n\n```go\ntype UpdateTask struct {\n\tID          int64  `xorm:\"pk autoincr\"`\n\tUUID        string `xorm:\"index\"`\n\tRefName     string\n\tOldCommitID string\n\tNewCommitID string\n}\n```\n\n```go\nfunc GetUpdateTaskByUUID(uuid string) (*UpdateTask, error)\n```\nGetUpdateTaskByUUID returns update task by given UUID.\n\n```go\ntype User struct {\n\tId        int64\n\tLowerName string `xorm:\"UNIQUE NOT NULL\"`\n\tName      string `xorm:\"UNIQUE NOT NULL\"`\n\tFullName  string\n\t// Email is the primary email address (to be used for communication).\n\tEmail       string `xorm:\"NOT NULL\"`\n\tPasswd      string `xorm:\"NOT NULL\"`\n\tLoginType   LoginType\n\tLoginSource int64 `xorm:\"NOT NULL DEFAULT 0\"`\n\tLoginName   string\n\tType        UserType\n\tOwnedOrgs   []*User       `xorm:\"-\"`\n\tOrgs        []*User       `xorm:\"-\"`\n\tRepos       []*Repository `xorm:\"-\"`\n\tLocation    string\n\tWebsite     string\n\tRands       string    `xorm:\"VARCHAR(10)\"`\n\tSalt        string    `xorm:\"VARCHAR(10)\"`\n\tCreated     time.Time `xorm:\"CREATED\"`\n\tUpdated     time.Time `xorm:\"UPDATED\"`\n\n\t// Remember visibility choice for convenience, true for private\n\tLastRepoVisibility bool\n\n\t// Permissions.\n\tIsActive         bool\n\tIsAdmin          bool\n\tAllowGitHook     bool\n\tAllowImportLocal bool // Allow migrate repository by local path\n\n\t// Avatar.\n\tAvatar          string `xorm:\"VARCHAR(2048) NOT NULL\"`\n\tAvatarEmail     string `xorm:\"NOT NULL\"`\n\tUseCustomAvatar bool\n\n\t// Counters.\n\tNumFollowers  int\n\tNumFollowings int\n\tNumStars      int\n\tNumRepos      int\n\n\t// For organization.\n\tDescription string\n\tNumTeams    int\n\tNumMembers  int\n\tTeams       []*Team `xorm:\"-\"`\n\tMembers     []*User `xorm:\"-\"`\n}\n```\nUser represents the object of individual and member of organization.\n\n```go\nfunc ExternalUserLogin(u *User, name, passwd string, source *LoginSource, autoRegister bool) (*User, error)\n```\n\n```go\nfunc GetAssigneeByID(repo *Repository, userID int64) (*User, error)\n```\nGetAssigneeByID returns the user with write access of repository by given ID.\n\n```go\nfunc GetOrgByName(name string) (*User, error)\n```\nGetOrgByName returns organization by given name.\n\n```go\nfunc GetOwnedOrgsByUserID(userID int64) ([]*User, error)\n```\nGetOwnedOrgsByUserID returns a list of organizations are owned by given user ID.\n\n```go\nfunc GetOwnedOrgsByUserIDDesc(userID int64, desc string) ([]*User, error)\n```\nGetOwnedOrganizationsByUserIDDesc returns a list of organizations are owned by given user ID and descring order by given condition.\n\n```go\nfunc GetTeamMembers(teamID int64) ([]*User, error)\n```\nGetTeamMembers returns all members in given team of organization.\n\n```go\nfunc GetUserByEmail(email string) (*User, error)\n```\nGetUserByEmail returns the user object by given e-mail if exists.\n\n```go\nfunc GetUserByID(id int64) (*User, error)\n```\nGetUserByID returns the user object by given ID if exists.\n\n```go\nfunc GetUserByKeyID(keyID int64) (*User, error)\n```\n\n```go\nfunc GetUserByName(name string) (*User, error)\n```\nGetUserByName returns user by given name.\n\n```go\nfunc LoginUserLDAPSource(u *User, loginName, passwd string, source *LoginSource, autoRegister bool) (*User, error)\n```\nLoginUserLDAPSource queries if loginName/passwd can login against the LDAP directory pool, and create a local user if success when enabled. It returns the same LoginUserPlain semantic.\n\n```go\nfunc LoginUserPAMSource(u *User, name, passwd string, sourceId int64, cfg *PAMConfig, autoRegister bool) (*User, error)\n```\nQuery if name/passwd can login against PAM Create a local user if success Return the same LoginUserPlain semantic\n\n```go\nfunc LoginUserSMTPSource(u *User, name, passwd string, sourceId int64, cfg *SMTPConfig, autoRegister bool) (*User, error)\n```\nQuery if name/passwd can login against the LDAP directory pool Create a local user if success Return the same LoginUserPlain semantic\n\n```go\nfunc NewFakeUser() *User\n```\nNewFakeUser creates and returns a fake user for someone has deleted his/her account.\n\n```go\nfunc Organizations(page, pageSize int) ([]*User, error)\n```\nOrganizations returns number of organizations in given page.\n\n```go\nfunc SearchUserByName(opt SearchOption) (us []*User, err error)\n```\nSearchUserByName returns given number of users whose name contains keyword.\n\n```go\nfunc UserSignIn(uname, passwd string) (*User, error)\n```\nUserSignIn validates user name and password.\n\n```go\nfunc Users(page, pageSize int) ([]*User, error)\n```\nUsers returns number of users in given page.\n\n```go\nfunc ValidateCommitWithEmail(c *oldgit.Commit) *User\n```\nValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user.\n\n```go\nfunc VerifyUserActiveCode(code string) (user *User)\n```\nverify active code when active account\n\n```go\nfunc (org *User) AddMember(uid int64) error\n```\nAddMember adds new member to organization.\n\n```go\nfunc (u *User) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (u *User) AvatarLink() string\n```\nAvatarLink returns user gravatar link.\n\n```go\nfunc (u *User) CanEditGitHook() bool\n```\nCanEditGitHook returns true if user can edit Git hooks.\n\n```go\nfunc (u *User) CanImportLocal() bool\n```\nCanImportLocal returns true if user can migrate repository by local path.\n\n```go\nfunc (u *User) CustomAvatarPath() string\n```\nCustomAvatarPath returns user custom avatar file path.\n\n```go\nfunc (u *User) DashboardLink() string\n```\nDashboardLink returns the user dashboard page link.\n\n```go\nfunc (u *User) DisplayName() string\n```\nDisplayName returns full name if it's not empty, returns username otherwise.\n\n```go\nfunc (u *User) EncodePasswd()\n```\nEncodePasswd encodes password to safe format.\n\n```go\nfunc (u *User) GenerateActivateCode() string\n```\nGenerateActivateCode generates an activate code based on user information.\n\n```go\nfunc (u *User) GenerateEmailActivateCode(email string) string\n```\nGenerateEmailActivateCode generates an activate code based on user information and given e-mail.\n\n```go\nfunc (u *User) GenerateRandomAvatar() error\n```\nGenerateRandomAvatar generates a random avatar for user.\n\n```go\nfunc (u *User) GetAccessibleRepositories() ([]*Repository, error)\n```\nGetAccessibleRepositories finds all repositories where a user has access but does not own.\n\n```go\nfunc (org *User) GetMembers() error\n```\nGetMembers returns all members of organization.\n\n```go\nfunc (u *User) GetOrganizationCount() (int64, error)\n```\nGetOrganizationCount returns count of membership of organization of user.\n\n```go\nfunc (u *User) GetOrganizations() error\n```\nGetOrganizations returns all organizations that user belongs to.\n\n```go\nfunc (u *User) GetOwnedOrganizations() (err error)\n```\nGetOwnedOrganizations returns all organizations that user owns.\n\n```go\nfunc (org *User) GetOwnerTeam() (*Team, error)\n```\nGetOwnerTeam returns owner team of organization.\n\n```go\nfunc (u *User) GetRepositories() (err error)\n```\nGetRepositories returns all repositories that user owns, including private repositories.\n\n```go\nfunc (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error)\n```\nGetRepositoryAccesses finds all repositories with their access mode where a user has access but does not own.\n\n```go\nfunc (org *User) GetTeam(name string) (*Team, error)\n```\nGetTeam returns named team of organization.\n\n```go\nfunc (org *User) GetTeams() error\n```\nGetTeams returns all teams that belong to organization.\n\n```go\nfunc (u *User) HasForkedRepo(repoID int64) bool\n```\nHasForkedRepo checks if user has already forked a repository with given ID.\n\n```go\nfunc (u *User) HomeLink() string\n```\nHomeLink returns the user or organization home page link.\n\n```go\nfunc (u *User) IsAdminOfRepo(repo *Repository) bool\n```\nIsAdminOfRepo returns true if user has admin or higher access of repository.\n\n```go\nfunc (org *User) IsOrgMember(uid int64) bool\n```\nIsOrgMember returns true if given user is member of organization.\n\n```go\nfunc (u *User) IsOrganization() bool\n```\nIsOrganization returns true if user is actually a organization.\n\n```go\nfunc (org *User) IsOwnedBy(uid int64) bool\n```\nIsOwnedBy returns true if given user is in the owner team.\n\n```go\nfunc (u *User) IsPublicMember(orgId int64) bool\n```\nIsPublicMember returns true if user public his/her membership in give organization.\n\n```go\nfunc (u *User) IsUserOrgOwner(orgId int64) bool\n```\nIsUserOrgOwner returns true if user is in the owner team of given organization.\n\n```go\nfunc (u *User) NewGitSig() *git.Signature\n```\nNewGitSig generates and returns the signature of given user.\n\n```go\nfunc (u *User) RelAvatarLink() string\n```\n\n```go\nfunc (org *User) RemoveMember(uid int64) error\n```\nRemoveMember removes member from organization.\n\n```go\nfunc (org *User) RemoveOrgRepo(repoID int64) error\n```\nRemoveOrgRepo removes all team-repository relations of organization.\n\n```go\nfunc (u *User) ShortName(length int) string\n```\nShortName returns shorted user name with given maximum length, it adds \"...\" at the end if user name has more length than maximum.\n\n```go\nfunc (u *User) UploadAvatar(data []byte) error\n```\nUploadAvatar saves custom avatar for user. FIXME: split uploads to different subdirs in case we have massive users.\n\n```go\nfunc (u *User) ValidatePassword(passwd string) bool\n```\nValidatePassword checks if given password matches the one belongs to the user.\n\n```go\ntype UserCommit struct {\n\tUser *User\n\t*oldgit.Commit\n}\n```\nUserCommit represents a commit with validation of user.\n\n```go\ntype UserType int\n```\n\n```go\nconst (\n\tINDIVIDUAL UserType = iota // Historic reason to make it starts at 0.\n\tORGANIZATION\n)\n```\n\n```go\ntype Watch struct {\n\tID     int64 `xorm:\"pk autoincr\"`\n\tUserID int64 `xorm:\"UNIQUE(watch)\"`\n\tRepoID int64 `xorm:\"UNIQUE(watch)\"`\n}\n```\nWatch is connection request for receiving repository notification.\n\n```go\nfunc GetWatchers(repoID int64) ([]*Watch, error)\n```\nGetWatchers returns all watchers of given repository.\n\n```go\ntype Webhook struct {\n\tID           int64 `xorm:\"pk autoincr\"`\n\tRepoID       int64\n\tOrgID        int64\n\tURL          string `xorm:\"url TEXT\"`\n\tContentType  HookContentType\n\tSecret       string `xorm:\"TEXT\"`\n\tEvents       string `xorm:\"TEXT\"`\n\t*HookEvent   `xorm:\"-\"`\n\tIsSSL        bool `xorm:\"is_ssl\"`\n\tIsActive     bool\n\tHookTaskType HookTaskType\n\tMeta         string     `xorm:\"TEXT\"` // store hook-specific attributes\n\tLastStatus   HookStatus // Last delivery status\n\tCreated      time.Time  `xorm:\"CREATED\"`\n\tUpdated      time.Time  `xorm:\"UPDATED\"`\n}\n```\nWebhook represents a web hook object.\n\n```go\nfunc GetActiveWebhooksByOrgID(orgID int64) (ws []*Webhook, err error)\n```\nGetActiveWebhooksByOrgID returns all active webhooks for an organization.\n\n```go\nfunc GetActiveWebhooksByRepoID(repoID int64) (ws []*Webhook, err error)\n```\nGetActiveWebhooksByRepoID returns all active webhooks of repository.\n\n```go\nfunc GetWebhookByID(id int64) (*Webhook, error)\n```\nGetWebhookByID returns webhook by given ID.\n\n```go\nfunc GetWebhooksByOrgId(orgID int64) (ws []*Webhook, err error)\n```\nGetWebhooksByOrgId returns all webhooks for an organization.\n\n```go\nfunc GetWebhooksByRepoID(repoID int64) (ws []*Webhook, err error)\n```\nGetWebhooksByRepoID returns all webhooks of repository.\n\n```go\nfunc (w *Webhook) AfterSet(colName string, _ xorm.Cell)\n```\n\n```go\nfunc (w *Webhook) EventsArray() []string\n```\n\n```go\nfunc (w *Webhook) GetSlackHook() *SlackMeta\n```\n\n```go\nfunc (w *Webhook) HasCreateEvent() bool\n```\nHasCreateEvent returns true if hook enabled create event.\n\n```go\nfunc (w *Webhook) HasPushEvent() bool\n```\nHasPushEvent returns true if hook enabled push event.\n\n```go\nfunc (w *Webhook) History(page int) ([]*HookTask, error)\n```\nHistory returns history of webhook by given conditions.\n\n```go\nfunc (w *Webhook) UpdateEvent() error\n```\nUpdateEvent handles conversion from HookEvent to Events.\n\n","path":"github.com/generaltso/gogs/models","name":"models","synopsis":"","isRedistributable":true}
