api

package
v4.3.0-rc4+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2017 License: AGPL-3.0, Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PREVIEW_IMAGE_TYPE   = "image/jpeg"
	THUMBNAIL_IMAGE_TYPE = "image/jpeg"
)
View Source
const OPEN_GRAPH_METADATA_CACHE_SIZE = 10000

Variables

View Source
var UNSAFE_CONTENT_TYPES = [...]string{
	"application/javascript",
	"application/ecmascript",
	"text/javascript",
	"text/ecmascript",
	"application/x-javascript",
	"text/html",
}

Functions

func CanManageChannel

func CanManageChannel(c *Context, channel *model.Channel) bool

func GenerateTestEmail

func GenerateTestEmail() string

func GenerateTestTeamName

func GenerateTestTeamName() string

func GetAllTeamListings

func GetAllTeamListings(c *Context, w http.ResponseWriter, r *http.Request)

func Handle404

func Handle404(w http.ResponseWriter, r *http.Request)

func IsApiCall

func IsApiCall(r *http.Request) bool

func Logout

func Logout(c *Context, w http.ResponseWriter, r *http.Request)

func NewInvalidParamError

func NewInvalidParamError(where string, name string) *model.AppError

func NewRouter

func NewRouter() *mux.Router

func ReloadConfigForSetup

func ReloadConfigForSetup()

func ReturnStatusOK

func ReturnStatusOK(w http.ResponseWriter)

Types

type API

type API struct {
	App        *app.App
	BaseRoutes *Routes
}

func Init

func Init(a *app.App, root *mux.Router) *API

func (*API) ApiAdminSystemRequired

func (api *API) ApiAdminSystemRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) ApiAdminSystemRequiredTrustRequester

func (api *API) ApiAdminSystemRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) ApiAppHandler

func (api *API) ApiAppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) ApiAppHandlerTrustRequester

func (api *API) ApiAppHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) ApiAppHandlerTrustRequesterIndependent

func (api *API) ApiAppHandlerTrustRequesterIndependent(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) ApiUserRequired

func (api *API) ApiUserRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) ApiUserRequiredActivity

func (api *API) ApiUserRequiredActivity(h func(*Context, http.ResponseWriter, *http.Request), isUserActivity bool) http.Handler

func (*API) ApiUserRequiredMfa

func (api *API) ApiUserRequiredMfa(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) ApiUserRequiredTrustRequester

func (api *API) ApiUserRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) AppHandler

func (api *API) AppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) AppHandlerIndependent

func (api *API) AppHandlerIndependent(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) AppHandlerTrustRequester

func (api *API) AppHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*API) InitAdmin

func (api *API) InitAdmin()

func (*API) InitChannel

func (api *API) InitChannel()

func (*API) InitCommand

func (api *API) InitCommand()

func (*API) InitDeprecated

func (api *API) InitDeprecated()

func (*API) InitEmoji

func (api *API) InitEmoji()

func (*API) InitFile

func (api *API) InitFile()

func (*API) InitGeneral

func (api *API) InitGeneral()

func (*API) InitLicense

func (api *API) InitLicense()

func (*API) InitOAuth

func (api *API) InitOAuth()

func (*API) InitPost

func (api *API) InitPost()

func (*API) InitPreference

func (api *API) InitPreference()

func (*API) InitReaction

func (api *API) InitReaction()

func (*API) InitStatus

func (api *API) InitStatus()

func (*API) InitTeam

func (api *API) InitTeam()

func (*API) InitUser

func (api *API) InitUser()

func (*API) InitWebSocket

func (api *API) InitWebSocket()

func (*API) InitWebhook

func (api *API) InitWebhook()

func (*API) InitWebrtc

func (api *API) InitWebrtc()

func (*API) UserRequired

func (api *API) UserRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

type Context

type Context struct {
	App       *app.App
	Session   model.Session
	RequestId string
	IpAddress string
	Path      string
	Err       *model.AppError

	T      goi18n.TranslateFunc
	Locale string
	TeamId string
	// contains filtered or unexported fields
}

func (*Context) CheckTeamId

func (c *Context) CheckTeamId()

func (*Context) GetCurrentTeamMember

func (c *Context) GetCurrentTeamMember() *model.TeamMember

func (*Context) GetSiteURLHeader

func (c *Context) GetSiteURLHeader() string

func (*Context) GetTeamURL

func (c *Context) GetTeamURL() string

func (*Context) GetTeamURLFromTeam

func (c *Context) GetTeamURLFromTeam(team *model.Team) string

TODO see where these are used

func (*Context) HandleEtag

func (c *Context) HandleEtag(etag string, routeName string, w http.ResponseWriter, r *http.Request) bool

func (*Context) IsSystemAdmin

func (c *Context) IsSystemAdmin() bool

