{"modulePath":"github.com/stackdocker/gogs","version":"v0.9.13","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package context\n\n## Functions\n\n```go\nfunc APIContexter() macaron.Handler\n```\n\n```go\nfunc Contexter() macaron.Handler\n```\nContexter initializes a classic context for a request.\n\n```go\nfunc GitHookService() macaron.Handler\n```\nGitHookService checks if repository Git hooks service has been enabled.\n\n```go\nfunc HandleOrgAssignment(ctx *Context, args ...bool)\n```\n\n```go\nfunc OrgAssignment(args ...bool) macaron.Handler\n```\n\n```go\nfunc RepoAssignment(args ...bool) macaron.Handler\n```\n\n```go\nfunc RepoRef() macaron.Handler\n```\nRepoRef handles repository reference name including those contain \\`/\\`.\n\n```go\nfunc RequireRepoAdmin() macaron.Handler\n```\n\n```go\nfunc RequireRepoWriter() macaron.Handler\n```\n\n```go\nfunc RetrieveBaseRepo(ctx *Context, repo *models.Repository)\n```\n\n```go\nfunc Toggle(options *ToggleOptions) macaron.Handler\n```\n\n## Types\n\n```go\ntype APIContext struct {\n\t*Context\n}\n```\n\n```go\nfunc (ctx *APIContext) Error(status int, title string, obj interface{})\n```\nError responses error message to client with given message. If status is 500, also it prints error to log.\n\n```go\nfunc (ctx *APIContext) SetLinkHeader(total, pageSize int)\n```\n\n```go\ntype Context struct {\n\t*macaron.Context\n\tCache cache.Cache\n\n\tFlash   *session.Flash\n\tSession session.Store\n\n\tUser        *models.User\n\tIsSigned    bool\n\tIsBasicAuth bool\n\n\tRepo *Repository\n\tOrg  *Organization\n\t// contains filtered or unexported fields\n}\n```\nContext represents context of a request.\n\n```go\nfunc (ctx *Context) GetErrMsg() string\n```\n\n```go\nfunc (ctx *Context) HTML(status int, name base.TplName)\n```\nHTML calls Context.HTML and converts template name to string.\n\n```go\nfunc (ctx *Context) Handle(status int, title string, err error)\n```\nHandle handles and logs error by given status.\n\n```go\nfunc (ctx *Context) HandleText(status int, title string)\n```\n\n```go\nfunc (ctx *Context) HasApiError() bool\n```\nHasError returns true if error occurs in form validation.\n\n```go\nfunc (ctx *Context) HasError() bool\n```\nHasError returns true if error occurs in form validation.\n\n```go\nfunc (ctx *Context) HasValue(name string) bool\n```\nHasValue returns true if value of given name exists.\n\n```go\nfunc (ctx *Context) RenderWithErr(msg string, tpl base.TplName, form interface{})\n```\nRenderWithErr used for page has form validation but need to prompt error to users.\n\n```go\nfunc (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{})\n```\n\n```go\ntype Organization struct {\n\tIsOwner      bool\n\tIsMember     bool\n\tIsTeamMember bool // Is member of team.\n\tIsTeamAdmin  bool // In owner team or team that has admin permission level.\n\tOrganization *models.User\n\tOrgLink      string\n\n\tTeam *models.Team\n}\n```\n\n```go\ntype PullRequest struct {\n\tBaseRepo *models.Repository\n\tAllowed  bool\n\tSameRepo bool\n\tHeadInfo string // [\u003cuser\u003e:]\u003cbranch\u003e\n}\n```\n\n```go\ntype Repository struct {\n\tAccessMode   models.AccessMode\n\tIsWatching   bool\n\tIsViewBranch bool\n\tIsViewTag    bool\n\tIsViewCommit bool\n\tRepository   *models.Repository\n\tOwner        *models.User\n\tCommit       *git.Commit\n\tTag          *git.Tag\n\tGitRepo      *git.Repository\n\tBranchName   string\n\tTagName      string\n\tTreeName     string\n\tCommitID     string\n\tRepoLink     string\n\tCloneLink    models.CloneLink\n\tCommitsCount int64\n\tMirror       *models.Mirror\n\n\tPullRequest *PullRequest\n}\n```\n\n```go\nfunc (r *Repository) HasAccess() bool\n```\nHasAccess returns true if the current user has at least read access for this repository\n\n```go\nfunc (r *Repository) IsAdmin() bool\n```\nIsAdmin returns true if current user has admin or higher access of repository.\n\n```go\nfunc (r *Repository) IsOwner() bool\n```\nIsOwner returns true if current user is the owner of repository.\n\n```go\nfunc (r *Repository) IsWriter() bool\n```\nIsWriter returns true if current user has write or higher access of repository.\n\n```go\ntype ToggleOptions struct {\n\tSignInRequired  bool\n\tSignOutRequired bool\n\tAdminRequired   bool\n\tDisableCSRF     bool\n}\n```\n\n","path":"github.com/stackdocker/gogs/modules/context","name":"context","synopsis":"","isRedistributable":true}
