model

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2015 License: AGPL-3.0, Apache-2.0 Imports: 19 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"
)
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_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_MM_SESSION_TOKEN_INDEX = "X-MM-TokenIndex"
	SESSION_TOKEN_INDEX           = "session_token_index"
	API_URL_SUFFIX                = "/api/v1"
)
View Source
const (
	RESP_EXECUTED        = "executed"
	RESP_NOT_IMPLEMENTED = "not implemented"
)
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"

	SERVICE_GITLAB = "gitlab"
)
View Source
const (
	DEFAULT_WEBHOOK_USERNAME = "webhook"
	DEFAULT_WEBHOOK_ICON     = "/static/images/webhook_icon.jpg"
)
View Source
const (
	ACTION_TYPING         = "typing"
	ACTION_POSTED         = "posted"
	ACTION_POST_EDITED    = "post_edited"
	ACTION_POST_DELETED   = "post_deleted"
	ACTION_CHANNEL_VIEWED = "channel_viewed"
	ACTION_NEW_USER       = "new_user"
	ACTION_USER_ADDED     = "user_added"
	ACTION_USER_REMOVED   = "user_removed"
)
View Source
const (
	POST_SYSTEM_MESSAGE_PREFIX = "system_"
	POST_DEFAULT               = ""
	POST_SLACK_ATTACHMENT      = "slack_attachment"
	POST_JOIN_LEAVE            = "system_join_leave"
	POST_HEADER_CHANGE         = "system_header_change"
)
View Source
const (
	PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW = "direct_channel_show"
	PREFERENCE_CATEGORY_TUTORIAL_STEPS      = "tutorial_step"
	PREFERENCE_CATEGORY_ADVANCED_SETTINGS   = "advanced_settings"
)
View Source
const (
	PUSH_NOTIFY_APPLE   = "apple"
	PUSH_NOTIFY_ANDROID = "android"
)
View Source
const (
	SESSION_COOKIE_TOKEN        = "MMTOKEN"
	SESSION_TIME_WEB_IN_DAYS    = 30
	SESSION_TIME_WEB_IN_SECS    = 60 * 60 * 24 * SESSION_TIME_WEB_IN_DAYS
	SESSION_TIME_MOBILE_IN_DAYS = 30
	SESSION_TIME_MOBILE_IN_SECS = 60 * 60 * 24 * SESSION_TIME_MOBILE_IN_DAYS
	SESSION_TIME_OAUTH_IN_DAYS  = 365
	SESSION_TIME_OAUTH_IN_SECS  = 60 * 60 * 24 * SESSION_TIME_OAUTH_IN_DAYS
	SESSION_CACHE_IN_SECS       = 60 * 10
	SESSION_CACHE_SIZE          = 10000
	SESSION_PROP_PLATFORM       = "platform"
	SESSION_PROP_OS             = "os"
	SESSION_PROP_BROWSER        = "browser"
)
View Source
const (
	SYSTEM_DIAGNOSTIC_ID      = "DiagnosticId"
	SYSTEM_RAN_UNIT_TESTS     = "RanUnitTests"
	SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
)
View Source
const (
	TEAM_OPEN   = "O"
	TEAM_INVITE = "I"
)
View Source
const (
	ROLE_TEAM_ADMIN      = "admin"
	ROLE_SYSTEM_ADMIN    = "system_admin"
	USER_AWAY_TIMEOUT    = 5 * 60 * 1000 // 5 minutes
	USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
	USER_OFFLINE         = "offline"
	USER_AWAY            = "away"
	USER_ONLINE          = "online"
	USER_NOTIFY_ALL      = "all"
	USER_NOTIFY_MENTION  = "mention"
	USER_NOTIFY_NONE     = "none"
)
View Source
const (
	MAX_FILE_SIZE = 50000000 // 50 MB
)
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 = "_BUILD_DATE_"
View Source
var BuildHash = "_BUILD_HASH_"
View Source
var BuildNumber = "_BUILD_NUMBER_"
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 ComparePassword