func (*Context) LogAudit

func (c *Context) LogAudit(extraInfo string)

func (*Context) LogAuditWithUserId

func (c *Context) LogAuditWithUserId(userId, extraInfo string)

func (*Context) LogDebug

func (c *Context) LogDebug(err *model.AppError)

func (*Context) LogError

func (c *Context) LogError(err *model.AppError)

func (*Context) MfaRequired

func (c *Context) MfaRequired()

func (*Context) RemoveSessionCookie

func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)

func (*Context) SetInvalidParam

func (c *Context) SetInvalidParam(where string, name string)

func (*Context) SetPermissionError

func (c *Context) SetPermissionError(permission *model.Permission)

func (*Context) SetSiteURLHeader

func (c *Context) SetSiteURLHeader(url string)

func (*Context) SetTeamURLFromSession added in v1.1.0

func (c *Context) SetTeamURLFromSession()

func (*Context) SetUnknownError

func (c *Context) SetUnknownError(where string, details string)

func (*Context) SystemAdminRequired

func (c *Context) SystemAdminRequired()

func (*Context) UserRequired

func (c *Context) UserRequired()

type Routes

type Routes struct {
	Root    *mux.Router // ”
	ApiRoot *mux.Router // 'api/v3'

	Users    *mux.Router // 'api/v3/users'
	NeedUser *mux.Router // 'api/v3/users/{user_id:[A-Za-z0-9]+}'

	Teams    *mux.Router // 'api/v3/teams'
	NeedTeam *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}'

	Channels        *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels'
	NeedChannel     *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}'
	NeedChannelName *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}'

	Posts    *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}/posts'
	NeedPost *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}/posts/{post_id:[A-Za-z0-9]+}'

	Commands *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/commands'
	Hooks    *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/hooks'

	TeamFiles *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/files'
	Files     *mux.Router // 'api/v3/files'
	NeedFile  *mux.Router // 'api/v3/files/{file_id:[A-Za-z0-9]+}'

	OAuth *mux.Router // 'api/v3/oauth'

	Admin *mux.Router // 'api/v3/admin'

	General *mux.Router // 'api/v3/general'

	Preferences *mux.Router // 'api/v3/preferences'

	License *mux.Router // 'api/v3/license'

	Public *mux.Router // 'api/v3/public'

	Emoji *mux.Router // 'api/v3/emoji'

	Webrtc *mux.Router // 'api/v3/webrtc'
}

type TestHelper

type TestHelper struct {
	App *app.App

	BasicClient  *model.Client
	BasicTeam    *model.Team
	BasicUser    *model.User
	BasicUser2   *model.User
	BasicChannel *model.Channel
	BasicPost    *model.Post
	PinnedPost   *model.Post

	SystemAdminClient  *model.Client
	SystemAdminTeam    *model.Team
	SystemAdminUser    *model.User
	SystemAdminChannel *model.Channel
}

func Setup

func Setup() *TestHelper

func SetupEnterprise

func SetupEnterprise() *TestHelper

func (*TestHelper) CreateChannel

func (me *TestHelper) CreateChannel(client *model.Client, team *model.Team) *model.Channel

func (*TestHelper) CreateClient

func (me *TestHelper) CreateClient() *model.Client

func (*TestHelper) CreatePinnedPost

func (me *TestHelper) CreatePinnedPost(client *model.Client, channel *model.Channel) *model.Post

func (*TestHelper) CreatePost

func (me *TestHelper) CreatePost(client *model.Client, channel *model.Channel) *model.Post

func (*TestHelper) CreatePrivateChannel

func (me *TestHelper) CreatePrivateChannel(client *model.Client, team *model.Team) *model.Channel

func (*TestHelper) CreateTeam

func (me *TestHelper) CreateTeam(client *model.Client) *model.Team

func (*TestHelper) CreateUser

func (me *TestHelper) CreateUser(client *model.Client) *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) LinkUserToTeam

func (me *TestHelper) LinkUserToTeam(user *model.User, team *model.Team)

func (*TestHelper) LoginBasic

func (me *TestHelper) LoginBasic()

func (*TestHelper) LoginBasic2

func (me *TestHelper) LoginBasic2()

func (*TestHelper) LoginSystemAdmin

func (me *TestHelper) LoginSystemAdmin()

func (*TestHelper) MakeUserChannelAdmin

func (me *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel)

func (*TestHelper) MakeUserChannelUser

func (me *TestHelper) MakeUserChannelUser(user *model.User, channel *model.Channel)

func (*TestHelper) TearDown

func (me *TestHelper) TearDown()

func (*TestHelper) UpdateUserToNonTeamAdmin

func (me *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)

func (*TestHelper) UpdateUserToTeamAdmin

func (me *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL