Documentation ¶
Index ¶
- Variables
- type Conversation
- type ConversationType
- type Device
- type EmailAddress
- type Errors
- type Integration
- type Member
- type MemberRole
- type Message
- type Namespace
- type Organization
- type OwnerType
- type Privacy
- type RetentionMode
- type User
- func (u *User) AbbreviatedName() string
- func (u *User) AddEmailAddress(email string)
- func (u *User) FullName() string
- func (u *User) GetPrimaryEmail() string
- func (u *User) HasEmailAddress(email string) bool
- func (u *User) ListOfEmails() []string
- func (u *User) RemoveEmailAddress(email string)
- func (u *User) SetPassword(password string) error
- func (u *User) SetPrimaryEmail(email string)
- func (u *User) ValidatePassword(password string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrUserAlreadyExist = errors.New("User already exist") ErrUserNotExist = errors.New("User does not exist") ErrUserNotValid = errors.New("User is not valid") )
Errors
Functions ¶
This section is empty.
Types ¶
type Conversation ¶
type Conversation struct { ID bson.ObjectId `bson:"_id,omitempty"` CreatorID bson.ObjectId `bson:"creator_id"` Title string `bson:"title"` Purpose string `bson:"purpose"` Topic string `bson:"topic"` Namespace struct { ID bson.ObjectId `bson:"id"` Path string `bson:"path"` OwnerID bson.ObjectId `bson:"owner_id"` OwnerType OwnerType `bson:"owner_type"` } `bson:"namespace"` ConversationType ConversationType `bson:"conversation_type"` Privacy Privacy `bson:"privacy,ommitempty"` Avatar struct { FileSize int `bson:"file_size"` OriginalFilename string `bson:"original_filename"` ContenType string `bson:"content_type"` Md5 string `bson:"md5"` Sha256 string `bson:"sha256"` } Retention struct { Mode RetentionMode `bson:"mode"` Value int `bson:"value,omitempty"` } `bson:"retention,omitempty"` MessagesCount int `bson:"messages_count"` ParticipantsCount int `bson:"participants_count"` LastActiveAt time.Time `bson:"last_active_at"` Archived bool `bson:"archived"` ArchivedAt time.Time `bson:"archived_at"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` LastMessage struct { ContentHTML string ContentPlainText string From struct { UserID bson.ObjectId Name string } `bson:"from"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` } `bson:"last_message,omitempty"` Errors Errors `bson:"-"` }
Conversation represents a conversation within a namespace. Conversastions can be 1-on-1, group, or channel.
func NewConversation ¶
func NewConversation() *Conversation
NewConversation creates a new instance of a Conversation
func (*Conversation) IsArchived ¶
func (c *Conversation) IsArchived() bool
IsArchived is a helper method that returns if the conversation has been archived
type ConversationType ¶
type ConversationType int
ConversationType represents the one of the 3 modes of conversation supported: private (aka 1-on-1s), group, and channels (aka. Rooms)
const ( ConversationTypePrivate ConversationType = iota ConversationTypeGroup ConversationTypeChannel )
Conversation Types
func (ConversationType) MarshalJSON ¶
func (r ConversationType) MarshalJSON() ([]byte, error)
MarshalJSON is generated so ConversationType satisfies json.Marshaler.
func (ConversationType) String ¶
func (t ConversationType) String() string
func (*ConversationType) UnmarshalJSON ¶
func (r *ConversationType) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so ConversationType satisfies json.Unmarshaler.
type EmailAddress ¶
type EmailAddress struct { Email string `json:"email" bson:"email"` IsConfirmed bool `json:"confirmed" bson:"confirmed"` ConfirmedAt time.Time `json:"confirmed_at" bson:"confirmed_at"` DeletedAt time.Time `json:"deleted_at" bson:"deleted_at"` }
EmailAddress is the list of all email addresses of a user. Can contain the primary email address, but is not obligatory
type Errors ¶
func (*Errors) HasMessages ¶
type Integration ¶
type Member ¶
type Member struct { ID bson.ObjectId `bson:"_id,omitempty"` UserID bson.ObjectId `bson:"user_id"` OrganizationID bson.ObjectId `bson:"org_id"` State string `bson:"state"` Published bool `bson:"published"` Role MemberRole `bson:"role"` InvitedBy bson.ObjectId `bson:"invited_by,omitempty"` InviteEmail string `bson:"invite_email,omitempty"` InviteToken string `bson:"invite_token,omitempty"` InviteSentAt time.Time `bson:"invite_sent_at,omitempty"` InviteAcceptedAt time.Time `bson:"invite_accepted_at,omitempty"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` Errors Errors `json:"-" bson:"-"` }
Member represents an organization membership for a user
func (*Member) IsPublished ¶
IsPublished returns if the organization membership visibility is public
type MemberRole ¶
type MemberRole int
MemberRole describes the Membership role
const ( MemberRoleOwner MemberRole = iota MemberRoleMember MemberRoleGuest )
Member roles
func (MemberRole) String ¶
func (m MemberRole) String() string
type Message ¶
type Message struct { Id bson.ObjectId `bson:"_id,omitempty"` ContentHTML string ContentPlainText string From struct { UserID bson.ObjectId Name string } `bson:"from"` CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` Errors Errors `bson:"-"` }
type Namespace ¶
type Namespace struct { Errors Errors `bson:"-"` ID bson.ObjectId `bson:"_id"` Path string `bson:"path"` OwnerID bson.ObjectId `bson:"owner_id,omitempty"` OwnerType OwnerType `bson:"owner_type"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` }
Namespace represents the slug path for a User or Organization
func (*Namespace) BelongsToOrganization ¶
BelongsToOrganization returns true if the naemspace owner is an organization
func (*Namespace) BelongsToUser ¶
BelongsToUser returns true if the naemspace owner is a user
type Organization ¶
type Organization struct { ID bson.ObjectId `bson:"_id"` Namespace struct { ID bson.ObjectId `bson:"id"` Path string `bson:"path"` OwnerType OwnerType `bson:"owner_type"` } `bson:"namespace"` Name string `bson:"name"` Description string `bson:"description"` URL string `bson:"url"` Location string `bson:"location"` Email string `bson:"email"` BillingEmail string `bson:"billing_email"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` Errors Errors `bson:"-"` }
Organization represents the an organization, team, group or company in the system
type OwnerType ¶
type OwnerType int
OwnerType represents the type of namespace owner
func (OwnerType) MarshalJSON ¶
MarshalJSON turns a OwnerType into a json.Marshaller.
type Privacy ¶
type Privacy int
Privacy represents the type of privacy and security a conversation has
const ( PrivacyPersonal Privacy = iota PrivacyPublic PrivacyPrivate PrivacyProtected PrivacySecret )
Privacy modes
func (Privacy) MarshalJSON ¶
MarshalJSON is generated so Privacy satisfies json.Marshaler.
func (*Privacy) UnmarshalJSON ¶
UnmarshalJSON is generated so Privacy satisfies json.Unmarshaler.
type RetentionMode ¶
type RetentionMode int
RetentionMode describes the type of rentention policy for messages in a conversation
const ( RetentionModeAll RetentionMode = iota RetentionModeNone RetentionModeAge RetentionModeDays )
Retention modes
func (RetentionMode) MarshalJSON ¶
func (r RetentionMode) MarshalJSON() ([]byte, error)
MarshalJSON is generated so RetentionMode satisfies json.Marshaler.
func (RetentionMode) String ¶
func (m RetentionMode) String() string
func (*RetentionMode) UnmarshalJSON ¶
func (r *RetentionMode) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so RetentionMode satisfies json.Unmarshaler.
type User ¶
type User struct { ID bson.ObjectId `json:"id" bson:"_id,omitempty"` Namespace struct { ID bson.ObjectId `bson:"id"` Path string `bson:"path"` OwnerType OwnerType `bson:"owner_type"` } `bson:"namespace"` Username string `json:"username" bson:"username"` GivenName string `json:"given_name,omitempty" bson:"given_name,omitempty"` FamilyName string `json:"family_name,omitempty" bson:"family_name,omitempty"` HashedPassword string `json:"-" bson:"hashed_password"` Emails []EmailAddress `json:"emails" bson:"emails"` CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` Errors Errors `json:"-" bson:"-"` // contains filtered or unexported fields }
User represents the object of individual and member of organization.
func (*User) AbbreviatedName ¶
AbbreviatedName returns the abbreviated name for the user
func (*User) AddEmailAddress ¶
AddEmailAddress adds a new email address to the user's account
func (*User) GetPrimaryEmail ¶
GetPrimaryEmail returns the user's primary email address
func (*User) HasEmailAddress ¶
HasEmailAddress returns true if the user has the provided email address registered already
func (*User) ListOfEmails ¶
ListOfEmails returns the list of email address that the user have registered in the system
func (*User) RemoveEmailAddress ¶
RemoveEmailAddress removes the email address from the user's account
func (*User) SetPassword ¶
SetPassword updates the password for the user
func (*User) SetPrimaryEmail ¶
SetPrimaryEmail sets the provided email address as the primary email for the account