func ComparePassword(hash string, password string) bool

ComparePassword compares the hash

func Etag

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

func GetDMNameFromIds

func GetDMNameFromIds(userId1, userId2 string) string

func GetImageMimeType

func GetImageMimeType(ext string) string

func GetMillis

func GetMillis() int64

GetMillis is a convience method to get milliseconds since epoch.

func GetPreviousVersion

func GetPreviousVersion(currentVersion string) (int64, int64)

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 added in v1.1.0

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 permssions This function should not be used to check permissions.

func IsLower

func IsLower(s string) bool

func IsOfficalBuild added in v1.1.0

func IsOfficalBuild() bool

func IsPreviousVersion

func IsPreviousVersion(versionToCheck string) bool

func IsReservedTeamName

func IsReservedTeamName(s 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 added in v1.2.1

func IsValidHttpUrl(rawUrl string) bool

func IsValidRoles

func IsValidRoles(userRoles string) bool

func IsValidTeamName

func IsValidTeamName(s 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 OAuthAppMapFromJson

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

func OAuthAppMapToJson

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

func OutgoingWebhookListToJson added in v1.2.1

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 StringInterfaceFromJson added in v1.2.1

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

func StringInterfaceToJson added in v1.2.1

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

func TeamMapFromJson

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

func TeamMapToJson

func TeamMapToJson(u map[string]*Team) 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 {
	AuthCode     string `json:"auth_code"`
	Token        string `json:"token"`
	RefreshToken string `json:"refresh_token"`
	RedirectUri  string `json:"redirect_uri"`
}

func AccessDataFromJson

func AccessDataFromJson(data io.Reader) *AccessData

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 added in v1.2.1

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

func AnalyticsRowFromJson added in v1.2.1

func AnalyticsRowFromJson(data io.Reader) *AnalyticsRow

func (*AnalyticsRow) ToJson added in v1.2.1

func (me *AnalyticsRow) ToJson() string

type AnalyticsRows added in v1.2.1

type AnalyticsRows []*AnalyticsRow

func AnalyticsRowsFromJson added in v1.2.1

func AnalyticsRowsFromJson(data io.Reader) AnalyticsRows

func (AnalyticsRows) ToJson added in v1.2.1

func (me AnalyticsRows) ToJson() string

type AppError

type AppError struct {
	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"`     // The RequestId that's also set in the header
	StatusCode    int    `json:"status_code"`    // The http status code
	Where         string `json:"-"`              // The function where it happened in the form of Struct.Func
	IsOAuth       bool   `json:"is_oauth"`       // Whether the error is OAuth specific
}

AppError is returned for any http response that's not in the 200 range.

func AppErrorFromJson

func AppErrorFromJson(data io.Reader) *AppError

AppErrorFromJson will decode the input and return an AppError

func NewAppError

func NewAppError(where string, message string, details string) *AppError

func (*AppError) Error

func (er *AppError) Error() string

func (*AppError) ToJson

func (er *AppError) ToJson() string

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() string

func (*Channel) ExtraUpdated

func (o *Channel) ExtraUpdated()

func (*Channel) IsValid

func (o *Channel) IsValid() *AppError

func (*Channel) PreExport

func (o *Channel) PreExport()

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 added in v1.1.0

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/v1"
	HttpClient *http.Client // The http client
	AuthToken  string
	AuthType   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) AllowOAuth

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

func (*Client) ClearOAuthToken

func (c *Client) ClearOAuthToken()

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) CreateDirectChannel

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

func (*Client) CreateIncomingWebhook

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

func (*Client) CreateOutgoingWebhook added in v1.2.1

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)

func (*Client) CreateTeamFromSignup

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

func (*Client) CreateUser

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

func (*Client) CreateUserFromSignup

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

func (*Client) DeleteChannel

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

func (*Client) DeleteIncomingWebhook

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

func (*Client) DeleteOutgoingWebhook added in v1.2.1

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

