model

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2016 License: AGPL-3.0, Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCESS_TOKEN_GRANT_TYPE  = "authorization_code"
	ACCESS_TOKEN_TYPE        = "bearer"
	REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
)
View Source
const (
	AUTHCODE_EXPIRE_TIME   = 60 * 10 // 10 minutes
	AUTHCODE_RESPONSE_TYPE = "code"
	DEFAULT_SCOPE          = "user"
)
View Source
const (
	CHANNEL_OPEN    = "O"
	CHANNEL_PRIVATE = "P"
	CHANNEL_DIRECT  = "D"
	DEFAULT_CHANNEL = "town-square"
)
View Source
const (
	CHANNEL_ROLE_ADMIN          = "admin"
	CHANNEL_NOTIFY_DEFAULT      = "default"
	CHANNEL_NOTIFY_ALL          = "all"
	CHANNEL_NOTIFY_MENTION      = "mention"
	CHANNEL_NOTIFY_NONE         = "none"
	CHANNEL_MARK_UNREAD_ALL     = "all"
	CHANNEL_MARK_UNREAD_MENTION = "mention"
)
View Source
const (
	HEADER_REQUEST_ID         = "X-Request-ID"
	HEADER_VERSION_ID         = "X-Version-ID"
	HEADER_CLUSTER_ID         = "X-Cluster-ID"
	HEADER_ETAG_SERVER        = "ETag"
	HEADER_ETAG_CLIENT        = "If-None-Match"
	HEADER_FORWARDED          = "X-Forwarded-For"
	HEADER_REAL_IP            = "X-Real-IP"
	HEADER_FORWARDED_PROTO    = "X-Forwarded-Proto"
	HEADER_TOKEN              = "token"
	HEADER_BEARER             = "BEARER"
	HEADER_AUTH               = "Authorization"
	HEADER_REQUESTED_WITH     = "X-Requested-With"
	HEADER_REQUESTED_WITH_XML = "XMLHttpRequest"
	STATUS                    = "status"
	STATUS_OK                 = "OK"
	STATUS_FAIL               = "FAIL"

	API_URL_SUFFIX_V1 = "/api/v1"
	API_URL_SUFFIX_V3 = "/api/v3"
	API_URL_SUFFIX    = API_URL_SUFFIX_V3
)
View Source
const (
	COMMAND_METHOD_POST = "P"
	COMMAND_METHOD_GET  = "G"
	MIN_TRIGGER_LENGTH  = 1
	MAX_TRIGGER_LENGTH  = 128
)
View Source
const (
	COMMAND_RESPONSE_TYPE_IN_CHANNEL = "in_channel"
	COMMAND_RESPONSE_TYPE_EPHEMERAL  = "ephemeral"
)
View Source
const (
	COMPLIANCE_STATUS_CREATED  = "created"
	COMPLIANCE_STATUS_RUNNING  = "running"
	COMPLIANCE_STATUS_FINISHED = "finished"
	COMPLIANCE_STATUS_FAILED   = "failed"
	COMPLIANCE_STATUS_REMOVED  = "removed"

	COMPLIANCE_TYPE_DAILY = "daily"
	COMPLIANCE_TYPE_ADHOC = "adhoc"
)
View Source
const (
	CONN_SECURITY_NONE     = ""
	CONN_SECURITY_TLS      = "TLS"
	CONN_SECURITY_STARTTLS = "STARTTLS"

	IMAGE_DRIVER_LOCAL = "local"
	IMAGE_DRIVER_S3    = "amazons3"

	DATABASE_DRIVER_MYSQL    = "mysql"
	DATABASE_DRIVER_POSTGRES = "postgres"

	PASSWORD_MAXIMUM_LENGTH = 64
	PASSWORD_MINIMUM_LENGTH = 5

	SERVICE_GITLAB    = "gitlab"
	SERVICE_GOOGLE    = "google"
	SERVICE_OFFICE365 = "office365"

	WEBSERVER_MODE_REGULAR  = "regular"
	WEBSERVER_MODE_GZIP     = "gzip"
	WEBSERVER_MODE_DISABLED = "disabled"

	GENERIC_NOTIFICATION = "generic"
	FULL_NOTIFICATION    = "full"

	DIRECT_MESSAGE_ANY  = "any"
	DIRECT_MESSAGE_TEAM = "team"

	PERMISSIONS_ALL          = "all"
	PERMISSIONS_TEAM_ADMIN   = "team_admin"
	PERMISSIONS_SYSTEM_ADMIN = "system_admin"

	FAKE_SETTING = "********************************"

	RESTRICT_EMOJI_CREATION_ALL          = "all"
	RESTRICT_EMOJI_CREATION_ADMIN        = "admin"
	RESTRICT_EMOJI_CREATION_SYSTEM_ADMIN = "system_admin"

	SITENAME_MAX_LENGTH = 30
)
View Source
const (
	USER_AUTH_SERVICE_LDAP = "ldap"
	LDAP_SYNC_TASK_NAME    = "LDAP Syncronization"
)
View Source
const (
	OAUTH_ACTION_SIGNUP       = "signup"
	OAUTH_ACTION_LOGIN        = "login"
	OAUTH_ACTION_EMAIL_TO_SSO = "email_to_sso"
	OAUTH_ACTION_SSO_TO_EMAIL = "sso_to_email"
)
View Source
const (
	PASSWORD_RECOVERY_CODE_SIZE  = 128
	PASSWORD_RECOVER_EXPIRY_TIME = 1000 * 60 * 60 // 1 hour
)
View Source
const (
	POST_SYSTEM_MESSAGE_PREFIX = "system_"
	POST_DEFAULT               = ""
	POST_SLACK_ATTACHMENT      = "slack_attachment"
	POST_SYSTEM_GENERIC        = "system_generic"
	POST_JOIN_LEAVE            = "system_join_leave"
	POST_HEADER_CHANGE         = "system_header_change"
	POST_CHANNEL_DELETED       = "system_channel_deleted"
	POST_EPHEMERAL             = "system_ephemeral"
)
View Source
const (
	PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW = "direct_channel_show"
	PREFERENCE_CATEGORY_TUTORIAL_STEPS      = "tutorial_step"
	PREFERENCE_CATEGORY_ADVANCED_SETTINGS   = "advanced_settings"
	PREFERENCE_CATEGORY_FLAGGED_POST        = "flagged_post"

	PREFERENCE_CATEGORY_DISPLAY_SETTINGS = "display_settings"
	PREFERENCE_NAME_COLLAPSE_SETTING     = "collapse_previews"

	PREFERENCE_CATEGORY_THEME = "theme"

	PREFERENCE_CATEGORY_AUTHORIZED_OAUTH_APP = "oauth_app"

	PREFERENCE_CATEGORY_LAST     = "last"
	PREFERENCE_NAME_LAST_CHANNEL = "channel"
)
View Source
const (
	PUSH_NOTIFY_APPLE   = "apple"
	PUSH_NOTIFY_ANDROID = "android"

	CATEGORY_DM = "DIRECT_MESSAGE"

	MHPNS = "https://push.mattermost.com"
)
View Source
const (
	USER_AUTH_SERVICE_SAML      = "saml"
	USER_AUTH_SERVICE_SAML_TEXT = "With SAML"
	SAML_IDP_CERTIFICATE        = 1
	SAML_PRIVATE_KEY            = 2
	SAML_PUBLIC_CERT            = 3
)
View Source
const (
	SESSION_COOKIE_TOKEN  = "MMAUTHTOKEN"
	SESSION_CACHE_SIZE    = 10000
	SESSION_PROP_PLATFORM = "platform"
	SESSION_PROP_OS       = "os"
	SESSION_PROP_BROWSER  = "browser"
)
View Source
const (
	STATUS_OFFLINE    = "offline"
	STATUS_AWAY       = "away"
	STATUS_ONLINE     = "online"
	STATUS_CACHE_SIZE = 10000
)
View Source
const (
	SYSTEM_DIAGNOSTIC_ID        = "DiagnosticId"
	SYSTEM_RAN_UNIT_TESTS       = "RanUnitTests"
	SYSTEM_LAST_SECURITY_TIME   = "LastSecurityTime"
	SYSTEM_ACTIVE_LICENSE_ID    = "ActiveLicenseId"
	SYSTEM_LAST_COMPLIANCE_TIME = "LastComplianceTime"
)
View Source
const (
	TEAM_OPEN   = "O"
	TEAM_INVITE = "I"
)
View Source
const (
	ROLE_SYSTEM_ADMIN          = "system_admin"
	USER_NOTIFY_ALL            = "all"
	USER_NOTIFY_MENTION        = "mention"
	USER_NOTIFY_NONE           = "none"
	DEFAULT_LOCALE             = "en"
	USER_AUTH_SERVICE_EMAIL    = "email"
	USER_AUTH_SERVICE_USERNAME = "username"
)
View Source
const (
	LOWERCASE_LETTERS = "abcdefghijklmnopqrstuvwxyz"
	UPPERCASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	NUMBERS           = "0123456789"
	SYMBOLS           = " !\"\\#$%&'()*+,-./:;<=>?@[]^_`|~"
)
View Source
const (
	WEBSOCKET_EVENT_TYPING             = "typing"
	WEBSOCKET_EVENT_POSTED             = "posted"
	WEBSOCKET_EVENT_POST_EDITED        = "post_edited"
	WEBSOCKET_EVENT_POST_DELETED       = "post_deleted"
	WEBSOCKET_EVENT_CHANNEL_DELETED    = "channel_deleted"
	WEBSOCKET_EVENT_CHANNEL_VIEWED     = "channel_viewed"
	WEBSOCKET_EVENT_DIRECT_ADDED       = "direct_added"
	WEBSOCKET_EVENT_NEW_USER           = "new_user"
	WEBSOCKET_EVENT_LEAVE_TEAM         = "leave_team"
	WEBSOCKET_EVENT_USER_ADDED         = "user_added"
	WEBSOCKET_EVENT_USER_REMOVED       = "user_removed"
	WEBSOCKET_EVENT_PREFERENCE_CHANGED = "preference_changed"
	WEBSOCKET_EVENT_EPHEMERAL_MESSAGE  = "ephemeral_message"
	WEBSOCKET_EVENT_STATUS_CHANGE      = "status_change"
)
View Source
const (
	DEFAULT_WEBHOOK_USERNAME = "webhook"
)
View Source
const (
	ROLE_TEAM_ADMIN = "admin"
)
View Source
const (
	USER_AUTH_SERVICE_GITLAB = "gitlab"
)

Variables

