Documentation
¶
Index ¶
- Constants
- Variables
- func ApiHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func ApiHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func ApiSessionRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func ApiSessionRequiredMfa(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func ApiSessionRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func CanManageChannel(c *Context, channel *model.Channel) bool
- func CheckBadRequestStatus(t *testing.T, resp *model.Response)
- func CheckCreatedStatus(t *testing.T, resp *model.Response)
- func CheckErrorMessage(t *testing.T, resp *model.Response, errorId string)
- func CheckEtag(t *testing.T, data interface{}, resp *model.Response)
- func CheckForbiddenStatus(t *testing.T, resp *model.Response)
- func CheckInternalErrorStatus(t *testing.T, resp *model.Response)
- func CheckNoError(t *testing.T, resp *model.Response)
- func CheckNotFoundStatus(t *testing.T, resp *model.Response)
- func CheckNotImplementedStatus(t *testing.T, resp *model.Response)
- func CheckOKStatus(t *testing.T, resp *model.Response)
- func CheckPayLoadTooLargeStatus(t *testing.T, resp *model.Response)
- func CheckTeamSanitization(t *testing.T, team *model.Team)
- func CheckUnauthorizedStatus(t *testing.T, resp *model.Response)
- func CheckUserSanitization(t *testing.T, user *model.User)
- func GenerateTestAppName() string
- func GenerateTestChannelName() string
- func GenerateTestEmail() string
- func GenerateTestId() string
- func GenerateTestTeamName() string
- func GenerateTestUsername() string
- func Handle404(w http.ResponseWriter, r *http.Request)
- func HandleEtag(etag string, routeName string, w http.ResponseWriter, r *http.Request) bool
- func InitApi(full bool)
- func InitBrand()
- func InitChannel()
- func InitCluster()
- func InitCommand()
- func InitCompliance()
- func InitElasticsearch()
- func InitEmoji()
- func InitFile()
- func InitJob()
- func InitLdap()
- func InitOAuth()
- func InitOpenGraph()
- func InitPlugin()
- func InitPost()
- func InitPreference()
- func InitReaction()
- func InitRouter()
- func InitSaml()
- func InitStatus()
- func InitSystem()
- func InitTeam()
- func InitUser()
- func InitWebSocket()
- func InitWebhook()
- func InitWebrtc()
- func LinkUserToTeam(user *model.User, team *model.Team)
- func Logout(c *Context, w http.ResponseWriter, r *http.Request)
- func MakeUserChannelAdmin(user *model.User, channel *model.Channel)
- func NewInvalidParamError(parameter string) *model.AppError
- func NewInvalidUrlParamError(parameter string) *model.AppError
- func ReturnStatusOK(w http.ResponseWriter)
- func StopServer()
- func TearDown()
- func UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)
- func UpdateUserToTeamAdmin(user *model.User, team *model.Team)
- func VerifyUserEmail(userId string)
- type ApiParams
- type Context
- func (c *Context) GetSiteURLHeader() string
- func (c *Context) IsSystemAdmin() bool
- func (c *Context) LogAudit(extraInfo string)
- func (c *Context) LogAuditWithUserId(userId, extraInfo string)
- func (c *Context) LogDebug(err *model.AppError)
- func (c *Context) LogError(err *model.AppError)
- func (c *Context) MfaRequired()
- func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)
- func (c *Context) RequireActionId() *Context
- func (c *Context) RequireAppId() *Context
- func (c *Context) RequireCategory() *Context
- func (c *Context) RequireChannelId() *Context
- func (c *Context) RequireChannelName() *Context
- func (c *Context) RequireCommandId() *Context
- func (c *Context) RequireEmail() *Context
- func (c *Context) RequireEmojiId() *Context
- func (c *Context) RequireEmojiName() *Context
- func (c *Context) RequireFileId() *Context
- func (c *Context) RequireHookId() *Context
- func (c *Context) RequireInviteId() *Context
- func (c *Context) RequireJobId() *Context
- func (c *Context) RequireJobType() *Context
- func (c *Context) RequirePluginId() *Context
- func (c *Context) RequirePostId() *Context
- func (c *Context) RequirePreferenceName() *Context
- func (c *Context) RequireReportId() *Context
- func (c *Context) RequireService() *Context
- func (c *Context) RequireTeamId() *Context
- func (c *Context) RequireTeamName() *Context
- func (c *Context) RequireTokenId() *Context
- func (c *Context) RequireUserId() *Context
- func (c *Context) RequireUsername() *Context
- func (c *Context) SessionRequired()
- func (c *Context) SetInvalidParam(parameter string)
- func (c *Context) SetInvalidUrlParam(parameter string)
- func (c *Context) SetPermissionError(permission *model.Permission)
- func (c *Context) SetSiteURLHeader(url string)
- type Routes
- type TestHelper
- func (me *TestHelper) CreateChannelWithClient(client *model.Client4, channelType string) *model.Channel
- func (me *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType string, teamId string) *model.Channel
- func (me *TestHelper) CreateClient() *model.Client4
- func (me *TestHelper) CreateMessagePost(message string) *model.Post
- func (me *TestHelper) CreateMessagePostWithClient(client *model.Client4, channel *model.Channel, message string) *model.Post
- func (me *TestHelper) CreatePinnedPost() *model.Post
- func (me *TestHelper) CreatePinnedPostWithClient(client *model.Client4, channel *model.Channel) *model.Post
- func (me *TestHelper) CreatePost() *model.Post
- func (me *TestHelper) CreatePostWithClient(client *model.Client4, channel *model.Channel) *model.Post
- func (me *TestHelper) CreatePrivateChannel() *model.Channel
- func (me *TestHelper) CreatePublicChannel() *model.Channel
- func (me *TestHelper) CreateTeam() *model.Team
- func (me *TestHelper) CreateTeamWithClient(client *model.Client4) *model.Team
- func (me *TestHelper) CreateUser() *model.User
- func (me *TestHelper) CreateUserWithClient(client *model.Client4) *model.User
- func (me *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, *model.AppError)
- func (me *TestHelper) InitBasic() *TestHelper
- func (me *TestHelper) InitSystemAdmin() *TestHelper
- func (me *TestHelper) LoginBasic()
- func (me *TestHelper) LoginBasic2()
- func (me *TestHelper) LoginBasic2WithClient(client *model.Client4)
- func (me *TestHelper) LoginBasicWithClient(client *model.Client4)
- func (me *TestHelper) LoginSystemAdmin()
- func (me *TestHelper) LoginSystemAdminWithClient(client *model.Client4)
- func (me *TestHelper) LoginTeamAdmin()
- func (me *TestHelper) LoginTeamAdminWithClient(client *model.Client4)
- func (me *TestHelper) UpdateActiveUser(user *model.User, active bool)
Constants ¶
View Source
const ( FILE_TEAM_ID = "noteam" PREVIEW_IMAGE_TYPE = "image/jpeg" THUMBNAIL_IMAGE_TYPE = "image/jpeg" )
View Source
const ( PAGE_DEFAULT = 0 PER_PAGE_DEFAULT = 60 PER_PAGE_MAXIMUM = 200 )
View Source
const (
MAXIMUM_PLUGIN_FILE_SIZE = 50 * 1024 * 1024
)
View Source
const (
MAX_ADD_MEMBERS_BATCH = 20
)
View Source
const OPEN_GRAPH_METADATA_CACHE_SIZE = 10000
Variables ¶
View Source
var MEDIA_CONTENT_TYPES = [...]string{
"image/jpeg",
"image/png",
"image/bmp",
"image/gif",
"video/avi",
"video/mpeg",
"video/mp4",
"audio/mpeg",
"audio/wav",
}
View Source
var UNSAFE_CONTENT_TYPES = [...]string{
"application/javascript",
"application/ecmascript",
"text/javascript",
"text/ecmascript",
"application/x-javascript",
"text/html",
}
Functions ¶
func ApiHandler ¶
func ApiSessionRequired ¶
func ApiSessionRequiredMfa ¶
func GenerateTestAppName ¶
func GenerateTestAppName() string
func GenerateTestChannelName ¶
func GenerateTestChannelName() string
func GenerateTestEmail ¶
func GenerateTestEmail() string
func GenerateTestId ¶
func GenerateTestId() string
func GenerateTestTeamName ¶
func GenerateTestTeamName() string
func GenerateTestUsername ¶
func GenerateTestUsername() string
func HandleEtag ¶
func InitChannel ¶
func InitChannel()
func InitCluster ¶
func InitCluster()
func InitCommand ¶
func InitCommand()
func InitCompliance ¶
func InitCompliance()
func InitElasticsearch ¶
func InitElasticsearch()
func InitOpenGraph ¶
func InitOpenGraph()
func InitPlugin ¶
func InitPlugin()
func InitPreference ¶
func InitPreference()
func InitReaction ¶
func InitReaction()
func InitRouter ¶
func InitRouter()
func InitStatus ¶
func InitStatus()
func InitSystem ¶
func InitSystem()
func InitWebSocket ¶
func InitWebSocket()
func InitWebhook ¶
func InitWebhook()
func InitWebrtc ¶
func InitWebrtc()
func NewInvalidParamError ¶
func NewInvalidUrlParamError ¶
func ReturnStatusOK ¶
func ReturnStatusOK(w http.ResponseWriter)
func StopServer ¶
func StopServer()
func VerifyUserEmail ¶
func VerifyUserEmail(userId string)
Types ¶
type ApiParams ¶
type ApiParams struct {
UserId string
TeamId string
InviteId string
TokenId string
ChannelId string
PostId string
FileId string
PluginId string
CommandId string
HookId string
ReportId string
EmojiId string
AppId string
Email string
Username string
TeamName string
ChannelName string
PreferenceName string
EmojiName string
Category string
Service string
JobId string
JobType string
ActionId string
Page int
PerPage int
Permanent bool
}
func ApiParamsFromRequest ¶
type Context ¶
type Context struct {
Session model.Session
Params *ApiParams
Err *model.AppError
T goi18n.TranslateFunc
RequestId string
IpAddress string
Path string
// contains filtered or unexported fields
}
func (*Context) GetSiteURLHeader ¶
func (*Context) IsSystemAdmin ¶
func (*Context) LogAuditWithUserId ¶
func (*Context) MfaRequired ¶
func (c *Context) MfaRequired()
func (*Context) RemoveSessionCookie ¶
func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)
func (*Context) RequireActionId ¶
func (*Context) RequireAppId ¶
func (*Context) RequireCategory ¶
func (*Context) RequireChannelId ¶
func (*Context) RequireChannelName ¶
func (*Context) RequireCommandId ¶
func (*Context) RequireEmail ¶
func (*Context) RequireEmojiId ¶
func (*Context) RequireEmojiName ¶
func (*Context) RequireFileId ¶
func (*Context) RequireHookId ¶
func (*Context) RequireInviteId ¶
func (*Context) RequireJobId ¶
func (*Context) RequireJobType ¶
func (*Context) RequirePluginId ¶
func (*Context) RequirePostId ¶
func (*Context) RequirePreferenceName ¶
func (*Context) RequireReportId ¶
func (*Context) RequireService ¶
func (*Context) RequireTeamId ¶
func (*Context) RequireTeamName ¶
func (*Context) RequireTokenId ¶
func (*Context) RequireUserId ¶
func (*Context) RequireUsername ¶
func (*Context) SessionRequired ¶
func (c *Context) SessionRequired()
func (*Context) SetInvalidParam ¶
func (*Context) SetInvalidUrlParam ¶
func (*Context) SetPermissionError ¶
func (c *Context) SetPermissionError(permission *model.Permission)
func (*Context) SetSiteURLHeader ¶
type Routes ¶
type Routes struct {
Root *mux.Router // ”
ApiRoot *mux.Router // 'api/v4'
Users *mux.Router // 'api/v4/users'
User *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}'
UserByUsername *mux.Router // 'api/v4/users/username/{username:[A-Za-z0-9_-\.]+}'
UserByEmail *mux.Router // 'api/v4/users/email/{email}'
Teams *mux.Router // 'api/v4/teams'
TeamsForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams'
Team *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}'
TeamForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}'
TeamByName *mux.Router // 'api/v4/teams/name/{team_name:[A-Za-z0-9_-]+}'
TeamMembers *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9_-]+}/members'
TeamMember *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9_-]+}/members/{user_id:[A-Za-z0-9_-]+}'
TeamMembersForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/members'
Channels *mux.Router // 'api/v4/channels'
Channel *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}'
ChannelForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}'
ChannelByName *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}'
ChannelByNameForTeamName *mux.Router // 'api/v4/teams/name/{team_name:[A-Za-z0-9_-]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}'
ChannelsForTeam *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels'
ChannelMembers *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members'
ChannelMember *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members/{user_id:[A-Za-z0-9]+}'
ChannelMembersForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}/channels/members'
Posts *mux.Router // 'api/v4/posts'
Post *mux.Router // 'api/v4/posts/{post_id:[A-Za-z0-9]+}'
PostsForChannel *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/posts'
PostsForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/posts'
PostForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/posts/{post_id:[A-Za-z0-9]+}'
Files *mux.Router // 'api/v4/files'
File *mux.Router // 'api/v4/files/{file_id:[A-Za-z0-9]+}'
Plugins *mux.Router // 'api/v4/plugins'
Plugin *mux.Router // 'api/v4/plugins/{plugin_id:[A-Za-z0-9_-]+}'
PublicFile *mux.Router // 'files/{file_id:[A-Za-z0-9]+}/public'
Commands *mux.Router // 'api/v4/commands'
Command *mux.Router // 'api/v4/commands/{command_id:[A-Za-z0-9]+}'
Hooks *mux.Router // 'api/v4/hooks'
IncomingHooks *mux.Router // 'api/v4/hooks/incoming'
IncomingHook *mux.Router // 'api/v4/hooks/incoming/{hook_id:[A-Za-z0-9]+}'
OutgoingHooks *mux.Router // 'api/v4/hooks/outgoing'
OutgoingHook *mux.Router // 'api/v4/hooks/outgoing/{hook_id:[A-Za-z0-9]+}'
OAuth *mux.Router // 'api/v4/oauth'
OAuthApps *mux.Router // 'api/v4/oauth/apps'
OAuthApp *mux.Router // 'api/v4/oauth/apps/{app_id:[A-Za-z0-9]+}'
OpenGraph *mux.Router // 'api/v4/opengraph'
SAML *mux.Router // 'api/v4/saml'
Compliance *mux.Router // 'api/v4/compliance'
Cluster *mux.Router // 'api/v4/cluster'
LDAP *mux.Router // 'api/v4/ldap'
Elasticsearch *mux.Router // 'api/v4/elasticsearch'
Brand *mux.Router // 'api/v4/brand'
System *mux.Router // 'api/v4/system'
Jobs *mux.Router // 'api/v4/jobs'
Preferences *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/preferences'
License *mux.Router // 'api/v4/license'
Public *mux.Router // 'api/v4/public'
Reactions *mux.Router // 'api/v4/reactions'
Emojis *mux.Router // 'api/v4/emoji'
Emoji *mux.Router // 'api/v4/emoji/{emoji_id:[A-Za-z0-9]+}'
ReactionByNameForPostForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/posts/{post_id:[A-Za-z0-9]+}/reactions/{emoji_name:[A-Za-z0-9_-+]+}'
Webrtc *mux.Router // 'api/v4/webrtc'
}
var BaseRoutes *Routes
type TestHelper ¶
type TestHelper struct {
Client *model.Client4
BasicUser *model.User
BasicUser2 *model.User
TeamAdminUser *model.User
BasicTeam *model.Team
BasicChannel *model.Channel
BasicPrivateChannel *model.Channel
BasicChannel2 *model.Channel
BasicPost *model.Post
SystemAdminClient *model.Client4
SystemAdminUser *model.User
}
func Setup ¶
func Setup() *TestHelper
func SetupEnterprise ¶
func SetupEnterprise() *TestHelper
func (*TestHelper) CreateChannelWithClient ¶
func (*TestHelper) CreateChannelWithClientAndTeam ¶
func (*TestHelper) CreateClient ¶
func (me *TestHelper) CreateClient() *model.Client4
func (*TestHelper) CreateMessagePost ¶
func (me *TestHelper) CreateMessagePost(message string) *model.Post
func (*TestHelper) CreateMessagePostWithClient ¶
func (*TestHelper) CreatePinnedPost ¶
func (me *TestHelper) CreatePinnedPost() *model.Post
func (*TestHelper) CreatePinnedPostWithClient ¶
func (*TestHelper) CreatePost ¶
func (me *TestHelper) CreatePost() *model.Post
func (*TestHelper) CreatePostWithClient ¶
func (*TestHelper) CreatePrivateChannel ¶
func (me *TestHelper) CreatePrivateChannel() *model.Channel
func (*TestHelper) CreatePublicChannel ¶
func (me *TestHelper) CreatePublicChannel() *model.Channel
func (*TestHelper) CreateTeam ¶
func (me *TestHelper) CreateTeam() *model.Team
func (*TestHelper) CreateTeamWithClient ¶
func (me *TestHelper) CreateTeamWithClient(client *model.Client4) *model.Team
func (*TestHelper) CreateUser ¶
func (me *TestHelper) CreateUser() *model.User
func (*TestHelper) CreateUserWithClient ¶
func (me *TestHelper) CreateUserWithClient(client *model.Client4) *model.User
func (*TestHelper) CreateWebSocketClient ¶
func (me *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, *model.AppError)
func (*TestHelper) InitBasic ¶
func (me *TestHelper) InitBasic() *TestHelper
func (*TestHelper) InitSystemAdmin ¶
func (me *TestHelper) InitSystemAdmin() *TestHelper
func (*TestHelper) LoginBasic ¶
func (me *TestHelper) LoginBasic()
func (*TestHelper) LoginBasic2 ¶
func (me *TestHelper) LoginBasic2()
func (*TestHelper) LoginBasic2WithClient ¶
func (me *TestHelper) LoginBasic2WithClient(client *model.Client4)
func (*TestHelper) LoginBasicWithClient ¶
func (me *TestHelper) LoginBasicWithClient(client *model.Client4)
func (*TestHelper) LoginSystemAdmin ¶
func (me *TestHelper) LoginSystemAdmin()
func (*TestHelper) LoginSystemAdminWithClient ¶
func (me *TestHelper) LoginSystemAdminWithClient(client *model.Client4)
func (*TestHelper) LoginTeamAdmin ¶
func (me *TestHelper) LoginTeamAdmin()
func (*TestHelper) LoginTeamAdminWithClient ¶
func (me *TestHelper) LoginTeamAdminWithClient(client *model.Client4)
func (*TestHelper) UpdateActiveUser ¶
func (me *TestHelper) UpdateActiveUser(user *model.User, active bool)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.