func (*Client) DeletePost

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

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) FindTeamByName

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

func (*Client) FindTeams

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

func (*Client) FindTeamsSendEmail

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

func (*Client) GetAccessToken

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

func (*Client) GetAllPreferences added in v1.2.1

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

func (*Client) GetAllTeams

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

func (*Client) GetAnalytics added in v1.2.1

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

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, etag string) (*Result, *AppError)

func (*Client) GetChannels

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

func (*Client) GetClientProperties

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

func (*Client) GetConfig

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

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) GetLogs

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

func (*Client) GetMe

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

func (*Client) GetMoreChannels

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

func (*Client) GetMyTeam

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

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 added in v1.2.1

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

func (*Client) GetPostsBefore added in v1.2.1

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 added in v1.2.1

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

func (*Client) GetPreferenceCategory added in v1.2.1

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

func (*Client) GetProfiles

func (c *Client) GetProfiles(teamId string, etag string) (*Result, *AppError)
func (c *Client) GetPublicLink(data map[string]string) (*Result, *AppError)

func (*Client) GetSessions

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

func (*Client) GetStatuses

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

func (*Client) GetUser

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

func (*Client) InviteMembers

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

func (*Client) JoinChannel

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

func (*Client) LeaveChannel

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

func (*Client) ListIncomingWebhooks

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

func (*Client) ListOutgoingWebhooks added in v1.2.1

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

func (*Client) LoginByEmail

func (c *Client) LoginByEmail(name string, email string, password string) (*Result, *AppError)

func (*Client) LoginByEmailWithDevice

func (c *Client) LoginByEmailWithDevice(name string, email string, password string, deviceId string) (*Result, *AppError)

func (*Client) LoginById

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

func (*Client) Logout

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

func (*Client) MockSession

func (c *Client) MockSession(sessionToken string)

func (*Client) Must

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

func (*Client) PostToWebhook

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

func (*Client) RegenOutgoingWebhookToken added in v1.2.1

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

func (*Client) RegisterApp

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

func (*Client) RemoveChannelMember

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

func (*Client) ResetPassword

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

func (*Client) RevokeSession

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

func (*Client) SaveConfig

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

func (*Client) SearchPosts

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

func (*Client) SendPasswordReset

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

func (*Client) SetOAuthToken

func (c *Client) SetOAuthToken(token string)

func (*Client) SetPreferences added in v1.2.1

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

func (*Client) SignupTeam

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

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 added in v1.2.1

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

func (*Client) UpdateChannelPurpose added in v1.2.1

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

func (*Client) UpdateLastViewedAt

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

func (*Client) UpdateNotifyProps added in v1.1.0

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

func (*Client) UpdatePost

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

func (*Client) UpdateTeam added in v1.2.1

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

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) UploadFile

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

type Command

type Command struct {
	Command      string            `json:"command"`
	Response     string            `json:"response"`
	GotoLocation string            `json:"goto_location"`
	ChannelId    string            `json:"channel_id"`
	Suggest      bool              `json:"-"`
	Suggestions  []*SuggestCommand `json:"suggestions"`
}

func CommandFromJson

func CommandFromJson(data io.Reader) *Command

func (*Command) AddSuggestion

func (o *Command) AddSuggestion(suggest *SuggestCommand)

func (*Command) ToJson

func (o *Command) ToJson() string

type Config

type Config struct {
	ServiceSettings   ServiceSettings
	TeamSettings      TeamSettings
	SqlSettings       SqlSettings
	LogSettings       LogSettings
	FileSettings      FileSettings
	EmailSettings     EmailSettings
	RateLimitSettings RateLimitSettings
	PrivacySettings   PrivacySettings
	GitLabSettings    SSOSettings
}

func ConfigFromJson

func ConfigFromJson(data io.Reader) *Config

func (*Config) GetSSOService

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

func (*Config) GetSanitizeOptions added in v1.3.0

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