View Source
var (
	IMAGE_EXTENSIONS = [5]string{".jpg", ".jpeg", ".gif", ".bmp", ".png"}
	IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"}
)
View Source
var BuildDate string
View Source
var BuildEnterpriseReady string
View Source
var BuildHash string
View Source
var BuildHashEnterprise string
View Source
var BuildNumber string
View Source
var CurrentVersion string = versions[0]
View Source
var PartialUrlRegex = regexp.MustCompile(`/([A-Za-z0-9]{26})/([A-Za-z0-9]{26})/((?:[A-Za-z0-9]{26})?.+(?:\.[A-Za-z0-9]{3,})?)`)
View Source
var SplitRunes = map[rune]bool{',': true, ' ': true, '.': true, '!': true, '?': true, ':': true, ';': true, '\n': true, '<': true, '>': true, '(': true, ')': true, '{': true, '}': true, '[': true, ']': true, '+': true, '/': true, '\\': true}
View Source
var UrlRegex = regexp.MustCompile(`^((?:[a-z]+:\/\/)?(?:(?:[a-z0-9\-]+\.)+(?:[a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(?:\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(?:\?[a-z0-9+_~\-\.%=&amp;]*)?)?(?:#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(?:\s+|$)$`)

Functions

func ArrayFromJson

func ArrayFromJson(data io.Reader) []string

func ArrayToJson

func ArrayToJson(objmap []string) string

func CleanTeamName

func CleanTeamName(s string) string

func CleanUsername

func CleanUsername(s string) string

func ClearMentionTags

func ClearMentionTags(post string) string

func ClusterInfosToJson added in v3.3.0

func ClusterInfosToJson(objmap []*ClusterInfo) string

func CommandListToJson

func CommandListToJson(l []*Command) string

func ComparePassword

func ComparePassword(hash string, password string) bool

ComparePassword compares the hash

func CompliancePostHeader

func CompliancePostHeader() []string

func EmojiListToJson added in v3.2.0

func EmojiListToJson(emojiList []*Emoji) string

func Etag

func Etag(parts ...interface{}) string

func GetAllTasks added in v3.1.0

func GetAllTasks() *map[string]*ScheduledTask

func GetDMNameFromIds

func GetDMNameFromIds(userId1, userId2 string) string

func GetImageMimeType

func GetImageMimeType(ext string) string

func GetInfoForBytes

func GetInfoForBytes(filename string, data []byte) (*FileInfo, *AppError)

func GetMillis

func GetMillis() int64

GetMillis is a convience method to get milliseconds since epoch.

func GetPreviousVersion

func GetPreviousVersion(version string) string

func GetSubDomain

func GetSubDomain(s string) (string, string)

func HashPassword

func HashPassword(password string) string

HashPassword generates a hash using the bcrypt.GenerateFromPassword

func IncomingWebhookListToJson

func IncomingWebhookListToJson(l []*IncomingWebhook) string

func IsChannelMarkUnreadLevelValid

func IsChannelMarkUnreadLevelValid(markUnreadLevel string) bool

func IsChannelNotifyLevelValid

func IsChannelNotifyLevelValid(notifyLevel string) bool

func IsCurrentVersion

func IsCurrentVersion(versionToCheck string) bool

func IsFileExtImage

func IsFileExtImage(ext string) bool

func IsInRole

func IsInRole(userRoles string, inRole string) bool

Make sure you acually want to use this function. In context.go there are functions to check permissions This function should not be used to check permissions.

func IsInTeamRole

func IsInTeamRole(teamRoles string, inRole string) bool

func IsLower

func IsLower(s string) bool

func IsOfficalBuild

func IsOfficalBuild() bool

func IsPreviousVersionsSupported

func IsPreviousVersionsSupported(versionToCheck string) bool

func IsReservedTeamName

func IsReservedTeamName(s string) bool
func IsSafeLink(link *string) bool

func IsValidAlphaNum

func IsValidAlphaNum(s string, allowUnderscores bool) bool

func IsValidChannelIdentifier

func IsValidChannelIdentifier(s string) bool

func IsValidEmail

func IsValidEmail(email string) bool

func IsValidHttpUrl

func IsValidHttpUrl(rawUrl string) bool

func IsValidHttpsUrl

func IsValidHttpsUrl(rawUrl string) bool

func IsValidTeamName

func IsValidTeamName(s string) bool

func IsValidTeamRoles

func IsValidTeamRoles(teamRoles string) bool

func IsValidUserRoles

func IsValidUserRoles(userRoles string) bool

func IsValidUsername

func IsValidUsername(s string) bool

func MapFromJson

func MapFromJson(data io.Reader) map[string]string

MapFromJson will decode the key/value pair map

func MapToJson

func MapToJson(objmap map[string]string) string

MapToJson converts a map to a json string

func NewId

func NewId() string

NewId is a globally unique identifier. It is a [A-Z0-9] string 26 characters long. It is a UUID version 4 Guid that is zbased32 encoded with the padding stripped off.

func NewRandomString

func NewRandomString(length int) string

func NewWebSocketClient added in v3.3.0

func NewWebSocketClient(url, authToken string) (*WebSocketClient, *AppError)

NewWebSocketClient constructs a new WebSocket client with convienence methods for talking to the server.

func OAuthAppListToJson added in v3.3.0

func OAuthAppListToJson(l []*OAuthApp) string

func OAuthAppMapFromJson

func OAuthAppMapFromJson(data io.Reader) map[string]*OAuthApp

func OAuthAppMapToJson

func OAuthAppMapToJson(a map[string]*OAuthApp) string

func OutgoingWebhookListToJson

func OutgoingWebhookListToJson(l []*OutgoingWebhook) string

func ParseHashtags

func ParseHashtags(text string) (string, string)

func SessionsToJson

func SessionsToJson(o []*Session) string

func SplitVersion

func SplitVersion(version string) (int64, int64, int64)

func StringFromJson

func StringFromJson(data io.Reader) string

func StringInterfaceFromJson

func StringInterfaceFromJson(data io.Reader) map[string]interface{}

func StringInterfaceToJson

func StringInterfaceToJson(objmap map[string]interface{}) string

func StringToJson

func StringToJson(s string) string

func TeamMapFromJson

func TeamMapFromJson(data io.Reader) map[string]*Team

func TeamMapToJson

func TeamMapToJson(u map[string]*Team) string

func TeamMembersToJson

func TeamMembersToJson(o []*TeamMember) string

func UserMapFromJson

func UserMapFromJson(data io.Reader) map[string]*User

func UserMapToJson

func UserMapToJson(u map[string]*User) string

Types

type AccessData

type AccessData struct {
	ClientId     string `json:"client_id"`
	UserId       string `json:"user_id"`
	Token        string `json:"token"`
	RefreshToken string `json:"refresh_token"`
	RedirectUri  string `json:"redirect_uri"`
	ExpiresAt    int64  `json:"expires_at"`
}

func AccessDataFromJson

func AccessDataFromJson(data io.Reader) *AccessData

func (*AccessData) IsExpired added in v3.3.0

func (me *AccessData) IsExpired() bool

func (*AccessData) IsValid

func (ad *AccessData) IsValid() *AppError

IsValid validates the AccessData and returns an error if it isn't configured correctly.

func (*AccessData) ToJson

func (ad *AccessData) ToJson() string

type AccessResponse

type AccessResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int32  `json:"expires_in"`
	Scope        string `json:"scope"`
	RefreshToken string `json:"refresh_token"`
}

func AccessResponseFromJson

func AccessResponseFromJson(data io.Reader) *AccessResponse

func (*AccessResponse) ToJson

func (ar *AccessResponse) ToJson() string

type AnalyticsRow

type AnalyticsRow struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
}

func AnalyticsRowFromJson

func AnalyticsRowFromJson(data io.Reader) *AnalyticsRow

func (*AnalyticsRow) ToJson

func (me *AnalyticsRow) ToJson() string

type AnalyticsRows

type AnalyticsRows []*AnalyticsRow

func AnalyticsRowsFromJson

func AnalyticsRowsFromJson(data io.Reader) AnalyticsRows

func (AnalyticsRows) ToJson

func (me AnalyticsRows) ToJson() string

type AppError

type AppError struct {
	Id            string `json:"id"`
	Message       string `json:"message"`               // Message to be display to the end user without debugging information
	DetailedError string `json:"detailed_error"`        // Internal error string to help the developer
	RequestId     string `json:"request_id,omitempty"`  // The RequestId that's also set in the header
	StatusCode    int    `json:"status_code,omitempty"` // The http status code
	Where         string `json:"-"`                     // The function where it happened in the form of Struct.Func
	IsOAuth       bool   `json:"is_oauth,omitempty"`    // Whether the error is OAuth specific
	// contains filtered or unexported fields
}

func AppErrorFromJson

func AppErrorFromJson(data io.Reader) *AppError

AppErrorFromJson will decode the input and return an AppError

func NewLocAppError

func NewLocAppError(where string, id string, params map[string]interface{}, details string) *AppError

func (*AppError) Error

func (er *AppError) Error() string

func (*AppError) SystemMessage

func (er *AppError) SystemMessage(T goi18n.TranslateFunc) string

func (*AppError) ToJson

func (er *AppError) ToJson() string

func (*AppError) Translate

func (er *AppError) Translate(T goi18n.TranslateFunc)

type Audit

type Audit struct {
	Id        string `json:"id"`
	CreateAt  int64  `json:"create_at"`
	UserId    string `json:"user_id"`
	Action    string `json:"action"`
	ExtraInfo string `json:"extra_info"`
	IpAddress string `json:"ip_address"`
	SessionId string `json:"session_id"`
}

func AuditFromJson

func AuditFromJson(data io.Reader) *Audit

func (*Audit) ToJson

func (o *Audit) ToJson() string

type Audits

type Audits []Audit

func AuditsFromJson

func AuditsFromJson(data io.Reader) Audits

func (Audits) Etag

func (o Audits) Etag() string

func (Audits) ToJson

func (o Audits) ToJson() string

type AuthData

type AuthData struct {
	ClientId    string `json:"client_id"`
	UserId      string `json:"user_id"`
	Code        string `json:"code"`
	ExpiresIn   int32  `json:"expires_in"`
	CreateAt    int64  `json:"create_at"`
	RedirectUri string `json:"redirect_uri"`
	State       string `json:"state"`
	Scope       string `json:"scope"`
}

func AuthDataFromJson

func AuthDataFromJson(data io.Reader) *AuthData

func (*AuthData) IsExpired

func (ad *AuthData) IsExpired() bool

func (*AuthData) IsValid

func (ad *AuthData) IsValid() *AppError

IsValid validates the AuthData and returns an error if it isn't configured correctly.

func (*AuthData) PreSave

func (ad *AuthData) PreSave()

func (*AuthData) ToJson

func (ad *AuthData) ToJson() string

type Channel

type Channel struct {
	Id            string `json:"id"`
	CreateAt      int64  `json:"create_at"`
	UpdateAt      int64  `json:"update_at"`
	DeleteAt      int64  `json:"delete_at"`
	TeamId        string `json:"team_id"`
	Type          string `json:"type"`
	DisplayName   string `json:"display_name"`
	Name          string `json:"name"`
	Header        string `json:"header"`
	Purpose       string `json:"purpose"`
	LastPostAt    int64  `json:"last_post_at"`
	TotalMsgCount int64  `json:"total_msg_count"`
	ExtraUpdateAt int64  `json:"extra_update_at"`
	CreatorId     string `json:"creator_id"`
}

func ChannelFromJson

func ChannelFromJson(data io.Reader) *Channel

func (*Channel) Etag

func (o *Channel) Etag() string

