{"modulePath":"github.com/redafd/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package models\n\n## Constants\n\n```go\nconst (\n\tFilterModeAll = iota\n\tFilterModeAssign\n\tFilterModeCreate\n\tFilterModeMention\n)\n```\nFilter modes.\n\n```go\nconst (\n\t// LFSMetaFileIdentifier is the string appearing at the first line of LFS pointer files.\n\t// https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md\n\tLFSMetaFileIdentifier = \"version https://git-lfs.github.com/spec/v1\"\n\n\t// LFSMetaFileOidPrefix appears in LFS pointer files on a line before the sha256 hash.\n\tLFSMetaFileOidPrefix = \"oid sha256:\"\n)\n```\n\n```go\nconst (\n\tSMTPPlain = \"PLAIN\"\n\tSMTPLogin = \"LOGIN\"\n)\n```\nSMTP authentication type names.\n\n```go\nconst (\n\tSearchOrderByAlphabetically        SearchOrderBy = \"name ASC\"\n\tSearchOrderByAlphabeticallyReverse               = \"name DESC\"\n\tSearchOrderByLeastUpdated                        = \"updated_unix ASC\"\n\tSearchOrderByRecentUpdated                       = \"updated_unix DESC\"\n\tSearchOrderByOldest                              = \"created_unix ASC\"\n\tSearchOrderByNewest                              = \"created_unix DESC\"\n\tSearchOrderBySize                                = \"size ASC\"\n\tSearchOrderBySizeReverse                         = \"size DESC\"\n\tSearchOrderByID                                  = \"id ASC\"\n\tSearchOrderByIDReverse                           = \"id DESC\"\n\tSearchOrderByStars                               = \"num_stars ASC\"\n\tSearchOrderByStarsReverse                        = \"num_stars DESC\"\n\tSearchOrderByForks                               = \"num_forks ASC\"\n\tSearchOrderByForksReverse                        = \"num_forks DESC\"\n)\n```\nStrings for sorting result\n\n```go\nconst (\n\t// KeyTypeUser specifies the user key\n\tKeyTypeUser = iota + 1\n\t// KeyTypeDeploy specifies the deploy key\n\tKeyTypeDeploy\n)\n```\n\n```go\nconst (\n\tEnvRepoName     = \"GITEA_REPO_NAME\"\n\tEnvRepoUsername = \"GITEA_REPO_USER_NAME\"\n\tEnvRepoIsWiki   = \"GITEA_REPO_IS_WIKI\"\n\tEnvPusherName   = \"GITEA_PUSHER_NAME\"\n\tEnvPusherEmail  = \"GITEA_PUSHER_EMAIL\"\n\tEnvPusherID     = \"GITEA_PUSHER_ID\"\n)\n```\nenv keys for git hooks need\n\n```go\nconst (\n\tHookStatusNone = iota\n\tHookStatusSucceed\n\tHookStatusFail\n)\n```\nPossible statuses of a web hook\n\n```go\nconst NonexistentID = int64(math.MaxInt64)\n```\nNonexistentID an ID that will never exist\n\n```go\nconst (\n\t// ProtectedBranchRepoID protected Repo ID\n\tProtectedBranchRepoID = \"GITEA_REPO_ID\"\n)\n```\n\n```go\nconst RepositoryListDefaultPageSize = 64\n```\nRepositoryListDefaultPageSize is the default number of repositories to load in memory when running administrative tasks on all (or almost all) of them. The number should be low enough to avoid filling up all RAM with repository data...\n\n## Variables\n\n```go\nvar (\n\n\t// HasEngine specifies if we have a xorm.Engine\n\tHasEngine bool\n\n\t// DbCfg holds the database settings\n\tDbCfg struct {\n\t\tType, Host, Name, User, Passwd, Path, SSLMode string\n\t\tTimeout                                       int\n\t}\n\n\t// EnableSQLite3 use SQLite3\n\tEnableSQLite3 bool\n\n\t// EnableTiDB enable TiDB\n\tEnableTiDB bool\n)\n```\n\n```go\nvar (\n\t// ErrMirrorNotExist mirror does not exist error\n\tErrMirrorNotExist = errors.New(\"Mirror does not exist\")\n\n\t// ErrNameEmpty name is empty error\n\tErrNameEmpty = errors.New(\"Name is empty\")\n)\n```\n\n```go\nvar (\n\t// Gitignores contains the gitiginore files\n\tGitignores []string\n\n\t// Licenses contains the license files\n\tLicenses []string\n\n\t// Readmes contains the readme files\n\tReadmes []string\n\n\t// LabelTemplates contains the label template files\n\tLabelTemplates []string\n\n\t// ItemsPerPage maximum items per page in forks, watchers and stars of a repo\n\tItemsPerPage = 40\n)\n```\n\n```go\nvar (\n\tUnitCode = Unit{\n\t\tUnitTypeCode,\n\t\t\"repo.code\",\n\t\t\"/\",\n\t\t\"repo.code.desc\",\n\t\t0,\n\t}\n\n\tUnitIssues = Unit{\n\t\tUnitTypeIssues,\n\t\t\"repo.issues\",\n\t\t\"/issues\",\n\t\t\"repo.issues.desc\",\n\t\t1,\n\t}\n\n\tUnitExternalTracker = Unit{\n\t\tUnitTypeExternalTracker,\n\t\t\"repo.ext_issues\",\n\t\t\"/issues\",\n\t\t\"repo.ext_issues.desc\",\n\t\t1,\n\t}\n\n\tUnitPullRequests = Unit{\n\t\tUnitTypePullRequests,\n\t\t\"repo.pulls\",\n\t\t\"/pulls\",\n\t\t\"repo.pulls.desc\",\n\t\t2,\n\t}\n\n\tUnitReleases = Unit{\n\t\tUnitTypeReleases,\n\t\t\"repo.releases\",\n\t\t\"/releases\",\n\t\t\"repo.releases.desc\",\n\t\t3,\n\t}\n\n\tUnitWiki = Unit{\n\t\tUnitTypeWiki,\n\t\t\"repo.wiki\",\n\t\t\"/wiki\",\n\t\t\"repo.wiki.desc\",\n\t\t4,\n\t}\n\n\tUnitExternalWiki = Unit{\n\t\tUnitTypeExternalWiki,\n\t\t\"repo.ext_wiki\",\n\t\t\"/wiki\",\n\t\t\"repo.ext_wiki.desc\",\n\t\t4,\n\t}\n\n\t// Units contains all the units\n\tUnits = map[UnitType]Unit{\n\t\tUnitTypeCode:            UnitCode,\n\t\tUnitTypeIssues:          UnitIssues,\n\t\tUnitTypeExternalTracker: UnitExternalTracker,\n\t\tUnitTypePullRequests:    UnitPullRequests,\n\t\tUnitTypeReleases:        UnitReleases,\n\t\tUnitTypeWiki:            UnitWiki,\n\t\tUnitTypeExternalWiki:    UnitExternalWiki,\n\t}\n)\n```\nEnumerate all the units\n\n```go\nvar (\n\t// ErrUserNotKeyOwner user does not own this key error\n\tErrUserNotKeyOwner = errors.New(\"User does not own this public key\")\n\n\t// ErrEmailNotExist e-mail does not exist error\n\tErrEmailNotExist = errors.New(\"E-mail does not exist\")\n\n\t// ErrEmailNotActivated e-mail address has not been activated error\n\tErrEmailNotActivated = errors.New(\"E-mail address has not been activated\")\n\n\t// ErrUserNameIllegal user name contains illegal characters error\n\tErrUserNameIllegal = errors.New(\"User name contains illegal characters\")\n\n\t// ErrLoginSourceNotActived login source is not actived error\n\tErrLoginSourceNotActived = errors.New(\"Login source is not actived\")\n\n\t// ErrUnsupportedLoginType login source is unknown error\n\tErrUnsupportedLoginType = errors.New(\"Login source is unknown\")\n)\n```\n\n```go\nvar (\n\t// ErrEmailAddressNotExist email address not exist\n\tErrEmailAddressNotExist = errors.New(\"Email address does not exist\")\n)\n```\n\n```go\nvar (\n\t// ErrLFSObjectNotExist is returned from lfs models functions in order\n\t// to differentiate between database and missing object errors.\n\tErrLFSObjectNotExist = errors.New(\"LFS Meta object does not exist\")\n)\n```\n\n```go\nvar (\n\t// ErrOpenIDNotExist openid is not known\n\tErrOpenIDNotExist = errors.New(\"OpenID is unknown\")\n)\n```\n\n```go\nvar (\n\t// ErrTeamNotExist team does not exist\n\tErrTeamNotExist = errors.New(\"Team does not exist\")\n)\n```\n\n```go\nvar (\n\t// ErrUnitNotExist organization does not exist\n\tErrUnitNotExist = errors.New(\"Unit does not exist\")\n)\n```\n\n```go\nvar HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)\n```\nHookQueue is a global queue of web hooks\n\n```go\nvar LoginNames = map[LoginType]string{\n\tLoginLDAP:   \"LDAP (via BindDN)\",\n\tLoginDLDAP:  \"LDAP (simple auth)\",\n\tLoginSMTP:   \"SMTP\",\n\tLoginPAM:    \"PAM\",\n\tLoginOAuth2: \"OAuth2\",\n}\n```\nLoginNames contains the name of LoginType values.\n\n```go\nvar MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)\n```\nMirrorQueue holds an UniqueQueue object of the mirror\n\n```go\nvar (\n\n\t// MustRepoUnits contains the units could not be disabled currently\n\tMustRepoUnits = []UnitType{\n\t\tUnitTypeCode,\n\t\tUnitTypeReleases,\n\t}\n)\n```\n\n```go\nvar OAuth2DefaultCustomURLMappings = map[string]*oauth2.CustomURLMapping{\n\t\"github\": OAuth2Providers[\"github\"].CustomURLMapping,\n\t\"gitlab\": OAuth2Providers[\"gitlab\"].CustomURLMapping,\n}\n```\nOAuth2DefaultCustomURLMappings contains the map of default URL's for OAuth2 providers that are allowed to have custom urls key is used to map the OAuth2Provider value is the mapping as defined for the OAuth2Provider\n\n```go\nvar OAuth2Providers = map[string]OAuth2Provider{\n\t\"bitbucket\": {Name: \"bitbucket\", DisplayName: \"Bitbucket\", Image: \"/img/auth/bitbucket.png\"},\n\t\"dropbox\":   {Name: \"dropbox\", DisplayName: \"Dropbox\", Image: \"/img/auth/dropbox.png\"},\n\t\"facebook\":  {Name: \"facebook\", DisplayName: \"Facebook\", Image: \"/img/auth/facebook.png\"},\n\t\"github\": {Name: \"github\", DisplayName: \"GitHub\", Image: \"/img/auth/github.png\",\n\t\tCustomURLMapping: \u0026oauth2.CustomURLMapping{\n\t\t\tTokenURL:   oauth2.GetDefaultTokenURL(\"github\"),\n\t\t\tAuthURL:    oauth2.GetDefaultAuthURL(\"github\"),\n\t\t\tProfileURL: oauth2.GetDefaultProfileURL(\"github\"),\n\t\t\tEmailURL:   oauth2.GetDefaultEmailURL(\"github\"),\n\t\t},\n\t},\n\t\"gitlab\": {Name: \"gitlab\", DisplayName: \"GitLab\", Image: \"/img/auth/gitlab.png\",\n\t\tCustomURLMapping: \u0026oauth2.CustomURLMapping{\n\t\t\tTokenURL:   oauth2.GetDefaultTokenURL(\"gitlab\"),\n\t\t\tAuthURL:    oauth2.GetDefaultAuthURL(\"gitlab\"),\n\t\t\tProfileURL: oauth2.GetDefaultProfileURL(\"gitlab\"),\n\t\t},\n\t},\n\t\"gplus\":         {Name: \"gplus\", DisplayName: \"Google+\", Image: \"/img/auth/google_plus.png\"},\n\t\"openidConnect\": {Name: \"openidConnect\", DisplayName: \"OpenID Connect\", Image: \"/img/auth/openid_connect.png\"},\n\t\"twitter\":       {Name: \"twitter\", DisplayName: \"Twitter\", Image: \"/img/auth/twitter.png\"},\n\t\"discord\":       {Name: \"discord\", DisplayName: \"Discord\", Image: \"/img/auth/discord.png\"},\n}\n```\nOAuth2Providers contains the map of registered OAuth2 providers in Gitea (based on goth) key is used to map the OAuth2Provider with the goth provider type (also in LoginSource.OAuth2Config.Provider) value is used to store display data\n\n```go\nvar SMTPAuths = []string{SMTPPlain, SMTPLogin}\n```\nSMTPAuths contains available SMTP authentication type names.\n\n```go\nvar SecurityProtocolNames = map[ldap.SecurityProtocol]string{\n\tldap.SecurityProtocolUnencrypted: \"Unencrypted\",\n\tldap.SecurityProtocolLDAPS:       \"LDAPS\",\n\tldap.SecurityProtocolStartTLS:    \"StartTLS\",\n}\n```\nSecurityProtocolNames contains the name of SecurityProtocol values.\n\n## Functions\n\n```go\nfunc AddAssigneeIfNotAssigned(issue *Issue, doer *User, assigneeID int64) (err error)\n```\nAddAssigneeIfNotAssigned adds an assignee only if he isn't aleady assigned to the issue\n\n```go\nfunc AddDeletePRBranchComment(doer *User, repo *Repository, issueID int64, branchName string) error\n```\nAddDeletePRBranchComment adds delete branch comment for pull request issue\n\n```go\nfunc AddEmailAddress(email *EmailAddress) error\n```\nAddEmailAddress adds an email address to given user.\n\n```go\nfunc AddEmailAddresses(emails []*EmailAddress) error\n```\nAddEmailAddresses adds an email address to given user.\n\n```go\nfunc AddOrgUser(orgID, uid int64) error\n```\nAddOrgUser adds new user to given organization.\n\n```go\nfunc AddTeamMember(team *Team, userID int64) error\n```\nAddTeamMember adds new membership of given team to given organization, the user will have membership to given organization automatically when needed.\n\n```go\nfunc AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool)\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 AddUserOpenID(openid *UserOpenID) error\n```\nAddUserOpenID adds an pre-verified/normalized OpenID URI to given user.\n\n```go\nfunc AssertCount(t testing.TB, bean interface{}, expected interface{})\n```\nAssertCount assert the count of a bean\n\n```go\nfunc AssertExistsAndLoadBean(t testing.TB, bean interface{}, conditions ...interface{}) interface{}\n```\nAssertExistsAndLoadBean assert that a bean exists and load it from the test database\n\n```go\nfunc AssertExistsIf(t *testing.T, expected bool, bean interface{}, conditions ...interface{})\n```\nAssertExistsIf asserts that a bean exists or does not exist, depending on what is expected.\n\n```go\nfunc AssertInt64InRange(t testing.TB, low, high, value int64)\n```\nAssertInt64InRange assert value is in range \\[low, high]\n\n```go\nfunc AssertNotExistsBean(t testing.TB, bean interface{}, conditions ...interface{})\n```\nAssertNotExistsBean assert that a bean does not exist in the test database\n\n```go\nfunc AssertSuccessfulInsert(t testing.TB, beans ...interface{})\n```\nAssertSuccessfulInsert assert that beans is successfully inserted\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 BeanExists(t testing.TB, bean interface{}, conditions ...interface{}) bool\n```\nBeanExists for testing, check if a bean exists\n\n```go\nfunc CancelStopwatch(user *User, issue *Issue) error\n```\nCancelStopwatch removes the given stopwatch and logs it into issue's timeline.\n\n```go\nfunc Cell2Int64(val xorm.Cell) int64\n```\nCell2Int64 converts a xorm.Cell type to int64, and handles possible irregular cases.\n\n```go\nfunc ChangeMilestoneAssign(issue *Issue, doer *User, oldMilestoneID int64) (err error)\n```\nChangeMilestoneAssign changes assignment of milestone for 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 ChangeUsernameInPullRequests(oldUserName, newUserName string) error\n```\nChangeUsernameInPullRequests changes the name of head\\_user\\_name\n\n```go\nfunc CheckConsistencyFor(t *testing.T, beansToCheck ...interface{})\n```\nCheckConsistencyFor test that all matching database entries are consistent\n\n```go\nfunc CheckConsistencyForAll(t *testing.T)\n```\nCheckConsistencyForAll test that the entire database is consistent\n\n```go\nfunc CheckLFSAccessForRepo(u *User, repo *Repository, mode AccessMode) error\n```\nCheckLFSAccessForRepo check needed access mode base on action\n\n```go\nfunc CheckPublicKeyString(content string) (_ string, err error)\n```\nCheckPublicKeyString checks if the given public key string is recognized by SSH. It returns the actual public key line on success.\n\n```go\nfunc CheckRepoStats()\n```\nCheckRepoStats checks the repository stats\n\n```go\nfunc CommentHashTag(id int64) string\n```\nCommentHashTag returns unique hash tag for comment id.\n\n```go\nfunc CommitRepoAction(opts CommitRepoActionOptions) error\n```\nCommitRepoAction adds new commit action to the repository, and prepare corresponding webhooks.\n\n```go\nfunc ComposeHTTPSCloneURL(owner, repo string) string\n```\nComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.\n\n```go\nfunc Cond(query interface{}, args ...interface{}) interface{}\n```\nCond create a condition with arguments for a test\n\n```go\nfunc CountIssuesByRepo(opts *IssuesOptions) (map[int64]int64, error)\n```\nCountIssuesByRepo map from repoID to number of issues matching the options\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 CountRepoClosedMilestones(repoID int64) (int64, error)\n```\nCountRepoClosedMilestones returns number of closed milestones in given repository.\n\n```go\nfunc CountRepositories(private bool) int64\n```\nCountRepositories returns number of repositories. Argument private only takes effect when it is false, set it true to count all repositories.\n\n```go\nfunc CountUserRepositories(userID int64, private bool) int64\n```\nCountUserRepositories returns number of repositories user owns. Argument private only takes effect when it is false, set it true to count all 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 CreateIssueDependency(user *User, issue, dep *Issue) error\n```\nCreateIssueDependency creates a new dependency for an issue\n\n```go\nfunc CreateLoginSource(source *LoginSource) error\n```\nCreateLoginSource inserts a LoginSource in the DB if not already existing with the given name.\n\n```go\nfunc CreateNotice(tp NoticeType, desc string) error\n```\nCreateNotice creates new system notice.\n\n```go\nfunc CreateOrStopIssueStopwatch(user *User, issue *Issue) error\n```\nCreateOrStopIssueStopwatch will create or remove a stopwatch and will log it into issue's timeline.\n\n```go\nfunc CreateOrUpdateIssueNotifications(issue *Issue, notificationAuthorID int64) error\n```\nCreateOrUpdateIssueNotifications creates an issue notification for each watcher, or updates it if already exists\n\n```go\nfunc CreateOrUpdateIssueWatch(userID, issueID int64, isWatching bool) error\n```\nCreateOrUpdateIssueWatch set watching for a user and issue\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, attachmentUUIDs []string) 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 NoticeRepository.\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 CutDiffAroundLine(originalDiff io.Reader, line int64, old bool, numbersOfLine int) string\n```\nCutDiffAroundLine cuts a diff of a file in way that only the given line + numberOfLine above it will be shown it also recalculates hunks and adds the appropriate headers to the new diff. Warning: Only one-file diffs are allowed.\n\n```go\nfunc DeleteAccessTokenByID(id, userID 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 DeleteComment(doer *User, comment *Comment) error\n```\nDeleteComment deletes the comment\n\n```go\nfunc DeleteCommentReaction(doer *User, issue *Issue, comment *Comment, content string) error\n```\nDeleteCommentReaction deletes a reaction on comment.\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) (err error)\n```\nDeleteEmailAddress deletes an email address of given user.\n\n```go\nfunc DeleteEmailAddresses(emails []*EmailAddress) (err error)\n```\nDeleteEmailAddresses deletes multiple email addresses\n\n```go\nfunc DeleteGPGKey(doer *User, id int64) (err error)\n```\nDeleteGPGKey deletes GPG key information in database.\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, doer *User) (err error)\n```\nDeleteIssueLabel deletes issue-label relation.\n\n```go\nfunc DeleteIssueReaction(doer *User, issue *Issue, content string) error\n```\nDeleteIssueReaction deletes a reaction on issue.\n\n```go\nfunc DeleteLabel(repoID, labelID int64) error\n```\nDeleteLabel delete a label of given repository.\n\n```go\nfunc DeleteMilestoneByRepoID(repoID, id int64) error\n```\nDeleteMilestoneByRepoID deletes a milestone from a repository.\n\n```go\nfunc DeleteMirrorByRepoID(repoID int64) error\n```\nDeleteMirrorByRepoID deletes a mirror by repoID\n\n```go\nfunc DeleteMissingRepositories(doer *User) error\n```\nDeleteMissingRepositories deletes all repository records that lost Git files.\n\n```go\nfunc DeleteNotPassedAssignee(issue *Issue, doer *User, assignees []*User) (err error)\n```\nDeleteNotPassedAssignee deletes all assignees who aren't passed via the \"assignees\" array\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 DeleteOAuth2Application(id, userid int64) error\n```\nDeleteOAuth2Application deletes the application with the given id and the grants and auth codes related to it. It checks if the userid was the creator of the app.\n\n```go\nfunc DeleteOldRepositoryArchives()\n```\nDeleteOldRepositoryArchives deletes old repository archives.\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 DeleteReaction(opts *ReactionOptions) error\n```\nDeleteReaction deletes reaction for issue or comment.\n\n```go\nfunc DeleteRegistration(reg *U2FRegistration) error\n```\nDeleteRegistration will delete U2FRegistration\n\n```go\nfunc DeleteReleaseByID(id int64, u *User, delTag bool) error\n```\nDeleteReleaseByID deletes a release and corresponding Git tag by given ID.\n\n```go\nfunc DeleteRepoFromIndexer(repo *Repository)\n```\nDeleteRepoFromIndexer remove all of a repository's entries from the indexer\n\n```go\nfunc DeleteRepository(doer *User, 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```\nDeleteSource deletes a LoginSource record in DB.\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 DeleteTwoFactorByID(id, userID int64) error\n```\nDeleteTwoFactorByID deletes two-factor authentication token by given ID.\n\n```go\nfunc DeleteUploadByUUID(uuid string) error\n```\nDeleteUploadByUUID deletes a upload by UUID\n\n```go\nfunc DeleteUploads(uploads ...*Upload) (err error)\n```\nDeleteUploads deletes multiple uploads\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 DeleteUserOpenID(openid *UserOpenID) (err error)\n```\nDeleteUserOpenID deletes an openid address of given user.\n\n```go\nfunc DeleteWebhookByOrgID(orgID, id int64) error\n```\nDeleteWebhookByOrgID deletes webhook of organization by given ID.\n\n```go\nfunc DeleteWebhookByRepoID(repoID, id int64) error\n```\nDeleteWebhookByRepoID deletes webhook of repository by given ID.\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, dbType string) error\n```\nDumpDatabase dumps all data from database according the special database SQL syntax to file system.\n\n```go\nfunc FindUserAccessibleRepoIDs(userID int64) ([]int64, error)\n```\nFindUserAccessibleRepoIDs find all accessible repositories' ID by user's id\n\n```go\nfunc FollowUser(userID, followID int64) (err error)\n```\nFollowUser marks someone be another's follower.\n\n```go\nfunc GenerateLFSOid(content io.Reader) (string, error)\n```\nGenerateLFSOid generates a Sha256Sum to represent an oid for arbitrary content\n\n```go\nfunc GetActiveOAuth2Providers() ([]string, map[string]OAuth2Provider, error)\n```\nGetActiveOAuth2Providers returns the map of configured active OAuth2 providers key is used as technical name (like in the callbackURL) values to display\n\n```go\nfunc GetCount(t testing.TB, bean interface{}, conditions ...interface{}) int\n```\nGetCount get the count of a bean\n\n```go\nfunc GetExternalLogin(externalLoginUser *ExternalLoginUser) (bool, error)\n```\nGetExternalLogin checks if a externalID in loginSourceID scope already exists\n\n```go\nfunc GetIssueIDsByRepoID(repoID int64) ([]int64, error)\n```\nGetIssueIDsByRepoID returns all issue ids by repo id\n\n```go\nfunc GetLabelIDsInRepoByNames(repoID int64, labelNames []string) ([]int64, error)\n```\nGetLabelIDsInRepoByNames returns a list of labelIDs by names in a given repository. it silently ignores label names that do not belong to the repository.\n\n```go\nfunc GetLabelTemplateFile(name string) ([][3]string, error)\n```\nGetLabelTemplateFile loads the label template file by given name, then parses and returns a list of name-color pairs and optionally description.\n\n```go\nfunc GetNotificationCount(user *User, status NotificationStatus) (int64, error)\n```\nGetNotificationCount returns the notification count for user\n\n```go\nfunc GetPrivateRepositoryCount(u *User) (int64, error)\n```\nGetPrivateRepositoryCount returns the total number of private repositories of user.\n\n```go\nfunc GetPublicRepositoryCount(u *User) (int64, error)\n```\nGetPublicRepositoryCount returns the total number of public repositories of user.\n\n```go\nfunc GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Writer) error\n```\nGetRawDiff dumps diff results of repository in given commit ID to io.Writer. TODO: move this function to gogits/git-module\n\n```go\nfunc GetRawDiffForFile(repoPath, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error\n```\nGetRawDiffForFile dumps diff results of file in given commit ID to io.Writer. TODO: move this function to gogits/git-module\n\n```go\nfunc GetReleaseAttachments(rels ...*Release) (err error)\n```\nGetReleaseAttachments retrieves the attachments for releases\n\n```go\nfunc GetReleaseCountByRepoID(repoID int64, opts FindReleasesOptions) (int64, error)\n```\nGetReleaseCountByRepoID returns the count of releases of repository\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 GetRepositoriesMapByIDs(ids []int64) (map[int64]*Repository, error)\n```\nGetRepositoriesMapByIDs returns the repositories by given id slice.\n\n```go\nfunc GetRepositoryCount(u *User) (int64, error)\n```\nGetRepositoryCount returns the total number of repositories of user.\n\n```go\nfunc GetTagsByPath(path string) ([]*git.Tag, error)\n```\nGetTagsByPath returns repo tags by it's path\n\n```go\nfunc GetUser(user *User) (bool, error)\n```\nGetUser checks if a user already exists\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, error)\n```\nGetUserSalt returns a random user salt token.\n\n```go\nfunc GitConfigPath(repoPath string) string\n```\nGitConfigPath returns the path to a repository's git config/ directory\n\n```go\nfunc GitFsck()\n```\nGitFsck calls 'git fsck' to check repository health.\n\n```go\nfunc GitGcRepos() error\n```\nGitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository\n\n```go\nfunc HasAccess(userID int64, repo *Repository) (bool, error)\n```\nHasAccess returns true if user has access to repo\n\n```go\nfunc HasAccessUnit(user *User, repo *Repository, unitType UnitType, testMode AccessMode) (bool, error)\n```\nHasAccessUnit returns ture if user has testMode to the unit of the repository\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 HasOrgVisible(org *User, user *User) bool\n```\nHasOrgVisible tells if the given user can see the given org\n\n```go\nfunc HasOrgsVisible(orgs []*User, user *User) bool\n```\nHasOrgsVisible tells if the given user can see at least one of the orgs provided\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```\nInitDeliverHooks starts the hooks delivery thread\n\n```go\nfunc InitFixtures(helper testfixtures.Helper, dir string) (err error)\n```\nInitFixtures initialize test fixtures for a test database\n\n```go\nfunc InitMailRender(tmpls *template.Template)\n```\nInitMailRender initializes the macaron mail renderer\n\n```go\nfunc InitOAuth2() error\n```\nInitOAuth2 initialize the OAuth2 lib and register all active OAuth2 providers in the library\n\n```go\nfunc InitRepoIndexer()\n```\nInitRepoIndexer initialize the repo indexer\n\n```go\nfunc InitSyncMirrors()\n```\nInitSyncMirrors initializes a go routine to sync the mirrors\n\n```go\nfunc InitTestPullRequests()\n```\nInitTestPullRequests runs the task to test all the checking status pull requests\n\n```go\nfunc IsEmailUsed(email string) (bool, error)\n```\nIsEmailUsed returns true if the email has been used.\n\n```go\nfunc IsErrAccessTokenEmpty(err error) bool\n```\nIsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.\n\n```go\nfunc IsErrAccessTokenNotExist(err error) bool\n```\nIsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.\n\n```go\nfunc IsErrAttachmentNotExist(err error) bool\n```\nIsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.\n\n```go\nfunc IsErrBranchAlreadyExists(err error) bool\n```\nIsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.\n\n```go\nfunc IsErrBranchNameConflict(err error) bool\n```\nIsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.\n\n```go\nfunc IsErrBranchNotExist(err error) bool\n```\nIsErrBranchNotExist checks if an error is a ErrBranchNotExist.\n\n```go\nfunc IsErrCircularDependency(err error) bool\n```\nIsErrCircularDependency checks if an error is a ErrCircularDependency.\n\n```go\nfunc IsErrCommentNotExist(err error) bool\n```\nIsErrCommentNotExist checks if an error is a ErrCommentNotExist.\n\n```go\nfunc IsErrDependenciesLeft(err error) bool\n```\nIsErrDependenciesLeft checks if an error is a ErrDependenciesLeft.\n\n```go\nfunc IsErrDependencyExists(err error) bool\n```\nIsErrDependencyExists checks if an error is a ErrDependencyExists.\n\n```go\nfunc IsErrDependencyNotExists(err error) bool\n```\nIsErrDependencyNotExists checks if an error is a ErrDependencyExists.\n\n```go\nfunc IsErrDeployKeyAlreadyExist(err error) bool\n```\nIsErrDeployKeyAlreadyExist checks if an error is a ErrDeployKeyAlreadyExist.\n\n```go\nfunc IsErrDeployKeyNameAlreadyUsed(err error) bool\n```\nIsErrDeployKeyNameAlreadyUsed checks if an error is a ErrDeployKeyNameAlreadyUsed.\n\n```go\nfunc IsErrDeployKeyNotExist(err error) bool\n```\nIsErrDeployKeyNotExist checks if an error is a ErrDeployKeyNotExist.\n\n```go\nfunc IsErrEmailAlreadyUsed(err error) bool\n```\nIsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed.\n\n```go\nfunc IsErrExternalLoginUserAlreadyExist(err error) bool\n```\nIsErrExternalLoginUserAlreadyExist checks if an error is a ExternalLoginUserAlreadyExist.\n\n```go\nfunc IsErrExternalLoginUserNotExist(err error) bool\n```\nIsErrExternalLoginUserNotExist checks if an error is a ExternalLoginUserNotExist.\n\n```go\nfunc IsErrGPGKeyAccessDenied(err error) bool\n```\nIsErrGPGKeyAccessDenied checks if an error is a ErrGPGKeyAccessDenied.\n\n```go\nfunc IsErrGPGKeyIDAlreadyUsed(err error) bool\n```\nIsErrGPGKeyIDAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.\n\n```go\nfunc IsErrGPGKeyNotExist(err error) bool\n```\nIsErrGPGKeyNotExist checks if an error is a ErrGPGKeyNotExist.\n\n```go\nfunc IsErrGPGKeyParsing(err error) bool\n```\nIsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing.\n\n```go\nfunc IsErrGPGNoEmailFound(err error) bool\n```\nIsErrGPGNoEmailFound checks if an error is a ErrGPGNoEmailFound.\n\n```go\nfunc IsErrInvalidCloneAddr(err error) bool\n```\nIsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.\n\n```go\nfunc IsErrInvalidMergeStyle(err error) bool\n```\nIsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.\n\n```go\nfunc IsErrInvalidTagName(err error) bool\n```\nIsErrInvalidTagName checks if an error is a ErrInvalidTagName.\n\n```go\nfunc IsErrIssueNotExist(err error) bool\n```\nIsErrIssueNotExist checks if an error is a ErrIssueNotExist.\n\n```go\nfunc IsErrKeyAccessDenied(err error) bool\n```\nIsErrKeyAccessDenied checks if an error is a ErrKeyAccessDenied.\n\n```go\nfunc IsErrKeyAlreadyExist(err error) bool\n```\nIsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist.\n\n```go\nfunc IsErrKeyNameAlreadyUsed(err error) bool\n```\nIsErrKeyNameAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.\n\n```go\nfunc IsErrKeyNotExist(err error) bool\n```\nIsErrKeyNotExist checks if an error is a ErrKeyNotExist.\n\n```go\nfunc IsErrKeyUnableVerify(err error) bool\n```\nIsErrKeyUnableVerify checks if an error is a ErrKeyUnableVerify.\n\n```go\nfunc IsErrLFSLockAlreadyExist(err error) bool\n```\nIsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.\n\n```go\nfunc IsErrLFSLockNotExist(err error) bool\n```\nIsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.\n\n```go\nfunc IsErrLFSUnauthorizedAction(err error) bool\n```\nIsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.\n\n```go\nfunc IsErrLabelNotExist(err error) bool\n```\nIsErrLabelNotExist checks if an error is a ErrLabelNotExist.\n\n```go\nfunc IsErrLastOrgOwner(err error) bool\n```\nIsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.\n\n```go\nfunc IsErrLoginSourceAlreadyExist(err error) bool\n```\nIsErrLoginSourceAlreadyExist checks if an error is a ErrLoginSourceAlreadyExist.\n\n```go\nfunc IsErrLoginSourceInUse(err error) bool\n```\nIsErrLoginSourceInUse checks if an error is a ErrLoginSourceInUse.\n\n```go\nfunc IsErrLoginSourceNotExist(err error) bool\n```\nIsErrLoginSourceNotExist checks if an error is a ErrLoginSourceNotExist.\n\n```go\nfunc IsErrMilestoneNotExist(err error) bool\n```\nIsErrMilestoneNotExist checks if an error is a ErrMilestoneNotExist.\n\n```go\nfunc IsErrNamePatternNotAllowed(err error) bool\n```\nIsErrNamePatternNotAllowed checks if an error is an ErrNamePatternNotAllowed.\n\n```go\nfunc IsErrNameReserved(err error) bool\n```\nIsErrNameReserved checks if an error is a ErrNameReserved.\n\n```go\nfunc IsErrNotAllowedToMerge(err error) bool\n```\nIsErrNotAllowedToMerge checks if an error is an ErrNotAllowedToMerge.\n\n```go\nfunc IsErrOAuthApplicationNotFound(err error) bool\n```\nIsErrOAuthApplicationNotFound checks if an error is a ErrReviewNotExist.\n\n```go\nfunc IsErrOauthClientIDInvalid(err error) bool\n```\nIsErrOauthClientIDInvalid checks if an error is a ErrReviewNotExist.\n\n```go\nfunc IsErrOpenIDAlreadyUsed(err error) bool\n```\nIsErrOpenIDAlreadyUsed checks if an error is a ErrOpenIDAlreadyUsed.\n\n```go\nfunc IsErrOpenIDConnectInitialize(err error) bool\n```\nIsErrOpenIDConnectInitialize checks if an error is a ExternalLoginUserAlreadyExist.\n\n```go\nfunc IsErrOrgNotExist(err error) bool\n```\nIsErrOrgNotExist checks if an error is a ErrOrgNotExist.\n\n```go\nfunc IsErrPullRequestAlreadyExists(err error) bool\n```\nIsErrPullRequestAlreadyExists checks if an error is a ErrPullRequestAlreadyExists.\n\n```go\nfunc IsErrPullRequestNotExist(err error) bool\n```\nIsErrPullRequestNotExist checks if an error is a ErrPullRequestNotExist.\n\n```go\nfunc IsErrReachLimitOfRepo(err error) bool\n```\nIsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.\n\n```go\nfunc IsErrReleaseAlreadyExist(err error) bool\n```\nIsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.\n\n```go\nfunc IsErrReleaseNotExist(err error) bool\n```\nIsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.\n\n```go\nfunc IsErrRepoAlreadyExist(err error) bool\n```\nIsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.\n\n```go\nfunc IsErrRepoFileAlreadyExist(err error) bool\n```\nIsErrRepoFileAlreadyExist checks if an error is a ErrRepoFileAlreadyExist.\n\n```go\nfunc IsErrRepoNotExist(err error) bool\n```\nIsErrRepoNotExist checks if an error is a ErrRepoNotExist.\n\n```go\nfunc IsErrRepoRedirectNotExist(err error) bool\n```\nIsErrRepoRedirectNotExist check if an error is an ErrRepoRedirectNotExist\n\n```go\nfunc IsErrReviewNotExist(err error) bool\n```\nIsErrReviewNotExist checks if an error is a ErrReviewNotExist.\n\n```go\nfunc IsErrSSHDisabled(err error) bool\n```\nIsErrSSHDisabled checks if an error is a ErrSSHDisabled.\n\n```go\nfunc IsErrStopwatchNotExist(err error) bool\n```\nIsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.\n\n```go\nfunc IsErrTagAlreadyExists(err error) bool\n```\nIsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.\n\n```go\nfunc IsErrTeamAlreadyExist(err error) bool\n```\nIsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.\n\n```go\nfunc IsErrTopicNotExist(err error) bool\n```\nIsErrTopicNotExist checks if an error is an ErrTopicNotExist.\n\n```go\nfunc IsErrTrackedTimeNotExist(err error) bool\n```\nIsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.\n\n```go\nfunc IsErrTwoFactorNotEnrolled(err error) bool\n```\nIsErrTwoFactorNotEnrolled checks if an error is a ErrTwoFactorNotEnrolled.\n\n```go\nfunc IsErrU2FRegistrationNotExist(err error) bool\n```\nIsErrU2FRegistrationNotExist checks if an error is a ErrU2FRegistrationNotExist.\n\n```go\nfunc IsErrUnknownDependencyType(err error) bool\n```\nIsErrUnknownDependencyType checks if an error is ErrUnknownDependencyType\n\n```go\nfunc IsErrUpdateTaskNotExist(err error) bool\n```\nIsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.\n\n```go\nfunc IsErrUploadNotExist(err error) bool\n```\nIsErrUploadNotExist checks if an error is a ErrUploadNotExist.\n\n```go\nfunc IsErrUserAlreadyExist(err error) bool\n```\nIsErrUserAlreadyExist checks if an error is a ErrUserAlreadyExists.\n\n```go\nfunc IsErrUserDoesNotHaveAccessToRepo(err error) bool\n```\nIsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrRepoFileAlreadyExist.\n\n```go\nfunc IsErrUserHasOrgs(err error) bool\n```\nIsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.\n\n```go\nfunc IsErrUserInactive(err error) bool\n```\nIsErrUserInactive checks if an error is a ErrUserInactive\n\n```go\nfunc IsErrUserNotAllowedCreateOrg(err error) bool\n```\nIsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.\n\n```go\nfunc IsErrUserNotExist(err error) bool\n```\nIsErrUserNotExist checks if an error is a ErrUserNotExist.\n\n```go\nfunc IsErrUserOwnRepos(err error) bool\n```\nIsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.\n\n```go\nfunc IsErrUserProhibitLogin(err error) bool\n```\nIsErrUserProhibitLogin checks if an error is a ErrUserProhibitLogin\n\n```go\nfunc IsErrWebhookNotExist(err error) bool\n```\nIsErrWebhookNotExist checks if an error is a ErrWebhookNotExist.\n\n```go\nfunc IsErrWikiAlreadyExist(err error) bool\n```\nIsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.\n\n```go\nfunc IsErrWikiInvalidFileName(err error) bool\n```\nIsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.\n\n```go\nfunc IsErrWikiReservedName(err error) bool\n```\nIsErrWikiReservedName checks if an error is an ErrWikiReservedName.\n\n```go\nfunc IsFollowing(userID, followID int64) bool\n```\nIsFollowing returns true if user is following followID.\n\n```go\nfunc IsOpenIDUsed(openid string) (bool, error)\n```\nIsOpenIDUsed returns true if the openid has been used.\n\n```go\nfunc IsOrganizationMember(orgID, uid int64) (bool, error)\n```\nIsOrganizationMember returns true if given user is member of organization.\n\n```go\nfunc IsOrganizationOwner(orgID, uid int64) (bool, error)\n```\nIsOrganizationOwner returns true if given user is in the owner team.\n\n```go\nfunc IsPublicMembership(orgID, uid int64) (bool, error)\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(userID, repoID int64) bool\n```\nIsStaring checks if user has starred given repository.\n\n```go\nfunc IsTeamMember(orgID, teamID, userID int64) (bool, error)\n```\nIsTeamMember returns true if given user is a member of team.\n\n```go\nfunc IsUsableRepoName(name string) error\n```\nIsUsableRepoName returns true when repository is usable\n\n```go\nfunc IsUsableTeamName(name string) error\n```\nIsUsableTeamName tests if a name could be as team name\n\n```go\nfunc IsUsableUsername(name string) error\n```\nIsUsableUsername returns an error when a username is reserved\n\n```go\nfunc IsUserAssignedToIssue(issue *Issue, user *User) (isAssigned bool, err error)\n```\nIsUserAssignedToIssue returns true when the user is assigned to the issue\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 IsUserInTeams(userID int64, teamIDs []int64) (bool, error)\n```\nIsUserInTeams returns if a user in some teams\n\n```go\nfunc IsUserRepoAdmin(repo *Repository, user *User) (bool, error)\n```\nIsUserRepoAdmin return ture if user has admin right of a repo\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(userID, repoID int64) bool\n```\nIsWatching checks if user has watched given repository.\n\n```go\nfunc IssueNoDependenciesLeft(issue *Issue) (bool, error)\n```\nIssueNoDependenciesLeft checks if issue can be closed\n\n```go\nfunc LinkAccountToUser(user *User, gothUser goth.User) error\n```\nLinkAccountToUser link the gothUser to the user\n\n```go\nfunc LoadConfigs()\n```\nLoadConfigs loads the database settings\n\n```go\nfunc LoadFixtures() error\n```\nLoadFixtures load fixtures for a test database\n\n```go\nfunc LoadRepoConfig()\n```\nLoadRepoConfig loads the repository config\n\n```go\nfunc LocalCopyPath() string\n```\nLocalCopyPath returns the local repository copy path.\n\n```go\nfunc LocalWikiPath() string\n```\nLocalWikiPath returns the local wiki repository copy path.\n\n```go\nfunc LockIssue(opts *IssueLockOptions) error\n```\nLockIssue locks an issue. This would limit commenting abilities to users with write access to the repo\n\n```go\nfunc LookupRepoRedirect(ownerID int64, repoName string) (int64, error)\n```\nLookupRepoRedirect look up if a repository has a redirect name\n\n```go\nfunc MainTest(m *testing.M, pathToGiteaRoot string)\n```\nMainTest a reusable TestMain(..) function for unit tests that need to use a test database. Creates the test database, and sets necessary settings.\n\n```go\nfunc MakeAssigneeList(issue *Issue) (assigneeList string, err error)\n```\nMakeAssigneeList concats a string with all names of the assignees. Useful for logs.\n\n```go\nfunc MakeEmailPrimary(email *EmailAddress) error\n```\nMakeEmailPrimary sets primary email address of given user.\n\n```go\nfunc MakeIDsFromAPIAssigneesToAdd(oneAssignee string, multipleAssignees []string) (assigneeIDs []int64, err error)\n```\nMakeIDsFromAPIAssigneesToAdd returns an array with all assignee IDs\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, err error)\n```\nMilestoneStats returns number of open and closed milestones of given repository.\n\n```go\nfunc MirrorSyncCreateAction(repo *Repository, refName string) error\n```\nMirrorSyncCreateAction adds new action for mirror synchronization of new reference.\n\n```go\nfunc MirrorSyncDeleteAction(repo *Repository, refName string) error\n```\nMirrorSyncDeleteAction adds new action for mirror synchronization of delete reference.\n\n```go\nfunc MirrorSyncPushAction(repo *Repository, opts MirrorSyncPushActionOptions) error\n```\nMirrorSyncPushAction adds new action for mirror synchronization of pushed commits.\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 NewCommitStatus(repo *Repository, creator *User, sha string, status *CommitStatus) error\n```\nNewCommitStatus creates a new CommitStatus given a bunch of parameters NOTE: All text-values will be trimmed from whitespaces. Requires: Repo, Creator, SHA\n\n```go\nfunc NewEngine(migrateFunc func(*xorm.Engine) error) (err error)\n```\nNewEngine initializes a new xorm.Engine\n\n```go\nfunc NewIssue(repo *Repository, issue *Issue, labelIDs []int64, assigneeIDs []int64, uuids []string) (err error)\n```\nNewIssue creates new issue with labels for repository.\n\n```go\nfunc NewIssueLabel(issue *Issue, label *Label, doer *User) (err error)\n```\nNewIssueLabel creates a new issue-label relation.\n\n```go\nfunc NewIssueLabels(issue *Issue, labels []*Label, doer *User) (err error)\n```\nNewIssueLabels creates a list of issue-label relations.\n\n```go\nfunc NewLabel(label *Label) error\n```\nNewLabel creates a new label for a repository\n\n```go\nfunc NewLabels(labels ...*Label) error\n```\nNewLabels creates new labels for a 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, assigneeIDs []int64) (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```\nNewRepoContext creates a new repository context\n\n```go\nfunc NewRepoRedirect(ownerID, repoID int64, oldRepoName, newRepoName string) error\n```\nNewRepoRedirect create a new repo redirect\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```\nNewTestEngine sets a new test xorm.Engine\n\n```go\nfunc NewTwoFactor(t *TwoFactor) error\n```\nNewTwoFactor creates a new two-factor authentication token.\n\n```go\nfunc NormalizeWikiName(name string) string\n```\nNormalizeWikiName normalizes a wiki name\n\n```go\nfunc NotifyWatchers(act *Action) error\n```\nNotifyWatchers creates batch of actions for every watcher.\n\n```go\nfunc ParseCommitsWithSignature(oldCommits *list.List) *list.List\n```\nParseCommitsWithSignature checks if signaute of commits are corresponding to users gpg keys.\n\n```go\nfunc ParseCommitsWithStatus(oldCommits *list.List, repo *Repository) *list.List\n```\nParseCommitsWithStatus checks commits latest statuses and calculates its worst status state\n\n```go\nfunc ParseMSSQLHostPort(info string) (string, string)\n```\nParseMSSQLHostPort splits the host into host and port\n\n```go\nfunc Ping() error\n```\nPing tests if database is alive\n\n```go\nfunc PrepareTestDatabase() error\n```\nPrepareTestDatabase load test fixtures into test database\n\n```go\nfunc PrepareTestEnv(t testing.TB)\n```\nPrepareTestEnv prepares the environment for unit tests. Can only be called by tests that use the above MainTest(..) function.\n\n```go\nfunc PrepareWebhook(w *Webhook, repo *Repository, event HookEventType, p api.Payloader) error\n```\nPrepareWebhook adds special webhook to task queue for given payload.\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 PushUpdate(branch string, opt PushUpdateOptions) error\n```\nPushUpdate must be called for any push actions in order to generates necessary push action history feeds.\n\n```go\nfunc ReinitMissingRepositories() error\n```\nReinitMissingRepositories reinitializes all repository records that lost Git files.\n\n```go\nfunc RemoveAccountLink(user *User, loginSourceID int64) (int64, error)\n```\nRemoveAccountLink will remove all external login sources for the given user\n\n```go\nfunc RemoveAllWithNotice(title, path string)\n```\nRemoveAllWithNotice removes all directories in given path and creates a system notice when error occurs.\n\n```go\nfunc RemoveIssueDependency(user *User, issue *Issue, dep *Issue, depType DependencyType) (err error)\n```\nRemoveIssueDependency removes a dependency from an issue\n\n```go\nfunc RemoveOldDeletedBranches()\n```\nRemoveOldDeletedBranches removes old deleted branches\n\n```go\nfunc RemoveOrgUser(orgID, userID int64) error\n```\nRemoveOrgUser removes user from given organization.\n\n```go\nfunc RemoveTeamMember(team *Team, userID int64) error\n```\nRemoveTeamMember removes member from given team of given organization.\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. Note: x.Iterate does not get latest data after insert/delete, so we have to call this function outside any session scope independently.\n\n```go\nfunc SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error\n```\nSMTPAuth performs an SMTP authentication.\n\n```go\nfunc SSHKeyGenParsePublicKey(key string) (string, int, error)\n```\nSSHKeyGenParsePublicKey extracts key type and length using ssh-keygen.\n\n```go\nfunc SSHNativeParsePublicKey(keyLine string) (string, int, error)\n```\nSSHNativeParsePublicKey extracts the key type and length using the golang SSH library.\n\n```go\nfunc SaveTopics(repoID int64, topicNames ...string) error\n```\nSaveTopics save topics to a repository\n\n```go\nfunc SearchIssueIDsByKeyword(kw string, repoID int64, limit, start int) (int64, []int64, error)\n```\nSearchIssueIDsByKeyword search issues on database\n\n```go\nfunc SecToTime(duration int64) string\n```\nSecToTime converts an amount of seconds to a human-readable string (example: 66s -\u003e 1min 6s)\n\n```go\nfunc SendActivateAccountMail(c *macaron.Context, u *User)\n```\nSendActivateAccountMail sends an activation mail to the user (new user registration)\n\n```go\nfunc SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress)\n```\nSendActivateEmailMail sends confirmation email to confirm new email address\n\n```go\nfunc SendCollaboratorMail(u, doer *User, repo *Repository)\n```\nSendCollaboratorMail sends mail notification to new collaborator.\n\n```go\nfunc SendIssueCommentMail(issue *Issue, doer *User, content string, comment *Comment, tos []string)\n```\nSendIssueCommentMail composes and sends issue comment emails to target receivers.\n\n```go\nfunc SendIssueMentionMail(issue *Issue, doer *User, content string, comment *Comment, tos []string)\n```\nSendIssueMentionMail composes and sends issue mention emails to target receivers.\n\n```go\nfunc SendRegisterNotifyMail(c *macaron.Context, u *User)\n```\nSendRegisterNotifyMail triggers a notify e-mail by admin created a account.\n\n```go\nfunc SendResetPasswordMail(c *macaron.Context, u *User)\n```\nSendResetPasswordMail sends a password reset mail to the user\n\n```go\nfunc SendTestMail(email string) error\n```\nSendTestMail sends a test mail\n\n```go\nfunc SendUserMail(c *macaron.Context, u *User, tpl base.TplName, code, subject, info string)\n```\nSendUserMail sends a mail to the user\n\n```go\nfunc SetEngine() (err error)\n```\nSetEngine sets the xorm.Engine\n\n```go\nfunc SetNotificationStatus(notificationID int64, user *User, status NotificationStatus) error\n```\nSetNotificationStatus change the notification status\n\n```go\nfunc SlackLinkFormatter(url string, text string) string\n```\nSlackLinkFormatter creates a link compatible with slack\n\n```go\nfunc SlackLinkToRef(repoURL, ref string) string\n```\nSlackLinkToRef slack-formatter link to a repo ref\n\n```go\nfunc SlackShortTextFormatter(s string) string\n```\nSlackShortTextFormatter replaces \u0026, \\\u003c, \u003e with HTML characters\n\n```go\nfunc SlackTextFormatter(s string) string\n```\nSlackTextFormatter replaces \u0026, \\\u003c, \u003e with HTML characters see: [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(userID, repoID int64, star bool) error\n```\nStarRepo or unstar repository.\n\n```go\nfunc StopwatchExists(userID int64, issueID int64) bool\n```\nStopwatchExists returns true if the stopwatch exists\n\n```go\nfunc SyncExternalUsers()\n```\nSyncExternalUsers is used to synchronize users with external authorization source\n\n```go\nfunc SyncMirrors()\n```\nSyncMirrors checks and syncs mirrors. TODO: sync more mirrors at same time.\n\n```go\nfunc SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error\n```\nSyncReleasesWithTags synchronizes release table with repository tags\n\n```go\nfunc SyncRepositoryHooks() error\n```\nSyncRepositoryHooks rewrites all repositories' pre-receive, update and post-receive hooks to make sure the binary and custom conf path are up-to-date.\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 ToggleUserOpenIDVisibility(id int64) (err error)\n```\nToggleUserOpenIDVisibility toggles visibility of an openid address of given user.\n\n```go\nfunc TotalTimes(options FindTrackedTimesOptions) (map[*User]string, error)\n```\nTotalTimes returns the spent time for each user by an issue\n\n```go\nfunc TransferOwnership(doer *User, newOwnerName string, repo *Repository) error\n```\nTransferOwnership transfers all corresponding setting from old user to new one.\n\n```go\nfunc TransferRepoAction(doer, oldOwner *User, repo *Repository) error\n```\nTransferRepoAction adds new action for transferring repository, the Owner field of repository is assumed to be new owner.\n\n```go\nfunc UnfollowUser(userID, followID int64) (err error)\n```\nUnfollowUser unmarks someone as another's follower.\n\n```go\nfunc UnlockIssue(opts *IssueLockOptions) error\n```\nUnlockIssue unlocks a previously locked issue.\n\n```go\nfunc UpdateAPIAssignee(issue *Issue, oneAssignee string, multipleAssignees []string, doer *User) (err error)\n```\nUpdateAPIAssignee is a helper function to add or delete one or multiple issue assignee(s) Deleting is done the GitHub way (quote from their api documentation): [https://developer.github.com/v3/issues/#edit-an-issue](https://developer.github.com/v3/issues/#edit-an-issue) \"assignees\" (array): Logins for Users to assign to this issue. Pass one or more user logins to replace the set of assignees on this Issue. Send an empty array (\\[]) to clear all assignees from the Issue.\n\n```go\nfunc UpdateAccessToken(t *AccessToken) error\n```\nUpdateAccessToken updates information of access token.\n\n```go\nfunc UpdateAssignee(issue *Issue, doer *User, assigneeID int64) (err error)\n```\nUpdateAssignee deletes or adds an assignee to an issue\n\n```go\nfunc UpdateAttachment(atta *Attachment) error\n```\nUpdateAttachment updates the given attachment in database\n\n```go\nfunc UpdateComment(doer *User, c *Comment, oldContent string) 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 UpdateDeployKeyCols(key *DeployKey, cols ...string) error\n```\nUpdateDeployKeyCols updates deploy key information in the specified columns.\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 UpdateIssueCols(issue *Issue, cols ...string) error\n```\nUpdateIssueCols only updates values of specific columns for given issue.\n\n```go\nfunc UpdateIssueDeadline(issue *Issue, deadlineUnix util.TimeStamp, doer *User) (err error)\n```\nUpdateIssueDeadline updates an issue deadline and adds comments. Setting a deadline to 0 means deleting it.\n\n```go\nfunc UpdateIssueMentions(e Engine, issueID int64, mentions []string) error\n```\nUpdateIssueMentions extracts mentioned people from content and updates issue-user relations for them.\n\n```go\nfunc UpdateIssueUserByRead(uid, issueID int64) error\n```\nUpdateIssueUserByRead updates issue-user relation for reading.\n\n```go\nfunc UpdateIssueUsersByMentions(e Engine, issueID int64, uids []int64) error\n```\nUpdateIssueUsersByMentions updates issue-user pairs by mentioning.\n\n```go\nfunc UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit, branchName string) error\n```\nUpdateIssuesCommit checks if issues are manipulated by commit message.\n\n```go\nfunc UpdateLabel(l *Label) error\n```\nUpdateLabel updates label information.\n\n```go\nfunc UpdateLocalCopyBranch(repoPath, localPath, branch string) error\n```\nUpdateLocalCopyBranch pulls latest changes of given branch from repoPath to localPath. It creates a new clone if local copy does not exist. This function checks out target branch by default, it is safe to assume subsequent operations are operating against target branch when caller has confidence for no race condition.\n\n```go\nfunc UpdateMilestone(m *Milestone) error\n```\nUpdateMilestone updates information of given milestone.\n\n```go\nfunc UpdateMirror(m *Mirror) error\n```\nUpdateMirror updates the mirror\n\n```go\nfunc UpdateNotificationStatuses(user *User, currentStatus NotificationStatus, desiredStatus NotificationStatus) error\n```\nUpdateNotificationStatuses updates the statuses of all of a user's notifications that are of the currentStatus type to the desiredStatus\n\n```go\nfunc UpdateOAuth2Application(opts UpdateOAuth2ApplicationOptions) error\n```\nUpdateOAuth2Application updates an oauth2 application\n\n```go\nfunc UpdateProtectBranch(repo *Repository, protectBranch *ProtectedBranch, opts WhitelistOptions) (err error)\n```\nUpdateProtectBranch saves branch protection options of repository. If ID is 0, it creates a new record. Otherwise, updates existing record. This function also performs check if whitelist user and team's IDs have been changed to avoid unnecessary whitelist delete and regenerate.\n\n```go\nfunc UpdatePublicKeyUpdated(id int64) error\n```\nUpdatePublicKeyUpdated updates public key use time.\n\n```go\nfunc UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachmentUUIDs []string) (err error)\n```\nUpdateRelease updates information of a release.\n\n```go\nfunc UpdateRepoIndexer(repo *Repository)\n```\nUpdateRepoIndexer update a repository's entries in the indexer\n\n```go\nfunc UpdateRepository(repo *Repository, visibilityChanged bool) (err error)\n```\nUpdateRepository updates a repository\n\n```go\nfunc UpdateRepositoryUnits(repo *Repository, units []RepoUnit) (err error)\n```\nUpdateRepositoryUnits updates a repository's units\n\n```go\nfunc UpdateReview(r *Review) error\n```\nUpdateReview will update all cols of the given review in db\n\n```go\nfunc UpdateSource(source *LoginSource) error\n```\nUpdateSource updates a LoginSource record in DB.\n\n```go\nfunc UpdateTeam(t *Team, authChanged bool) (err error)\n```\nUpdateTeam updates information of team.\n\n```go\nfunc UpdateTeamUnits(team *Team, units []TeamUnit) (err error)\n```\nUpdateTeamUnits updates a teams's units\n\n```go\nfunc UpdateTwoFactor(t *TwoFactor) error\n```\nUpdateTwoFactor updates a two-factor authentication token.\n\n```go\nfunc UpdateUser(u *User) error\n```\nUpdateUser updates user's information.\n\n```go\nfunc UpdateUserCols(u *User, cols ...string) error\n```\nUpdateUserCols update user according special columns\n\n```go\nfunc UpdateUserSetting(u *User) error\n```\nUpdateUserSetting updates user's settings.\n\n```go\nfunc UpdateWebhook(w *Webhook) error\n```\nUpdateWebhook updates information of webhook.\n\n```go\nfunc UpdateWebhookLastStatus(w *Webhook) error\n```\nUpdateWebhookLastStatus updates last status of webhook.\n\n```go\nfunc UploadLocalPath(uuid string) string\n```\nUploadLocalPath returns where uploads is stored in local file system based on given UUID.\n\n```go\nfunc UserPath(userName string) string\n```\nUserPath returns the path absolute path of user repositories.\n\n```go\nfunc UsersInTeamsCount(userIDs []int64, teamIDs []int64) (count int64, err error)\n```\nUsersInTeamsCount counts the number of users which are in userIDs and teamIDs\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 ValidateTopic(topic string) bool\n```\nValidateTopic checks topics by length and match pattern rules\n\n```go\nfunc WatchRepo(userID, repoID int64, watch bool) (err error)\n```\nWatchRepo watch or unwatch repository.\n\n```go\nfunc WikiFilenameToName(filename string) (string, error)\n```\nWikiFilenameToName converts a wiki filename to its corresponding page name.\n\n```go\nfunc WikiNameToFilename(name string) string\n```\nWikiNameToFilename converts a wiki name to its corresponding filename.\n\n```go\nfunc WikiNameToSubURL(name string) string\n```\nWikiNameToSubURL converts a wiki name to its corresponding sub-URL.\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```\nAccessMode specifies the users access mode\n\n```go\nconst (\n\t// AccessModeNone no access\n\tAccessModeNone AccessMode = iota // 0\n\t// AccessModeRead read access\n\tAccessModeRead // 1\n\t// AccessModeWrite write access\n\tAccessModeWrite // 2\n\t// AccessModeAdmin admin access\n\tAccessModeAdmin // 3\n\t// AccessModeOwner owner access\n\tAccessModeOwner // 4\n)\n```\n\n```go\nfunc AccessLevel(user *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.\n\n```go\nfunc ParseAccessMode(permission string) AccessMode\n```\nParseAccessMode returns corresponding access mode to given permission string.\n\n```go\nfunc (mode AccessMode) String() string\n```\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\n\tCreatedUnix       util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix       util.TimeStamp `xorm:\"INDEX updated\"`\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\nfunc (t *AccessToken) AfterLoad()\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\ntype AccessibleReposEnvironment interface {\n\tCountRepos() (int64, error)\n\tRepoIDs(page, pageSize int) ([]int64, error)\n\tRepos(page, pageSize int) ([]*Repository, error)\n\tMirrorRepos() ([]*Repository, error)\n\tAddKeyword(keyword string)\n\tSetSort(SearchOrderBy)\n}\n```\nAccessibleReposEnvironment operations involving the repositories that are accessible to a particular user\n\n```go\ntype Action struct {\n\tID          int64 `xorm:\"pk autoincr\"`\n\tUserID      int64 `xorm:\"INDEX\"` // Receiver user id.\n\tOpType      ActionType\n\tActUserID   int64       `xorm:\"INDEX\"` // Action user id.\n\tActUser     *User       `xorm:\"-\"`\n\tRepoID      int64       `xorm:\"INDEX\"`\n\tRepo        *Repository `xorm:\"-\"`\n\tCommentID   int64       `xorm:\"INDEX\"`\n\tComment     *Comment    `xorm:\"-\"`\n\tIsDeleted   bool        `xorm:\"INDEX NOT NULL DEFAULT false\"`\n\tRefName     string\n\tIsPrivate   bool           `xorm:\"INDEX NOT NULL DEFAULT false\"`\n\tContent     string         `xorm:\"TEXT\"`\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX 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(opts GetFeedsOptions) ([]*Action, error)\n```\nGetFeeds returns actions according to the provided options\n\n```go\nfunc (a *Action) GetActAvatar() string\n```\nGetActAvatar the action's user's avatar link\n\n```go\nfunc (a *Action) GetActFullName() string\n```\nGetActFullName gets the action's user full name.\n\n```go\nfunc (a *Action) GetActUserName() string\n```\nGetActUserName gets the action's user name.\n\n```go\nfunc (a *Action) GetBranch() string\n```\nGetBranch returns the action's repository branch.\n\n```go\nfunc (a *Action) GetCommentLink() string\n```\nGetCommentLink returns link to action comment.\n\n```go\nfunc (a *Action) GetContent() string\n```\nGetContent returns the action's content.\n\n```go\nfunc (a *Action) GetCreate() time.Time\n```\nGetCreate returns the action creation time.\n\n```go\nfunc (a *Action) GetIssueContent() string\n```\nGetIssueContent returns the content of first issue associated with this action.\n\n```go\nfunc (a *Action) GetIssueInfos() []string\n```\nGetIssueInfos returns a list of issues associated with the action.\n\n```go\nfunc (a *Action) GetIssueTitle() string\n```\nGetIssueTitle returns the title of first issue associated with the action.\n\n```go\nfunc (a *Action) GetOpType() ActionType\n```\nGetOpType gets the ActionType of this action.\n\n```go\nfunc (a *Action) GetRepoLink() string\n```\nGetRepoLink returns relative link to action repository.\n\n```go\nfunc (a *Action) GetRepoName() string\n```\nGetRepoName returns the name of the action repository.\n\n```go\nfunc (a *Action) GetRepoPath() string\n```\nGetRepoPath returns the virtual path to the action repository.\n\n```go\nfunc (a *Action) GetRepoUserName() string\n```\nGetRepoUserName returns the name of the action repository owner.\n\n```go\nfunc (a *Action) ShortActUserName() string\n```\nShortActUserName gets the action's user name trimmed to max 20 chars.\n\n```go\nfunc (a *Action) ShortRepoName() string\n```\nShortRepoName returns the name of the action repository trimmed to max 33 chars.\n\n```go\nfunc (a *Action) ShortRepoPath() string\n```\nShortRepoPath returns the virtual path to the action repository trimmed to max 20 + 1 + 33 chars.\n\n```go\nfunc (a *Action) ShortRepoUserName() string\n```\nShortRepoUserName returns the name of the action repository owner trimmed to max 20 chars.\n\n```go\ntype ActionList []*Action\n```\nActionList defines a list of actions\n\n```go\nfunc (actions ActionList) LoadAttributes() error\n```\nLoadAttributes loads attributes of the actions\n\n```go\nfunc (actions ActionList) LoadRepositories() ([]*Repository, error)\n```\nLoadRepositories loads actions' all repositories\n\n```go\nfunc (actions ActionList) LoadUsers() ([]*User, error)\n```\nLoadUsers loads actions' all users\n\n```go\ntype ActionType int\n```\nActionType represents the type of an action.\n\n```go\nconst (\n\tActionCreateRepo        ActionType = iota + 1 // 1\n\tActionRenameRepo                              // 2\n\tActionStarRepo                                // 3\n\tActionWatchRepo                               // 4\n\tActionCommitRepo                              // 5\n\tActionCreateIssue                             // 6\n\tActionCreatePullRequest                       // 7\n\tActionTransferRepo                            // 8\n\tActionPushTag                                 // 9\n\tActionCommentIssue                            // 10\n\tActionMergePullRequest                        // 11\n\tActionCloseIssue                              // 12\n\tActionReopenIssue                             // 13\n\tActionClosePullRequest                        // 14\n\tActionReopenPullRequest                       // 15\n\tActionDeleteTag                               // 16\n\tActionDeleteBranch                            // 17\n\tActionMirrorSyncPush                          // 18\n\tActionMirrorSyncCreate                        // 19\n\tActionMirrorSyncDelete                        // 20\n)\n```\nPossible action types.\n\n```go\ntype ActivityStats struct {\n\tOpenedPRs                   PullRequestList\n\tOpenedPRAuthorCount         int64\n\tMergedPRs                   PullRequestList\n\tMergedPRAuthorCount         int64\n\tOpenedIssues                IssueList\n\tOpenedIssueAuthorCount      int64\n\tClosedIssues                IssueList\n\tClosedIssueAuthorCount      int64\n\tUnresolvedIssues            IssueList\n\tPublishedReleases           []*Release\n\tPublishedReleaseAuthorCount int64\n}\n```\nActivityStats represets issue and pull request information.\n\n```go\nfunc GetActivityStats(repoID int64, timeFrom time.Time, releases, issues, prs bool) (*ActivityStats, error)\n```\nGetActivityStats return stats for repository at given time range\n\n```go\nfunc (stats *ActivityStats) ActiveIssueCount() int\n```\nActiveIssueCount returns total active issue count\n\n```go\nfunc (stats *ActivityStats) ActivePRCount() int\n```\nActivePRCount returns total active pull request count\n\n```go\nfunc (stats *ActivityStats) ClosedIssueCount() int\n```\nClosedIssueCount returns closed issue count\n\n```go\nfunc (stats *ActivityStats) ClosedIssuePerc() int\n```\nClosedIssuePerc returns closed issue count percent from total active\n\n```go\nfunc (stats *ActivityStats) FillIssues(repoID int64, fromTime time.Time) error\n```\nFillIssues returns issue information for activity page\n\n```go\nfunc (stats *ActivityStats) FillPullRequests(repoID int64, fromTime time.Time) error\n```\nFillPullRequests returns pull request information for activity page\n\n```go\nfunc (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error\n```\nFillReleases returns release information for activity page\n\n```go\nfunc (stats *ActivityStats) FillUnresolvedIssues(repoID int64, fromTime time.Time, issues, prs bool) error\n```\nFillUnresolvedIssues returns unresolved issue and pull request information for activity page\n\n```go\nfunc (stats *ActivityStats) MergedPRCount() int\n```\nMergedPRCount returns merged pull request count\n\n```go\nfunc (stats *ActivityStats) MergedPRPerc() int\n```\nMergedPRPerc returns merged pull request percent from total active\n\n```go\nfunc (stats *ActivityStats) OpenedIssueCount() int\n```\nOpenedIssueCount returns open issue count\n\n```go\nfunc (stats *ActivityStats) OpenedIssuePerc() int\n```\nOpenedIssuePerc returns open issue count percent from total active\n\n```go\nfunc (stats *ActivityStats) OpenedPRCount() int\n```\nOpenedPRCount returns opened pull request count\n\n```go\nfunc (stats *ActivityStats) OpenedPRPerc() int\n```\nOpenedPRPerc returns opened pull request percents from total active\n\n```go\nfunc (stats *ActivityStats) PublishedReleaseCount() int\n```\nPublishedReleaseCount returns published release count\n\n```go\nfunc (stats *ActivityStats) UnresolvedIssueCount() int\n```\nUnresolvedIssueCount returns unresolved issue and pull request count\n\n```go\ntype Attachment struct {\n\tID            int64  `xorm:\"pk autoincr\"`\n\tUUID          string `xorm:\"uuid UNIQUE\"`\n\tIssueID       int64  `xorm:\"INDEX\"`\n\tReleaseID     int64  `xorm:\"INDEX\"`\n\tCommentID     int64\n\tName          string\n\tDownloadCount int64          `xorm:\"DEFAULT 0\"`\n\tSize          int64          `xorm:\"DEFAULT 0\"`\n\tCreatedUnix   util.TimeStamp `xorm:\"created\"`\n}\n```\nAttachment represent a attachment of issue/comment/release.\n\n```go\nfunc GetAttachmentByID(id int64) (*Attachment, error)\n```\nGetAttachmentByID returns attachment by given id\n\n```go\nfunc GetAttachmentByReleaseIDFileName(releaseID int64, fileName string) (*Attachment, error)\n```\nGetAttachmentByReleaseIDFileName returns attachment by given releaseId and fileName.\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 of an issue.\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 (a *Attachment) APIFormat() *api.Attachment\n```\nAPIFormat converts models.Attachment to api.Attachment\n\n```go\nfunc (a *Attachment) DownloadURL() string\n```\nDownloadURL returns the download url of the attached file\n\n```go\nfunc (a *Attachment) IncreaseDownloadCount() error\n```\nIncreaseDownloadCount is update download count + 1\n\n```go\nfunc (a *Attachment) LocalPath() string\n```\nLocalPath returns where attachment is stored in local file system.\n\n```go\ntype Branch struct {\n\tPath string\n\tName string\n}\n```\nBranch holds the branch information\n\n```go\nfunc GetBranchesByPath(path string) ([]*Branch, error)\n```\nGetBranchesByPath returns a branch by it's path\n\n```go\nfunc (branch *Branch) GetCommit() (*git.Commit, error)\n```\nGetCommit returns all the commits of a branch\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 CodeComments map[string]map[int64][]*Comment\n```\nCodeComments represents comments on code by using this structure: FILENAME -\u003e LINE (+ == proposed; - == previous) -\u003e COMMENTS\n\n```go\nfunc FetchCodeComments(issue *Issue, currentUser *User) (CodeComments, error)\n```\nFetchCodeComments will return a 2d-map: \\[\"Path\"]\\[\"Line\"] = Comments at line\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\tMode   AccessMode `xorm:\"DEFAULT 2 NOT NULL\"`\n}\n```\nCollaboration represent the relation between an individual and a repository.\n\n```go\nfunc (c *Collaboration) ModeI18nKey() string\n```\nModeI18nKey returns the collaboration mode I18n Key\n\n```go\ntype Collaborator struct {\n\t*User\n\tCollaboration *Collaboration\n}\n```\nCollaborator represents a user with collaboration details.\n\n```go\ntype Comment struct {\n\tID               int64 `xorm:\"pk autoincr\"`\n\tType             CommentType\n\tPosterID         int64  `xorm:\"INDEX\"`\n\tPoster           *User  `xorm:\"-\"`\n\tIssueID          int64  `xorm:\"INDEX\"`\n\tIssue            *Issue `xorm:\"-\"`\n\tLabelID          int64\n\tLabel            *Label `xorm:\"-\"`\n\tOldMilestoneID   int64\n\tMilestoneID      int64\n\tOldMilestone     *Milestone `xorm:\"-\"`\n\tMilestone        *Milestone `xorm:\"-\"`\n\tAssigneeID       int64\n\tRemovedAssignee  bool\n\tAssignee         *User `xorm:\"-\"`\n\tOldTitle         string\n\tNewTitle         string\n\tDependentIssueID int64\n\tDependentIssue   *Issue `xorm:\"-\"`\n\n\tCommitID        int64\n\tLine            int64 // - previous line / + proposed line\n\tTreePath        string\n\tContent         string `xorm:\"TEXT\"`\n\tRenderedContent string `xorm:\"-\"`\n\n\t// Path represents the 4 lines of code cemented by this comment\n\tPatch string `xorm:\"TEXT\"`\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n\n\t// Reference issue in commit message\n\tCommitSHA string `xorm:\"VARCHAR(40)\"`\n\n\tAttachments []*Attachment `xorm:\"-\"`\n\tReactions   ReactionList  `xorm:\"-\"`\n\n\t// For view issue page.\n\tShowTag CommentTag `xorm:\"-\"`\n\n\tReview      *Review `xorm:\"-\"`\n\tReviewID    int64\n\tInvalidated bool\n}\n```\nComment represents a comment in commit and issue page.\n\n```go\nfunc CreateCodeComment(doer *User, repo *Repository, issue *Issue, content, treePath string, line, reviewID int64) (*Comment, error)\n```\nCreateCodeComment creates a plain code comment at the specified line / path\n\n```go\nfunc CreateComment(opts *CreateCommentOptions) (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 FindComments(opts FindCommentsOptions) ([]*Comment, error)\n```\nFindComments returns all comments according options\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 an issue.\n\n```go\nfunc GetCommentsByIssueIDSince(issueID, since int64) ([]*Comment, error)\n```\nGetCommentsByIssueIDSince returns a list of comments of an issue since a given time point.\n\n```go\nfunc GetCommentsByRepoIDSince(repoID, since int64) ([]*Comment, error)\n```\nGetCommentsByRepoIDSince returns a list of comments for all issues in a repo since a given time point.\n\n```go\nfunc (c *Comment) APIFormat() *api.Comment\n```\nAPIFormat converts a Comment to the api.Comment format\n\n```go\nfunc (c *Comment) AfterDelete()\n```\nAfterDelete is invoked from XORM after the object is deleted.\n\n```go\nfunc (c *Comment) AsDiff() (*Diff, error)\n```\nAsDiff returns c.Patch as \\*Diff\n\n```go\nfunc (c *Comment) CheckInvalidation(repo *git.Repository, doer *User, branch string) error\n```\nCheckInvalidation checks if the line of code comment got changed by another commit. If the line got changed the comment is going to be invalidated.\n\n```go\nfunc (c *Comment) CodeCommentURL() string\n```\nCodeCommentURL returns the url to a comment in code\n\n```go\nfunc (c *Comment) DiffSide() string\n```\nDiffSide returns \"previous\" if Comment.Line is a LOC of the previous changes and \"proposed\" if it is a LOC of the proposed changes.\n\n```go\nfunc (c *Comment) EventTag() string\n```\nEventTag returns unique event hash tag for comment.\n\n```go\nfunc (c *Comment) HTMLURL() string\n```\nHTMLURL formats a URL-string to the issue-comment\n\n```go\nfunc (c *Comment) HashTag() string\n```\nHashTag returns unique hash tag for comment.\n\n```go\nfunc (c *Comment) IssueURL() string\n```\nIssueURL formats a URL-string to the issue\n\n```go\nfunc (c *Comment) LoadAssigneeUser() error\n```\nLoadAssigneeUser if comment.Type is CommentTypeAssignees, then load assignees\n\n```go\nfunc (c *Comment) LoadAttachments() error\n```\nLoadAttachments loads attachments\n\n```go\nfunc (c *Comment) LoadDepIssueDetails() (err error)\n```\nLoadDepIssueDetails loads Dependent Issue Details\n\n```go\nfunc (c *Comment) LoadIssue() (err error)\n```\nLoadIssue loads issue from database\n\n```go\nfunc (c *Comment) LoadLabel() error\n```\nLoadLabel if comment.Type is CommentTypeLabel, then load Label\n\n```go\nfunc (c *Comment) LoadMilestone() error\n```\nLoadMilestone if comment.Type is CommentTypeMilestone, then load milestone\n\n```go\nfunc (c *Comment) LoadPoster() error\n```\nLoadPoster loads comment poster\n\n```go\nfunc (c *Comment) LoadReactions() error\n```\nLoadReactions loads comment reactions\n\n```go\nfunc (c *Comment) LoadReview() error\n```\nLoadReview loads the associated review\n\n```go\nfunc (c *Comment) MailParticipants(opType ActionType, issue *Issue) (err error)\n```\nMailParticipants sends new comment emails to repository watchers and mentioned people.\n\n```go\nfunc (c *Comment) MustAsDiff() *Diff\n```\nMustAsDiff executes AsDiff and logs the error instead of returning\n\n```go\nfunc (c *Comment) PRURL() string\n```\nPRURL formats a URL-string to the pull-request\n\n```go\nfunc (c *Comment) UnsignedLine() uint64\n```\nUnsignedLine returns the LOC of the code comment without + or -\n\n```go\ntype CommentList []*Comment\n```\nCommentList defines a list of comments\n\n```go\nfunc (comments CommentList) LoadPosters() error\n```\nLoadPosters loads posters from database\n\n```go\ntype CommentTag int\n```\nCommentTag defines comment tag type\n\n```go\nconst (\n\tCommentTagNone CommentTag = iota\n\tCommentTagPoster\n\tCommentTagWriter\n\tCommentTagOwner\n)\n```\nEnumerate all the comment tag types\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 (LineNum \u003e 0)\n\tCommentTypeComment CommentType = iota\n\tCommentTypeReopen\n\tCommentTypeClose\n\n\t// References.\n\tCommentTypeIssueRef\n\t// Reference from a commit (not part of a pull request)\n\tCommentTypeCommitRef\n\t// Reference from a comment\n\tCommentTypeCommentRef\n\t// Reference from a pull request\n\tCommentTypePullRef\n\t// Labels changed\n\tCommentTypeLabel\n\t// Milestone changed\n\tCommentTypeMilestone\n\t// Assignees changed\n\tCommentTypeAssignees\n\t// Change Title\n\tCommentTypeChangeTitle\n\t// Delete Branch\n\tCommentTypeDeleteBranch\n\t// Start a stopwatch for time tracking\n\tCommentTypeStartTracking\n\t// Stop a stopwatch for time tracking\n\tCommentTypeStopTracking\n\t// Add time manual for time tracking\n\tCommentTypeAddTimeManual\n\t// Cancel a stopwatch for time tracking\n\tCommentTypeCancelTracking\n\t// Added a due date\n\tCommentTypeAddedDeadline\n\t// Modified the due date\n\tCommentTypeModifiedDeadline\n\t// Removed a due date\n\tCommentTypeRemovedDeadline\n\t// Dependency added\n\tCommentTypeAddDependency\n\t//Dependency removed\n\tCommentTypeRemoveDependency\n\t// Comment a line of code\n\tCommentTypeCode\n\t// Reviews a pull request by giving general feedback\n\tCommentTypeReview\n\t// Lock an issue, giving only collaborators access\n\tCommentTypeLock\n\t// Unlocks a previously locked issue\n\tCommentTypeUnlock\n)\n```\nEnumerate all the comment types\n\n```go\nconst (\n\tCommentTypeUnknown CommentType = -1\n)\n```\ndefine unknown comment type\n\n```go\ntype CommitRepoActionOptions struct {\n\tPusherName  string\n\tRepoOwnerID int64\n\tRepoName    string\n\tRefFullName string\n\tOldCommitID string\n\tNewCommitID string\n\tCommits     *PushCommits\n}\n```\nCommitRepoActionOptions represent options of a new commit action.\n\n```go\ntype CommitStatus struct {\n\tID          int64             `xorm:\"pk autoincr\"`\n\tIndex       int64             `xorm:\"INDEX UNIQUE(repo_sha_index)\"`\n\tRepoID      int64             `xorm:\"INDEX UNIQUE(repo_sha_index)\"`\n\tRepo        *Repository       `xorm:\"-\"`\n\tState       CommitStatusState `xorm:\"VARCHAR(7) NOT NULL\"`\n\tSHA         string            `xorm:\"VARCHAR(64) NOT NULL INDEX UNIQUE(repo_sha_index)\"`\n\tTargetURL   string            `xorm:\"TEXT\"`\n\tDescription string            `xorm:\"TEXT\"`\n\tContext     string            `xorm:\"TEXT\"`\n\tCreator     *User             `xorm:\"-\"`\n\tCreatorID   int64\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n}\n```\nCommitStatus holds a single Status of a single Commit\n\n```go\nfunc CalcCommitStatus(statuses []*CommitStatus) *CommitStatus\n```\nCalcCommitStatus returns commit status state via some status, the commit statues should order by id desc\n\n```go\nfunc GetCommitStatus(repo *Repository, sha string, status *CommitStatus) (*CommitStatus, error)\n```\nGetCommitStatus populates a given status for a given commit. NOTE: If ID or Index isn't given, and only Context, TargetURL and/or Description\n\n\tis given, the CommitStatus created _last_ will be returned.\n\n```go\nfunc GetCommitStatuses(repo *Repository, sha string, page int) ([]*CommitStatus, error)\n```\nGetCommitStatuses returns all statuses for a given commit.\n\n```go\nfunc GetLatestCommitStatus(repo *Repository, sha string, page int) ([]*CommitStatus, error)\n```\nGetLatestCommitStatus returns all statuses with a unique context for a given commit.\n\n```go\nfunc (status *CommitStatus) APIFormat() *api.Status\n```\nAPIFormat assumes some fields assigned with values: Required - Repo, Creator\n\n```go\nfunc (status *CommitStatus) APIURL() string\n```\nAPIURL returns the absolute APIURL to this commit-status.\n\n```go\ntype CommitStatusState string\n```\nCommitStatusState holds the state of a Status It can be \"pending\", \"success\", \"error\", \"failure\", and \"warning\"\n\n```go\nconst (\n\t// CommitStatusPending is for when the Status is Pending\n\tCommitStatusPending CommitStatusState = \"pending\"\n\t// CommitStatusSuccess is for when the Status is Success\n\tCommitStatusSuccess CommitStatusState = \"success\"\n\t// CommitStatusError is for when the Status is Error\n\tCommitStatusError CommitStatusState = \"error\"\n\t// CommitStatusFailure is for when the Status is Failure\n\tCommitStatusFailure CommitStatusState = \"failure\"\n\t// CommitStatusWarning is for when the Status is Warning\n\tCommitStatusWarning CommitStatusState = \"warning\"\n)\n```\n\n```go\nfunc (css CommitStatusState) IsWorseThan(css2 CommitStatusState) bool\n```\nIsWorseThan returns true if this State is worse than the given State\n\n```go\ntype CommitVerification struct {\n\tVerified    bool\n\tReason      string\n\tSigningUser *User\n\tSigningKey  *GPGKey\n}\n```\nCommitVerification represents a commit validation of signature\n\n```go\nfunc ParseCommitWithSignature(c *git.Commit) *CommitVerification\n```\nParseCommitWithSignature check if signature is good against keystore.\n\n```go\ntype CreateCommentOptions struct {\n\tType  CommentType\n\tDoer  *User\n\tRepo  *Repository\n\tIssue *Issue\n\tLabel *Label\n\n\tDependentIssueID int64\n\tOldMilestoneID   int64\n\tMilestoneID      int64\n\tAssigneeID       int64\n\tRemovedAssignee  bool\n\tOldTitle         string\n\tNewTitle         string\n\tCommitID         int64\n\tCommitSHA        string\n\tPatch            string\n\tLineNum          int64\n\tTreePath         string\n\tReviewID         int64\n\tContent          string\n\tAttachments      []string // UUIDs of attachments\n}\n```\nCreateCommentOptions defines options for creating comment\n\n```go\ntype CreateOAuth2ApplicationOptions struct {\n\tName         string\n\tUserID       int64\n\tRedirectURIs []string\n}\n```\nCreateOAuth2ApplicationOptions holds options to create an oauth2 application\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```\nCreateRepoOptions contains the create repository options\n\n```go\ntype CreateReviewOptions struct {\n\tContent  string\n\tType     ReviewType\n\tIssue    *Issue\n\tReviewer *User\n}\n```\nCreateReviewOptions represent the options to create a review. Type, Issue and Reviewer are required.\n\n```go\ntype DeletedBranch struct {\n\tID          int64          `xorm:\"pk autoincr\"`\n\tRepoID      int64          `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tName        string         `xorm:\"UNIQUE(s) NOT NULL\"`\n\tCommit      string         `xorm:\"UNIQUE(s) NOT NULL\"`\n\tDeletedByID int64          `xorm:\"INDEX\"`\n\tDeletedBy   *User          `xorm:\"-\"`\n\tDeletedUnix util.TimeStamp `xorm:\"INDEX created\"`\n}\n```\nDeletedBranch struct\n\n```go\nfunc (deletedBranch *DeletedBranch) LoadUser()\n```\nLoadUser loads the user that deleted the branch When there's no user found it returns a NewGhostUser\n\n```go\ntype DependencyType int\n```\nDependencyType Defines Dependency Type Constants\n\n```go\nconst (\n\tDependencyTypeBlockedBy DependencyType = iota\n\tDependencyTypeBlocking\n)\n```\nDefine Dependency Types\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\n\tMode AccessMode `xorm:\"NOT NULL DEFAULT 1\"`\n\n\tCreatedUnix       util.TimeStamp `xorm:\"created\"`\n\tUpdatedUnix       util.TimeStamp `xorm:\"updated\"`\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, readOnly bool) (*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 SearchDeployKeys(repoID int64, keyID int64, fingerprint string) ([]*DeployKey, error)\n```\nSearchDeployKeys returns a list of deploy keys matching the provided arguments.\n\n```go\nfunc (key *DeployKey) AfterLoad()\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\nfunc (key *DeployKey) GetContent() error\n```\nGetContent gets associated public key content.\n\n```go\nfunc (key *DeployKey) IsReadOnly() bool\n```\nIsReadOnly checks if the key can only be used for read operations\n\n```go\ntype Diff struct {\n\tTotalAddition, TotalDeletion int\n\tFiles                        []*DiffFile\n\tIsIncomplete                 bool\n}\n```\nDiff represents a difference between two git trees.\n\n```go\nfunc GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error)\n```\nGetDiffCommit builds a Diff representing the given commitID.\n\n```go\nfunc GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error)\n```\nGetDiffRange builds a Diff between two commits of a repository. passing the empty string as beforeCommitID returns a diff from the parent commit.\n\n```go\nfunc GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int, whitespaceBehavior string) (*Diff, error)\n```\nGetDiffRangeWithWhitespaceBehavior builds a Diff between two commits of a repository. Passing the empty string as beforeCommitID returns a diff from the parent commit. The whitespaceBehavior is either an empty string or a git flag\n\n```go\nfunc ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*Diff, error)\n```\nParsePatch builds a Diff object from a io.Reader and some parameters. TODO: move this function to gogits/git-module\n\n```go\nfunc (diff *Diff) LoadComments(issue *Issue, currentUser *User) error\n```\nLoadComments loads comments into each line\n\n```go\nfunc (diff *Diff) NumFiles() int\n```\nNumFiles returns number of files changes in a diff.\n\n```go\ntype DiffFile struct {\n\tName               string\n\tOldName            string\n\tIndex              int\n\tAddition, Deletion int\n\tType               DiffFileType\n\tIsCreated          bool\n\tIsDeleted          bool\n\tIsBin              bool\n\tIsLFSFile          bool\n\tIsRenamed          bool\n\tIsSubmodule        bool\n\tSections           []*DiffSection\n\tIsIncomplete       bool\n}\n```\nDiffFile represents a file diff.\n\n```go\nfunc (diffFile *DiffFile) GetHighlightClass() string\n```\nGetHighlightClass returns highlight class for a filename.\n\n```go\nfunc (diffFile *DiffFile) GetType() int\n```\nGetType returns type of diff file.\n\n```go\ntype DiffFileType uint8\n```\nDiffFileType represents the type of a DiffFile.\n\n```go\nconst (\n\tDiffFileAdd DiffFileType = iota + 1\n\tDiffFileChange\n\tDiffFileDel\n\tDiffFileRename\n)\n```\nDiffFileType possible values.\n\n```go\ntype DiffLine struct {\n\tLeftIdx  int\n\tRightIdx int\n\tType     DiffLineType\n\tContent  string\n\tComments []*Comment\n}\n```\nDiffLine represents a line difference in a DiffSection.\n\n```go\nfunc (d *DiffLine) CanComment() bool\n```\nCanComment returns whether or not a line can get commented\n\n```go\nfunc (d *DiffLine) GetCommentSide() string\n```\nGetCommentSide returns the comment side of the first comment, if not set returns empty string\n\n```go\nfunc (d *DiffLine) GetType() int\n```\nGetType returns the type of a DiffLine.\n\n```go\ntype DiffLineType uint8\n```\nDiffLineType represents the type of a DiffLine.\n\n```go\nconst (\n\tDiffLinePlain DiffLineType = iota + 1\n\tDiffLineAdd\n\tDiffLineDel\n\tDiffLineSection\n)\n```\nDiffLineType possible values.\n\n```go\ntype DiffSection struct {\n\tName  string\n\tLines []*DiffLine\n}\n```\nDiffSection represents a section of a DiffFile.\n\n```go\nfunc (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) template.HTML\n```\nGetComputedInlineDiffFor computes inline diff for the given line.\n\n```go\nfunc (diffSection *DiffSection) GetLine(lineType DiffLineType, idx int) *DiffLine\n```\nGetLine gets a specific line by type (add or del) and file line number\n\n```go\ntype DingtalkPayload dingtalk.Payload\n```\nDingtalkPayload represents\n\n```go\nfunc GetDingtalkPayload(p api.Payloader, event HookEventType, meta string) (*DingtalkPayload, error)\n```\nGetDingtalkPayload converts a ding talk webhook into a DingtalkPayload\n\n```go\nfunc (p *DingtalkPayload) JSONPayload() ([]byte, error)\n```\nJSONPayload Marshals the DingtalkPayload to json\n\n```go\nfunc (p *DingtalkPayload) SetSecret(_ string)\n```\nSetSecret sets the dingtalk secret\n\n```go\ntype DiscordEmbed struct {\n\tTitle       string              `json:\"title\"`\n\tDescription string              `json:\"description\"`\n\tURL         string              `json:\"url\"`\n\tColor       int                 `json:\"color\"`\n\tFooter      DiscordEmbedFooter  `json:\"footer\"`\n\tAuthor      DiscordEmbedAuthor  `json:\"author\"`\n\tFields      []DiscordEmbedField `json:\"fields\"`\n}\n```\nDiscordEmbed is for Embed Structure\n\n```go\ntype DiscordEmbedAuthor struct {\n\tName    string `json:\"name\"`\n\tURL     string `json:\"url\"`\n\tIconURL string `json:\"icon_url\"`\n}\n```\nDiscordEmbedAuthor for Embed Author Structure\n\n```go\ntype DiscordEmbedField struct {\n\tName  string `json:\"name\"`\n\tValue string `json:\"value\"`\n}\n```\nDiscordEmbedField for Embed Field Structure\n\n```go\ntype DiscordEmbedFooter struct {\n\tText string `json:\"text\"`\n}\n```\nDiscordEmbedFooter for Embed Footer Structure.\n\n```go\ntype DiscordMeta struct {\n\tUsername string `json:\"username\"`\n\tIconURL  string `json:\"icon_url\"`\n}\n```\nDiscordMeta contains the discord metadata\n\n```go\ntype DiscordPayload struct {\n\tWait      bool           `json:\"wait\"`\n\tContent   string         `json:\"content\"`\n\tUsername  string         `json:\"username\"`\n\tAvatarURL string         `json:\"avatar_url\"`\n\tTTS       bool           `json:\"tts\"`\n\tEmbeds    []DiscordEmbed `json:\"embeds\"`\n}\n```\nDiscordPayload represents\n\n```go\nfunc GetDiscordPayload(p api.Payloader, event HookEventType, meta string) (*DiscordPayload, error)\n```\nGetDiscordPayload converts a discord webhook into a DiscordPayload\n\n```go\nfunc (p *DiscordPayload) JSONPayload() ([]byte, error)\n```\nJSONPayload Marshals the DiscordPayload to json\n\n```go\nfunc (p *DiscordPayload) SetSecret(_ string)\n```\nSetSecret sets the discord secret\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```\nEmailAddress 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 email addresses belongs to given user.\n\n```go\nfunc VerifyActiveEmailCode(code, email string) *EmailAddress\n```\nVerifyActiveEmailCode verifies active email code when active account\n\n```go\nfunc (email *EmailAddress) Activate() error\n```\nActivate activates the email address to given user.\n\n```go\ntype Engine interface {\n\tTable(tableNameOrBean interface{}) *xorm.Session\n\tCount(...interface{}) (int64, error)\n\tDecr(column string, arg ...interface{}) *xorm.Session\n\tDelete(interface{}) (int64, error)\n\tExec(...interface{}) (sql.Result, error)\n\tFind(interface{}, ...interface{}) error\n\tGet(interface{}) (bool, error)\n\tID(interface{}) *xorm.Session\n\tIn(string, ...interface{}) *xorm.Session\n\tIncr(column string, arg ...interface{}) *xorm.Session\n\tInsert(...interface{}) (int64, error)\n\tInsertOne(interface{}) (int64, error)\n\tIterate(interface{}, xorm.IterFunc) error\n\tJoin(joinOperator string, tablename interface{}, condition string, args ...interface{}) *xorm.Session\n\tSQL(interface{}, ...interface{}) *xorm.Session\n\tWhere(interface{}, ...interface{}) *xorm.Session\n}\n```\nEngine represents a xorm engine or session.\n\n```go\ntype ErrAccessTokenEmpty struct {\n}\n```\nErrAccessTokenEmpty represents a \"AccessTokenEmpty\" kind of error.\n\n```go\nfunc (err ErrAccessTokenEmpty) Error() string\n```\n\n```go\ntype ErrAccessTokenNotExist struct {\n\tSHA string\n}\n```\nErrAccessTokenNotExist represents a \"AccessTokenNotExist\" kind of error.\n\n```go\nfunc (err ErrAccessTokenNotExist) Error() string\n```\n\n```go\ntype ErrAttachmentNotExist struct {\n\tID   int64\n\tUUID string\n}\n```\nErrAttachmentNotExist represents a \"AttachmentNotExist\" kind of error.\n\n```go\nfunc (err ErrAttachmentNotExist) Error() string\n```\n\n```go\ntype ErrBranchAlreadyExists struct {\n\tBranchName string\n}\n```\nErrBranchAlreadyExists represents an error that branch with such name already exists\n\n```go\nfunc (err ErrBranchAlreadyExists) Error() string\n```\n\n```go\ntype ErrBranchNameConflict struct {\n\tBranchName string\n}\n```\nErrBranchNameConflict represents an error that branch name conflicts with other branch\n\n```go\nfunc (err ErrBranchNameConflict) Error() string\n```\n\n```go\ntype ErrBranchNotExist struct {\n\tName string\n}\n```\nErrBranchNotExist represents a \"BranchNotExist\" kind of error.\n\n```go\nfunc (err ErrBranchNotExist) Error() string\n```\n\n```go\ntype ErrCircularDependency struct {\n\tIssueID      int64\n\tDependencyID int64\n}\n```\nErrCircularDependency represents a \"DependencyCircular\" kind of error.\n\n```go\nfunc (err ErrCircularDependency) Error() string\n```\n\n```go\ntype ErrCommentNotExist struct {\n\tID      int64\n\tIssueID int64\n}\n```\nErrCommentNotExist represents a \"CommentNotExist\" kind of error.\n\n```go\nfunc (err ErrCommentNotExist) Error() string\n```\n\n```go\ntype ErrDependenciesLeft struct {\n\tIssueID int64\n}\n```\nErrDependenciesLeft represents an error where the issue you're trying to close still has dependencies left.\n\n```go\nfunc (err ErrDependenciesLeft) Error() string\n```\n\n```go\ntype ErrDependencyExists struct {\n\tIssueID      int64\n\tDependencyID int64\n}\n```\nErrDependencyExists represents a \"DependencyAlreadyExists\" kind of error.\n\n```go\nfunc (err ErrDependencyExists) Error() string\n```\n\n```go\ntype ErrDependencyNotExists struct {\n\tIssueID      int64\n\tDependencyID int64\n}\n```\nErrDependencyNotExists represents a \"DependencyAlreadyExists\" kind of error.\n\n```go\nfunc (err ErrDependencyNotExists) Error() string\n```\n\n```go\ntype ErrDeployKeyAlreadyExist struct {\n\tKeyID  int64\n\tRepoID int64\n}\n```\nErrDeployKeyAlreadyExist represents a \"DeployKeyAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrDeployKeyAlreadyExist) Error() string\n```\n\n```go\ntype ErrDeployKeyNameAlreadyUsed struct {\n\tRepoID int64\n\tName   string\n}\n```\nErrDeployKeyNameAlreadyUsed represents a \"DeployKeyNameAlreadyUsed\" kind of error.\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```\nErrDeployKeyNotExist represents a \"DeployKeyNotExist\" kind of error.\n\n```go\nfunc (err ErrDeployKeyNotExist) Error() string\n```\n\n```go\ntype ErrEmailAlreadyUsed struct {\n\tEmail string\n}\n```\nErrEmailAlreadyUsed represents a \"EmailAlreadyUsed\" kind of error.\n\n```go\nfunc (err ErrEmailAlreadyUsed) Error() string\n```\n\n```go\ntype ErrExternalLoginUserAlreadyExist struct {\n\tExternalID    string\n\tUserID        int64\n\tLoginSourceID int64\n}\n```\nErrExternalLoginUserAlreadyExist represents a \"ExternalLoginUserAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrExternalLoginUserAlreadyExist) Error() string\n```\n\n```go\ntype ErrExternalLoginUserNotExist struct {\n\tUserID        int64\n\tLoginSourceID int64\n}\n```\nErrExternalLoginUserNotExist represents a \"ExternalLoginUserNotExist\" kind of error.\n\n```go\nfunc (err ErrExternalLoginUserNotExist) Error() string\n```\n\n```go\ntype ErrGPGKeyAccessDenied struct {\n\tUserID int64\n\tKeyID  int64\n}\n```\nErrGPGKeyAccessDenied represents a \"GPGKeyAccessDenied\" kind of Error.\n\n```go\nfunc (err ErrGPGKeyAccessDenied) Error() string\n```\nError pretty-prints an error of type ErrGPGKeyAccessDenied.\n\n```go\ntype ErrGPGKeyIDAlreadyUsed struct {\n\tKeyID string\n}\n```\nErrGPGKeyIDAlreadyUsed represents a \"GPGKeyIDAlreadyUsed\" kind of error.\n\n```go\nfunc (err ErrGPGKeyIDAlreadyUsed) Error() string\n```\n\n```go\ntype ErrGPGKeyNotExist struct {\n\tID int64\n}\n```\nErrGPGKeyNotExist represents a \"GPGKeyNotExist\" kind of error.\n\n```go\nfunc (err ErrGPGKeyNotExist) Error() string\n```\n\n```go\ntype ErrGPGKeyParsing struct {\n\tParseError error\n}\n```\nErrGPGKeyParsing represents a \"ErrGPGKeyParsing\" kind of error.\n\n```go\nfunc (err ErrGPGKeyParsing) Error() string\n```\n\n```go\ntype ErrGPGNoEmailFound struct {\n\tFailedEmails []string\n}\n```\nErrGPGNoEmailFound represents a \"ErrGPGNoEmailFound\" kind of error.\n\n```go\nfunc (err ErrGPGNoEmailFound) Error() string\n```\n\n```go\ntype ErrInvalidCloneAddr struct {\n\tIsURLError         bool\n\tIsInvalidPath      bool\n\tIsPermissionDenied bool\n}\n```\nErrInvalidCloneAddr represents a \"InvalidCloneAddr\" kind of error.\n\n```go\nfunc (err ErrInvalidCloneAddr) Error() string\n```\n\n```go\ntype ErrInvalidMergeStyle struct {\n\tID    int64\n\tStyle MergeStyle\n}\n```\nErrInvalidMergeStyle represents an error if merging with disabled merge strategy\n\n```go\nfunc (err ErrInvalidMergeStyle) Error() string\n```\n\n```go\ntype ErrInvalidTagName struct {\n\tTagName string\n}\n```\nErrInvalidTagName represents a \"InvalidTagName\" kind of error.\n\n```go\nfunc (err ErrInvalidTagName) Error() string\n```\n\n```go\ntype ErrIssueNotExist struct {\n\tID     int64\n\tRepoID int64\n\tIndex  int64\n}\n```\nErrIssueNotExist represents a \"IssueNotExist\" kind of error.\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```\nErrKeyAccessDenied represents a \"KeyAccessDenied\" kind of error.\n\n```go\nfunc (err ErrKeyAccessDenied) Error() string\n```\n\n```go\ntype ErrKeyAlreadyExist struct {\n\tOwnerID     int64\n\tFingerprint string\n\tContent     string\n}\n```\nErrKeyAlreadyExist represents a \"KeyAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrKeyAlreadyExist) Error() string\n```\n\n```go\ntype ErrKeyNameAlreadyUsed struct {\n\tOwnerID int64\n\tName    string\n}\n```\nErrKeyNameAlreadyUsed represents a \"KeyNameAlreadyUsed\" kind of error.\n\n```go\nfunc (err ErrKeyNameAlreadyUsed) Error() string\n```\n\n```go\ntype ErrKeyNotExist struct {\n\tID int64\n}\n```\nErrKeyNotExist represents a \"KeyNotExist\" kind of error.\n\n```go\nfunc (err ErrKeyNotExist) Error() string\n```\n\n```go\ntype ErrKeyUnableVerify struct {\n\tResult string\n}\n```\nErrKeyUnableVerify represents a \"KeyUnableVerify\" kind of error.\n\n```go\nfunc (err ErrKeyUnableVerify) Error() string\n```\n\n```go\ntype ErrLFSLockAlreadyExist struct {\n\tRepoID int64\n\tPath   string\n}\n```\nErrLFSLockAlreadyExist represents a \"LFSLockAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrLFSLockAlreadyExist) Error() string\n```\n\n```go\ntype ErrLFSLockNotExist struct {\n\tID     int64\n\tRepoID int64\n\tPath   string\n}\n```\nErrLFSLockNotExist represents a \"LFSLockNotExist\" kind of error.\n\n```go\nfunc (err ErrLFSLockNotExist) Error() string\n```\n\n```go\ntype ErrLFSUnauthorizedAction struct {\n\tRepoID   int64\n\tUserName string\n\tMode     AccessMode\n}\n```\nErrLFSUnauthorizedAction represents a \"LFSUnauthorizedAction\" kind of error.\n\n```go\nfunc (err ErrLFSUnauthorizedAction) Error() string\n```\n\n```go\ntype ErrLabelNotExist struct {\n\tLabelID int64\n\tRepoID  int64\n}\n```\nErrLabelNotExist represents a \"LabelNotExist\" kind of error.\n\n```go\nfunc (err ErrLabelNotExist) Error() string\n```\n\n```go\ntype ErrLastOrgOwner struct {\n\tUID int64\n}\n```\nErrLastOrgOwner represents a \"LastOrgOwner\" kind of error.\n\n```go\nfunc (err ErrLastOrgOwner) Error() string\n```\n\n```go\ntype ErrLoginSourceAlreadyExist struct {\n\tName string\n}\n```\nErrLoginSourceAlreadyExist represents a \"LoginSourceAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrLoginSourceAlreadyExist) Error() string\n```\n\n```go\ntype ErrLoginSourceInUse struct {\n\tID int64\n}\n```\nErrLoginSourceInUse represents a \"LoginSourceInUse\" kind of error.\n\n```go\nfunc (err ErrLoginSourceInUse) Error() string\n```\n\n```go\ntype ErrLoginSourceNotExist struct {\n\tID int64\n}\n```\nErrLoginSourceNotExist represents a \"LoginSourceNotExist\" kind of error.\n\n```go\nfunc (err ErrLoginSourceNotExist) Error() string\n```\n\n```go\ntype ErrMilestoneNotExist struct {\n\tID     int64\n\tRepoID int64\n}\n```\nErrMilestoneNotExist represents a \"MilestoneNotExist\" kind of error.\n\n```go\nfunc (err ErrMilestoneNotExist) Error() string\n```\n\n```go\ntype ErrNamePatternNotAllowed struct {\n\tPattern string\n}\n```\nErrNamePatternNotAllowed represents a \"pattern not allowed\" error.\n\n```go\nfunc (err ErrNamePatternNotAllowed) Error() string\n```\n\n```go\ntype ErrNameReserved struct {\n\tName string\n}\n```\nErrNameReserved represents a \"reserved name\" error.\n\n```go\nfunc (err ErrNameReserved) Error() string\n```\n\n```go\ntype ErrNotAllowedToMerge struct {\n\tReason string\n}\n```\nErrNotAllowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it\n\n```go\nfunc (err ErrNotAllowedToMerge) Error() string\n```\n\n```go\ntype ErrOAuthApplicationNotFound struct {\n\tID int64\n}\n```\nErrOAuthApplicationNotFound will be thrown if id cannot be found\n\n```go\nfunc (err ErrOAuthApplicationNotFound) Error() string\n```\nError returns the error message\n\n```go\ntype ErrOAuthClientIDInvalid struct {\n\tClientID string\n}\n```\nErrOAuthClientIDInvalid will be thrown if client id cannot be found\n\n```go\nfunc (err ErrOAuthClientIDInvalid) Error() string\n```\nError returns the error message\n\n```go\ntype ErrOpenIDAlreadyUsed struct {\n\tOpenID string\n}\n```\nErrOpenIDAlreadyUsed represents a \"OpenIDAlreadyUsed\" kind of error.\n\n```go\nfunc (err ErrOpenIDAlreadyUsed) Error() string\n```\n\n```go\ntype ErrOpenIDConnectInitialize struct {\n\tOpenIDConnectAutoDiscoveryURL string\n\tProviderName                  string\n\tCause                         error\n}\n```\nErrOpenIDConnectInitialize represents a \"OpenIDConnectInitialize\" kind of error.\n\n```go\nfunc (err ErrOpenIDConnectInitialize) Error() string\n```\n\n```go\ntype ErrOrgNotExist struct {\n\tID   int64\n\tName string\n}\n```\nErrOrgNotExist represents a \"OrgNotExist\" kind of error.\n\n```go\nfunc (err ErrOrgNotExist) Error() string\n```\n\n```go\ntype ErrPullRequestAlreadyExists struct {\n\tID         int64\n\tIssueID    int64\n\tHeadRepoID int64\n\tBaseRepoID int64\n\tHeadBranch string\n\tBaseBranch string\n}\n```\nErrPullRequestAlreadyExists represents a \"PullRequestAlreadyExists\"-error\n\n```go\nfunc (err ErrPullRequestAlreadyExists) Error() string\n```\nError does pretty-printing :D\n\n```go\ntype ErrPullRequestNotExist struct {\n\tID         int64\n\tIssueID    int64\n\tHeadRepoID int64\n\tBaseRepoID int64\n\tHeadBranch string\n\tBaseBranch string\n}\n```\nErrPullRequestNotExist represents a \"PullRequestNotExist\" kind of error.\n\n```go\nfunc (err ErrPullRequestNotExist) Error() string\n```\n\n```go\ntype ErrReachLimitOfRepo struct {\n\tLimit int\n}\n```\nErrReachLimitOfRepo represents a \"ReachLimitOfRepo\" kind of error.\n\n```go\nfunc (err ErrReachLimitOfRepo) Error() string\n```\n\n```go\ntype ErrReleaseAlreadyExist struct {\n\tTagName string\n}\n```\nErrReleaseAlreadyExist represents a \"ReleaseAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrReleaseAlreadyExist) Error() string\n```\n\n```go\ntype ErrReleaseNotExist struct {\n\tID      int64\n\tTagName string\n}\n```\nErrReleaseNotExist represents a \"ReleaseNotExist\" kind of error.\n\n```go\nfunc (err ErrReleaseNotExist) Error() string\n```\n\n```go\ntype ErrRepoAlreadyExist struct {\n\tUname string\n\tName  string\n}\n```\nErrRepoAlreadyExist represents a \"RepoAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrRepoAlreadyExist) Error() string\n```\n\n```go\ntype ErrRepoFileAlreadyExist struct {\n\tFileName string\n}\n```\nErrRepoFileAlreadyExist represents a \"RepoFileAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrRepoFileAlreadyExist) Error() string\n```\n\n```go\ntype ErrRepoNotExist struct {\n\tID        int64\n\tUID       int64\n\tOwnerName string\n\tName      string\n}\n```\nErrRepoNotExist represents a \"RepoNotExist\" kind of error.\n\n```go\nfunc (err ErrRepoNotExist) Error() string\n```\n\n```go\ntype ErrRepoRedirectNotExist struct {\n\tOwnerID  int64\n\tRepoName string\n}\n```\nErrRepoRedirectNotExist represents a \"RepoRedirectNotExist\" kind of error.\n\n```go\nfunc (err ErrRepoRedirectNotExist) Error() string\n```\n\n```go\ntype ErrReviewNotExist struct {\n\tID int64\n}\n```\nErrReviewNotExist represents a \"ReviewNotExist\" kind of error.\n\n```go\nfunc (err ErrReviewNotExist) Error() string\n```\n\n```go\ntype ErrSSHDisabled struct {\n}\n```\nErrSSHDisabled represents an \"SSH disabled\" error.\n\n```go\nfunc (err ErrSSHDisabled) Error() string\n```\n\n```go\ntype ErrStopwatchNotExist struct {\n\tID int64\n}\n```\nErrStopwatchNotExist represents a \"Stopwatch Not Exist\" kind of error.\n\n```go\nfunc (err ErrStopwatchNotExist) Error() string\n```\n\n```go\ntype ErrTagAlreadyExists struct {\n\tTagName string\n}\n```\nErrTagAlreadyExists represents an error that tag with such name already exists\n\n```go\nfunc (err ErrTagAlreadyExists) Error() string\n```\n\n```go\ntype ErrTeamAlreadyExist struct {\n\tOrgID int64\n\tName  string\n}\n```\nErrTeamAlreadyExist represents a \"TeamAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrTeamAlreadyExist) Error() string\n```\n\n```go\ntype ErrTopicNotExist struct {\n\tName string\n}\n```\nErrTopicNotExist represents an error that a topic is not exist\n\n```go\nfunc (err ErrTopicNotExist) Error() string\n```\nError implements error interface\n\n```go\ntype ErrTrackedTimeNotExist struct {\n\tID int64\n}\n```\nErrTrackedTimeNotExist represents a \"TrackedTime Not Exist\" kind of error.\n\n```go\nfunc (err ErrTrackedTimeNotExist) Error() string\n```\n\n```go\ntype ErrTwoFactorNotEnrolled struct {\n\tUID int64\n}\n```\nErrTwoFactorNotEnrolled indicates that a user is not enrolled in two-factor authentication.\n\n```go\nfunc (err ErrTwoFactorNotEnrolled) Error() string\n```\n\n```go\ntype ErrU2FRegistrationNotExist struct {\n\tID int64\n}\n```\nErrU2FRegistrationNotExist represents a \"ErrU2FRegistrationNotExist\" kind of error.\n\n```go\nfunc (err ErrU2FRegistrationNotExist) Error() string\n```\n\n```go\ntype ErrUnknownDependencyType struct {\n\tType DependencyType\n}\n```\nErrUnknownDependencyType represents an error where an unknown dependency type was passed\n\n```go\nfunc (err ErrUnknownDependencyType) Error() string\n```\n\n```go\ntype ErrUpdateTaskNotExist struct {\n\tUUID string\n}\n```\nErrUpdateTaskNotExist represents a \"UpdateTaskNotExist\" kind of error.\n\n```go\nfunc (err ErrUpdateTaskNotExist) Error() string\n```\n\n```go\ntype ErrUploadNotExist struct {\n\tID   int64\n\tUUID string\n}\n```\nErrUploadNotExist represents a \"UploadNotExist\" kind of error.\n\n```go\nfunc (err ErrUploadNotExist) Error() string\n```\n\n```go\ntype ErrUserAlreadyExist struct {\n\tName string\n}\n```\nErrUserAlreadyExist represents a \"user already exists\" error.\n\n```go\nfunc (err ErrUserAlreadyExist) Error() string\n```\n\n```go\ntype ErrUserDoesNotHaveAccessToRepo struct {\n\tUserID   int64\n\tRepoName string\n}\n```\nErrUserDoesNotHaveAccessToRepo represets an error where the user doesn't has access to a given repo\n\n```go\nfunc (err ErrUserDoesNotHaveAccessToRepo) Error() string\n```\n\n```go\ntype ErrUserHasOrgs struct {\n\tUID int64\n}\n```\nErrUserHasOrgs represents a \"UserHasOrgs\" kind of error.\n\n```go\nfunc (err ErrUserHasOrgs) Error() string\n```\n\n```go\ntype ErrUserInactive struct {\n\tUID  int64\n\tName string\n}\n```\nErrUserInactive represents a \"ErrUserInactive\" kind of error.\n\n```go\nfunc (err ErrUserInactive) Error() string\n```\n\n```go\ntype ErrUserNotAllowedCreateOrg struct {\n}\n```\nErrUserNotAllowedCreateOrg represents a \"UserNotAllowedCreateOrg\" kind of error.\n\n```go\nfunc (err ErrUserNotAllowedCreateOrg) Error() string\n```\n\n```go\ntype ErrUserNotExist struct {\n\tUID   int64\n\tName  string\n\tKeyID int64\n}\n```\nErrUserNotExist represents a \"UserNotExist\" kind of error.\n\n```go\nfunc (err ErrUserNotExist) Error() string\n```\n\n```go\ntype ErrUserOwnRepos struct {\n\tUID int64\n}\n```\nErrUserOwnRepos represents a \"UserOwnRepos\" kind of error.\n\n```go\nfunc (err ErrUserOwnRepos) Error() string\n```\n\n```go\ntype ErrUserProhibitLogin struct {\n\tUID  int64\n\tName string\n}\n```\nErrUserProhibitLogin represents a \"ErrUserProhibitLogin\" kind of error.\n\n```go\nfunc (err ErrUserProhibitLogin) Error() string\n```\n\n```go\ntype ErrWebhookNotExist struct {\n\tID int64\n}\n```\nErrWebhookNotExist represents a \"WebhookNotExist\" kind of error.\n\n```go\nfunc (err ErrWebhookNotExist) Error() string\n```\n\n```go\ntype ErrWikiAlreadyExist struct {\n\tTitle string\n}\n```\nErrWikiAlreadyExist represents a \"WikiAlreadyExist\" kind of error.\n\n```go\nfunc (err ErrWikiAlreadyExist) Error() string\n```\n\n```go\ntype ErrWikiInvalidFileName struct {\n\tFileName string\n}\n```\nErrWikiInvalidFileName represents an invalid wiki file name.\n\n```go\nfunc (err ErrWikiInvalidFileName) Error() string\n```\n\n```go\ntype ErrWikiReservedName struct {\n\tTitle string\n}\n```\nErrWikiReservedName represents a reserved name error.\n\n```go\nfunc (err ErrWikiReservedName) Error() string\n```\n\n```go\ntype ExternalLoginUser struct {\n\tExternalID    string `xorm:\"pk NOT NULL\"`\n\tUserID        int64  `xorm:\"INDEX NOT NULL\"`\n\tLoginSourceID int64  `xorm:\"pk NOT NULL\"`\n}\n```\nExternalLoginUser makes the connecting between some existing user and additional external login sources\n\n```go\nfunc ListAccountLinks(user *User) ([]*ExternalLoginUser, error)\n```\nListAccountLinks returns a map with the ExternalLoginUser and its LoginSource\n\n```go\ntype ExternalTrackerConfig struct {\n\tExternalTrackerURL    string\n\tExternalTrackerFormat string\n\tExternalTrackerStyle  string\n}\n```\nExternalTrackerConfig describes external tracker config\n\n```go\nfunc (cfg *ExternalTrackerConfig) FromDB(bs []byte) error\n```\nFromDB fills up a ExternalTrackerConfig from serialized format.\n\n```go\nfunc (cfg *ExternalTrackerConfig) ToDB() ([]byte, error)\n```\nToDB exports a ExternalTrackerConfig to a serialized format.\n\n```go\ntype ExternalWikiConfig struct {\n\tExternalWikiURL string\n}\n```\nExternalWikiConfig describes external wiki config\n\n```go\nfunc (cfg *ExternalWikiConfig) FromDB(bs []byte) error\n```\nFromDB fills up a ExternalWikiConfig from serialized format.\n\n```go\nfunc (cfg *ExternalWikiConfig) ToDB() ([]byte, error)\n```\nToDB exports a ExternalWikiConfig to a serialized format.\n\n```go\ntype FindCommentsOptions struct {\n\tRepoID   int64\n\tIssueID  int64\n\tReviewID int64\n\tSince    int64\n\tType     CommentType\n}\n```\nFindCommentsOptions describes the conditions to Find comments\n\n```go\ntype FindReactionsOptions struct {\n\tIssueID   int64\n\tCommentID int64\n}\n```\nFindReactionsOptions describes the conditions to Find reactions\n\n```go\ntype FindReleasesOptions struct {\n\tIncludeDrafts bool\n\tIncludeTags   bool\n\tTagNames      []string\n}\n```\nFindReleasesOptions describes the conditions to Find releases\n\n```go\ntype FindReviewOptions struct {\n\tType       ReviewType\n\tIssueID    int64\n\tReviewerID int64\n}\n```\nFindReviewOptions represent possible filters to find reviews\n\n```go\ntype FindTopicOptions struct {\n\tRepoID  int64\n\tKeyword string\n\tLimit   int\n\tPage    int\n}\n```\nFindTopicOptions represents the options when fdin topics\n\n```go\ntype FindTrackedTimesOptions struct {\n\tIssueID      int64\n\tUserID       int64\n\tRepositoryID int64\n\tMilestoneID  int64\n}\n```\nFindTrackedTimesOptions represent the filters for tracked times. If an ID is 0 it will be ignored.\n\n```go\nfunc (opts *FindTrackedTimesOptions) ToCond() builder.Cond\n```\nToCond will convert each condition into a xorm-Cond\n\n```go\nfunc (opts *FindTrackedTimesOptions) ToSession(e Engine) *xorm.Session\n```\nToSession will convert the given options to a xorm Session by using the conditions from ToCond and joining with issue table if required\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 represents relations of user and his/her followers.\n\n```go\ntype GPGKey struct {\n\tID                int64          `xorm:\"pk autoincr\"`\n\tOwnerID           int64          `xorm:\"INDEX NOT NULL\"`\n\tKeyID             string         `xorm:\"INDEX CHAR(16) NOT NULL\"`\n\tPrimaryKeyID      string         `xorm:\"CHAR(16)\"`\n\tContent           string         `xorm:\"TEXT NOT NULL\"`\n\tCreatedUnix       util.TimeStamp `xorm:\"created\"`\n\tExpiredUnix       util.TimeStamp\n\tAddedUnix         util.TimeStamp\n\tSubsKey           []*GPGKey `xorm:\"-\"`\n\tEmails            []*EmailAddress\n\tCanSign           bool\n\tCanEncryptComms   bool\n\tCanEncryptStorage bool\n\tCanCertify        bool\n}\n```\nGPGKey represents a GPG key.\n\n```go\nfunc AddGPGKey(ownerID int64, content string) (*GPGKey, error)\n```\nAddGPGKey adds new public key to database.\n\n```go\nfunc GetGPGKeyByID(keyID int64) (*GPGKey, error)\n```\nGetGPGKeyByID returns public key by given ID.\n\n```go\nfunc ListGPGKeys(uid int64) ([]*GPGKey, error)\n```\nListGPGKeys returns a list of public keys belongs to given user.\n\n```go\nfunc (key *GPGKey) AfterLoad(session *xorm.Session)\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\nfunc (key *GPGKey) BeforeInsert()\n```\nBeforeInsert will be invoked by XORM before inserting a record\n\n```go\ntype GetFeedsOptions struct {\n\tRequestedUser    *User\n\tRequestingUserID int64\n\tIncludePrivate   bool // include private actions\n\tOnlyPerformedBy  bool // only actions performed by requested user\n\tIncludeDeleted   bool // include deleted actions\n}\n```\nGetFeedsOptions options for retrieving feeds\n\n```go\ntype GraphItem struct {\n\tGraphAcii    string\n\tRelation     string\n\tBranch       string\n\tRev          string\n\tDate         string\n\tAuthor       string\n\tAuthorEmail  string\n\tShortRev     string\n\tSubject      string\n\tOnlyRelation bool\n}\n```\nGraphItem represent one commit, or one relation in timeline\n\n```go\ntype GraphItems []GraphItem\n```\nGraphItems is a list of commits from all branches\n\n```go\nfunc GetCommitGraph(r *git.Repository) (GraphItems, error)\n```\nGetCommitGraph return a list of commit (GraphItems) from all branches\n\n```go\ntype HookContentType int\n```\nHookContentType is the content type of a web hook\n\n```go\nconst (\n\t// ContentTypeJSON is a JSON payload for web hooks\n\tContentTypeJSON HookContentType = iota + 1\n\t// ContentTypeForm is an url-encoded form payload for web hook\n\tContentTypeForm\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```\nName returns the name of a given web hook's content type\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```\nHookEventType is the type of an hook event\n\n```go\nconst (\n\tHookEventCreate              HookEventType = \"create\"\n\tHookEventDelete              HookEventType = \"delete\"\n\tHookEventFork                HookEventType = \"fork\"\n\tHookEventPush                HookEventType = \"push\"\n\tHookEventIssues              HookEventType = \"issues\"\n\tHookEventIssueComment        HookEventType = \"issue_comment\"\n\tHookEventPullRequest         HookEventType = \"pull_request\"\n\tHookEventRepository          HookEventType = \"repository\"\n\tHookEventRelease             HookEventType = \"release\"\n\tHookEventPullRequestApproved HookEventType = \"pull_request_approved\"\n\tHookEventPullRequestRejected HookEventType = \"pull_request_rejected\"\n\tHookEventPullRequestComment  HookEventType = \"pull_request_comment\"\n)\n```\nTypes of hook events\n\n```go\ntype HookEvents struct {\n\tCreate       bool `json:\"create\"`\n\tDelete       bool `json:\"delete\"`\n\tFork         bool `json:\"fork\"`\n\tIssues       bool `json:\"issues\"`\n\tIssueComment bool `json:\"issue_comment\"`\n\tPush         bool `json:\"push\"`\n\tPullRequest  bool `json:\"pull_request\"`\n\tRepository   bool `json:\"repository\"`\n\tRelease      bool `json:\"release\"`\n}\n```\nHookEvents is a set of web hook events\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```\nHookStatus is the status of a web hook\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 `xorm:\"TEXT\"`\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) AfterLoad()\n```\nAfterLoad updates the webhook object upon setting a column\n\n```go\nfunc (t *HookTask) BeforeUpdate()\n```\nBeforeUpdate will be invoked by XORM before updating a record representing this object\n\n```go\ntype HookTaskType int\n```\nHookTaskType is the type of an hook task\n\n```go\nconst (\n\tGOGS HookTaskType = iota + 1\n\tSLACK\n\tGITEA\n\tDISCORD\n\tDINGTALK\n)\n```\nTypes of hook tasks\n\n```go\nfunc ToHookTaskType(name string) HookTaskType\n```\nToHookTaskType returns HookTaskType by given name.\n\n```go\nfunc (t HookTaskType) Name() string\n```\nName returns the name of an hook task type\n\n```go\ntype Issue struct {\n\tID              int64       `xorm:\"pk autoincr\"`\n\tRepoID          int64       `xorm:\"INDEX UNIQUE(repo_index)\"`\n\tRepo            *Repository `xorm:\"-\"`\n\tIndex           int64       `xorm:\"UNIQUE(repo_index)\"` // Index in one repository.\n\tPosterID        int64       `xorm:\"INDEX\"`\n\tPoster          *User       `xorm:\"-\"`\n\tTitle           string      `xorm:\"name\"`\n\tContent         string      `xorm:\"TEXT\"`\n\tRenderedContent string      `xorm:\"-\"`\n\tLabels          []*Label    `xorm:\"-\"`\n\tMilestoneID     int64       `xorm:\"INDEX\"`\n\tMilestone       *Milestone  `xorm:\"-\"`\n\tPriority        int\n\tAssigneeID      int64        `xorm:\"-\"`\n\tAssignee        *User        `xorm:\"-\"`\n\tIsClosed        bool         `xorm:\"INDEX\"`\n\tIsRead          bool         `xorm:\"-\"`\n\tIsPull          bool         `xorm:\"INDEX\"` // Indicates whether is a pull request or not.\n\tPullRequest     *PullRequest `xorm:\"-\"`\n\tNumComments     int\n\tRef             string\n\n\tDeadlineUnix util.TimeStamp `xorm:\"INDEX\"`\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n\tClosedUnix  util.TimeStamp `xorm:\"INDEX\"`\n\n\tAttachments      []*Attachment `xorm:\"-\"`\n\tComments         []*Comment    `xorm:\"-\"`\n\tReactions        ReactionList  `xorm:\"-\"`\n\tTotalTrackedTime int64         `xorm:\"-\"`\n\tAssignees        []*User       `xorm:\"-\"`\n\n\t// IsLocked limits commenting abilities to users on an issue\n\t// with write access\n\tIsLocked bool `xorm:\"NOT NULL DEFAULT false\"`\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 raw issue without loading attributes by index in a repository.\n\n```go\nfunc GetIssueWithAttrsByID(id int64) (*Issue, error)\n```\nGetIssueWithAttrsByID returns an issue with attributes by given ID.\n\n```go\nfunc GetIssueWithAttrsByIndex(repoID, index int64) (*Issue, error)\n```\nGetIssueWithAttrsByIndex returns issue by index in a repository.\n\n```go\nfunc GetIssuesByIDs(issueIDs []int64) ([]*Issue, error)\n```\nGetIssuesByIDs return issues with the given IDs.\n\n```go\nfunc Issues(opts *IssuesOptions) ([]*Issue, error)\n```\nIssues returns a list of issues by given conditions.\n\n```go\nfunc (issue *Issue) APIFormat() *api.Issue\n```\nAPIFormat assumes some fields assigned with values: Required - Poster, Labels, Optional - Milestone, Assignee, PullRequest\n\n```go\nfunc (issue *Issue) APIURL() string\n```\nAPIURL returns the absolute APIURL to this issue.\n\n```go\nfunc (issue *Issue) AddLabel(doer *User, label *Label) error\n```\nAddLabel adds a new label to the issue.\n\n```go\nfunc (issue *Issue) AddLabels(doer *User, labels []*Label) error\n```\nAddLabels adds a list of new labels to the issue.\n\n```go\nfunc (issue *Issue) BlockedByDependencies() ([]*Issue, error)\n```\nBlockedByDependencies finds all Dependencies an issue is blocked by\n\n```go\nfunc (issue *Issue) BlockingDependencies() ([]*Issue, error)\n```\nBlockingDependencies returns all blocking dependencies, aka all other issues a given issue blocks\n\n```go\nfunc (issue *Issue) ChangeAssignee(doer *User, assigneeID int64) (err error)\n```\nChangeAssignee changes the Assignee of this issue.\n\n```go\nfunc (issue *Issue) ChangeContent(doer *User, content string) (err error)\n```\nChangeContent changes issue content, as the given user.\n\n```go\nfunc (issue *Issue) ChangeStatus(doer *User, isClosed bool) (err error)\n```\nChangeStatus changes issue status to open or closed.\n\n```go\nfunc (issue *Issue) ChangeTitle(doer *User, title string) (err error)\n```\nChangeTitle changes the title of this issue, as the given user.\n\n```go\nfunc (issue *Issue) ClearLabels(doer *User) (err error)\n```\nClearLabels removes all issue labels as the given user. Triggers appropriate WebHooks, if any.\n\n```go\nfunc (issue *Issue) DiffURL() string\n```\nDiffURL returns the absolute URL to this diff\n\n```go\nfunc (issue *Issue) GetIsRead(userID int64) error\n```\nGetIsRead load the \\`IsRead\\` field of the issue\n\n```go\nfunc (issue *Issue) GetLastEventLabel() string\n```\nGetLastEventLabel returns the localization label for the current issue.\n\n```go\nfunc (issue *Issue) GetLastEventTimestamp() util.TimeStamp\n```\nGetLastEventTimestamp returns the last user visible event timestamp, either the creation of this issue or the close.\n\n```go\nfunc (issue *Issue) GetPullRequest() (pr *PullRequest, err error)\n```\nGetPullRequest returns the issue pull request\n\n```go\nfunc (issue *Issue) GetTasks() int\n```\nGetTasks returns the amount of tasks in the issues content\n\n```go\nfunc (issue *Issue) GetTasksDone() int\n```\nGetTasksDone returns the amount of completed tasks in the issues content\n\n```go\nfunc (issue *Issue) HTMLURL() string\n```\nHTMLURL returns the absolute URL to this issue.\n\n```go\nfunc (issue *Issue) HasLabel(labelID int64) bool\n```\nHasLabel returns true if issue has been labeled by given ID.\n\n```go\nfunc (issue *Issue) HashTag() string\n```\nHashTag returns unique hash tag for issue.\n\n```go\nfunc (issue *Issue) IsOverdue() bool\n```\nIsOverdue checks if the issue is overdue\n\n```go\nfunc (issue *Issue) IsPoster(uid int64) bool\n```\nIsPoster returns true if given user by ID is the poster.\n\n```go\nfunc (issue *Issue) IsTimetrackerEnabled() bool\n```\nIsTimetrackerEnabled returns true if the repo enables timetracking\n\n```go\nfunc (issue *Issue) LoadAttributes() error\n```\nLoadAttributes loads the attribute of this issue.\n\n```go\nfunc (issue *Issue) LoadDiscussComments() error\n```\nLoadDiscussComments loads discuss comments\n\n```go\nfunc (issue *Issue) LoadPoster() error\n```\nLoadPoster loads poster\n\n```go\nfunc (issue *Issue) LoadPullRequest() error\n```\nLoadPullRequest loads pull request info\n\n```go\nfunc (issue *Issue) LoadRepo() error\n```\nLoadRepo loads issue's repository\n\n```go\nfunc (issue *Issue) MailParticipants(opType ActionType) (err error)\n```\nMailParticipants sends new issue thread created emails to repository watchers and mentioned people.\n\n```go\nfunc (issue *Issue) PatchURL() string\n```\nPatchURL returns the absolute URL to this patch\n\n```go\nfunc (issue *Issue) ReadBy(userID int64) error\n```\nReadBy sets issue to be read by given user.\n\n```go\nfunc (issue *Issue) RemoveLabel(doer *User, label *Label) error\n```\nRemoveLabel removes a label from issue by given ID.\n\n```go\nfunc (issue *Issue) ReplaceLabels(labels []*Label, doer *User) (err error)\n```\nReplaceLabels removes all current labels and add new labels to the issue. Triggers appropriate WebHooks, if any.\n\n```go\nfunc (issue *Issue) State() api.StateType\n```\nState returns string representation of issue status.\n\n```go\ntype IssueAssignees struct {\n\tID         int64 `xorm:\"pk autoincr\"`\n\tAssigneeID int64 `xorm:\"INDEX\"`\n\tIssueID    int64 `xorm:\"INDEX\"`\n}\n```\nIssueAssignees saves all issue assignees\n\n```go\ntype IssueDependency struct {\n\tID           int64          `xorm:\"pk autoincr\"`\n\tUserID       int64          `xorm:\"NOT NULL\"`\n\tIssueID      int64          `xorm:\"UNIQUE(issue_dependency) NOT NULL\"`\n\tDependencyID int64          `xorm:\"UNIQUE(issue_dependency) NOT NULL\"`\n\tCreatedUnix  util.TimeStamp `xorm:\"created\"`\n\tUpdatedUnix  util.TimeStamp `xorm:\"updated\"`\n}\n```\nIssueDependency represents an issue dependency\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 represents an issue-label relation.\n\n```go\ntype IssueList []*Issue\n```\nIssueList defines a list of issues\n\n```go\nfunc (issues IssueList) LoadAttachments() error\n```\nLoadAttachments loads attachments\n\n```go\nfunc (issues IssueList) LoadAttributes() error\n```\nLoadAttributes loads attributes of the issues, except for attachments and comments\n\n```go\nfunc (issues IssueList) LoadComments() error\n```\nLoadComments loads comments\n\n```go\nfunc (issues IssueList) LoadDiscussComments() error\n```\nLoadDiscussComments loads discuss comments\n\n```go\nfunc (issues IssueList) LoadRepositories() ([]*Repository, error)\n```\nLoadRepositories loads issues' all repositories\n\n```go\ntype IssueLockOptions struct {\n\tDoer   *User\n\tIssue  *Issue\n\tReason string\n}\n```\nIssueLockOptions defines options for locking and/or unlocking an issue/PR\n\n```go\ntype IssueStats struct {\n\tOpenCount, ClosedCount int64\n\tYourRepositoriesCount  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, error)\n```\nGetIssueStats returns issue statistic information by given conditions.\n\n```go\nfunc GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error)\n```\nGetUserIssueStats returns issue statistic information for dashboard by given conditions.\n\n```go\ntype IssueStatsOptions struct {\n\tRepoID      int64\n\tLabels      string\n\tMilestoneID int64\n\tAssigneeID  int64\n\tMentionedID int64\n\tPosterID    int64\n\tIsPull      util.OptionalBool\n\tIssueIDs    []int64\n}\n```\nIssueStatsOptions contains parameters accepted by GetIssueStats.\n\n```go\ntype IssueUser struct {\n\tID          int64 `xorm:\"pk autoincr\"`\n\tUID         int64 `xorm:\"INDEX\"` // User ID.\n\tIssueID     int64\n\tIsRead      bool\n\tIsMentioned bool\n}\n```\nIssueUser represents an issue-user relation.\n\n```go\ntype IssueWatch struct {\n\tID          int64          `xorm:\"pk autoincr\"`\n\tUserID      int64          `xorm:\"UNIQUE(watch) NOT NULL\"`\n\tIssueID     int64          `xorm:\"UNIQUE(watch) NOT NULL\"`\n\tIsWatching  bool           `xorm:\"NOT NULL\"`\n\tCreatedUnix util.TimeStamp `xorm:\"created NOT NULL\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"updated NOT NULL\"`\n}\n```\nIssueWatch is connection request for receiving issue notification.\n\n```go\nfunc GetIssueWatch(userID, issueID int64) (iw *IssueWatch, exists bool, err error)\n```\nGetIssueWatch returns an issue watch by user and issue\n\n```go\nfunc GetIssueWatchers(issueID int64) ([]*IssueWatch, error)\n```\nGetIssueWatchers returns watchers/unwatchers of a given issue\n\n```go\ntype IssuesConfig struct {\n\tEnableTimetracker                bool\n\tAllowOnlyContributorsToTrackTime bool\n\tEnableDependencies               bool\n}\n```\nIssuesConfig describes issues config\n\n```go\nfunc (cfg *IssuesConfig) FromDB(bs []byte) error\n```\nFromDB fills up a IssuesConfig from serialized format.\n\n```go\nfunc (cfg *IssuesConfig) ToDB() ([]byte, error)\n```\nToDB exports a IssuesConfig to a serialized format.\n\n```go\ntype IssuesOptions struct {\n\tRepoIDs     []int64 // include all repos if empty\n\tAssigneeID  int64\n\tPosterID    int64\n\tMentionedID int64\n\tMilestoneID int64\n\tPage        int\n\tPageSize    int\n\tIsClosed    util.OptionalBool\n\tIsPull      util.OptionalBool\n\tLabelIDs    []int64\n\tSortType    string\n\tIssueIDs    []int64\n}\n```\nIssuesOptions represents options of an issue.\n\n```go\ntype KeyType int\n```\nKeyType specifies the key type\n\n```go\ntype LDAPConfig struct {\n\t*ldap.Source\n}\n```\nLDAPConfig holds configuration for LDAP login source.\n\n```go\nfunc (cfg *LDAPConfig) FromDB(bs []byte) error\n```\nFromDB fills up a LDAPConfig from serialized format.\n\n```go\nfunc (cfg *LDAPConfig) SecurityProtocolName() string\n```\nSecurityProtocolName returns the name of configured security protocol.\n\n```go\nfunc (cfg *LDAPConfig) ToDB() ([]byte, error)\n```\nToDB exports a LDAPConfig to a serialized format.\n\n```go\ntype LFSLock struct {\n\tID      int64       `xorm:\"pk autoincr\"`\n\tRepo    *Repository `xorm:\"-\"`\n\tRepoID  int64       `xorm:\"INDEX NOT NULL\"`\n\tOwner   *User       `xorm:\"-\"`\n\tOwnerID int64       `xorm:\"INDEX NOT NULL\"`\n\tPath    string      `xorm:\"TEXT\"`\n\tCreated time.Time   `xorm:\"created\"`\n}\n```\nLFSLock represents a git lfs lock of repository.\n\n```go\nfunc CreateLFSLock(lock *LFSLock) (*LFSLock, error)\n```\nCreateLFSLock creates a new lock.\n\n```go\nfunc DeleteLFSLockByID(id int64, u *User, force bool) (*LFSLock, error)\n```\nDeleteLFSLockByID deletes a lock by given ID.\n\n```go\nfunc GetLFSLock(repo *Repository, path string) (*LFSLock, error)\n```\nGetLFSLock returns release by given path.\n\n```go\nfunc GetLFSLockByID(id int64) (*LFSLock, error)\n```\nGetLFSLockByID returns release by given id.\n\n```go\nfunc GetLFSLockByRepoID(repoID int64) (locks []*LFSLock, err error)\n```\nGetLFSLockByRepoID returns a list of locks of repository.\n\n```go\nfunc (l *LFSLock) APIFormat() *api.LFSLock\n```\nAPIFormat convert a Release to lfs.LFSLock\n\n```go\nfunc (l *LFSLock) AfterLoad(session *xorm.Session)\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\nfunc (l *LFSLock) BeforeInsert()\n```\nBeforeInsert is invoked from XORM before inserting an object of this type.\n\n```go\ntype LFSMetaObject struct {\n\tID           int64          `xorm:\"pk autoincr\"`\n\tOid          string         `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tSize         int64          `xorm:\"NOT NULL\"`\n\tRepositoryID int64          `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tExisting     bool           `xorm:\"-\"`\n\tCreatedUnix  util.TimeStamp `xorm:\"created\"`\n}\n```\nLFSMetaObject stores metadata for LFS tracked files.\n\n```go\nfunc NewLFSMetaObject(m *LFSMetaObject) (*LFSMetaObject, error)\n```\nNewLFSMetaObject stores a given populated LFSMetaObject structure in the database if it is not already present.\n\n```go\nfunc (m *LFSMetaObject) Pointer() string\n```\nPointer returns the string representation of an LFS pointer file\n\n```go\ntype LFSTokenResponse struct {\n\tHeader map[string]string `json:\"header\"`\n\tHref   string            `json:\"href\"`\n}\n```\nLFSTokenResponse defines the JSON structure in which the JWT token is stored. This structure is fetched via SSH and passed by the Git LFS client to the server endpoint for authorization.\n\n```go\ntype Label struct {\n\tID              int64 `xorm:\"pk autoincr\"`\n\tRepoID          int64 `xorm:\"INDEX\"`\n\tName            string\n\tDescription     string\n\tColor           string `xorm:\"VARCHAR(7)\"`\n\tNumIssues       int\n\tNumClosedIssues int\n\tNumOpenIssues   int  `xorm:\"-\"`\n\tIsChecked       bool `xorm:\"-\"`\n\tQueryString     string\n\tIsSelected      bool\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 GetLabelInRepoByID(repoID, labelID int64) (*Label, error)\n```\nGetLabelInRepoByID returns a label by ID in given repository.\n\n```go\nfunc GetLabelInRepoByName(repoID int64, labelName string) (*Label, error)\n```\nGetLabelInRepoByName returns a label by name in given repository.\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, sortType string) ([]*Label, error)\n```\nGetLabelsByRepoID returns all labels that belong to given repository by ID.\n\n```go\nfunc GetLabelsInRepoByIDs(repoID int64, labelIDs []int64) ([]*Label, error)\n```\nGetLabelsInRepoByIDs returns a list of labels by IDs in given repository, it silently ignores label IDs that do not belong to the repository.\n\n```go\nfunc (label *Label) APIFormat() *api.Label\n```\nAPIFormat converts a Label to the api.Label format\n\n```go\nfunc (label *Label) CalOpenIssues()\n```\nCalOpenIssues calculates the open issues of label.\n\n```go\nfunc (label *Label) ForegroundColor() template.CSS\n```\nForegroundColor calculates the text color for labels based on their background color.\n\n```go\nfunc (label *Label) LoadSelectedLabelsAfterClick(currentSelectedLabels []int64)\n```\nLoadSelectedLabelsAfterClick calculates the set of selected labels when a label is clicked\n\n```go\ntype LoginSource struct {\n\tID            int64 `xorm:\"pk autoincr\"`\n\tType          LoginType\n\tName          string          `xorm:\"UNIQUE\"`\n\tIsActived     bool            `xorm:\"INDEX NOT NULL DEFAULT false\"`\n\tIsSyncEnabled bool            `xorm:\"INDEX NOT NULL DEFAULT false\"`\n\tCfg           core.Conversion `xorm:\"TEXT\"`\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n}\n```\nLoginSource represents an external way for authorizing users.\n\n```go\nfunc GetActiveOAuth2LoginSourceByName(name string) (*LoginSource, error)\n```\nGetActiveOAuth2LoginSourceByName returns a OAuth2 LoginSource based on the given name\n\n```go\nfunc GetActiveOAuth2ProviderLoginSources() ([]*LoginSource, error)\n```\nGetActiveOAuth2ProviderLoginSources returns all actived LoginOAuth2 sources\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```\nLoginSources returns a slice of all login sources found in DB.\n\n```go\nfunc (source *LoginSource) BeforeSet(colName string, val xorm.Cell)\n```\nBeforeSet is invoked from XORM before setting the value of a field of this object.\n\n```go\nfunc (source *LoginSource) HasTLS() bool\n```\nHasTLS returns true of this source supports TLS.\n\n```go\nfunc (source *LoginSource) IsDLDAP() bool\n```\nIsDLDAP returns true of this source is of the DLDAP type.\n\n```go\nfunc (source *LoginSource) IsLDAP() bool\n```\nIsLDAP returns true of this source is of the LDAP type.\n\n```go\nfunc (source *LoginSource) IsOAuth2() bool\n```\nIsOAuth2 returns true of this source is of the OAuth2 type.\n\n```go\nfunc (source *LoginSource) IsPAM() bool\n```\nIsPAM returns true of this source is of the PAM type.\n\n```go\nfunc (source *LoginSource) IsSMTP() bool\n```\nIsSMTP returns true of this source is of the SMTP type.\n\n```go\nfunc (source *LoginSource) LDAP() *LDAPConfig\n```\nLDAP returns LDAPConfig for this source, if of LDAP type.\n\n```go\nfunc (source *LoginSource) OAuth2() *OAuth2Config\n```\nOAuth2 returns OAuth2Config for this source, if of OAuth2 type.\n\n```go\nfunc (source *LoginSource) PAM() *PAMConfig\n```\nPAM returns PAMConfig for this source, if of PAM type.\n\n```go\nfunc (source *LoginSource) SMTP() *SMTPConfig\n```\nSMTP returns SMTPConfig for this source, if of SMTP type.\n\n```go\nfunc (source *LoginSource) SkipVerify() bool\n```\nSkipVerify returns true if this source is configured to skip SSL verification.\n\n```go\nfunc (source *LoginSource) TypeName() string\n```\nTypeName return name of this login source type.\n\n```go\nfunc (source *LoginSource) UseTLS() bool\n```\nUseTLS returns true of this source is configured to use TLS.\n\n```go\ntype LoginType int\n```\nLoginType represents an login type.\n\n```go\nconst (\n\tLoginNoType LoginType = iota\n\tLoginPlain            // 1\n\tLoginLDAP             // 2\n\tLoginSMTP             // 3\n\tLoginPAM              // 4\n\tLoginDLDAP            // 5\n\tLoginOAuth2           // 6\n)\n```\nNote: new type must append to the end of list to maintain compatibility.\n\n```go\ntype MergeStyle string\n```\nMergeStyle represents the approach to merge commits into base branch.\n\n```go\nconst (\n\t// MergeStyleMerge create merge commit\n\tMergeStyleMerge MergeStyle = \"merge\"\n\t// MergeStyleRebase rebase before merging\n\tMergeStyleRebase MergeStyle = \"rebase\"\n\t// MergeStyleRebaseMerge rebase before merging with merge commit (--no-ff)\n\tMergeStyleRebaseMerge MergeStyle = \"rebase-merge\"\n\t// MergeStyleSquash squash commits into single commit before merging\n\tMergeStyleSquash MergeStyle = \"squash\"\n)\n```\n\n```go\ntype MigrateRepoOptions struct {\n\tName        string\n\tDescription string\n\tIsPrivate   bool\n\tIsMirror    bool\n\tRemoteAddr  string\n}\n```\nMigrateRepoOptions contains the repository migrate options\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\tIsOverdue       bool `xorm:\"-\"`\n\n\tDeadlineString string `xorm:\"-\"`\n\tDeadlineUnix   util.TimeStamp\n\tClosedDateUnix util.TimeStamp\n\n\tTotalTrackedTime int64 `xorm:\"-\"`\n}\n```\nMilestone represents a milestone of repository.\n\n```go\nfunc GetMilestoneByID(id int64) (*Milestone, error)\n```\nGetMilestoneByID returns the milestone via id .\n\n```go\nfunc GetMilestoneByRepoID(repoID, id int64) (*Milestone, error)\n```\nGetMilestoneByRepoID returns the milestone in a repository.\n\n```go\nfunc (m *Milestone) APIFormat() *api.Milestone\n```\nAPIFormat returns this Milestone in API format.\n\n```go\nfunc (m *Milestone) AfterLoad()\n```\nAfterLoad is invoked from XORM after setting the value of a field of this object.\n\n```go\nfunc (m *Milestone) BeforeUpdate()\n```\nBeforeUpdate is invoked from XORM before updating this object.\n\n```go\nfunc (m *Milestone) State() api.StateType\n```\nState returns string representation of milestone status.\n\n```go\ntype MilestoneList []*Milestone\n```\nMilestoneList is a list of milestones offering additional functionality\n\n```go\nfunc GetMilestones(repoID int64, page int, isClosed bool, sortType string) (MilestoneList, error)\n```\nGetMilestones returns a list of milestones of given repository and status.\n\n```go\nfunc GetMilestonesByRepoID(repoID int64) (MilestoneList, error)\n```\nGetMilestonesByRepoID returns all opened milestones of a repository.\n\n```go\nfunc (milestones MilestoneList) LoadTotalTrackedTimes() error\n```\nLoadTotalTrackedTimes loads for every milestone in the list the TotalTrackedTime by a batch request\n\n```go\ntype Mirror struct {\n\tID          int64       `xorm:\"pk autoincr\"`\n\tRepoID      int64       `xorm:\"INDEX\"`\n\tRepo        *Repository `xorm:\"-\"`\n\tInterval    time.Duration\n\tEnablePrune bool `xorm:\"NOT NULL DEFAULT true\"`\n\n\tUpdatedUnix    util.TimeStamp `xorm:\"INDEX\"`\n\tNextUpdateUnix util.TimeStamp `xorm:\"INDEX\"`\n\t// contains filtered or unexported fields\n}\n```\nMirror represents mirror information of a repository.\n\n```go\nfunc GetMirrorByRepoID(repoID int64) (*Mirror, error)\n```\nGetMirrorByRepoID returns mirror information of a repository.\n\n```go\nfunc (m *Mirror) Address() string\n```\nAddress returns mirror address from Git repository config without credentials.\n\n```go\nfunc (m *Mirror) AfterLoad(session *xorm.Session)\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\nfunc (m *Mirror) BeforeInsert()\n```\nBeforeInsert will be invoked by XORM before inserting a record\n\n```go\nfunc (m *Mirror) FullAddress() string\n```\nFullAddress returns mirror address from Git repository config.\n\n```go\nfunc (m *Mirror) SaveAddress(addr string) error\n```\nSaveAddress writes new address to Git repository config.\n\n```go\nfunc (m *Mirror) ScheduleNextUpdate()\n```\nScheduleNextUpdate calculates and sets next update time.\n\n```go\ntype MirrorRepositoryList []*Repository\n```\nMirrorRepositoryList contains the mirror repositories\n\n```go\nfunc (repos MirrorRepositoryList) LoadAttributes() error\n```\nLoadAttributes loads the attributes for the given MirrorRepositoryList\n\n```go\ntype MirrorSyncPushActionOptions struct {\n\tRefName     string\n\tOldCommitID string\n\tNewCommitID string\n\tCommits     *PushCommits\n}\n```\nMirrorSyncPushActionOptions mirror synchronization action options.\n\n```go\ntype NewCommitStatusOptions struct {\n\tRepo         *Repository\n\tCreator      *User\n\tSHA          string\n\tCommitStatus *CommitStatus\n}\n```\nNewCommitStatusOptions holds options for creating a CommitStatus\n\n```go\ntype NewIssueOptions struct {\n\tRepo        *Repository\n\tIssue       *Issue\n\tLabelIDs    []int64\n\tAssigneeIDs []int64\n\tAttachments []string // In UUID format.\n\tIsPull      bool\n}\n```\nNewIssueOptions represents the options of a new issue.\n\n```go\ntype Notice struct {\n\tID          int64 `xorm:\"pk autoincr\"`\n\tType        NoticeType\n\tDescription string         `xorm:\"TEXT\"`\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n}\n```\nNotice represents a system notice for admin.\n\n```go\nfunc Notices(page, pageSize int) ([]*Notice, error)\n```\nNotices returns 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```\nNoticeType describes the notice type\n\n```go\nconst (\n\t//NoticeRepository type\n\tNoticeRepository NoticeType = iota + 1\n)\n```\n\n```go\ntype Notification struct {\n\tID     int64 `xorm:\"pk autoincr\"`\n\tUserID int64 `xorm:\"INDEX NOT NULL\"`\n\tRepoID int64 `xorm:\"INDEX NOT NULL\"`\n\n\tStatus NotificationStatus `xorm:\"SMALLINT INDEX NOT NULL\"`\n\tSource NotificationSource `xorm:\"SMALLINT INDEX NOT NULL\"`\n\n\tIssueID  int64  `xorm:\"INDEX NOT NULL\"`\n\tCommitID string `xorm:\"INDEX\"`\n\n\tUpdatedBy int64 `xorm:\"INDEX NOT NULL\"`\n\n\tIssue      *Issue      `xorm:\"-\"`\n\tRepository *Repository `xorm:\"-\"`\n\n\tCreatedUnix util.TimeStamp `xorm:\"created INDEX NOT NULL\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"updated INDEX NOT NULL\"`\n}\n```\nNotification represents a notification\n\n```go\nfunc NotificationsForUser(user *User, statuses []NotificationStatus, page, perPage int) ([]*Notification, error)\n```\nNotificationsForUser returns notifications for a given user and status\n\n```go\nfunc (n *Notification) GetIssue() (*Issue, error)\n```\nGetIssue returns the issue of the notification\n\n```go\nfunc (n *Notification) GetRepo() (*Repository, error)\n```\nGetRepo returns the repo of the notification\n\n```go\ntype NotificationSource uint8\n```\nNotificationSource is the source of the notification (issue, PR, commit, etc)\n\n```go\nconst (\n\t// NotificationSourceIssue is a notification of an issue\n\tNotificationSourceIssue NotificationSource = iota + 1\n\t// NotificationSourcePullRequest is a notification of a pull request\n\tNotificationSourcePullRequest\n\t// NotificationSourceCommit is a notification of a commit\n\tNotificationSourceCommit\n)\n```\n\n```go\ntype NotificationStatus uint8\n```\nNotificationStatus is the status of the notification (read or unread)\n\n```go\nconst (\n\t// NotificationStatusUnread represents an unread notification\n\tNotificationStatusUnread NotificationStatus = iota + 1\n\t// NotificationStatusRead represents a read notification\n\tNotificationStatusRead\n\t// NotificationStatusPinned represents a pinned notification\n\tNotificationStatusPinned\n)\n```\n\n```go\ntype OAuth2Application struct {\n\tID   int64 `xorm:\"pk autoincr\"`\n\tUID  int64 `xorm:\"INDEX\"`\n\tUser *User `xorm:\"-\"`\n\n\tName string\n\n\tClientID     string `xorm:\"unique\"`\n\tClientSecret string\n\n\tRedirectURIs []string `xorm:\"redirect_uris JSON TEXT\"`\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n}\n```\nOAuth2Application represents an OAuth2 client (RFC 6749)\n\n```go\nfunc CreateOAuth2Application(opts CreateOAuth2ApplicationOptions) (*OAuth2Application, error)\n```\nCreateOAuth2Application inserts a new oauth2 application\n\n```go\nfunc GetOAuth2ApplicationByClientID(clientID string) (app *OAuth2Application, err error)\n```\nGetOAuth2ApplicationByClientID returns the oauth2 application with the given client\\_id. Returns an error if not found.\n\n```go\nfunc GetOAuth2ApplicationByID(id int64) (app *OAuth2Application, err error)\n```\nGetOAuth2ApplicationByID returns the oauth2 application with the given id. Returns an error if not found.\n\n```go\nfunc GetOAuth2ApplicationsByUserID(userID int64) (apps []*OAuth2Application, err error)\n```\nGetOAuth2ApplicationsByUserID returns all oauth2 applications owned by the user\n\n```go\nfunc (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool\n```\nContainsRedirectURI checks if redirectURI is allowed for app\n\n```go\nfunc (app *OAuth2Application) CreateGrant(userID int64) (*OAuth2Grant, error)\n```\nCreateGrant generates a grant for an user\n\n```go\nfunc (app *OAuth2Application) GenerateClientSecret() (string, error)\n```\nGenerateClientSecret will generate the client secret and returns the plaintext and saves the hash at the database\n\n```go\nfunc (app *OAuth2Application) GetGrantByUserID(userID int64) (*OAuth2Grant, error)\n```\nGetGrantByUserID returns a OAuth2Grant by its user and application ID\n\n```go\nfunc (app *OAuth2Application) LoadUser() (err error)\n```\nLoadUser will load User by UID\n\n```go\nfunc (app *OAuth2Application) PrimaryRedirectURI() string\n```\nPrimaryRedirectURI returns the first redirect uri or an empty string if empty\n\n```go\nfunc (app *OAuth2Application) TableName() string\n```\nTableName sets the table name to \\`oauth2\\_application\\`\n\n```go\nfunc (app *OAuth2Application) ValidateClientSecret(secret []byte) bool\n```\nValidateClientSecret validates the given secret by the hash saved in database\n\n```go\ntype OAuth2AuthorizationCode struct {\n\tID                  int64        `xorm:\"pk autoincr\"`\n\tGrant               *OAuth2Grant `xorm:\"-\"`\n\tGrantID             int64\n\tCode                string `xorm:\"INDEX unique\"`\n\tCodeChallenge       string\n\tCodeChallengeMethod string\n\tRedirectURI         string\n\tValidUntil          util.TimeStamp `xorm:\"index\"`\n}\n```\nOAuth2AuthorizationCode is a code to obtain an access token in combination with the client secret once. It has a limited lifetime.\n\n```go\nfunc GetOAuth2AuthorizationByCode(code string) (*OAuth2AuthorizationCode, error)\n```\nGetOAuth2AuthorizationByCode returns an authorization by its code\n\n```go\nfunc (code *OAuth2AuthorizationCode) GenerateRedirectURI(state string) (redirect *url.URL, err error)\n```\nGenerateRedirectURI generates a redirect URI for a successful authorization request. State will be used if not empty.\n\n```go\nfunc (code *OAuth2AuthorizationCode) Invalidate() error\n```\nInvalidate deletes the auth code from the database to invalidate this code\n\n```go\nfunc (code *OAuth2AuthorizationCode) TableName() string\n```\nTableName sets the table name to \\`oauth2\\_authorization\\_code\\`\n\n```go\nfunc (code *OAuth2AuthorizationCode) ValidateCodeChallenge(verifier string) bool\n```\nValidateCodeChallenge validates the given verifier against the saved code challenge. This is part of the PKCE implementation.\n\n```go\ntype OAuth2Config struct {\n\tProvider                      string\n\tClientID                      string\n\tClientSecret                  string\n\tOpenIDConnectAutoDiscoveryURL string\n\tCustomURLMapping              *oauth2.CustomURLMapping\n}\n```\nOAuth2Config holds configuration for the OAuth2 login source.\n\n```go\nfunc (cfg *OAuth2Config) FromDB(bs []byte) error\n```\nFromDB fills up an OAuth2Config from serialized format.\n\n```go\nfunc (cfg *OAuth2Config) ToDB() ([]byte, error)\n```\nToDB exports an SMTPConfig to a serialized format.\n\n```go\ntype OAuth2Grant struct {\n\tID            int64          `xorm:\"pk autoincr\"`\n\tUserID        int64          `xorm:\"INDEX unique(user_application)\"`\n\tApplicationID int64          `xorm:\"INDEX unique(user_application)\"`\n\tCounter       int64          `xorm:\"NOT NULL DEFAULT 1\"`\n\tCreatedUnix   util.TimeStamp `xorm:\"created\"`\n\tUpdatedUnix   util.TimeStamp `xorm:\"updated\"`\n}\n```\nOAuth2Grant represents the permission of an user for a specifc application to access resources\n\n```go\nfunc GetOAuth2GrantByID(id int64) (*OAuth2Grant, error)\n```\nGetOAuth2GrantByID returns the grant with the given ID\n\n```go\nfunc (grant *OAuth2Grant) GenerateNewAuthorizationCode(redirectURI, codeChallenge, codeChallengeMethod string) (*OAuth2AuthorizationCode, error)\n```\nGenerateNewAuthorizationCode generates a new authorization code for a grant and saves it to the databse\n\n```go\nfunc (grant *OAuth2Grant) IncreaseCounter() error\n```\nIncreaseCounter increases the counter and updates the grant\n\n```go\nfunc (grant *OAuth2Grant) TableName() string\n```\nTableName sets the table name to \\`oauth2\\_grant\\`\n\n```go\ntype OAuth2Provider struct {\n\tName             string\n\tDisplayName      string\n\tImage            string\n\tCustomURLMapping *oauth2.CustomURLMapping\n}\n```\nOAuth2Provider describes the display values of a single OAuth2 provider\n\n```go\ntype OAuth2Token struct {\n\tGrantID int64           `json:\"gnt\"`\n\tType    OAuth2TokenType `json:\"tt\"`\n\tCounter int64           `json:\"cnt,omitempty\"`\n\tjwt.StandardClaims\n}\n```\nOAuth2Token represents a JWT token used to authenticate a client\n\n```go\nfunc ParseOAuth2Token(jwtToken string) (*OAuth2Token, error)\n```\nParseOAuth2Token parses a singed jwt string\n\n```go\nfunc (token *OAuth2Token) SignToken() (string, error)\n```\nSignToken signs the token with the JWT secret\n\n```go\ntype OAuth2TokenType int\n```\nOAuth2TokenType represents the type of token for an oauth application\n\n```go\nconst (\n\t// TypeAccessToken is a token with short lifetime to access the api\n\tTypeAccessToken OAuth2TokenType = 0\n\t// TypeRefreshToken is token with long lifetime to refresh access tokens obtained by the client\n\tTypeRefreshToken = iota\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  `xorm:\"INDEX\"`\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, all bool) ([]*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```\nPAMConfig holds configuration for the PAM login source.\n\n```go\nfunc (cfg *PAMConfig) FromDB(bs []byte) error\n```\nFromDB fills up a PAMConfig from serialized format.\n\n```go\nfunc (cfg *PAMConfig) ToDB() ([]byte, error)\n```\nToDB exports a PAMConfig to a serialized format.\n\n```go\ntype Permission struct {\n\tAccessMode AccessMode\n\tUnits      []*RepoUnit\n\tUnitsMode  map[UnitType]AccessMode\n}\n```\nPermission contains all the permissions related variables to a repository for a user\n\n```go\nfunc GetUserRepoPermission(repo *Repository, user *User) (Permission, error)\n```\nGetUserRepoPermission returns the user permissions to the repository\n\n```go\nfunc (p *Permission) CanAccess(mode AccessMode, unitType UnitType) bool\n```\nCanAccess returns true if user has mode access to the unit of the repository\n\n```go\nfunc (p *Permission) CanAccessAny(mode AccessMode, unitTypes ...UnitType) bool\n```\nCanAccessAny returns true if user has mode access to any of the units of the repository\n\n```go\nfunc (p *Permission) CanRead(unitType UnitType) bool\n```\nCanRead returns true if user could read to this unit\n\n```go\nfunc (p *Permission) CanReadAny(unitTypes ...UnitType) bool\n```\nCanReadAny returns true if user has read access to any of the units of the repository\n\n```go\nfunc (p *Permission) CanReadIssuesOrPulls(isPull bool) bool\n```\nCanReadIssuesOrPulls returns true if isPull is true and user could read pull requests and returns true if isPull is false and user could read to issues\n\n```go\nfunc (p *Permission) CanWrite(unitType UnitType) bool\n```\nCanWrite returns true if user could write to this unit\n\n```go\nfunc (p *Permission) CanWriteIssuesOrPulls(isPull bool) bool\n```\nCanWriteIssuesOrPulls returns true if isPull is true and user could write to pull requests and returns true if isPull is false and user could write to issues\n\n```go\nfunc (p *Permission) HasAccess() bool\n```\nHasAccess returns true if the current user has at least read access to any unit of this repository\n\n```go\nfunc (p *Permission) IsAdmin() bool\n```\nIsAdmin returns true if current user has admin or higher access of repository.\n\n```go\nfunc (p *Permission) IsOwner() bool\n```\nIsOwner returns true if current user is the owner of repository.\n\n```go\nfunc (p *Permission) UnitAccessMode(unitType UnitType) AccessMode\n```\nUnitAccessMode returns current user accessmode to the specify unit of the repository\n\n```go\ntype ProtectedBranch struct {\n\tID                        int64  `xorm:\"pk autoincr\"`\n\tRepoID                    int64  `xorm:\"UNIQUE(s)\"`\n\tBranchName                string `xorm:\"UNIQUE(s)\"`\n\tCanPush                   bool   `xorm:\"NOT NULL DEFAULT false\"`\n\tEnableWhitelist           bool\n\tWhitelistUserIDs          []int64        `xorm:\"JSON TEXT\"`\n\tWhitelistTeamIDs          []int64        `xorm:\"JSON TEXT\"`\n\tEnableMergeWhitelist      bool           `xorm:\"NOT NULL DEFAULT false\"`\n\tMergeWhitelistUserIDs     []int64        `xorm:\"JSON TEXT\"`\n\tMergeWhitelistTeamIDs     []int64        `xorm:\"JSON TEXT\"`\n\tApprovalsWhitelistUserIDs []int64        `xorm:\"JSON TEXT\"`\n\tApprovalsWhitelistTeamIDs []int64        `xorm:\"JSON TEXT\"`\n\tRequiredApprovals         int64          `xorm:\"NOT NULL DEFAULT 0\"`\n\tCreatedUnix               util.TimeStamp `xorm:\"created\"`\n\tUpdatedUnix               util.TimeStamp `xorm:\"updated\"`\n}\n```\nProtectedBranch struct\n\n```go\nfunc GetProtectedBranchBy(repoID int64, BranchName string) (*ProtectedBranch, error)\n```\nGetProtectedBranchBy getting protected branch by ID/Name\n\n```go\nfunc GetProtectedBranchByID(id int64) (*ProtectedBranch, error)\n```\nGetProtectedBranchByID getting protected branch by ID\n\n```go\nfunc GetProtectedBranchByRepoID(RepoID int64) ([]*ProtectedBranch, error)\n```\nGetProtectedBranchByRepoID getting protected branch by repo ID\n\n```go\nfunc (protectBranch *ProtectedBranch) CanUserMerge(userID int64) bool\n```\nCanUserMerge returns if some user could merge a pull request to this protected branch\n\n```go\nfunc (protectBranch *ProtectedBranch) CanUserPush(userID int64) bool\n```\nCanUserPush returns if some user could push to this protected branch\n\n```go\nfunc (protectBranch *ProtectedBranch) GetGrantedApprovalsCount(pr *PullRequest) int64\n```\nGetGrantedApprovalsCount returns the number of granted approvals for pr. A granted approval must be authored by a user in an approval whitelist.\n\n```go\nfunc (protectBranch *ProtectedBranch) HasEnoughApprovals(pr *PullRequest) bool\n```\nHasEnoughApprovals returns true if pr has enough granted approvals.\n\n```go\nfunc (protectBranch *ProtectedBranch) IsProtected() bool\n```\nIsProtected returns if the branch is protected\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:\"INDEX 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\tLoginSourceID int64      `xorm:\"NOT NULL DEFAULT 0\"`\n\n\tCreatedUnix       util.TimeStamp `xorm:\"created\"`\n\tUpdatedUnix       util.TimeStamp `xorm:\"updated\"`\n\tHasRecentActivity bool           `xorm:\"-\"`\n\tHasUsed           bool           `xorm:\"-\"`\n}\n```\nPublicKey represents a user or deploy SSH public key.\n\n```go\nfunc AddPublicKey(ownerID int64, name, content string, LoginSourceID int64) (*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 ListPublicLdapSSHKeys(uid int64, LoginSourceID int64) ([]*PublicKey, error)\n```\nListPublicLdapSSHKeys returns a list of synchronized public ldap ssh keys belongs to given user and login source.\n\n```go\nfunc SearchPublicKey(uid int64, fingerprint string) ([]*PublicKey, error)\n```\nSearchPublicKey returns a list of public keys matching the provided arguments.\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 (key *PublicKey) AfterLoad()\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\nfunc (key *PublicKey) AuthorizedString() string\n```\nAuthorizedString returns formatted public key string for authorized\\_keys file.\n\n```go\nfunc (key *PublicKey) OmitEmail() string\n```\nOmitEmail returns content of public key without email address.\n\n```go\ntype PullRequest struct {\n\tID              int64 `xorm:\"pk autoincr\"`\n\tType            PullRequestType\n\tStatus          PullRequestStatus\n\tConflictedFiles []string `xorm:\"TEXT JSON\"`\n\n\tIssueID int64  `xorm:\"INDEX\"`\n\tIssue   *Issue `xorm:\"-\"`\n\tIndex   int64\n\n\tHeadRepoID      int64       `xorm:\"INDEX\"`\n\tHeadRepo        *Repository `xorm:\"-\"`\n\tBaseRepoID      int64       `xorm:\"INDEX\"`\n\tBaseRepo        *Repository `xorm:\"-\"`\n\tHeadUserName    string\n\tHeadBranch      string\n\tBaseBranch      string\n\tProtectedBranch *ProtectedBranch `xorm:\"-\"`\n\tMergeBase       string           `xorm:\"VARCHAR(40)\"`\n\n\tHasMerged      bool           `xorm:\"INDEX\"`\n\tMergedCommitID string         `xorm:\"VARCHAR(40)\"`\n\tMergerID       int64          `xorm:\"INDEX\"`\n\tMerger         *User          `xorm:\"-\"`\n\tMergedUnix     util.TimeStamp `xorm:\"updated INDEX\"`\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 GetPullRequestByIndex(repoID int64, index int64) (*PullRequest, error)\n```\nGetPullRequestByIndex returns a pull request by the given index\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 returns 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 returns 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 returns all pull requests that are open and has not been merged by given head information (repo and branch).\n\n```go\nfunc PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest, int64, error)\n```\nPullRequests returns all pull requests for a base Repo by the given conditions\n\n```go\nfunc (pr *PullRequest) APIFormat() *api.PullRequest\n```\nAPIFormat assumes following fields have been assigned with valid values: Required - Issue Optional - Merger\n\n```go\nfunc (pr *PullRequest) AddToTaskQueue()\n```\nAddToTaskQueue adds itself to pull request test task queue.\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) CheckUserAllowedToMerge(doer *User) (err error)\n```\nCheckUserAllowedToMerge checks whether the user is allowed to merge\n\n```go\nfunc (pr *PullRequest) GetBaseRepo() (err error)\n```\nGetBaseRepo loads the target repository\n\n```go\nfunc (pr *PullRequest) GetDefaultMergeMessage() string\n```\nGetDefaultMergeMessage returns default message used when merging pull request\n\n```go\nfunc (pr *PullRequest) GetDefaultSquashMessage() string\n```\nGetDefaultSquashMessage returns default message used when squash and merging pull request\n\n```go\nfunc (pr *PullRequest) GetGitRefName() string\n```\nGetGitRefName returns git ref for hidden pull request branch\n\n```go\nfunc (pr *PullRequest) GetHeadRepo() error\n```\nGetHeadRepo loads the head repository\n\n```go\nfunc (pr *PullRequest) GetWorkInProgressPrefix() string\n```\nGetWorkInProgressPrefix returns the prefix used to mark the pull request as a work in progress. It returns an empty string when none were found\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) IsFilesConflicted() bool\n```\nIsFilesConflicted determines if the  Pull Request has changes conflicting with the target branch.\n\n```go\nfunc (pr *PullRequest) IsWorkInProgress() bool\n```\nIsWorkInProgress determine if the Pull Request is a Work In Progress by its title\n\n```go\nfunc (pr *PullRequest) LoadAttributes() error\n```\nLoadAttributes loads pull request attributes from database\n\n```go\nfunc (pr *PullRequest) LoadIssue() (err error)\n```\nLoadIssue loads issue information from database\n\n```go\nfunc (pr *PullRequest) LoadProtectedBranch() (err error)\n```\nLoadProtectedBranch loads the protected branch of the base branch\n\n```go\nfunc (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle MergeStyle, message string) (err error)\n```\nMerge merges pull request to base repository. FIXME: add repoWorkingPull make sure two merges does not happen at same time.\n\n```go\nfunc (pr *PullRequest) PushToBaseRepo() (err error)\n```\nPushToBaseRepo pushes commits from branches of head repository to corresponding branches of base repository. FIXME: Only push branches that are actually updates?\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```\nUpdateCols 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 PullRequestList []*PullRequest\n```\nPullRequestList defines a list of pull requests\n\n```go\nfunc (prs PullRequestList) InvalidateCodeComments(doer *User, repo *git.Repository, branch string) error\n```\nInvalidateCodeComments will lookup the prs for code comments which got invalidated by change\n\n```go\nfunc (prs PullRequestList) LoadAttributes() error\n```\nLoadAttributes load all the prs attributes\n\n```go\ntype PullRequestStatus int\n```\nPullRequestStatus defines pull request status\n\n```go\nconst (\n\tPullRequestStatusConflict PullRequestStatus = iota\n\tPullRequestStatusChecking\n\tPullRequestStatusMergeable\n\tPullRequestStatusManuallyMerged\n)\n```\nEnumerate all the pull request status\n\n```go\ntype PullRequestType int\n```\nPullRequestType defines pull request type\n\n```go\nconst (\n\tPullRequestGitea PullRequestType = iota\n\tPullRequestGit\n)\n```\nEnumerate all the pull request types\n\n```go\ntype PullRequestsConfig struct {\n\tIgnoreWhitespaceConflicts bool\n\tAllowMerge                bool\n\tAllowRebase               bool\n\tAllowRebaseMerge          bool\n\tAllowSquash               bool\n}\n```\nPullRequestsConfig describes pull requests config\n\n```go\nfunc (cfg *PullRequestsConfig) FromDB(bs []byte) error\n```\nFromDB fills up a PullRequestsConfig from serialized format.\n\n```go\nfunc (cfg *PullRequestsConfig) IsMergeStyleAllowed(mergeStyle MergeStyle) bool\n```\nIsMergeStyleAllowed returns if merge style is allowed\n\n```go\nfunc (cfg *PullRequestsConfig) ToDB() ([]byte, error)\n```\nToDB exports a PullRequestsConfig to a serialized format.\n\n```go\ntype PullRequestsOptions struct {\n\tPage        int\n\tState       string\n\tSortType    string\n\tLabels      []string\n\tMilestoneID int64\n}\n```\nPullRequestsOptions holds the options for PRs\n\n```go\ntype PullReviewersWithType struct {\n\tUser              `xorm:\"extends\"`\n\tType              ReviewType\n\tReviewUpdatedUnix util.TimeStamp `xorm:\"review_updated_unix\"`\n}\n```\nPullReviewersWithType represents the type used to display a review overview\n\n```go\nfunc GetReviewersByPullID(pullID int64) (issueReviewers []*PullReviewersWithType, err error)\n```\nGetReviewersByPullID gets all reviewers for a pull request with the statuses\n\n```go\ntype PushCommit struct {\n\tSha1           string\n\tMessage        string\n\tAuthorEmail    string\n\tAuthorName     string\n\tCommitterEmail string\n\tCommitterName  string\n\tTimestamp      time.Time\n}\n```\nPushCommit represents a commit in a push operation.\n\n```go\nfunc CommitToPushCommit(commit *git.Commit) *PushCommit\n```\nCommitToPushCommit transforms a git.Commit to PushCommit type.\n\n```go\ntype PushCommits struct {\n\tLen        int\n\tCommits    []*PushCommit\n\tCompareURL string\n\t// contains filtered or unexported fields\n}\n```\nPushCommits represents list of commits in a push operation.\n\n```go\nfunc ListToPushCommits(l *list.List) *PushCommits\n```\nListToPushCommits transforms a list.List to PushCommits type.\n\n```go\nfunc NewPushCommits() *PushCommits\n```\nNewPushCommits creates a new PushCommits object.\n\n```go\nfunc (pc *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\nfunc (pc *PushCommits) ToAPIPayloadCommits(repoLink string) []*api.PayloadCommit\n```\nToAPIPayloadCommits converts a PushCommits object to api.PayloadCommit format.\n\n```go\ntype PushUpdateOptions struct {\n\tPusherID     int64\n\tPusherName   string\n\tRepoUserName string\n\tRepoName     string\n\tRefFullName  string\n\tOldCommitID  string\n\tNewCommitID  string\n}\n```\nPushUpdateOptions defines the push update options\n\n```go\ntype RawDiffType string\n```\nRawDiffType type of a raw diff.\n\n```go\nconst (\n\tRawDiffNormal RawDiffType = \"diff\"\n\tRawDiffPatch  RawDiffType = \"patch\"\n)\n```\nRawDiffType possible values.\n\n```go\ntype Reaction struct {\n\tID          int64          `xorm:\"pk autoincr\"`\n\tType        string         `xorm:\"INDEX UNIQUE(s) NOT NULL\"`\n\tIssueID     int64          `xorm:\"INDEX UNIQUE(s) NOT NULL\"`\n\tCommentID   int64          `xorm:\"INDEX UNIQUE(s)\"`\n\tUserID      int64          `xorm:\"INDEX UNIQUE(s) NOT NULL\"`\n\tUser        *User          `xorm:\"-\"`\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n}\n```\nReaction represents a reactions on issues and comments.\n\n```go\nfunc CreateCommentReaction(doer *User, issue *Issue, comment *Comment, content string) (*Reaction, error)\n```\nCreateCommentReaction creates a reaction on comment.\n\n```go\nfunc CreateIssueReaction(doer *User, issue *Issue, content string) (*Reaction, error)\n```\nCreateIssueReaction creates a reaction on issue.\n\n```go\nfunc CreateReaction(opts *ReactionOptions) (reaction *Reaction, err error)\n```\nCreateReaction creates reaction for issue or comment.\n\n```go\ntype ReactionList []*Reaction\n```\nReactionList represents list of reactions\n\n```go\nfunc (list ReactionList) GetFirstUsers() string\n```\nGetFirstUsers returns first reacted user display names separated by comma\n\n```go\nfunc (list ReactionList) GetMoreUserCount() int\n```\nGetMoreUserCount returns count of not shown users in reaction tooltip\n\n```go\nfunc (list ReactionList) GroupByType() map[string]ReactionList\n```\nGroupByType returns reactions grouped by type\n\n```go\nfunc (list ReactionList) HasUser(userID int64) bool\n```\nHasUser check if user has reacted\n\n```go\nfunc (list ReactionList) LoadUsers() ([]*User, error)\n```\nLoadUsers loads reactions' all users\n\n```go\ntype ReactionOptions struct {\n\tType    string\n\tDoer    *User\n\tIssue   *Issue\n\tComment *Comment\n}\n```\nReactionOptions defines options for creating or deleting reactions\n\n```go\ntype Release struct {\n\tID               int64       `xorm:\"pk autoincr\"`\n\tRepoID           int64       `xorm:\"INDEX UNIQUE(n)\"`\n\tRepo             *Repository `xorm:\"-\"`\n\tPublisherID      int64       `xorm:\"INDEX\"`\n\tPublisher        *User       `xorm:\"-\"`\n\tTagName          string      `xorm:\"INDEX UNIQUE(n)\"`\n\tLowerTagName     string\n\tTarget           string\n\tTitle            string\n\tSha1             string `xorm:\"VARCHAR(40)\"`\n\tNumCommits       int64\n\tNumCommitsBehind int64          `xorm:\"-\"`\n\tNote             string         `xorm:\"TEXT\"`\n\tIsDraft          bool           `xorm:\"NOT NULL DEFAULT false\"`\n\tIsPrerelease     bool           `xorm:\"NOT NULL DEFAULT false\"`\n\tIsTag            bool           `xorm:\"NOT NULL DEFAULT false\"`\n\tAttachments      []*Attachment  `xorm:\"-\"`\n\tCreatedUnix      util.TimeStamp `xorm:\"INDEX\"`\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, opts FindReleasesOptions, page, pageSize int) (rels []*Release, err error)\n```\nGetReleasesByRepoID returns a list of releases of repository.\n\n```go\nfunc GetReleasesByRepoIDAndNames(repoID int64, tagNames []string) (rels []*Release, err error)\n```\nGetReleasesByRepoIDAndNames returns a list of releases of repository according repoID and tagNames.\n\n```go\nfunc (r *Release) APIFormat() *api.Release\n```\nAPIFormat convert a Release to api.Release\n\n```go\nfunc (r *Release) APIURL() string\n```\nAPIURL the api url for a release. release must have attributes loaded\n\n```go\nfunc (r *Release) LoadAttributes() error\n```\nLoadAttributes load repo and publisher attributes for a release\n\n```go\nfunc (r *Release) TarURL() string\n```\nTarURL the tar.gz url for a release. release must have attributes loaded\n\n```go\nfunc (r *Release) ZipURL() string\n```\nZipURL the zip url for a release. release must have attributes loaded\n\n```go\ntype RepoIndexerStatus struct {\n\tID        int64  `xorm:\"pk autoincr\"`\n\tRepoID    int64  `xorm:\"INDEX\"`\n\tCommitSha string `xorm:\"VARCHAR(40)\"`\n}\n```\nRepoIndexerStatus status of a repo's entry in the repo indexer For now, implicitly refers to default branch\n\n```go\ntype RepoRedirect struct {\n\tID             int64  `xorm:\"pk autoincr\"`\n\tOwnerID        int64  `xorm:\"UNIQUE(s)\"`\n\tLowerName      string `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tRedirectRepoID int64  // repoID to redirect to\n}\n```\nRepoRedirect represents that a repo name should be redirected to another\n\n```go\ntype RepoTopic struct {\n\tRepoID  int64 `xorm:\"UNIQUE(s)\"`\n\tTopicID int64 `xorm:\"UNIQUE(s)\"`\n}\n```\nRepoTopic represents associated repositories and topics\n\n```go\ntype RepoUnit struct {\n\tID          int64\n\tRepoID      int64           `xorm:\"INDEX(s)\"`\n\tType        UnitType        `xorm:\"INDEX(s)\"`\n\tConfig      core.Conversion `xorm:\"TEXT\"`\n\tCreatedUnix util.TimeStamp  `xorm:\"INDEX CREATED\"`\n}\n```\nRepoUnit describes all units of a repository\n\n```go\nfunc (r *RepoUnit) BeforeSet(colName string, val xorm.Cell)\n```\nBeforeSet is invoked from XORM before setting the value of a field of this object.\n\n```go\nfunc (r *RepoUnit) CodeConfig() *UnitConfig\n```\nCodeConfig returns config for UnitTypeCode\n\n```go\nfunc (r *RepoUnit) ExternalTrackerConfig() *ExternalTrackerConfig\n```\nExternalTrackerConfig returns config for UnitTypeExternalTracker\n\n```go\nfunc (r *RepoUnit) ExternalWikiConfig() *ExternalWikiConfig\n```\nExternalWikiConfig returns config for UnitTypeExternalWiki\n\n```go\nfunc (r *RepoUnit) IssuesConfig() *IssuesConfig\n```\nIssuesConfig returns config for UnitTypeIssues\n\n```go\nfunc (r *RepoUnit) PullRequestsConfig() *PullRequestsConfig\n```\nPullRequestsConfig returns config for UnitTypePullRequests\n\n```go\nfunc (r *RepoUnit) ReleasesConfig() *UnitConfig\n```\nReleasesConfig returns config for UnitTypeReleases\n\n```go\nfunc (r *RepoUnit) Unit() Unit\n```\nUnit returns Unit\n\n```go\ntype Repository struct {\n\tID            int64  `xorm:\"pk autoincr\"`\n\tOwnerID       int64  `xorm:\"UNIQUE(s)\"`\n\tOwnerName     string `xorm:\"-\"`\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\tNumReleases         int `xorm:\"-\"`\n\n\tIsPrivate  bool `xorm:\"INDEX\"`\n\tIsEmpty    bool `xorm:\"INDEX\"`\n\tIsArchived bool `xorm:\"INDEX\"`\n\n\tIsMirror bool `xorm:\"INDEX\"`\n\t*Mirror  `xorm:\"-\"`\n\n\tExternalMetas map[string]string `xorm:\"-\"`\n\tUnits         []*RepoUnit       `xorm:\"-\"`\n\n\tIsFork                          bool               `xorm:\"INDEX NOT NULL DEFAULT false\"`\n\tForkID                          int64              `xorm:\"INDEX\"`\n\tBaseRepo                        *Repository        `xorm:\"-\"`\n\tSize                            int64              `xorm:\"NOT NULL DEFAULT 0\"`\n\tIndexerStatus                   *RepoIndexerStatus `xorm:\"-\"`\n\tIsFsckEnabled                   bool               `xorm:\"NOT NULL DEFAULT true\"`\n\tCloseIssuesViaCommitInAnyBranch bool               `xorm:\"NOT NULL DEFAULT false\"`\n\tTopics                          []string           `xorm:\"TEXT JSON\"`\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n}\n```\nRepository represents a git repository.\n\n```go\nfunc CleanUpMigrateInfo(repo *Repository) (*Repository, error)\n```\nCleanUpMigrateInfo finishes migrating repository and/or wiki with things that don't need to be done for mirrors.\n\n```go\nfunc CreateRepository(doer, u *User, opts CreateRepoOptions) (_ *Repository, err error)\n```\nCreateRepository creates a repository for the user/organization.\n\n```go\nfunc ForkRepository(doer, u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error)\n```\nForkRepository forks a repository\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(ownerID int64, name string) (*Repository, error)\n```\nGetRepositoryByName returns the repository by given name under user if exists.\n\n```go\nfunc GetRepositoryByOwnerAndName(ownerName, repoName string) (*Repository, error)\n```\nGetRepositoryByOwnerAndName returns the repository by given ownername and reponame.\n\n```go\nfunc GetStarredRepos(userID int64, private bool) ([]*Repository, error)\n```\nGetStarredRepos returns the repos starred by a particular user\n\n```go\nfunc GetUserMirrorRepositories(userID int64) ([]*Repository, error)\n```\nGetUserMirrorRepositories returns a list of mirror repositories of given user.\n\n```go\nfunc GetUserRepositories(userID int64, private bool, page, pageSize int, orderBy string) ([]*Repository, error)\n```\nGetUserRepositories returns a list of repositories of given user.\n\n```go\nfunc GetWatchedRepos(userID int64, private bool) ([]*Repository, error)\n```\nGetWatchedRepos returns the repos watched by a particular user\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(doer, u *User, opts MigrateRepoOptions) (*Repository, error)\n```\nMigrateRepository migrates a existing repository from other project hosting.\n\n```go\nfunc (repo *Repository) APIFormat(mode AccessMode) *api.Repository\n```\nAPIFormat converts a Repository to api.Repository\n\n```go\nfunc (repo *Repository) APIURL() string\n```\nAPIURL returns the repository API URL\n\n```go\nfunc (repo *Repository) AddCollaborator(u *User) error\n```\nAddCollaborator adds new collaboration to a repository with default access mode.\n\n```go\nfunc (repo *Repository) AddDeletedBranch(branchName, commit string, deletedByID int64) error\n```\nAddDeletedBranch adds a deleted branch to the database\n\n```go\nfunc (repo *Repository) AddWikiPage(doer *User, wikiName, content, message string) error\n```\nAddWikiPage adds a new wiki page with a given wikiPath.\n\n```go\nfunc (repo *Repository) AfterLoad()\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\nfunc (repo *Repository) AllowOnlyContributorsToTrackTime() bool\n```\nAllowOnlyContributorsToTrackTime returns value of IssuesConfig or the default value\n\n```go\nfunc (repo *Repository) AllowsPulls() bool\n```\nAllowsPulls returns true if repository meets the requirements of accepting pulls and has them enabled.\n\n```go\nfunc (repo *Repository) CanCreateBranch() bool\n```\nCanCreateBranch returns true if repository meets the requirements for creating new branches.\n\n```go\nfunc (repo *Repository) CanEnableEditor() bool\n```\nCanEnableEditor returns true if repository meets the requirements of web editor.\n\n```go\nfunc (repo *Repository) CanEnablePulls() bool\n```\nCanEnablePulls returns true if repository meets the requirements of accepting pulls.\n\n```go\nfunc (repo *Repository) CanEnableTimetracker() bool\n```\nCanEnableTimetracker returns true when the server admin enabled time tracking This overrules IsTimetrackerEnabled\n\n```go\nfunc (repo *Repository) CanUserFork(user *User) (bool, error)\n```\nCanUserFork returns true if specified user can fork repository.\n\n```go\nfunc (repo *Repository) ChangeCollaborationAccessMode(uid int64, mode AccessMode) error\n```\nChangeCollaborationAccessMode sets new access mode for the collaboration.\n\n```go\nfunc (repo *Repository) CheckBranchName(name string) error\n```\nCheckBranchName validates branch name with existing repository branches\n\n```go\nfunc (repo *Repository) CheckUnitUser(userID int64, isAdmin bool, unitType UnitType) bool\n```\nCheckUnitUser check whether user could visit the unit of this repository\n\n```go\nfunc (repo *Repository) CheckoutNewBranch(oldBranch, newBranch string) error\n```\nCheckoutNewBranch checks out a new branch\n\n```go\nfunc (repo *Repository) CloneLink() (cl *CloneLink)\n```\nCloneLink returns clone URLs of repository.\n\n```go\nfunc (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string\n```\nComposeCompareURL returns the repository comparison URL\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) CreateNewBranch(doer *User, oldBranchName, branchName string) (err error)\n```\nCreateNewBranch creates a new repository branch\n\n```go\nfunc (repo *Repository) CreateNewBranchFromCommit(doer *User, commit, branchName string) (err error)\n```\nCreateNewBranchFromCommit creates a new repository branch\n\n```go\nfunc (repo *Repository) DeleteCollaboration(uid int64) (err error)\n```\nDeleteCollaboration removes collaboration relation between the user and repository.\n\n```go\nfunc (repo *Repository) DeleteProtectedBranch(id int64) (err error)\n```\nDeleteProtectedBranch removes ProtectedBranch relation between the user and repository.\n\n```go\nfunc (repo *Repository) DeleteWiki() error\n```\nDeleteWiki removes the actual and local copy of repository wiki.\n\n```go\nfunc (repo *Repository) DeleteWikiPage(doer *User, wikiName string) (err error)\n```\nDeleteWikiPage deletes a wiki page identified by its path.\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) DiscardLocalRepoBranchChanges(branch string) error\n```\nDiscardLocalRepoBranchChanges discards the local repository branch changes\n\n```go\nfunc (repo *Repository) EditWikiPage(doer *User, oldWikiName, newWikiName, content, message string) error\n```\nEditWikiPage updates a wiki page identified by its wikiPath, optionally also changing wikiPath.\n\n```go\nfunc (repo *Repository) FullName() string\n```\nFullName returns the repository full name\n\n```go\nfunc (repo *Repository) GetAssignees() (_ []*User, err error)\n```\nGetAssignees returns all users that have write access and can be assigned to issues of the repository,\n\n```go\nfunc (repo *Repository) GetBaseRepo() (err error)\n```\nGetBaseRepo populates repo.BaseRepo for a fork repository and returns an error on failure (NOTE: no error is returned for non-fork repositories, and BaseRepo will be left untouched)\n\n```go\nfunc (repo *Repository) GetBranch(branch string) (*Branch, error)\n```\nGetBranch returns a branch by it's name\n\n```go\nfunc (repo *Repository) GetBranches() ([]*Branch, error)\n```\nGetBranches returns all the branches of a repository\n\n```go\nfunc (repo *Repository) GetCollaborators() ([]*Collaborator, error)\n```\nGetCollaborators returns the collaborators for a repository\n\n```go\nfunc (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string\n```\nGetCommitsCountCacheKey returns cache key used for commits count caching.\n\n```go\nfunc (repo *Repository) GetDeletedBranchByID(ID int64) (*DeletedBranch, error)\n```\nGetDeletedBranchByID get a deleted branch by its ID\n\n```go\nfunc (repo *Repository) GetDeletedBranches() ([]*DeletedBranch, error)\n```\nGetDeletedBranches returns all the deleted branches\n\n```go\nfunc (repo *Repository) GetForks() ([]*Repository, error)\n```\nGetForks returns all the forks of the repository\n\n```go\nfunc (repo *Repository) GetLFSMetaObjectByOid(oid string) (*LFSMetaObject, error)\n```\nGetLFSMetaObjectByOid selects a LFSMetaObject entry from database by its OID. It may return ErrLFSObjectNotExist or a database error. If the error is nil, the returned pointer is a valid LFSMetaObject.\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```\nGetMirror sets the repository mirror, returns an error upon failure\n\n```go\nfunc (repo *Repository) GetOwner() error\n```\nGetOwner returns the repository owner\n\n```go\nfunc (repo *Repository) GetOwnerName() error\n```\nGetOwnerName returns the repository owner name\n\n```go\nfunc (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error)\n```\nGetProtectedBranches get all protected branches\n\n```go\nfunc (repo *Repository) GetStargazers(page int) ([]*User, error)\n```\nGetStargazers returns the users that starred the repo.\n\n```go\nfunc (repo *Repository) GetTags() ([]*git.Tag, error)\n```\nGetTags return repo's tags\n\n```go\nfunc (repo *Repository) GetUnit(tp UnitType) (*RepoUnit, error)\n```\nGetUnit returns a RepoUnit object\n\n```go\nfunc (repo *Repository) GetUserFork(userID int64) (*Repository, error)\n```\nGetUserFork return user forked repository from this repository, if not forked return nil\n\n```go\nfunc (repo *Repository) GetWatchers(page int) ([]*User, error)\n```\nGetWatchers returns range of users watching given repository.\n\n```go\nfunc (repo *Repository) GetWriters() (_ []*User, err error)\n```\nGetWriters returns all users that have write access to the repository.\n\n```go\nfunc (repo *Repository) GitConfigPath() string\n```\nGitConfigPath returns the repository git config path\n\n```go\nfunc (repo *Repository) HTMLURL() string\n```\nHTMLURL returns the repository HTML URL\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) IsCollaborator(userID int64) (bool, error)\n```\nIsCollaborator check if a user is a collaborator of a repository\n\n```go\nfunc (repo *Repository) IsDependenciesEnabled() bool\n```\nIsDependenciesEnabled returns if dependecies are enabled and returns the default setting if not set.\n\n```go\nfunc (repo *Repository) IsOwnedBy(userID int64) bool\n```\nIsOwnedBy returns true when user owns this repository\n\n```go\nfunc (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error)\n```\nIsProtectedBranch checks if branch is protected\n\n```go\nfunc (repo *Repository) IsProtectedBranchForMerging(pr *PullRequest, branchName string, doer *User) (bool, error)\n```\nIsProtectedBranchForMerging checks if branch is protected for merging\n\n```go\nfunc (repo *Repository) IsProtectedBranchForPush(branchName string, doer *User) (bool, error)\n```\nIsProtectedBranchForPush checks if branch is protected for push\n\n```go\nfunc (repo *Repository) IsTimetrackerEnabled() bool\n```\nIsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.\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) Link() string\n```\nLink returns the repository link\n\n```go\nfunc (repo *Repository) LocalCopyPath() string\n```\nLocalCopyPath returns the local repository copy path for the given repo.\n\n```go\nfunc (repo *Repository) LocalWikiPath() string\n```\nLocalWikiPath returns the path to the local wiki repository (?).\n\n```go\nfunc (repo *Repository) MustGetUnit(tp UnitType) *RepoUnit\n```\nMustGetUnit always returns a RepoUnit object\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 details when error occurs.\n\n```go\nfunc (repo *Repository) MustOwnerName() string\n```\nMustOwnerName always returns valid owner name to avoid conceptually impossible error handling. It returns \"error\" and logs error details when error occurs.\n\n```go\nfunc (repo *Repository) NextIssueIndex() int64\n```\nNextIssueIndex returns the next issue index FIXME: should have a mutex to prevent producing same index for two issues that are created closely enough.\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 (repo *Repository) RecalculateAccesses() error\n```\nRecalculateAccesses recalculates all accesses for repository.\n\n```go\nfunc (repo *Repository) RelLink() string\n```\nRelLink returns the repository relative link\n\n```go\nfunc (repo *Repository) RemoveDeletedBranch(id int64) (err error)\n```\nRemoveDeletedBranch removes a deleted branch from the database\n\n```go\nfunc (repo *Repository) RemoveLFSMetaObjectByOid(oid string) error\n```\nRemoveLFSMetaObjectByOid removes a LFSMetaObject entry from database by its OID. It may return ErrLFSObjectNotExist or a database error.\n\n```go\nfunc (repo *Repository) RepoPath() string\n```\nRepoPath returns the repository path\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) SetArchiveRepoState(isArchived bool) (err error)\n```\nSetArchiveRepoState sets if a repo is archived\n\n```go\nfunc (repo *Repository) UnitEnabled(tp UnitType) bool\n```\nUnitEnabled if this repository has the given unit enabled\n\n```go\nfunc (repo *Repository) UpdateDefaultBranch() error\n```\nUpdateDefaultBranch updates the default branch\n\n```go\nfunc (repo *Repository) UpdateLocalCopyBranch(branch string) error\n```\nUpdateLocalCopyBranch makes sure local copy of repository in given branch is up-to-date.\n\n```go\nfunc (repo *Repository) UpdateSize() error\n```\nUpdateSize updates the repository size, calculating it using git.GetRepoSize\n\n```go\nfunc (repo *Repository) WikiCloneLink() *CloneLink\n```\nWikiCloneLink returns clone URLs of repository wiki.\n\n```go\nfunc (repo *Repository) WikiPath() string\n```\nWikiPath returns wiki data path for given repository.\n\n```go\ntype RepositoryList []*Repository\n```\nRepositoryList contains a list of repositories\n\n```go\nfunc RepositoryListOfMap(repoMap map[int64]*Repository) RepositoryList\n```\nRepositoryListOfMap make list from values of map\n\n```go\nfunc SearchRepositoryByName(opts *SearchRepoOptions) (RepositoryList, int64, error)\n```\nSearchRepositoryByName takes keyword and part of repository name to search, it returns results in given range and number of total results.\n\n```go\nfunc (repos RepositoryList) Len() int\n```\n\n```go\nfunc (repos RepositoryList) Less(i, j int) bool\n```\n\n```go\nfunc (repos RepositoryList) LoadAttributes() error\n```\nLoadAttributes loads the attributes for the given RepositoryList\n\n```go\nfunc (repos RepositoryList) Swap(i, j int)\n```\n\n```go\ntype Review struct {\n\tID         int64 `xorm:\"pk autoincr\"`\n\tType       ReviewType\n\tReviewer   *User  `xorm:\"-\"`\n\tReviewerID int64  `xorm:\"index\"`\n\tIssue      *Issue `xorm:\"-\"`\n\tIssueID    int64  `xorm:\"index\"`\n\tContent    string\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n\n\t// CodeComments are the initial code comments of the review\n\tCodeComments CodeComments `xorm:\"-\"`\n}\n```\nReview represents collection of code comments giving feedback for a PR\n\n```go\nfunc CreateReview(opts CreateReviewOptions) (*Review, error)\n```\nCreateReview creates a new review based on opts\n\n```go\nfunc FindReviews(opts FindReviewOptions) ([]*Review, error)\n```\nFindReviews returns reviews passing FindReviewOptions\n\n```go\nfunc GetCurrentReview(reviewer *User, issue *Issue) (*Review, error)\n```\nGetCurrentReview returns the current pending review of reviewer for given issue\n\n```go\nfunc GetReviewByID(id int64) (*Review, error)\n```\nGetReviewByID returns the review by the given ID\n\n```go\nfunc GetUniqueApprovalsByPullRequestID(prID int64) ([]*Review, error)\n```\nGetUniqueApprovalsByPullRequestID returns all reviews submitted for a specific pull request\n\n```go\nfunc (r *Review) LoadAttributes() error\n```\nLoadAttributes loads all attributes except CodeComments\n\n```go\nfunc (r *Review) LoadCodeComments() error\n```\nLoadCodeComments loads CodeComments\n\n```go\nfunc (r *Review) Publish() error\n```\nPublish will send notifications / actions to participants for all code comments; parts are concurrent\n\n```go\ntype ReviewType int\n```\nReviewType defines the sort of feedback a review gives\n\n```go\nconst (\n\t// ReviewTypePending is a review which is not published yet\n\tReviewTypePending ReviewType = iota\n\t// ReviewTypeApprove approves changes\n\tReviewTypeApprove\n\t// ReviewTypeComment gives general feedback\n\tReviewTypeComment\n\t// ReviewTypeReject gives feedback blocking merge\n\tReviewTypeReject\n)\n```\n\n```go\nconst ReviewTypeUnknown ReviewType = -1\n```\nReviewTypeUnknown unknown review type\n\n```go\nfunc (rt ReviewType) Icon() string\n```\nIcon returns the corresponding icon for the review type\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```\nSMTPConfig holds configuration for the SMTP login source.\n\n```go\nfunc (cfg *SMTPConfig) FromDB(bs []byte) error\n```\nFromDB fills up an SMTPConfig from serialized format.\n\n```go\nfunc (cfg *SMTPConfig) ToDB() ([]byte, error)\n```\nToDB exports an SMTPConfig to a serialized format.\n\n```go\ntype SearchOrderBy string\n```\nSearchOrderBy is used to sort the result\n\n```go\nfunc (s SearchOrderBy) String() string\n```\n\n```go\ntype SearchRepoOptions struct {\n\tUserID      int64\n\tUserIsAdmin bool\n\tKeyword     string\n\tOwnerID     int64\n\tOrderBy     SearchOrderBy\n\tPrivate     bool // Include private repositories in results\n\tStarredByID int64\n\tPage        int\n\tIsProfile   bool\n\tAllPublic   bool // Include also all public repositories\n\tPageSize    int  // Can be smaller than or equal to setting.ExplorePagingNum\n\t// None -\u003e include collaborative AND non-collaborative\n\t// True -\u003e include just collaborative\n\t// False -\u003e incude just non-collaborative\n\tCollaborate util.OptionalBool\n\t// None -\u003e include forks AND non-forks\n\t// True -\u003e include just forks\n\t// False -\u003e include just non-forks\n\tFork util.OptionalBool\n\t// None -\u003e include mirrors AND non-mirrors\n\t// True -\u003e include just mirrors\n\t// False -\u003e include just non-mirrors\n\tMirror util.OptionalBool\n\t// only search topic name\n\tTopicOnly bool\n}\n```\nSearchRepoOptions holds the search options\n\n```go\ntype SearchUserOptions struct {\n\tKeyword       string\n\tType          UserType\n\tUID           int64\n\tOrderBy       SearchOrderBy\n\tPage          int\n\tPrivate       bool  // Include private orgs in search\n\tOwnerID       int64 // id of user for visibility calculation\n\tPageSize      int   // Can be smaller than or equal to setting.UI.ExplorePagingNum\n\tIsActive      util.OptionalBool\n\tSearchByEmail bool // Search by email as well as username/full name\n}\n```\nSearchUserOptions contains the options for searching\n\n```go\ntype SignCommit struct {\n\tVerification *CommitVerification\n\t*UserCommit\n}\n```\nSignCommit represents a commit with validation of signature.\n\n```go\ntype SignCommitWithStatuses struct {\n\tStatus *CommitStatus\n\t*SignCommit\n}\n```\nSignCommitWithStatuses represents a commit with validation of signature and status state.\n\n```go\ntype SlackAttachment struct {\n\tFallback string `json:\"fallback\"`\n\tColor    string `json:\"color\"`\n\tTitle    string `json:\"title\"`\n\tText     string `json:\"text\"`\n}\n```\nSlackAttachment contains the slack message\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```\nSlackMeta contains the slack metadata\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```\nSlackPayload contains the information about the slack channel\n\n```go\nfunc GetSlackPayload(p api.Payloader, event HookEventType, meta string) (*SlackPayload, error)\n```\nGetSlackPayload converts a slack webhook into a SlackPayload\n\n```go\nfunc (p *SlackPayload) JSONPayload() ([]byte, error)\n```\nJSONPayload Marshals the SlackPayload to json\n\n```go\nfunc (p *SlackPayload) SetSecret(_ string)\n```\nSetSecret sets the slack secret\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```\nStar represents a starred repo by an user.\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```\nStatistic contains the database statistics\n\n```go\nfunc GetStatistic() (stats Statistic)\n```\nGetStatistic returns the database statistics\n\n```go\ntype Stopwatch struct {\n\tID          int64          `xorm:\"pk autoincr\"`\n\tIssueID     int64          `xorm:\"INDEX\"`\n\tUserID      int64          `xorm:\"INDEX\"`\n\tCreatedUnix util.TimeStamp `xorm:\"created\"`\n}\n```\nStopwatch represents a stopwatch for time tracking.\n\n```go\nfunc HasUserStopwatch(userID int64) (exists bool, sw *Stopwatch, err error)\n```\nHasUserStopwatch returns true if the user has a stopwatch\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\tUnits       []*TeamUnit `xorm:\"-\"`\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 GetTeamsWithAccessToRepo(orgID, repoID int64, mode AccessMode) ([]*Team, error)\n```\nGetTeamsWithAccessToRepo returns all teams in an organization that have given access level to the repository.\n\n```go\nfunc GetUserOrgTeams(orgID, userID int64) ([]*Team, error)\n```\nGetUserOrgTeams returns all teams that user belongs to in given organization.\n\n```go\nfunc GetUserTeams(userID int64) ([]*Team, error)\n```\nGetUserTeams returns all teams that user belongs across all organizations.\n\n```go\nfunc (t *Team) AddMember(userID int64) error\n```\nAddMember adds new membership of the team to the organization, the user will have membership to the organization automatically when needed.\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) GetUnitNames() (res []string)\n```\nGetUnitNames returns the team units names\n\n```go\nfunc (t *Team) GetUnits() error\n```\nGetUnits return a list of available units for a team\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) HasWriteAccess() bool\n```\nHasWriteAccess returns true if team has at least write level access mode.\n\n```go\nfunc (t *Team) IsMember(userID int64) bool\n```\nIsMember 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(userID 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\nfunc (t *Team) UnitEnabled(tp UnitType) bool\n```\nUnitEnabled returns if the team has the given unit type enabled\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 TeamUnit struct {\n\tID     int64    `xorm:\"pk autoincr\"`\n\tOrgID  int64    `xorm:\"INDEX\"`\n\tTeamID int64    `xorm:\"UNIQUE(s)\"`\n\tType   UnitType `xorm:\"UNIQUE(s)\"`\n}\n```\nTeamUnit describes all units of a repository\n\n```go\nfunc (t *TeamUnit) Unit() Unit\n```\nUnit returns Unit\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 Topic struct {\n\tID          int64\n\tName        string `xorm:\"UNIQUE VARCHAR(25)\"`\n\tRepoCount   int\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n}\n```\nTopic represents a topic of repositories\n\n```go\nfunc FindTopics(opts *FindTopicOptions) (topics []*Topic, err error)\n```\nFindTopics retrieves the topics via FindTopicOptions\n\n```go\nfunc GetTopicByName(name string) (*Topic, error)\n```\nGetTopicByName retrieves topic by name\n\n```go\ntype TrackedTime struct {\n\tID          int64     `xorm:\"pk autoincr\" json:\"id\"`\n\tIssueID     int64     `xorm:\"INDEX\" json:\"issue_id\"`\n\tUserID      int64     `xorm:\"INDEX\" json:\"user_id\"`\n\tCreated     time.Time `xorm:\"-\" json:\"created\"`\n\tCreatedUnix int64     `xorm:\"created\" json:\"-\"`\n\tTime        int64     `json:\"time\"`\n}\n```\nTrackedTime represents a time that was spent for a specific issue.\n\n```go\nfunc AddTime(user *User, issue *Issue, time int64) (*TrackedTime, error)\n```\nAddTime will add the given time (in seconds) to the issue\n\n```go\nfunc GetTrackedTimes(options FindTrackedTimesOptions) (trackedTimes []*TrackedTime, err error)\n```\nGetTrackedTimes returns all tracked times that fit to the given options.\n\n```go\nfunc (t *TrackedTime) APIFormat() *api.TrackedTime\n```\nAPIFormat converts TrackedTime to API format\n\n```go\nfunc (t *TrackedTime) AfterLoad()\n```\nAfterLoad is invoked from XORM after setting the values of all fields of this object.\n\n```go\ntype TwoFactor struct {\n\tID               int64 `xorm:\"pk autoincr\"`\n\tUID              int64 `xorm:\"UNIQUE\"`\n\tSecret           string\n\tScratchSalt      string\n\tScratchHash      string\n\tLastUsedPasscode string         `xorm:\"VARCHAR(10)\"`\n\tCreatedUnix      util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix      util.TimeStamp `xorm:\"INDEX updated\"`\n}\n```\nTwoFactor represents a two-factor authentication token.\n\n```go\nfunc GetTwoFactorByUID(uid int64) (*TwoFactor, error)\n```\nGetTwoFactorByUID returns the two-factor authentication token associated with the user, if any.\n\n```go\nfunc (t *TwoFactor) GenerateScratchToken() (string, error)\n```\nGenerateScratchToken recreates the scratch token the user is using.\n\n```go\nfunc (t *TwoFactor) SetSecret(secret string) error\n```\nSetSecret sets the 2FA secret.\n\n```go\nfunc (t *TwoFactor) ValidateTOTP(passcode string) (bool, error)\n```\nValidateTOTP validates the provided passcode.\n\n```go\nfunc (t *TwoFactor) VerifyScratchToken(token string) bool\n```\nVerifyScratchToken verifies if the specified scratch token is valid.\n\n```go\ntype U2FRegistration struct {\n\tID          int64 `xorm:\"pk autoincr\"`\n\tName        string\n\tUserID      int64 `xorm:\"INDEX\"`\n\tRaw         []byte\n\tCounter     uint32         `xorm:\"BIGINT\"`\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX updated\"`\n}\n```\nU2FRegistration represents the registration data and counter of a security key\n\n```go\nfunc CreateRegistration(user *User, name string, reg *u2f.Registration) (*U2FRegistration, error)\n```\nCreateRegistration will create a new U2FRegistration from the given Registration\n\n```go\nfunc GetU2FRegistrationByID(id int64) (*U2FRegistration, error)\n```\nGetU2FRegistrationByID returns U2F registration by id\n\n```go\nfunc (reg *U2FRegistration) Parse() (*u2f.Registration, error)\n```\nParse will convert the db entry U2FRegistration to an u2f.Registration struct\n\n```go\nfunc (reg U2FRegistration) TableName() string\n```\nTableName returns a better table name for U2FRegistration\n\n```go\nfunc (reg *U2FRegistration) UpdateCounter() error\n```\nUpdateCounter will update the database value of counter\n\n```go\ntype U2FRegistrationList []*U2FRegistration\n```\nU2FRegistrationList is a list of \\*U2FRegistration\n\n```go\nfunc GetU2FRegistrationsByUID(uid int64) (U2FRegistrationList, error)\n```\nGetU2FRegistrationsByUID returns all U2F registrations of the given user\n\n```go\nfunc (list U2FRegistrationList) ToRegistrations() []u2f.Registration\n```\nToRegistrations will convert all U2FRegistrations to u2f.Registrations\n\n```go\ntype Unit struct {\n\tType    UnitType\n\tNameKey string\n\tURI     string\n\tDescKey string\n\tIdx     int\n}\n```\nUnit is a section of one repository\n\n```go\nfunc (u *Unit) CanDisable() bool\n```\nCanDisable returns if this unit could be disabled.\n\n```go\nfunc (u Unit) IsLessThan(unit Unit) bool\n```\nIsLessThan compares order of two units\n\n```go\ntype UnitConfig struct {\n}\n```\nUnitConfig describes common unit config\n\n```go\nfunc (cfg *UnitConfig) FromDB(bs []byte) error\n```\nFromDB fills up a UnitConfig from serialized format.\n\n```go\nfunc (cfg *UnitConfig) ToDB() ([]byte, error)\n```\nToDB exports a UnitConfig to a serialized format.\n\n```go\ntype UnitType int\n```\nUnitType is Unit's Type\n\n```go\nconst (\n\tUnitTypeCode            UnitType = iota + 1 // 1 code\n\tUnitTypeIssues                              // 2 issues\n\tUnitTypePullRequests                        // 3 PRs\n\tUnitTypeReleases                            // 4 Releases\n\tUnitTypeWiki                                // 5 Wiki\n\tUnitTypeExternalWiki                        // 6 ExternalWiki\n\tUnitTypeExternalTracker                     // 7 ExternalTracker\n)\n```\nEnumerate all the unit types\n\n```go\nfunc FindUnitTypes(nameKeys ...string) (res []UnitType)\n```\nFindUnitTypes give the unit key name and return unit\n\n```go\ntype UpdateOAuth2ApplicationOptions struct {\n\tID           int64\n\tName         string\n\tUserID       int64\n\tRedirectURIs []string\n}\n```\nUpdateOAuth2ApplicationOptions holds options to update an oauth2 application\n\n```go\ntype Upload struct {\n\tID   int64  `xorm:\"pk autoincr\"`\n\tUUID string `xorm:\"uuid UNIQUE\"`\n\tName string\n}\n```\nUpload represent a uploaded file to a repo to be deleted when moved\n\n```go\nfunc GetUploadByUUID(uuid string) (*Upload, error)\n```\nGetUploadByUUID returns the Upload by UUID\n\n```go\nfunc GetUploadsByUUIDs(uuids []string) ([]*Upload, error)\n```\nGetUploadsByUUIDs returns multiple uploads by UUIDS\n\n```go\nfunc NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err error)\n```\nNewUpload creates a new upload object.\n\n```go\nfunc (upload *Upload) LocalPath() string\n```\nLocalPath returns where uploads are temporarily stored in local file system.\n\n```go\ntype User struct {\n\tID        int64  `xorm:\"pk autoincr\"`\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\tKeepEmailPrivate bool\n\tPasswd           string `xorm:\"NOT NULL\"`\n\n\t// MustChangePassword is an attribute that determines if a user\n\t// is to change his/her password after registration.\n\tMustChangePassword bool `xorm:\"NOT NULL DEFAULT false\"`\n\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\tLanguage    string `xorm:\"VARCHAR(5)\"`\n\n\tCreatedUnix   util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix   util.TimeStamp `xorm:\"INDEX updated\"`\n\tLastLoginUnix util.TimeStamp `xorm:\"INDEX\"`\n\n\t// Remember visibility choice for convenience, true for private\n\tLastRepoVisibility bool\n\t// Maximum repository creation limit, -1 means use global default\n\tMaxRepoCreation int `xorm:\"NOT NULL DEFAULT -1\"`\n\n\t// Permissions\n\tIsActive                bool `xorm:\"INDEX\"` // Activate primary email\n\tIsAdmin                 bool\n\tAllowGitHook            bool\n\tAllowImportLocal        bool // Allow migrate repository by local path\n\tAllowCreateOrganization bool `xorm:\"DEFAULT true\"`\n\tProhibitLogin           bool `xorm:\"NOT NULL DEFAULT false\"`\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\tNumFollowing int `xorm:\"NOT NULL DEFAULT 0\"`\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\tVisibility  structs.VisibleType `xorm:\"NOT NULL DEFAULT 0\"`\n\n\t// Preferences\n\tDiffViewStyle string `xorm:\"NOT NULL DEFAULT ''\"`\n\tTheme         string `xorm:\"NOT NULL DEFAULT ''\"`\n}\n```\nUser represents the object of individual and member of organization.\n\n```go\nfunc ExternalUserLogin(user *User, login, password string, source *LoginSource, autoRegister bool) (*User, error)\n```\nExternalUserLogin attempts a login using external source types.\n\n```go\nfunc GetAssigneesByIssue(issue *Issue) (assignees []*User, err error)\n```\nGetAssigneesByIssue returns everyone assigned to that issue\n\n```go\nfunc GetOrgByName(name string) (*User, error)\n```\nGetOrgByName returns organization by given name.\n\n```go\nfunc GetOrgsByUserID(userID int64, showAll bool) ([]*User, error)\n```\nGetOrgsByUserID returns a list of organizations that the given user ID has joined.\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```\nGetOwnedOrgsByUserIDDesc returns a list of organizations are owned by given user ID, ordered descending by the given condition.\n\n```go\nfunc GetParticipantsByIssueID(issueID int64) ([]*User, error)\n```\nGetParticipantsByIssueID returns all users who are participated in comments of an issue.\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```\nGetUserByKeyID get user information by user's public key id\n\n```go\nfunc GetUserByName(name string) (*User, error)\n```\nGetUserByName returns user by given name.\n\n```go\nfunc GetUserByOpenID(uri string) (*User, error)\n```\nGetUserByOpenID returns the user object by given OpenID if exists.\n\n```go\nfunc GetUsersByIDs(ids []int64) ([]*User, error)\n```\nGetUsersByIDs returns all resolved users from a list of Ids.\n\n```go\nfunc LoginViaLDAP(user *User, login, password string, source *LoginSource, autoRegister bool) (*User, error)\n```\nLoginViaLDAP queries if login/password is valid against the LDAP directory pool, and create a local user if success when enabled.\n\n```go\nfunc LoginViaPAM(user *User, login, password string, sourceID int64, cfg *PAMConfig, autoRegister bool) (*User, error)\n```\nLoginViaPAM queries if login/password is valid against the PAM, and create a local user if success when enabled.\n\n```go\nfunc LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPConfig, autoRegister bool) (*User, error)\n```\nLoginViaSMTP queries if login/password is valid against the SMTP, and create a local user if success when enabled.\n\n```go\nfunc NewGhostUser() *User\n```\nNewGhostUser creates and returns a fake user for someone has deleted his/her account.\n\n```go\nfunc SearchUsers(opts *SearchUserOptions) (users []*User, _ int64, _ error)\n```\nSearchUsers takes options i.e. keyword and part of user name to search, it returns results in given range and number of total results.\n\n```go\nfunc UserSignIn(username, password string) (*User, error)\n```\nUserSignIn validates user name and password.\n\n```go\nfunc ValidateCommitWithEmail(c *git.Commit) *User\n```\nValidateCommitWithEmail check if author's e-mail of commit is corresponding to a user.\n\n```go\nfunc VerifyUserActiveCode(code string) (user *User)\n```\nVerifyUserActiveCode verifies active code when active account\n\n```go\nfunc (u *User) APIFormat() *api.User\n```\nAPIFormat converts a User to api.User\n\n```go\nfunc (org *User) AccessibleReposEnv(userID int64) (AccessibleReposEnvironment, error)\n```\nAccessibleReposEnv an AccessibleReposEnvironment for the repositories in \\`org\\` that are accessible to the specified user.\n\n```go\nfunc (org *User) AddMember(uid int64) error\n```\nAddMember adds new member to organization.\n\n```go\nfunc (u *User) AfterLoad()\n```\nAfterLoad is invoked from XORM after filling all the fields of this object.\n\n```go\nfunc (u *User) AvatarLink() string\n```\nAvatarLink returns user avatar absolute link.\n\n```go\nfunc (u *User) BeforeUpdate()\n```\nBeforeUpdate is invoked from XORM before updating this object.\n\n```go\nfunc (u *User) CanCreateOrganization() bool\n```\nCanCreateOrganization returns true if user can create organisation.\n\n```go\nfunc (u *User) CanCreateRepo() bool\n```\nCanCreateRepo returns if user login can create a repository\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) DeleteAvatar() error\n```\nDeleteAvatar deletes the user's custom avatar.\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) 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) GetAccessRepoIDs(units ...UnitType) ([]int64, error)\n```\nGetAccessRepoIDs returns all repositories IDs where user's or user is a team member organizations\n\n```go\nfunc (user *User) GetAccessibleRepositories(limit int) (repos []*Repository, _ error)\n```\nGetAccessibleRepositories finds repositories which the user has access but does not own. If limit is smaller than 1 means returns all found results.\n\n```go\nfunc (u *User) GetFollowers(page int) ([]*User, error)\n```\nGetFollowers returns range of user's followers.\n\n```go\nfunc (u *User) GetFollowing(page int) ([]*User, error)\n```\nGetFollowing returns range of user's following.\n\n```go\nfunc (org *User) GetMembers() error\n```\nGetMembers returns all members of organization.\n\n```go\nfunc (u *User) GetMirrorRepositories() ([]*Repository, error)\n```\nGetMirrorRepositories returns mirror repositories that user owns, including private repositories.\n\n```go\nfunc (u *User) GetOrgRepositoryIDs(units ...UnitType) ([]int64, error)\n```\nGetOrgRepositoryIDs returns repositories IDs where user's team owned and has unittypes\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(all bool) 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(page, pageSize int) (err error)\n```\nGetRepositories returns repositories that user owns, including private repositories.\n\n```go\nfunc (user *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 (u *User) GetRepositoryIDs(units ...UnitType) ([]int64, error)\n```\nGetRepositoryIDs returns repositories IDs where user owned and has unittypes\n\n```go\nfunc (u *User) GetStarredRepoCount(private bool) (int64, error)\n```\nGetStarredRepoCount returns the numbers of repo the user starred.\n\n```go\nfunc (u *User) GetStarredRepos(private bool, page, pageSize int, orderBy string) (repos RepositoryList, err error)\n```\nGetStarredRepos returns the repos the user starred.\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 (org *User) GetUserTeamIDs(userID int64) ([]int64, error)\n```\nGetUserTeamIDs returns of all team IDs of the organization that user is member of.\n\n```go\nfunc (org *User) GetUserTeams(userID int64) ([]*Team, error)\n```\nGetUserTeams returns all teams that belong to user, and that the user has joined.\n\n```go\nfunc (u *User) GitName() string\n```\nGitName returns a git safe name\n\n```go\nfunc (u *User) HTMLURL() string\n```\nHTMLURL returns the user or organization's full link.\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) HashPassword(passwd string)\n```\nHashPassword hashes a password using PBKDF.\n\n```go\nfunc (u *User) HomeLink() string\n```\nHomeLink returns the user or organization home page link.\n\n```go\nfunc (u *User) IsFollowing(followID int64) bool\n```\nIsFollowing returns true if user is following followID.\n\n```go\nfunc (u *User) IsLocal() bool\n```\nIsLocal returns true if user login type is LoginPlain.\n\n```go\nfunc (u *User) IsMailable() bool\n```\nIsMailable checks if a user is eligible to receive emails.\n\n```go\nfunc (u *User) IsOAuth2() bool\n```\nIsOAuth2 returns true if user login type is LoginOAuth2.\n\n```go\nfunc (org *User) IsOrgMember(uid int64) (bool, error)\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, error)\n```\nIsOwnedBy returns true if given user is in the owner team.\n\n```go\nfunc (u *User) IsPasswordSet() bool\n```\nIsPasswordSet checks if the password is set or left empty\n\n```go\nfunc (u *User) IsPublicMember(orgID int64) bool\n```\nIsPublicMember returns true if user public his/her membership in given 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) IsUserPartOfOrg(userID int64) bool\n```\nIsUserPartOfOrg returns true if user with userID is part of the u organisation.\n\n```go\nfunc (u *User) MaxCreationLimit() int\n```\nMaxCreationLimit returns the number of repositories a user is allowed to create\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```\nRelAvatarLink returns a relative link to the user's avatar. The link may either be a sub-URL to this site, or a full URL to an external avatar service.\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) SetLastLogin()\n```\nSetLastLogin set time to last login\n\n```go\nfunc (u *User) ShortName(length int) string\n```\nShortName ellipses username to length\n\n```go\nfunc (u *User) SizedRelAvatarLink(size int) string\n```\nSizedRelAvatarLink returns a relative link to the user's avatar. When applicable, the link is for an avatar of the indicated size (in pixels).\n\n```go\nfunc (org *User) TeamsWithAccessToRepo(repoID int64, mode AccessMode) ([]*Team, error)\n```\nTeamsWithAccessToRepo returns all teamsthat have given access level to the repository.\n\n```go\nfunc (u *User) UpdateDiffViewStyle(style string) error\n```\nUpdateDiffViewStyle updates the users diff view style\n\n```go\nfunc (u *User) UpdateTheme(themeName string) error\n```\nUpdateTheme updates a users' theme irrespective of the site wide theme\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*git.Commit\n}\n```\nUserCommit represents a commit with validation of user.\n\n```go\ntype UserHeatmapData struct {\n\tTimestamp     util.TimeStamp `json:\"timestamp\"`\n\tContributions int64          `json:\"contributions\"`\n}\n```\nUserHeatmapData represents the data needed to create a heatmap\n\n```go\nfunc GetUserHeatmapDataByUser(user *User) ([]*UserHeatmapData, error)\n```\nGetUserHeatmapDataByUser returns an array of UserHeatmapData\n\n```go\ntype UserIssueStatsOptions struct {\n\tUserID      int64\n\tRepoID      int64\n\tUserRepoIDs []int64\n\tFilterMode  int\n\tIsPull      bool\n\tIsClosed    bool\n}\n```\nUserIssueStatsOptions contains parameters accepted by GetUserIssueStats.\n\n```go\ntype UserOpenID struct {\n\tID   int64  `xorm:\"pk autoincr\"`\n\tUID  int64  `xorm:\"INDEX NOT NULL\"`\n\tURI  string `xorm:\"UNIQUE NOT NULL\"`\n\tShow bool   `xorm:\"DEFAULT false\"`\n}\n```\nUserOpenID is the list of all OpenID identities of a user.\n\n```go\nfunc GetUserOpenIDs(uid int64) ([]*UserOpenID, error)\n```\nGetUserOpenIDs returns all openid addresses that belongs to given user.\n\n```go\ntype UserType int\n```\nUserType defines the user type\n\n```go\nconst (\n\t// UserTypeIndividual defines an individual user\n\tUserTypeIndividual UserType = iota // Historic reason to make it starts at 0.\n\n\t// UserTypeOrganization defines an organization\n\tUserTypeOrganization\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  `xorm:\"INDEX\"`\n\tOrgID        int64  `xorm:\"INDEX\"`\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 `xorm:\"INDEX\"`\n\tHookTaskType HookTaskType\n\tMeta         string     `xorm:\"TEXT\"` // store hook-specific attributes\n\tLastStatus   HookStatus // Last delivery status\n\n\tCreatedUnix util.TimeStamp `xorm:\"INDEX created\"`\n\tUpdatedUnix util.TimeStamp `xorm:\"INDEX 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) ([]*Webhook, error)\n```\nGetActiveWebhooksByRepoID returns all active webhooks of repository.\n\n```go\nfunc GetWebhookByID(id int64) (*Webhook, error)\n```\nGetWebhookByID returns webhook of repository by given ID.\n\n```go\nfunc GetWebhookByOrgID(orgID, id int64) (*Webhook, error)\n```\nGetWebhookByOrgID returns webhook of organization by given ID.\n\n```go\nfunc GetWebhookByRepoID(repoID, id int64) (*Webhook, error)\n```\nGetWebhookByRepoID returns webhook of repository 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) ([]*Webhook, error)\n```\nGetWebhooksByRepoID returns all webhooks of a repository.\n\n```go\nfunc (w *Webhook) AfterLoad()\n```\nAfterLoad updates the webhook object upon setting a column\n\n```go\nfunc (w *Webhook) EventsArray() []string\n```\nEventsArray returns an array of hook events\n\n```go\nfunc (w *Webhook) GetDiscordHook() *DiscordMeta\n```\nGetDiscordHook returns discord metadata\n\n```go\nfunc (w *Webhook) GetSlackHook() *SlackMeta\n```\nGetSlackHook returns slack metadata\n\n```go\nfunc (w *Webhook) HasCreateEvent() bool\n```\nHasCreateEvent returns true if hook enabled create event.\n\n```go\nfunc (w *Webhook) HasDeleteEvent() bool\n```\nHasDeleteEvent returns true if hook enabled delete event.\n\n```go\nfunc (w *Webhook) HasForkEvent() bool\n```\nHasForkEvent returns true if hook enabled fork event.\n\n```go\nfunc (w *Webhook) HasIssueCommentEvent() bool\n```\nHasIssueCommentEvent returns true if hook enabled issue\\_comment event.\n\n```go\nfunc (w *Webhook) HasIssuesEvent() bool\n```\nHasIssuesEvent returns true if hook enabled issues event.\n\n```go\nfunc (w *Webhook) HasPullRequestEvent() bool\n```\nHasPullRequestEvent returns true if hook enabled pull request event.\n\n```go\nfunc (w *Webhook) HasPushEvent() bool\n```\nHasPushEvent returns true if hook enabled push event.\n\n```go\nfunc (w *Webhook) HasReleaseEvent() bool\n```\nHasReleaseEvent returns if hook enabled release event.\n\n```go\nfunc (w *Webhook) HasRepositoryEvent() bool\n```\nHasRepositoryEvent returns if hook enabled repository 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```go\ntype WhitelistOptions struct {\n\tUserIDs []int64\n\tTeamIDs []int64\n\n\tMergeUserIDs []int64\n\tMergeTeamIDs []int64\n\n\tApprovalsUserIDs []int64\n\tApprovalsTeamIDs []int64\n}\n```\nWhitelistOptions represent all sorts of whitelists used for protected branches\n\n","path":"github.com/redafd/code-core/models","name":"models","synopsis":"","isRedistributable":true}