func (*Config) IsValid added in v1.1.0

func (o *Config) IsValid() *AppError

func (*Config) SetDefaults added in v1.1.0

func (o *Config) SetDefaults()

func (*Config) ToJson

func (o *Config) ToJson() string

type EmailSettings

type EmailSettings struct {
	EnableSignUpWithEmail    bool
	SendEmailNotifications   bool
	RequireEmailVerification bool
	FeedbackName             string
	FeedbackEmail            string
	SMTPUsername             string
	SMTPPassword             string
	SMTPServer               string
	SMTPPort                 string
	ConnectionSecurity       string
	InviteSalt               string
	PasswordResetSalt        string
	SendPushNotifications    *bool
	PushNotificationServer   *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 FileSettings

type FileSettings struct {
	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
}

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 GitLabUser

type GitLabUser struct {
	Id       int64  `json:"id"`
	Username string `json:"username"`
	Login    string `json:"login"`
	Email    string `json:"email"`
	Name     string `json:"name"`
}

func GitLabUserFromJson

func GitLabUserFromJson(data io.Reader) *GitLabUser

func (*GitLabUser) GetAuthData

func (glu *GitLabUser) GetAuthData() 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"`
}

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 added in v1.2.1

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 added in v1.2.1

func IncomingWebhookRequestFromJson(data io.Reader) *IncomingWebhookRequest

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 LogSettings

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

type Message

type Message struct {
	TeamId    string            `json:"team_id"`
	ChannelId string            `json:"channel_id"`
	UserId    string            `json:"user_id"`
	Action    string            `json:"action"`
	Props     map[string]string `json:"props"`
}

func MessageFromJson

func MessageFromJson(data io.Reader) *Message

func NewMessage

func NewMessage(teamId string, channelId string, userId string, action string) *Message

func (*Message) Add

func (m *Message) Add(key string, value string)

func (*Message) ToJson

func (o *Message) ToJson() string

type OAuthApp

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

func OAuthAppFromJson

func OAuthAppFromJson(data io.Reader) *OAuthApp

OAuthAppFromJson will decode the input and return a User

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 added in v1.2.1

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"`
	CallbackURLs StringArray `json:"callback_urls"`
}

func OutgoingWebhookFromJson added in v1.2.1

func OutgoingWebhookFromJson(data io.Reader) *OutgoingWebhook

func OutgoingWebhookListFromJson added in v1.2.1

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

func (*OutgoingWebhook) HasTriggerWord added in v1.2.1

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

func (*OutgoingWebhook) IsValid added in v1.2.1

func (o *OutgoingWebhook) IsValid() *AppError

func (*OutgoingWebhook) PreSave added in v1.2.1

func (o *OutgoingWebhook) PreSave()

func (*OutgoingWebhook) PreUpdate added in v1.2.1

func (o *OutgoingWebhook) PreUpdate()

func (*OutgoingWebhook) ToJson added in v1.2.1

func (o *OutgoingWebhook) ToJson() string

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 added in v1.3.0

func (o *Post) IsSystemMessage() bool

func (*Post) IsValid

func (o *Post) IsValid() *AppError

func (*Post) MakeNonNil

func (o *Post) MakeNonNil()

func (*Post) PreExport

func (o *Post) PreExport()

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 added in v1.2.1

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 added in v1.2.1

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

func PreferenceFromJson added in v1.2.1

func PreferenceFromJson(data io.Reader) *Preference

func (*Preference) IsValid added in v1.2.1

func (o *Preference) IsValid() *AppError

func (*Preference) ToJson added in v1.2.1

func (o *Preference) ToJson() string

type Preferences added in v1.2.1

type Preferences []Preference

func PreferencesFromJson added in v1.2.1

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

func (*Preferences) ToJson added in v1.2.1

func (o *Preferences) ToJson() string

type PrivacySettings

type PrivacySettings struct {
	ShowEmailAddress bool
	ShowFullName     bool
}

type PushNotification added in v1.3.0

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"`
}