func (*Channel) ExtraEtag

func (o *Channel) ExtraEtag(memberLimit int) string

func (*Channel) ExtraUpdated

func (o *Channel) ExtraUpdated()

func (*Channel) IsValid

func (o *Channel) IsValid() *AppError

func (*Channel) PreSave

func (o *Channel) PreSave()

func (*Channel) PreUpdate

func (o *Channel) PreUpdate()

func (*Channel) ToJson

func (o *Channel) ToJson() string

type ChannelCounts

type ChannelCounts struct {
	Counts      map[string]int64 `json:"counts"`
	UpdateTimes map[string]int64 `json:"update_times"`
}

func ChannelCountsFromJson

func ChannelCountsFromJson(data io.Reader) *ChannelCounts

func (*ChannelCounts) Etag

func (o *ChannelCounts) Etag() string

func (*ChannelCounts) ToJson

func (o *ChannelCounts) ToJson() string

type ChannelData

type ChannelData struct {
	Channel *Channel       `json:"channel"`
	Member  *ChannelMember `json:"member"`
}

func ChannelDataFromJson

func ChannelDataFromJson(data io.Reader) *ChannelData

func (*ChannelData) Etag

func (o *ChannelData) Etag() string

func (*ChannelData) ToJson

func (o *ChannelData) ToJson() string

type ChannelExtra

type ChannelExtra struct {
	Id          string        `json:"id"`
	Members     []ExtraMember `json:"members"`
	MemberCount int64         `json:"member_count"`
}

func ChannelExtraFromJson

func ChannelExtraFromJson(data io.Reader) *ChannelExtra

func (*ChannelExtra) ToJson

func (o *ChannelExtra) ToJson() string

type ChannelList

type ChannelList struct {
	Channels []*Channel                `json:"channels"`
	Members  map[string]*ChannelMember `json:"members"`
}

func ChannelListFromJson

func ChannelListFromJson(data io.Reader) *ChannelList

func (*ChannelList) Etag

func (o *ChannelList) Etag() string

func (*ChannelList) ToJson

func (o *ChannelList) ToJson() string

type ChannelMember

type ChannelMember struct {
	ChannelId    string    `json:"channel_id"`
	UserId       string    `json:"user_id"`
	Roles        string    `json:"roles"`
	LastViewedAt int64     `json:"last_viewed_at"`
	MsgCount     int64     `json:"msg_count"`
	MentionCount int64     `json:"mention_count"`
	NotifyProps  StringMap `json:"notify_props"`
	LastUpdateAt int64     `json:"last_update_at"`
}

func ChannelMemberFromJson

func ChannelMemberFromJson(data io.Reader) *ChannelMember

func (*ChannelMember) IsValid

func (o *ChannelMember) IsValid() *AppError

func (*ChannelMember) PreSave

func (o *ChannelMember) PreSave()

func (*ChannelMember) PreUpdate

func (o *ChannelMember) PreUpdate()

func (*ChannelMember) ToJson

func (o *ChannelMember) ToJson() string

type Client

type Client struct {
	Url           string       // The location of the server like "http://localhost:8065"
	ApiUrl        string       // The api location of the server like "http://localhost:8065/api/v3"
	HttpClient    *http.Client // The http client
	AuthToken     string
	AuthType      string
	TeamId        string
	RequestId     string
	Etag          string
	ServerVersion string
}

func NewClient

func NewClient(url string) *Client

NewClient constructs a new client with convienence methods for talking to the server.

func (*Client) AddChannelMember

func (c *Client) AddChannelMember(id, user_id string) (*Result, *AppError)

func (*Client) AddUserToTeam

func (c *Client) AddUserToTeam(teamId string, userId string) (*Result, *AppError)

Adds a user directly to the team without sending an invite. The teamId and userId are required. You must be a valid member of the team and/or have the correct role to add new users to the team. Returns a map of user_id=userId if successful, otherwise returns an AppError.

func (*Client) AddUserToTeamFromInvite

func (c *Client) AddUserToTeamFromInvite(hash, dataToHash, inviteId string) (*Result, *AppError)

AddUserToTeamFromInvite adds a user to a team based off data provided in an invite link. Either hash and dataToHash are required or inviteId is required.

func (*Client) AdminResetMfa

func (c *Client) AdminResetMfa(userId string) (*Result, *AppError)

func (*Client) AdminResetPassword

func (c *Client) AdminResetPassword(userId, newPassword string) (*Result, *AppError)

func (*Client) AllowOAuth

func (c *Client) AllowOAuth(rspType, clientId, redirect, scope, state string) (*Result, *AppError)

AllowOAuth allows a new session by an OAuth2 App. On success it returns the url to be redirected back to the app which initiated the oauth2 flow. Must be authenticated as a user.

func (*Client) AttachDeviceId

func (c *Client) AttachDeviceId(deviceId string) (*Result, *AppError)

func (*Client) CheckMfa

func (c *Client) CheckMfa(loginId string) (*Result, *AppError)

CheckMfa returns a map with key "mfa_required" with the string value "true" or "false", indicating whether MFA is required to log the user in, based on a provided login id (username, email or some sort of SSO identifier based on configuration).

func (*Client) CheckStatusOK added in v3.1.0

func (c *Client) CheckStatusOK(r *http.Response) bool

CheckStatusOK is a convenience function for checking the return of Web Service call that return the a map of status=OK.

func (*Client) ClearOAuthToken

func (c *Client) ClearOAuthToken()

func (*Client) ClearTeamId

func (c *Client) ClearTeamId()

func (*Client) Command

func (c *Client) Command(channelId string, command string, suggest bool) (*Result, *AppError)

func (*Client) CreateChannel

func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError)

func (*Client) CreateCommand

func (c *Client) CreateCommand(cmd *Command) (*Result, *AppError)

func (*Client) CreateDirectChannel

func (c *Client) CreateDirectChannel(userId string) (*Result, *AppError)

func (*Client) CreateEmoji added in v3.2.0

func (c *Client) CreateEmoji(emoji *Emoji, image []byte, filename string) (*Emoji, *AppError)

CreateEmoji will save an emoji to the server if the current user has permission to do so. If successful, the provided emoji will be returned with its Id field filled in. Otherwise, an error will be returned.

func (*Client) CreateIncomingWebhook

func (c *Client) CreateIncomingWebhook(hook *IncomingWebhook) (*Result, *AppError)

func (*Client) CreateOutgoingWebhook

func (c *Client) CreateOutgoingWebhook(hook *OutgoingWebhook) (*Result, *AppError)

func (*Client) CreatePost

func (c *Client) CreatePost(post *Post) (*Result, *AppError)

func (*Client) CreateTeam

func (c *Client) CreateTeam(team *Team) (*Result, *AppError)

CreateTeam creates a team based on the provided Team struct. On success it returns the Team struct with the Id, CreateAt and other server-decided fields populated.

func (*Client) CreateTeamFromSignup

func (c *Client) CreateTeamFromSignup(teamSignup *TeamSignup) (*Result, *AppError)

CreateTeamFromSignup creates a team based on the provided TeamSignup struct. On success it returns the TeamSignup struct.

func (*Client) CreateUser

func (c *Client) CreateUser(user *User, hash string) (*Result, *AppError)

CreateUser creates a user in the system based on the provided user struct.

func (*Client) CreateUserFromSignup

func (c *Client) CreateUserFromSignup(user *User, data string, hash string) (*Result, *AppError)

func (*Client) CreateUserWithInvite

func (c *Client) CreateUserWithInvite(user *User, hash string, data string, inviteId string) (*Result, *AppError)

CreateUserWithInvite creates a user based on the provided user struct. Either the hash and data strings or the inviteId is required from the invite.

func (*Client) DeleteChannel

func (c *Client) DeleteChannel(id string) (*Result, *AppError)

func (*Client) DeleteCommand

func (c *Client) DeleteCommand(data map[string]string) (*Result, *AppError)

func (*Client) DeleteEmoji added in v3.2.0

func (c *Client) DeleteEmoji(id string) (bool, *AppError)

DeleteEmoji will delete an emoji from the server if the current user has permission to do so. If successful, it will return status=ok. Otherwise, an error will be returned.

func (*Client) DeleteIncomingWebhook

func (c *Client) DeleteIncomingWebhook(id string) (*Result, *AppError)

func (*Client) DeleteOAuthApp added in v3.3.0

func (c *Client) DeleteOAuthApp(id string) (*Result, *AppError)

DeleteOAuthApp deletes an OAuth2 app, the app must be deleted by the same user who created it or a System Administrator. On success returs Status OK. Must be authenticated as a user.

func (*Client) DeleteOutgoingWebhook

func (c *Client) DeleteOutgoingWebhook(id string) (*Result, *AppError)

func (*Client) DeletePost

func (c *Client) DeletePost(channelId string, postId string) (*Result, *AppError)

func (*Client) DeletePreferences added in v3.3.0

func (c *Client) DeletePreferences(preferences *Preferences) (bool, *AppError)

DeletePreferences deletes a list of preferences owned by the current user. If successful, it will return status=ok. Otherwise, an error will be returned.

func (*Client) DoApiGet

func (c *Client) DoApiGet(url string, data string, etag string) (*http.Response, *AppError)

func (*Client) DoApiPost

func (c *Client) DoApiPost(url string, data string) (*http.Response, *AppError)

func (*Client) DoPost

func (c *Client) DoPost(url, data, contentType string) (*http.Response, *AppError)

func (*Client) DownloadComplianceReport

func (c *Client) DownloadComplianceReport(id string) (*Result, *AppError)

func (*Client) EmailToLDAP

func (c *Client) EmailToLDAP(m map[string]string) (*Result, *AppError)

func (*Client) EmailToOAuth

func (c *Client) EmailToOAuth(m map[string]string) (*Result, *AppError)

func (*Client) FindTeamByName

func (c *Client) FindTeamByName(name string) (*Result, *AppError)

FindTeamByName returns the strings "true" or "false" depending on if a team with the provided name was found.

func (*Client) GenerateMfaQrCode

func (c *Client) GenerateMfaQrCode() (*Result, *AppError)

GenerateMfaQrCode returns a QR code imagem containing the secret, to be scanned by a multi-factor authentication mobile application. Must be authenticated.

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError)

func (*Client) GetAllAudits

func (c *Client) GetAllAudits() (*Result, *AppError)

func (*Client) GetAllPreferences

func (c *Client) GetAllPreferences() (*Result, *AppError)

func (*Client) GetAllTeamListings

func (c *Client) GetAllTeamListings() (*Result, *AppError)

GetAllTeamListings returns a map of all teams that are available to join using team ids as the key. Must be authenticated.

func (*Client) GetAllTeams

func (c *Client) GetAllTeams() (*Result, *AppError)

GetAllTeams returns a map of all teams using team ids as the key.

func (*Client) GetAudits

func (c *Client) GetAudits(id string, etag string) (*Result, *AppError)

func (*Client) GetChannel

func (c *Client) GetChannel(id, etag string) (*Result, *AppError)

func (*Client) GetChannelCounts

func (c *Client) GetChannelCounts(etag string) (*Result, *AppError)

func (*Client) GetChannelExtraInfo

func (c *Client) GetChannelExtraInfo(id string, memberLimit int, etag string) (*Result, *AppError)

func (*Client) GetChannelNameRoute

func (c *Client) GetChannelNameRoute(channelName string) string

func (*Client) GetChannelRoute

func (c *Client) GetChannelRoute(channelId string) string

func (*Client) GetChannels

func (c *Client) GetChannels(etag string) (*Result, *AppError)

func (*Client) GetClientLicenceConfig

func (c *Client) GetClientLicenceConfig(etag string) (*Result, *AppError)

func (*Client) GetClientProperties

func (c *Client) GetClientProperties() (map[string]string, *AppError)

GetClientProperties returns properties needed by the client to show/hide certian features. It returns a map of strings.

func (*Client) GetClusterStatus added in v3.3.0

func (c *Client) GetClusterStatus() ([]*ClusterInfo, *AppError)

func (*Client) GetComplianceReports

func (c *Client) GetComplianceReports() (*Result, *AppError)

func (*Client) GetConfig

func (c *Client) GetConfig() (*Result, *AppError)

func (*Client) GetCustomEmojiImageUrl added in v3.2.0

func (c *Client) GetCustomEmojiImageUrl(id string) string

GetCustomEmojiImageUrl returns the API route that can be used to get the image used by the given emoji.

func (*Client) GetDirectProfiles

func (c *Client) GetDirectProfiles(etag string) (*Result, *AppError)

GetDirectProfiles gets a map of users that are currently shown in the sidebar, using user id as the key. Must be authenticated.

func (*Client) GetEmojiRoute added in v3.2.0

func (c *Client) GetEmojiRoute() string

func (*Client) GetFile

func (c *Client) GetFile(url string, isFullUrl bool) (*Result, *AppError)

func (*Client) GetFileInfo

func (c *Client) GetFileInfo(url string) (*Result, *AppError)

func (*Client) GetFlaggedPosts added in v3.3.0

func (c *Client) GetFlaggedPosts(offset int, limit int) (*Result, *AppError)

GetFlaggedPosts will return a post list of posts that have been flagged by the user. The page is set by the integer parameters offset and limit.

func (*Client) GetGeneralRoute added in v3.1.0

func (c *Client) GetGeneralRoute() string

func (*Client) GetInitialLoad

func (c *Client) GetInitialLoad() (*Result, *AppError)

func (*Client) GetLogs

func (c *Client) GetLogs() (*Result, *AppError)

func (*Client) GetMe

func (c *Client) GetMe(etag string) (*Result, *AppError)

GetMe returns the current user.

func (*Client) GetMoreChannels

func (c *Client) GetMoreChannels(etag string) (*Result, *AppError)

func (*Client) GetMyTeam

func (c *Client) GetMyTeam(etag string) (*Result, *AppError)

func (*Client) GetOAuthAppInfo added in v3.3.0

func (c *Client) GetOAuthAppInfo(clientId string) (*Result, *AppError)

GetOAuthAppInfo lookup an OAuth2 App using the client_id. On success it returns a Sanitized OAuth2 App. Must be authenticated as a user.

func (*Client) GetOAuthAppsByUser added in v3.3.0

func (c *Client) GetOAuthAppsByUser() (*Result, *AppError)

GetOAuthAppsByUser returns the OAuth2 Apps registered by the user. On success it returns a list of OAuth2 Apps from the same user or all the registered apps if the user is a System Administrator. Must be authenticated as a user.

func (*Client) GetPing added in v3.1.0

func (c *Client) GetPing() (map[string]string, *AppError)

GetPing returns a map of strings with server time, server version, and node Id. Systems that want to check on health status of the server should check the url /api/v3/ping for a 200 status response.

func (*Client) GetPost

func (c *Client) GetPost(channelId string, postId string, etag string) (*Result, *AppError)

func (*Client) GetPosts

func (c *Client) GetPosts(channelId string, offset int, limit int, etag string) (*Result, *AppError)

func (*Client) GetPostsAfter

func (c *Client) GetPostsAfter(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError)

func (*Client) GetPostsBefore

func (c *Client) GetPostsBefore(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError)

func (*Client) GetPostsSince

func (c *Client) GetPostsSince(channelId string, time int64) (*Result, *AppError)

func (*Client) GetPreference

func (c *Client) GetPreference(category string, name string) (*Result, *AppError)

func (*Client) GetPreferenceCategory

func (c *Client) GetPreferenceCategory(category string) (*Result, *AppError)

func (*Client) GetProfiles

func (c *Client) GetProfiles(teamId string, etag string) (*Result, *AppError)

GetProfiles returns a map of users for a team using user id as the key. Must be authenticated.

func (*Client) GetProfilesForDirectMessageList

func (c *Client) GetProfilesForDirectMessageList(teamId string) (*Result, *AppError)

GetProfilesForDirectMessageList returns a map of users for a team that can be direct messaged, using user id as the key. Must be authenticated.

func (c *Client) GetPublicLink(filename string) (*Result, *AppError)

func (*Client) GetSessions

func (c *Client) GetSessions(id string) (*Result, *AppError)

func (*Client) GetStatuses

func (c *Client) GetStatuses() (*Result, *AppError)

GetStatuses returns a map of string statuses using user id as the key

func (*Client) GetSystemAnalytics

func (c *Client) GetSystemAnalytics(name string) (*Result, *AppError)

func (*Client) GetTeamAnalytics

func (c *Client) GetTeamAnalytics(teamId, name string) (*Result, *AppError)

func (*Client) GetTeamId

func (c *Client) GetTeamId() string

func (*Client) GetTeamMembers

func (c *Client) GetTeamMembers(teamId string) (*Result, *AppError)

func (*Client) GetTeamRoute

func (c *Client) GetTeamRoute() string

func (*Client) GetUser

func (c *Client) GetUser(id string, etag string) (*Result, *AppError)

GetUser returns a user based on a provided user id string. Must be authenticated.

func (*Client) InviteMembers

func (c *Client) InviteMembers(invites *Invites) (*Result, *AppError)

func (*Client) JoinChannel

func (c *Client) JoinChannel(id string) (*Result, *AppError)

func (*Client) JoinChannelByName

func (c *Client) JoinChannelByName(name string) (*Result, *AppError)

func (*Client) LDAPToEmail

func (c *Client) LDAPToEmail(m map[string]string) (*Result, *AppError)

func (*Client) LdapSyncNow added in v3.2.0

func (c *Client) LdapSyncNow() (*Result, *AppError)

Initiate immediate synchronization of LDAP users. The synchronization will be performed asynchronously and this function will always return OK unless you don't have permissions. You must be the system administrator to use this function.

func (*Client) LeaveChannel

func (c *Client) LeaveChannel(id string) (*Result, *AppError)

func (*Client) ListCommands

func (c *Client) ListCommands() (*Result, *AppError)

func (*Client) ListEmoji added in v3.2.0

func (c *Client) ListEmoji() ([]*Emoji, *AppError)

ListEmoji returns a list of all user-created emoji for the server.

func (*Client) ListIncomingWebhooks

func (c *Client) ListIncomingWebhooks() (*Result, *AppError)

func (*Client) ListOutgoingWebhooks

func (c *Client) ListOutgoingWebhooks() (*Result, *AppError)

func (*Client) ListTeamCommands

func (c *Client) ListTeamCommands() (*Result, *AppError)

func (*Client) LogClient added in v3.1.0

func (c *Client) LogClient(message string) (bool, *AppError)

LogClient is a convenience Web Service call so clients can log messages into the server-side logs. For example we typically log javascript error messages into the server-side. It returns true if the logging was successful.

func (*Client) Login

func (c *Client) Login(loginId string, password string) (*Result, *AppError)

Login authenticates a user by login id, which can be username, email or some sort of SSO identifier based on configuration, and a password.

func (*Client) LoginById

func (c *Client) LoginById(id string, password string) (*Result, *AppError)

LoginById authenticates a user by user id and password.

func (*Client) LoginByLdap

func (c *Client) LoginByLdap(loginId string, password string) (*Result, *AppError)

LoginByLdap authenticates a user by LDAP id and password.

func (*Client) LoginWithDevice

func (c *Client) LoginWithDevice(loginId string, password string, deviceId string) (*Result, *AppError)

LoginWithDevice authenticates a user by login id (username, email or some sort of SSO identifier based on configuration), password and attaches a device id to the session.

func (*Client) Logout

func (c *Client) Logout() (*Result, *AppError)

Logout terminates the current user's session.

func (*Client) MockSession

func (c *Client) MockSession(sessionToken string)

func (*Client) Must

func (c *Client) Must(result *Result, err *AppError) *Result

Must is a convenience function used for testing.

func (*Client) MustGeneric added in v3.2.0

func (c *Client) MustGeneric(result interface{}, err *AppError) interface{}

MustGeneric is a convenience function used for testing.

func (*Client) OAuthToEmail

func (c *Client) OAuthToEmail(m map[string]string) (*Result, *AppError)

func (*Client) PostToWebhook

func (c *Client) PostToWebhook(id, payload string) (*Result, *AppError)

func (*Client) RecycleDatabaseConnection added in v3.1.0

func (c *Client) RecycleDatabaseConnection() (bool, *AppError)

RecycleDatabaseConnection will attempt to recycle the database connections. You must have the system admin role to call this method. It will return status=OK if it's successfully recycled the connections, otherwise check the returned error.

func (*Client) RegenCommandToken

func (c *Client) RegenCommandToken(data map[string]string) (*Result, *AppError)

func (*Client) RegenOutgoingWebhookToken

func (c *Client) RegenOutgoingWebhookToken(id string) (*Result, *AppError)

func (*Client) RegisterApp

func (c *Client) RegisterApp(app *OAuthApp) (*Result, *AppError)

RegisterApp creates a new OAuth2 app to be used with the OAuth2 Provider. On success it returns the created app. Must be authenticated as a user.

func (*Client) ReloadConfig added in v3.1.0

func (c *Client) ReloadConfig() (bool, *AppError)

ReloadConfig will reload the config.json file from disk. Properties requiring a server restart will still need a server restart. You must have the system admin role to call this method. It will return status=OK if it's successfully reloaded the config file, otherwise check the returned error.

func (*Client) RemoveCertificateFile added in v3.3.0

func (c *Client) RemoveCertificateFile(filename string) *AppError

Removes a x509 base64 Certificate or Private Key file used with SAML. filename is required. Returns nil if successful, otherwise returns an AppError

func (*Client) RemoveChannelMember

func (c *Client) RemoveChannelMember(id, user_id string) (*Result, *AppError)

func (*Client) RemoveUserFromTeam added in v3.2.0

func (c *Client) RemoveUserFromTeam(teamId string, userId string) (*Result, *AppError)

Removes a user directly from the team. The teamId and userId are required. You must be a valid member of the team and/or have the correct role to remove a user from the team. Returns a map of user_id=userId if successful, otherwise returns an AppError.

func (*Client) ResetPassword

func (c *Client) ResetPassword(code, newPassword string) (*Result, *AppError)