func PushNotificationFromJson added in v1.3.0

func PushNotificationFromJson(data io.Reader) *PushNotification

func (*PushNotification) ToJson added in v1.3.0

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 SearchParams added in v1.2.1

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

func ParseSearchParams added in v1.2.1

func ParseSearchParams(text string) []*SearchParams

type SecurityBulletin added in v1.1.0

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

func SecurityBulletinFromJson added in v1.1.0

func SecurityBulletinFromJson(data io.Reader) *SecurityBulletin

func (*SecurityBulletin) ToJson added in v1.1.0

func (me *SecurityBulletin) ToJson() string

type SecurityBulletins added in v1.1.0

type SecurityBulletins []SecurityBulletin

func SecurityBulletinsFromJson added in v1.1.0

func SecurityBulletinsFromJson(data io.Reader) SecurityBulletins

func (SecurityBulletins) ToJson added in v1.1.0

func (me SecurityBulletins) ToJson() string

type ServiceSettings

type ServiceSettings struct {
	ListenAddress              string
	MaximumLoginAttempts       int
	SegmentDeveloperKey        string
	GoogleDeveloperKey         string
	EnableOAuthServiceProvider bool
	EnableIncomingWebhooks     bool
	EnableOutgoingWebhooks     bool
	EnablePostUsernameOverride bool
	EnablePostIconOverride     bool
	EnableTesting              bool
	EnableSecurityFixAlert     *bool
}

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"`
	TeamId         string    `json:"team_id"`
	DeviceId       string    `json:"device_id"`
	Roles          string    `json:"roles"`
	IsOAuth        bool      `json:"is_oauth"`
	Props          StringMap `json:"props"`
}

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) 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 int64)

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 StringArray

type StringArray []string

type StringInterface added in v1.2.1

type StringInterface map[string]interface{}

type StringMap

type StringMap map[string]string

func GetDefaultChannelNotifyProps added in v1.1.0

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 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 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"`
	AllowTeamListing bool   `json:"allow_team_listing"`
}

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) PreExport

func (o *Team) PreExport()

func (*Team) PreSave

func (o *Team) PreSave()

func (*Team) PreUpdate

func (o *Team) PreUpdate()

func (*Team) Sanitize added in v1.2.1

func (o *Team) Sanitize()

func (*Team) ToJson

func (o *Team) ToJson() string

type TeamSettings

type TeamSettings struct {
	SiteName                  string
	MaxUsersPerTeam           int
	EnableTeamCreation        bool
	EnableUserCreation        bool
	RestrictCreationToDomains string
	RestrictTeamNames         *bool
	EnableTeamListing         *bool
}

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"`
	TeamId             string    `json:"team_id"`
	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"`
	LastActivityAt     int64     `json:"last_activity_at,omitempty"`
	LastPingAt         int64     `json:"last_ping_at,omitempty"`
	AllowMarketing     bool      `json:"allow_marketing,omitempty"`
	Props              StringMap `json:"props,omitempty"`
	NotifyProps        StringMap `json:"notify_props,omitempty"`
	ThemeProps         StringMap `json:"theme_props,omitempty"`
	LastPasswordUpdate int64     `json:"last_password_update,omitempty"`
	LastPictureUpdate  int64     `json:"last_picture_update,omitempty"`
	FailedAttempts     int       `json:"failed_attempts,omitempty"`
}

func UserFromGitLabUser

func UserFromGitLabUser(glu *GitLabUser) *User

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 added in v1.3.0

func (u *User) ClearNonProfileFields()

func (*User) Etag

func (u *User) Etag() 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) IsAway

func (u *User) IsAway() bool

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 permssions This function should not be used to check permissions.

func (*User) IsOffline

func (u *User) IsOffline() bool

func (*User) IsSSOUser added in v1.2.1

func (u *User) IsSSOUser() 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) PreExport

func (u *User) PreExport()

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

Jump to

Keyboard shortcuts

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