func (*Client) RevokeSession

func (c *Client) RevokeSession(sessionAltId string) (*Result, *AppError)

func (*Client) SamlCertificateStatus added in v3.3.0

func (c *Client) SamlCertificateStatus(filename string) (map[string]interface{}, *AppError)

Checks if the x509 base64 Certificates and Private Key files used with SAML exists on the file system. Returns a map[string]interface{} if successful, otherwise returns an AppError. Must be System Admin authenticated.

func (*Client) SaveComplianceReport

func (c *Client) SaveComplianceReport(job *Compliance) (*Result, *AppError)

func (*Client) SaveConfig

func (c *Client) SaveConfig(config *Config) (*Result, *AppError)

func (*Client) SearchPosts

func (c *Client) SearchPosts(terms string, isOrSearch bool) (*Result, *AppError)

func (*Client) SendPasswordReset

func (c *Client) SendPasswordReset(email string) (*Result, *AppError)

func (*Client) SetOAuthToken

func (c *Client) SetOAuthToken(token string)

func (*Client) SetPreferences

func (c *Client) SetPreferences(preferences *Preferences) (*Result, *AppError)

func (*Client) SetTeamId

func (c *Client) SetTeamId(teamId string)

func (*Client) SignupTeam

func (c *Client) SignupTeam(email string, displayName string) (*Result, *AppError)

SignupTeam sends an email with a team sign-up link to the provided address if email verification is enabled, otherwise it returns a map with a "follow_link" entry containing the team sign-up link.

func (*Client) TestEmail

func (c *Client) TestEmail(config *Config) (*Result, *AppError)

func (*Client) UpdateActive

func (c *Client) UpdateActive(userId string, active bool) (*Result, *AppError)

func (*Client) UpdateChannel

func (c *Client) UpdateChannel(channel *Channel) (*Result, *AppError)

func (*Client) UpdateChannelHeader

func (c *Client) UpdateChannelHeader(data map[string]string) (*Result, *AppError)

func (*Client) UpdateChannelPurpose

func (c *Client) UpdateChannelPurpose(data map[string]string) (*Result, *AppError)

func (*Client) UpdateLastViewedAt

func (c *Client) UpdateLastViewedAt(channelId string) (*Result, *AppError)

func (*Client) UpdateMfa

func (c *Client) UpdateMfa(activate bool, token string) (*Result, *AppError)

UpdateMfa activates multi-factor authenticates for the current user if activate is true and a valid token is provided. If activate is false, then token is not required and multi-factor authentication is disabled for the current user.

func (*Client) UpdateNotifyProps

func (c *Client) UpdateNotifyProps(data map[string]string) (*Result, *AppError)

func (*Client) UpdatePost

func (c *Client) UpdatePost(post *Post) (*Result, *AppError)

func (*Client) UpdateTeam

func (c *Client) UpdateTeam(team *Team) (*Result, *AppError)

UpdateTeam updates a team based on the changes in the provided team struct. On success it returns a sanitized version of the updated team. Must be authenticated as a team admin for that team or a system admin.

func (*Client) UpdateUser

func (c *Client) UpdateUser(user *User) (*Result, *AppError)

func (*Client) UpdateUserNotify

func (c *Client) UpdateUserNotify(data map[string]string) (*Result, *AppError)

func (*Client) UpdateUserPassword

func (c *Client) UpdateUserPassword(userId, currentPassword, newPassword string) (*Result, *AppError)

func (*Client) UpdateUserRoles

func (c *Client) UpdateUserRoles(data map[string]string) (*Result, *AppError)

func (*Client) UploadCertificateFile added in v3.3.0

func (c *Client) UploadCertificateFile(data []byte, contentType string) *AppError

Uploads a x509 base64 Certificate or Private Key file to be used with SAML. data byte array is required and needs to be a Multi-Part with 'certificate' as the field name contentType is also required. Returns nil if succesful, otherwise returns an AppError

func (*Client) UploadPostAttachment

func (c *Client) UploadPostAttachment(data []byte, contentType string) (*Result, *AppError)

func (*Client) UploadProfileFile

func (c *Client) UploadProfileFile(data []byte, contentType string) (*Result, *AppError)

type ClusterInfo added in v3.3.0

type ClusterInfo struct {
	Id                 string `json:"id"`
	Version            string `json:"version"`
	ConfigHash         string `json:"config_hash"`
	InterNodeUrl       string `json:"internode_url"`
	Hostname           string `json:"hostname"`
	LastSuccessfulPing int64  `json:"last_ping"`
	IsAlive            bool   `json:"is_alive"`
}

func ClusterInfoFromJson added in v3.3.0

func ClusterInfoFromJson(data io.Reader) *ClusterInfo

func ClusterInfosFromJson added in v3.3.0

func ClusterInfosFromJson(data io.Reader) []*ClusterInfo

func (*ClusterInfo) HaveEstablishedInitialContact added in v3.3.0

func (me *ClusterInfo) HaveEstablishedInitialContact() bool

func (*ClusterInfo) ToJson added in v3.3.0

func (me *ClusterInfo) ToJson() string

type ClusterSettings added in v3.3.0

type ClusterSettings struct {
	Enable                 *bool
	InterNodeListenAddress *string
	InterNodeUrls          []string
}

type Command

type Command struct {
	Id               string `json:"id"`
	Token            string `json:"token"`
	CreateAt         int64  `json:"create_at"`
	UpdateAt         int64  `json:"update_at"`
	DeleteAt         int64  `json:"delete_at"`
	CreatorId        string `json:"creator_id"`
	TeamId           string `json:"team_id"`
	Trigger          string `json:"trigger"`
	Method           string `json:"method"`
	Username         string `json:"username"`
	IconURL          string `json:"icon_url"`
	AutoComplete     bool   `json:"auto_complete"`
	AutoCompleteDesc string `json:"auto_complete_desc"`
	AutoCompleteHint string `json:"auto_complete_hint"`
	DisplayName      string `json:"display_name"`
	Description      string `json:"description"`
	URL              string `json:"url"`
}

func CommandFromJson

func CommandFromJson(data io.Reader) *Command

func CommandListFromJson

func CommandListFromJson(data io.Reader) []*Command

func (*Command) IsValid

func (o *Command) IsValid() *AppError

func (*Command) PreSave

func (o *Command) PreSave()

func (*Command) PreUpdate

func (o *Command) PreUpdate()

func (*Command) Sanitize

func (o *Command) Sanitize()

func (*Command) ToJson

func (o *Command) ToJson() string

type CommandResponse

type CommandResponse struct {
	ResponseType string      `json:"response_type"`
	Text         string      `json:"text"`
	GotoLocation string      `json:"goto_location"`
	Attachments  interface{} `json:"attachments"`
}

func CommandResponseFromJson

func CommandResponseFromJson(data io.Reader) *CommandResponse

func (*CommandResponse) ToJson

func (o *CommandResponse) ToJson() string

type Compliance

type Compliance struct {
	Id       string `json:"id"`
	CreateAt int64  `json:"create_at"`
	UserId   string `json:"user_id"`
	Status   string `json:"status"`
	Count    int    `json:"count"`
	Desc     string `json:"desc"`
	Type     string `json:"type"`
	StartAt  int64  `json:"start_at"`
	EndAt    int64  `json:"end_at"`
	Keywords string `json:"keywords"`
	Emails   string `json:"emails"`
}

func ComplianceFromJson

func ComplianceFromJson(data io.Reader) *Compliance

func (*Compliance) IsValid

func (me *Compliance) IsValid() *AppError

func (*Compliance) JobName

func (me *Compliance) JobName() string

func (*Compliance) PreSave

func (me *Compliance) PreSave()

func (*Compliance) ToJson

func (o *Compliance) ToJson() string

type CompliancePost

type CompliancePost struct {

	// From Team
	TeamName        string
	TeamDisplayName string

	// From Channel
	ChannelName        string
	ChannelDisplayName string

	// From User
	UserUsername string
	UserEmail    string
	UserNickname string

	// From Post
	PostId         string
	PostCreateAt   int64
	PostUpdateAt   int64
	PostDeleteAt   int64
	PostRootId     string
	PostParentId   string
	PostOriginalId string
	PostMessage    string
	PostType       string
	PostProps      string
	PostHashtags   string
	PostFilenames  string
}

func (*CompliancePost) Row

func (me *CompliancePost) Row() []string

type ComplianceSettings

type ComplianceSettings struct {
	Enable      *bool
	Directory   *string
	EnableDaily *bool
}

type Compliances

type Compliances []Compliance

func CompliancesFromJson

func CompliancesFromJson(data io.Reader) Compliances

func (Compliances) ToJson

func (o Compliances) ToJson() string

type Config

type Config struct {
	ServiceSettings      ServiceSettings
	TeamSettings         TeamSettings
	SqlSettings          SqlSettings
	LogSettings          LogSettings
	PasswordSettings     PasswordSettings
	FileSettings         FileSettings
	EmailSettings        EmailSettings
	RateLimitSettings    RateLimitSettings
	PrivacySettings      PrivacySettings
	SupportSettings      SupportSettings
	GitLabSettings       SSOSettings
	GoogleSettings       SSOSettings
	Office365Settings    SSOSettings
	LdapSettings         LdapSettings
	ComplianceSettings   ComplianceSettings
	LocalizationSettings LocalizationSettings
	SamlSettings         SamlSettings
	NativeAppSettings    NativeAppSettings
	ClusterSettings      ClusterSettings
}

func ConfigFromJson

func ConfigFromJson(data io.Reader) *Config

func (*Config) GetSSOService

func (o *Config) GetSSOService(service string) *SSOSettings

func (*Config) GetSanitizeOptions

func (o *Config) GetSanitizeOptions() map[string]bool

func (*Config) IsValid

func (o *Config) IsValid() *AppError

func (*Config) Sanitize

func (o *Config) Sanitize()

func (*Config) SetDefaults

func (o *Config) SetDefaults()

func (*Config) ToJson

func (o *Config) ToJson() string

type Customer

type Customer struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Email       string `json:"email"`
	Company     string `json:"company"`
	PhoneNumber string `json:"phone_number"`
}

type EmailSettings

type EmailSettings struct {
	EnableSignUpWithEmail    bool
	EnableSignInWithEmail    *bool
	EnableSignInWithUsername *bool
	SendEmailNotifications   bool
	RequireEmailVerification bool
	FeedbackName             string
	FeedbackEmail            string
	FeedbackOrganization     *string
	SMTPUsername             string
	SMTPPassword             string
	SMTPServer               string
	SMTPPort                 string
	ConnectionSecurity       string
	InviteSalt               string
	PasswordResetSalt        string
	SendPushNotifications    *bool
	PushNotificationServer   *string
	PushNotificationContents *string
}

type Emoji added in v3.2.0

type Emoji struct {
	Id        string `json:"id"`
	CreateAt  int64  `json:"create_at"`
	UpdateAt  int64  `json:"update_at"`
	DeleteAt  int64  `json:"delete_at"`
	CreatorId string `json:"creator_id"`
	Name      string `json:"name"`
}

func EmojiFromJson added in v3.2.0

func EmojiFromJson(data io.Reader) *Emoji

func EmojiListFromJson added in v3.2.0

func EmojiListFromJson(data io.Reader) []*Emoji

func (*Emoji) IsValid added in v3.2.0

func (emoji *Emoji) IsValid() *AppError

func (*Emoji) PreSave added in v3.2.0

func (emoji *Emoji) PreSave()

func (*Emoji) PreUpdate added in v3.2.0

func (emoji *Emoji) PreUpdate()

func (*Emoji) ToJson added in v3.2.0

func (emoji *Emoji) ToJson() string

type EncryptStringMap

type EncryptStringMap map[string]string

type ExtraMember

type ExtraMember struct {
	Id       string `json:"id"`
	Nickname string `json:"nickname"`
	Email    string `json:"email"`
	Roles    string `json:"roles"`
	Username string `json:"username"`
}

func (*ExtraMember) Sanitize

func (o *ExtraMember) Sanitize(options map[string]bool)

type Features

type Features struct {
	Users                *int  `json:"users"`
	LDAP                 *bool `json:"ldap"`
	MFA                  *bool `json:"mfa"`
	GoogleOAuth          *bool `json:"google_oauth"`
	Office365OAuth       *bool `json:"office365_oauth"`
	Compliance           *bool `json:"compliance"`
	Cluster              *bool `json:"cluster"`
	CustomBrand          *bool `json:"custom_brand"`
	MHPNS                *bool `json:"mhpns"`
	SAML                 *bool `json:"saml"`
	PasswordRequirements *bool `json:"password_requirements"`
	FutureFeatures       *bool `json:"future_features"`
}

func (*Features) SetDefaults

func (f *Features) SetDefaults()

type FileInfo

type FileInfo struct {
	Filename        string `json:"filename"`
	Size            int    `json:"size"`
	Extension       string `json:"extension"`
	MimeType        string `json:"mime_type"`
	HasPreviewImage bool   `json:"has_preview_image"`
}

func FileInfoFromJson

func FileInfoFromJson(data io.Reader) *FileInfo

func (*FileInfo) ToJson

func (info *FileInfo) ToJson() string

type FileSettings

type FileSettings struct {
	MaxFileSize                *int64
	DriverName                 string
	Directory                  string
	EnablePublicLink           bool
	PublicLinkSalt             string
	ThumbnailWidth             int
	ThumbnailHeight            int
	PreviewWidth               int
	PreviewHeight              int
	ProfileWidth               int
	ProfileHeight              int
	InitialFont                string
	AmazonS3AccessKeyId        string
	AmazonS3SecretAccessKey    string
	AmazonS3Bucket             string
	AmazonS3Region             string
	AmazonS3Endpoint           string
	AmazonS3BucketEndpoint     string
	AmazonS3LocationConstraint *bool
	AmazonS3LowercaseBucket    *bool
}

type FileUploadResponse

type FileUploadResponse struct {
	Filenames []string `json:"filenames"`
	ClientIds []string `json:"client_ids"`
}

func FileUploadResponseFromJson

func FileUploadResponseFromJson(data io.Reader) *FileUploadResponse

func (*FileUploadResponse) ToJson

func (o *FileUploadResponse) ToJson() string

type IncomingWebhook

type IncomingWebhook struct {
	Id          string `json:"id"`
	CreateAt    int64  `json:"create_at"`
	UpdateAt    int64  `json:"update_at"`
	DeleteAt    int64  `json:"delete_at"`
	UserId      string `json:"user_id"`
	ChannelId   string `json:"channel_id"`
	TeamId      string `json:"team_id"`
	DisplayName string `json:"display_name"`
	Description string `json:"description"`
}

func IncomingWebhookFromJson

func IncomingWebhookFromJson(data io.Reader) *IncomingWebhook

func IncomingWebhookListFromJson

func IncomingWebhookListFromJson(data io.Reader) []*IncomingWebhook

func (*IncomingWebhook) IsValid

func (o *IncomingWebhook) IsValid() *AppError

func (*IncomingWebhook) PreSave

func (o *IncomingWebhook) PreSave()

func (*IncomingWebhook) PreUpdate

func (o *IncomingWebhook) PreUpdate()

func (*IncomingWebhook) ToJson

func (o *IncomingWebhook) ToJson() string

type IncomingWebhookRequest

type IncomingWebhookRequest struct {
	Text        string          `json:"text"`
	Username    string          `json:"username"`
	IconURL     string          `json:"icon_url"`
	ChannelName string          `json:"channel"`
	Props       StringInterface `json:"props"`
	Attachments interface{}     `json:"attachments"`
	Type        string          `json:"type"`
}

func IncomingWebhookRequestFromJson

func IncomingWebhookRequestFromJson(data io.Reader) *IncomingWebhookRequest

type InitialLoad

type InitialLoad struct {
	User           *User             `json:"user"`
	TeamMembers    []*TeamMember     `json:"team_members"`
	Teams          []*Team           `json:"teams"`
	DirectProfiles map[string]*User  `json:"direct_profiles"`
	Preferences    Preferences       `json:"preferences"`
	ClientCfg      map[string]string `json:"client_cfg"`
	LicenseCfg     map[string]string `json:"license_cfg"`
	NoAccounts     bool              `json:"no_accounts"`
}

func InitialLoadFromJson

func InitialLoadFromJson(data io.Reader) *InitialLoad

func (*InitialLoad) ToJson

func (me *InitialLoad) ToJson() string

type Invites

type Invites struct {
	Invites []map[string]string `json:"invites"`
}

func InvitesFromJson

func InvitesFromJson(data io.Reader) *Invites

func (*Invites) ToJson

func (o *Invites) ToJson() string

type LdapSettings

type LdapSettings struct {
	// Basic
	Enable             *bool
	LdapServer         *string
	LdapPort           *int
	ConnectionSecurity *string
	BaseDN             *string
	BindUsername       *string
	BindPassword       *string

	// Filtering
	UserFilter *string

	// User Mapping
	FirstNameAttribute *string
	LastNameAttribute  *string
	EmailAttribute     *string
	UsernameAttribute  *string
	NicknameAttribute  *string
	IdAttribute        *string

	// Syncronization
	SyncIntervalMinutes *int

	// Advanced
	SkipCertificateVerification *bool
	QueryTimeout                *int
	MaxPageSize                 *int

	// Customization
	LoginFieldName *string
}

type License

type License struct {
	Id        string    `json:"id"`
	IssuedAt  int64     `json:"issued_at"`
	StartsAt  int64     `json:"starts_at"`
	ExpiresAt int64     `json:"expires_at"`
	Customer  *Customer `json:"customer"`
	Features  *Features `json:"features"`
}

func LicenseFromJson

func LicenseFromJson(data io.Reader) *License

func (*License) IsExpired

func (l *License) IsExpired() bool

func (*License) IsStarted

func (l *License) IsStarted() bool

func (*License) ToJson

func (l *License) ToJson() string

type LicenseRecord

type LicenseRecord struct {
	Id       string `json:"id"`
	CreateAt int64  `json:"create_at"`
	Bytes    string `json:"-"`
}

func (*LicenseRecord) IsValid

func (lr *LicenseRecord) IsValid() *AppError

func (*LicenseRecord) PreSave

func (lr *LicenseRecord) PreSave()

type LocalizationSettings added in v3.1.0

type LocalizationSettings struct {
	DefaultServerLocale *string
	DefaultClientLocale *string
	AvailableLocales    *string
}

type LogSettings

type LogSettings struct {
	EnableConsole          bool
	ConsoleLevel           string
	EnableFile             bool
	FileLevel              string
	FileFormat             string
	FileLocation           string
	EnableWebhookDebugging bool
}

type NativeAppSettings added in v3.3.0

type NativeAppSettings struct {
	AppDownloadLink        *string
	AndroidAppDownloadLink *string
	IosAppDownloadLink     *string
}

type OAuthApp

type OAuthApp struct {
	Id           string      `json:"id"`
	CreatorId    string      `json:"creator_id"`
	CreateAt     int64       `json:"create_at"`
	UpdateAt     int64       `json:"update_at"`
	ClientSecret string      `json:"client_secret"`
	Name         string      `json:"name"`
	Description  string      `json:"description"`
	IconURL      string      `json:"icon_url"`
	CallbackUrls StringArray `json:"callback_urls"`
	Homepage     string      `json:"homepage"`
	IsTrusted    bool        `json:"is_trusted"`
}

func OAuthAppFromJson

func OAuthAppFromJson(data io.Reader) *OAuthApp

OAuthAppFromJson will decode the input and return a User

func OAuthAppListFromJson added in v3.3.0

func OAuthAppListFromJson(data io.Reader) []*OAuthApp

func (*OAuthApp) Etag

func (a *OAuthApp) Etag() string

Generate a valid strong etag so the browser can cache the results

func (*OAuthApp) IsValid

func (a *OAuthApp) IsValid() *AppError

IsValid validates the app and returns an error if it isn't configured correctly.

func (*OAuthApp) IsValidRedirectURL

func (a *OAuthApp) IsValidRedirectURL(url string) bool

func (*OAuthApp) PreSave

func (a *OAuthApp) PreSave()

PreSave will set the Id and ClientSecret if missing. It will also fill in the CreateAt, UpdateAt times. It should be run before saving the app to the db.

func (*OAuthApp) PreUpdate

func (a *OAuthApp) PreUpdate()

PreUpdate should be run before updating the app in the db.

func (*OAuthApp) Sanitize

func (a *OAuthApp) Sanitize()

Remove any private data from the app object

func (*OAuthApp) ToJson

func (a *OAuthApp) ToJson() string

ToJson convert a User to a json string

type OutgoingWebhook

type OutgoingWebhook struct {
	Id           string      `json:"id"`
	Token        string      `json:"token"`
	CreateAt     int64       `json:"create_at"`
	UpdateAt     int64       `json:"update_at"`
	DeleteAt     int64       `json:"delete_at"`
	CreatorId    string      `json:"creator_id"`
	ChannelId    string      `json:"channel_id"`
	TeamId       string      `json:"team_id"`
	TriggerWords StringArray `json:"trigger_words"`
	TriggerWhen  int         `json:"trigger_when"`
	CallbackURLs StringArray `json:"callback_urls"`
	DisplayName  string      `json:"display_name"`
	Description  string      `json:"description"`
	ContentType  string      `json:"content_type"`
}

func OutgoingWebhookFromJson

func OutgoingWebhookFromJson(data io.Reader) *OutgoingWebhook

func OutgoingWebhookListFromJson

func OutgoingWebhookListFromJson(data io.Reader) []*OutgoingWebhook

func (*OutgoingWebhook) HasTriggerWord

func (o *OutgoingWebhook) HasTriggerWord(word string) bool

func (*OutgoingWebhook) IsValid

func (o *OutgoingWebhook) IsValid() *AppError

func (*OutgoingWebhook) PreSave

func (o *OutgoingWebhook) PreSave()

func (*OutgoingWebhook) PreUpdate

func (o *OutgoingWebhook) PreUpdate()

func (*OutgoingWebhook) ToJson

func (o *OutgoingWebhook) ToJson() string

func (*OutgoingWebhook) TriggerWordStartsWith added in v3.3.0

func (o *OutgoingWebhook) TriggerWordStartsWith(word string) bool

type OutgoingWebhookPayload added in v3.1.0

type OutgoingWebhookPayload struct {
	Token       string `json:"token"`
	TeamId      string `json:"team_id"`
	TeamDomain  string `json:"team_domain"`
	ChannelId   string `json:"channel_id"`
	ChannelName string `json:"channel_name"`
	Timestamp   int64  `json:"timestamp"`
	UserId      string `json:"user_id"`
	UserName    string `json:"user_name"`
	PostId      string `json:"post_id"`
	Text        string `json:"text"`
	TriggerWord string `json:"trigger_word"`
}

func (*OutgoingWebhookPayload) ToFormValues added in v3.1.0

func (o *OutgoingWebhookPayload) ToFormValues() string

func (*OutgoingWebhookPayload) ToJSON added in v3.1.0

func (o *OutgoingWebhookPayload) ToJSON() string

type PasswordRecovery

type PasswordRecovery struct {
	UserId   string
	Code     string
	CreateAt int64
}

func (*PasswordRecovery) IsValid

func (p *PasswordRecovery) IsValid() *AppError

func (*PasswordRecovery) PreSave

func (p *PasswordRecovery) PreSave()

type PasswordSettings added in v3.2.0

type PasswordSettings struct {
	MinimumLength *int
	Lowercase     *bool
	Number        *bool
	Uppercase     *bool
	Symbol        *bool
}

type Post

type Post struct {
	Id            string          `json:"id"`
	CreateAt      int64           `json:"create_at"`
	UpdateAt      int64           `json:"update_at"`
	DeleteAt      int64           `json:"delete_at"`
	UserId        string          `json:"user_id"`
	ChannelId     string          `json:"channel_id"`
	RootId        string          `json:"root_id"`
	ParentId      string          `json:"parent_id"`
	OriginalId    string          `json:"original_id"`
	Message       string          `json:"message"`
	Type          string          `json:"type"`
	Props         StringInterface `json:"props"`
	Hashtags      string          `json:"hashtags"`
	Filenames     StringArray     `json:"filenames"`
	PendingPostId string          `json:"pending_post_id" db:"-"`
}

func PostFromJson

func PostFromJson(data io.Reader) *Post

func (*Post) AddProp

func (o *Post) AddProp(key string, value interface{})

func (*Post) Etag

func (o *Post) Etag() string

func (*Post) IsSystemMessage

func (o *Post) IsSystemMessage() bool

func (*Post) IsValid

func (o *Post) IsValid() *AppError

func (*Post) MakeNonNil

func (o *Post) MakeNonNil()

func (*Post) PreSave

func (o *Post) PreSave()

func (*Post) ToJson

func (o *Post) ToJson() string

type PostList

type PostList struct {
	Order []string         `json:"order"`
	Posts map[string]*Post `json:"posts"`
}

func PostListFromJson

func PostListFromJson(data io.Reader) *PostList

func (*PostList) AddOrder

func (o *PostList) AddOrder(id string)

func (*PostList) AddPost

func (o *PostList) AddPost(post *Post)

func (*PostList) Etag

func (o *PostList) Etag() string

func (*PostList) Extend

func (o *PostList) Extend(other *PostList)

func (*PostList) IsChannelId

func (o *PostList) IsChannelId(channelId string) bool

func (*PostList) MakeNonNil

func (o *PostList) MakeNonNil()

func (*PostList) ToJson

func (o *PostList) ToJson() string

type Preference

type Preference struct {
	UserId   string `json:"user_id"`
	Category string `json:"category"`
	Name     string `json:"name"`
	Value    string `json:"value"`
}

func PreferenceFromJson

func PreferenceFromJson(data io.Reader) *Preference

func (*Preference) IsValid

func (o *Preference) IsValid() *AppError

func (*Preference) PreUpdate added in v3.3.0

func (o *Preference) PreUpdate()

func (*Preference) ToJson

func (o *Preference) ToJson() string

type Preferences

type Preferences []Preference

func PreferencesFromJson

func PreferencesFromJson(data io.Reader) (Preferences, error)

func (*Preferences) ToJson

func (o *Preferences) ToJson() string

type PrivacySettings

type PrivacySettings struct {
	ShowEmailAddress bool
	ShowFullName     bool
}

type PushNotification

type PushNotification struct {
	Platform         string `json:"platform"`
	ServerId         string `json:"server_id"`
	DeviceId         string `json:"device_id"`
	Category         string `json:"category"`
	Sound            string `json:"sound"`
	Message          string `json:"message"`
	Badge            int    `json:"badge"`
	ContentAvailable int    `json:"cont_ava"`
	ChannelId        string `json:"channel_id"`
	ChannelName      string `json:"channel_name"`
}

func PushNotificationFromJson

func PushNotificationFromJson(data io.Reader) *PushNotification

func (*PushNotification) ToJson

func (me *PushNotification) ToJson() string

type RateLimitSettings

type RateLimitSettings struct {
	EnableRateLimiter bool
	PerSec            int
	MemoryStoreSize   int
	VaryByRemoteAddr  bool
	VaryByHeader      string
}

type Result

type Result struct {
	RequestId string
	Etag      string
	Data      interface{}
}

type SSOSettings

type SSOSettings struct {
	Enable          bool
	Secret          string
	Id              string
	Scope           string
	AuthEndpoint    string
	TokenEndpoint   string
	UserApiEndpoint string
}

type SamlAuthRequest added in v3.2.0

type SamlAuthRequest struct {
	Base64AuthRequest string
	URL               string
	RelayState        string
}

type SamlSettings added in v3.2.0

type SamlSettings struct {
	// Basic
	Enable  *bool
	Verify  *bool
	Encrypt *bool

	IdpUrl                      *string
	IdpDescriptorUrl            *string
	AssertionConsumerServiceURL *string

	IdpCertificateFile    *string
	PublicCertificateFile *string
	PrivateKeyFile        *string

	// User Mapping
	FirstNameAttribute *string
	LastNameAttribute  *string
	EmailAttribute     *string
	UsernameAttribute  *string
	NicknameAttribute  *string
	LocaleAttribute    *string

	LoginButtonText *string
}

type ScheduledTask added in v3.1.0

type ScheduledTask struct {
	Name      string        `json:"name"`
	Interval  time.Duration `json:"interval"`
	Recurring bool          `json:"recurring"`
	// contains filtered or unexported fields
}

func CreateRecurringTask added in v3.1.0

func CreateRecurringTask(name string, function TaskFunc, interval time.Duration) *ScheduledTask

func CreateTask added in v3.1.0

func CreateTask(name string, function TaskFunc, timeToExecution time.Duration) *ScheduledTask

func GetTaskByName added in v3.2.0

func GetTaskByName(name string) *ScheduledTask

func (*ScheduledTask) Cancel added in v3.1.0

func (task *ScheduledTask) Cancel()

func (*ScheduledTask) Execute added in v3.3.0

func (task *ScheduledTask) Execute()

Executes the task immediatly. A recurring task will be run regularally after interval.

func (*ScheduledTask) String added in v3.1.0

func (task *ScheduledTask) String() string

type SearchParams

type SearchParams struct {
	Terms      string
	IsHashtag  bool
	InChannels []string
	FromUsers  []string
	OrTerms    bool
}

func ParseSearchParams

func ParseSearchParams(text string) []*SearchParams

type SecurityBulletin

type SecurityBulletin struct {
	Id               string `json:"id"`
	AppliesToVersion string `json:"applies_to_version"`
}

func SecurityBulletinFromJson

func SecurityBulletinFromJson(data io.Reader) *SecurityBulletin

func (*SecurityBulletin) ToJson

func (me *SecurityBulletin) ToJson() string

type SecurityBulletins

type SecurityBulletins []SecurityBulletin

func SecurityBulletinsFromJson

func SecurityBulletinsFromJson(data io.Reader) SecurityBulletins

func (SecurityBulletins) ToJson

func (me SecurityBulletins) ToJson() string

type ServiceSettings

type ServiceSettings struct {
	SiteURL                           *string
	ListenAddress                     string
	MaximumLoginAttempts              int
	SegmentDeveloperKey               string
	GoogleDeveloperKey                string
	EnableOAuthServiceProvider        bool
	EnableIncomingWebhooks            bool
	EnableOutgoingWebhooks            bool
	EnableCommands                    *bool
	EnableOnlyAdminIntegrations       *bool
	EnablePostUsernameOverride        bool
	EnablePostIconOverride            bool
	EnableTesting                     bool
	EnableDeveloper                   *bool
	EnableSecurityFixAlert            *bool
	EnableInsecureOutgoingConnections *bool
	EnableMultifactorAuthentication   *bool
	AllowCorsFrom                     *string
	SessionLengthWebInDays            *int
	SessionLengthMobileInDays         *int
	SessionLengthSSOInDays            *int
	SessionCacheInMinutes             *int
	WebsocketSecurePort               *int
	WebsocketPort                     *int
	WebserverMode                     *string
	EnableCustomEmoji                 *bool
	RestrictCustomEmojiCreation       *string
}

type Session

type Session struct {
	Id             string        `json:"id"`
	Token          string        `json:"token"`
	CreateAt       int64         `json:"create_at"`
	ExpiresAt      int64         `json:"expires_at"`
	LastActivityAt int64         `json:"last_activity_at"`
	UserId         string        `json:"user_id"`
	DeviceId       string        `json:"device_id"`
	Roles          string        `json:"roles"`
	IsOAuth        bool          `json:"is_oauth"`
	Props          StringMap     `json:"props"`
	TeamMembers    []*TeamMember `json:"team_members" db:"-"`
}

func SessionFromJson

func SessionFromJson(data io.Reader) *Session

func SessionsFromJson

func SessionsFromJson(data io.Reader) []*Session

func (*Session) AddProp

func (me *Session) AddProp(key string, value string)

func (*Session) GetTeamByTeamId

func (me *Session) GetTeamByTeamId(teamId string) *TeamMember

func (*Session) IsExpired

func (me *Session) IsExpired() bool

func (*Session) PreSave

func (me *Session) PreSave()

func (*Session) Sanitize

func (me *Session) Sanitize()

func (*Session) SetExpireInDays

func (me *Session) SetExpireInDays(days int)

func (*Session) ToJson

func (me *Session) ToJson() string

type SqlSettings

type SqlSettings struct {
	DriverName         string
	DataSource         string
	DataSourceReplicas []string
	MaxIdleConns       int
	MaxOpenConns       int
	Trace              bool
	AtRestEncryptKey   string
}

type Status added in v3.3.0

type Status struct {
	UserId         string `json:"user_id"`
	Status         string `json:"status"`
	LastActivityAt int64  `json:"last_activity_at"`
}

func StatusFromJson added in v3.3.0

func StatusFromJson(data io.Reader) *Status

func (*Status) ToJson added in v3.3.0

func (o *Status) ToJson() string

type StringArray

type StringArray []string

type StringInterface

type StringInterface map[string]interface{}

type StringMap

type StringMap map[string]string

func GetDefaultChannelNotifyProps

func GetDefaultChannelNotifyProps() StringMap

type SuggestCommand

type SuggestCommand struct {
	Suggestion  string `json:"suggestion"`
	Description string `json:"description"`
}

func SuggestCommandFromJson

func SuggestCommandFromJson(data io.Reader) *SuggestCommand

func (*SuggestCommand) ToJson

func (o *SuggestCommand) ToJson() string

type SupportSettings

type SupportSettings struct {
	TermsOfServiceLink *string
	PrivacyPolicyLink  *string
	AboutLink          *string
	HelpLink           *string
	ReportAProblemLink *string
	SupportEmail       *string
}

type System

type System struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func SystemFromJson

func SystemFromJson(data io.Reader) *System

func (*System) ToJson

func (o *System) ToJson() string

type TaskFunc added in v3.1.0

type TaskFunc func()

type Team

type Team struct {
	Id              string `json:"id"`
	CreateAt        int64  `json:"create_at"`
	UpdateAt        int64  `json:"update_at"`
	DeleteAt        int64  `json:"delete_at"`
	DisplayName     string `json:"display_name"`
	Name            string `json:"name"`
	Email           string `json:"email"`
	Type            string `json:"type"`
	CompanyName     string `json:"company_name"`
	AllowedDomains  string `json:"allowed_domains"`
	InviteId        string `json:"invite_id"`
	AllowOpenInvite bool   `json:"allow_open_invite"`
}

func TeamFromJson

func TeamFromJson(data io.Reader) *Team

func (*Team) Etag

func (o *Team) Etag() string

func (*Team) IsValid

func (o *Team) IsValid(restrictTeamNames bool) *AppError

func (*Team) PreSave

func (o *Team) PreSave()

func (*Team) PreUpdate

func (o *Team) PreUpdate()

func (*Team) Sanitize

func (o *Team) Sanitize()

func (*Team) SanitizeForNotLoggedIn

func (o *Team) SanitizeForNotLoggedIn()

func (*Team) ToJson

func (o *Team) ToJson() string

type TeamMember

type TeamMember struct {
	TeamId   string `json:"team_id"`
	UserId   string `json:"user_id"`
	Roles    string `json:"roles"`
	DeleteAt int64  `json:"delete_at"`
}

func TeamMemberFromJson

func TeamMemberFromJson(data io.Reader) *TeamMember

func TeamMembersFromJson

func TeamMembersFromJson(data io.Reader) []*TeamMember

func (*TeamMember) IsTeamAdmin

func (o *TeamMember) IsTeamAdmin() bool

func (*TeamMember) IsValid

func (o *TeamMember) IsValid() *AppError

func (*TeamMember) ToJson

func (o *TeamMember) ToJson() string

type TeamSettings

type TeamSettings struct {
	SiteName                         string
	MaxUsersPerTeam                  int
	EnableTeamCreation               bool
	EnableUserCreation               bool
	EnableOpenServer                 *bool
	RestrictCreationToDomains        string
	RestrictTeamNames                *bool
	EnableCustomBrand                *bool
	CustomBrandText                  *string
	CustomDescriptionText            *string
	RestrictDirectMessage            *string
	RestrictTeamInvite               *string
	RestrictPublicChannelManagement  *string
	RestrictPrivateChannelManagement *string
	UserStatusAwayTimeout            *int64
}

type TeamSignup

type TeamSignup struct {
	Team    Team     `json:"team"`
	User    User     `json:"user"`
	Invites []string `json:"invites"`
	Data    string   `json:"data"`
	Hash    string   `json:"hash"`
}

func TeamSignupFromJson

func TeamSignupFromJson(data io.Reader) *TeamSignup

func (*TeamSignup) ToJson

func (o *TeamSignup) ToJson() string

type User

type User struct {
	Id                 string    `json:"id"`
	CreateAt           int64     `json:"create_at,omitempty"`
	UpdateAt           int64     `json:"update_at,omitempty"`
	DeleteAt           int64     `json:"delete_at"`
	Username           string    `json:"username"`
	Password           string    `json:"password,omitempty"`
	AuthData           *string   `json:"auth_data,omitempty"`
	AuthService        string    `json:"auth_service"`
	Email              string    `json:"email"`
	EmailVerified      bool      `json:"email_verified,omitempty"`
	Nickname           string    `json:"nickname"`
	FirstName          string    `json:"first_name"`
	LastName           string    `json:"last_name"`
	Roles              string    `json:"roles"`
	AllowMarketing     bool      `json:"allow_marketing,omitempty"`
	Props              StringMap `json:"props,omitempty"`
	NotifyProps        StringMap `json:"notify_props,omitempty"`
	LastPasswordUpdate int64     `json:"last_password_update,omitempty"`
	LastPictureUpdate  int64     `json:"last_picture_update,omitempty"`
	FailedAttempts     int       `json:"failed_attempts,omitempty"`
	Locale             string    `json:"locale"`
	MfaActive          bool      `json:"mfa_active,omitempty"`
	MfaSecret          string    `json:"mfa_secret,omitempty"`
}

func UserFromJson

func UserFromJson(data io.Reader) *User

UserFromJson will decode the input and return a User

func (*User) AddNotifyProp

func (u *User) AddNotifyProp(key string, value string)

func (*User) AddProp

func (u *User) AddProp(key string, value string)

func (*User) ClearNonProfileFields

func (u *User) ClearNonProfileFields()

func (*User) Etag

func (u *User) Etag(showFullName, showEmail bool) string

Generate a valid strong etag so the browser can cache the results

func (*User) GetDisplayName

func (u *User) GetDisplayName() string

func (*User) GetFullName

func (u *User) GetFullName() string

func (*User) IsInRole

func (u *User) IsInRole(inRole string) bool

Make sure you acually want to use this function. In context.go there are functions to check permissions This function should not be used to check permissions.

func (*User) IsLDAPUser

func (u *User) IsLDAPUser() bool

func (*User) IsOAuthUser

func (u *User) IsOAuthUser() bool

func (*User) IsValid

func (u *User) IsValid() *AppError

IsValid validates the user and returns an error if it isn't configured correctly.

func (*User) MakeNonNil

func (u *User) MakeNonNil()

func (*User) PreSave

func (u *User) PreSave()

PreSave will set the Id and Username if missing. It will also fill in the CreateAt, UpdateAt times. It will also hash the password. It should be run before saving the user to the db.

func (*User) PreUpdate

func (u *User) PreUpdate()

PreUpdate should be run before updating the user in the db.

func (*User) Sanitize

func (u *User) Sanitize(options map[string]bool)

Remove any private data from the user object

func (*User) SetDefaultNotifications

func (u *User) SetDefaultNotifications()

func (*User) ToJson

func (u *User) ToJson() string

ToJson convert a User to a json string

func (*User) UpdateMentionKeysFromUsername

func (user *User) UpdateMentionKeysFromUsername(oldUsername string)

type WebSocketClient added in v3.3.0

type WebSocketClient struct {
	Url             string          // The location of the server like "ws://localhost:8065"
	ApiUrl          string          // The api location of the server like "ws://localhost:8065/api/v3"
	Conn            *websocket.Conn // The WebSocket connection
	AuthToken       string          // The token used to open the WebSocket
	Sequence        int64           // The ever-incrementing sequence attached to each WebSocket action
	EventChannel    chan *WebSocketEvent
	ResponseChannel chan *WebSocketResponse
}

func (*WebSocketClient) Close added in v3.3.0

func (wsc *WebSocketClient) Close()

func (*WebSocketClient) Connect added in v3.3.0

func (wsc *WebSocketClient) Connect() *AppError

func (*WebSocketClient) GetStatuses added in v3.3.0

func (wsc *WebSocketClient) GetStatuses()

GetStatuses will return a map of string statuses using user id as the key

func (*WebSocketClient) Listen added in v3.3.0

func (wsc *WebSocketClient) Listen()

func (*WebSocketClient) SendMessage added in v3.3.0

func (wsc *WebSocketClient) SendMessage(action string, data map[string]interface{})

func (*WebSocketClient) UserTyping added in v3.3.0

func (wsc *WebSocketClient) UserTyping(channelId, parentId string)

UserTyping will push a user_typing event out to all connected users who are in the specified channel

type WebSocketEvent added in v3.3.0

type WebSocketEvent struct {
	TeamId    string                 `json:"team_id"`
	ChannelId string                 `json:"channel_id"`
	UserId    string                 `json:"user_id"`
	Event     string                 `json:"event"`
	Data      map[string]interface{} `json:"data"`
}

func NewWebSocketEvent added in v3.3.0

func NewWebSocketEvent(teamId string, channelId string, userId string, event string) *WebSocketEvent

func WebSocketEventFromJson added in v3.3.0

func WebSocketEventFromJson(data io.Reader) *WebSocketEvent

func (*WebSocketEvent) Add added in v3.3.0

func (m *WebSocketEvent) Add(key string, value interface{})

func (*WebSocketEvent) IsValid added in v3.3.0

func (o *WebSocketEvent) IsValid() bool

func (*WebSocketEvent) ToJson added in v3.3.0

func (o *WebSocketEvent) ToJson() string

type WebSocketMessage added in v3.3.0

type WebSocketMessage interface {
	ToJson() string
	IsValid() bool
}

type WebSocketRequest added in v3.3.0

type WebSocketRequest struct {
	// Client-provided fields
	Seq    int64                  `json:"seq"`
	Action string                 `json:"action"`
	Data   map[string]interface{} `json:"data"`

	// Server-provided fields
	Session Session              `json:"-"`
	T       goi18n.TranslateFunc `json:"-"`
	Locale  string               `json:"-"`
}

func WebSocketRequestFromJson added in v3.3.0

func WebSocketRequestFromJson(data io.Reader) *WebSocketRequest

func (*WebSocketRequest) ToJson added in v3.3.0

func (o *WebSocketRequest) ToJson() string

type WebSocketResponse added in v3.3.0

type WebSocketResponse struct {
	Status   string                 `json:"status"`
	SeqReply int64                  `json:"seq_reply,omitempty"`
	Data     map[string]interface{} `json:"data,omitempty"`
	Error    *AppError              `json:"error,omitempty"`
}

func NewWebSocketError added in v3.3.0

func NewWebSocketError(seqReply int64, err *AppError) *WebSocketResponse

func NewWebSocketResponse added in v3.3.0

func NewWebSocketResponse(status string, seqReply int64, data map[string]interface{}) *WebSocketResponse

func WebSocketResponseFromJson added in v3.3.0

func WebSocketResponseFromJson(data io.Reader) *WebSocketResponse

func (*WebSocketResponse) Add added in v3.3.0

func (m *WebSocketResponse) Add(key string, value interface{})

func (*WebSocketResponse) IsValid added in v3.3.0

func (o *WebSocketResponse) IsValid() bool

func (*WebSocketResponse) ToJson added in v3.3.0

func (o *WebSocketResponse) ToJson() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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