Documentation
¶
Index ¶
Constants ¶
View Source
const MaxMessageLen = 2048
MaxMessageLen is the maximum number of bytes per message.
View Source
const MaxMessagesQuery = 100
MaxMessagesQuery is the maximum number of messages per GET query.
View Source
const MaxRoomNameLen = 64
View Source
const MinAccounts = 1
View Source
const RoomsPerUser = 3
RoomsPerUser is the maximum number of rooms a user can make. This may change in the future.
View Source
const SessionTimeout = 7 * 24 * time.Hour
Variables ¶
View Source
var ( ErrNotInRoom = httperr.New(401, "you're not in this room") ErrRoomNotFound = httperr.New(404, "room not found") ErrIllegalRoomName = httperr.New(400, "room name contains invalid characters") )
View Source
var ErrMessageLimitInvalid = httperr.New(400, "message 0 < limit < 100 invalid")
View Source
var ErrNoAccountsLinked = httperr.New(400, "no accounts linked")
View Source
var ErrNotMutual = httperr.New(401, "not mutual friends")
View Source
var ErrUnknownSession = httperr.New(401, "unknown session")
View Source
var ErrUserNotFound = httperr.New(404, "user not found")
Functions ¶
func ValidateRoomName ¶
ValidateRoomName returns nil if the room name is valid.
Types ¶
type Message ¶
type Message struct { ID ID `json:"id,string" db:"id"` Type MessageType `json:"type" db:"type"` RoomID ID `json:"room_id,string" db:"room_id"` AuthorID ID `json:"author_id,string" db:"author_id"` Markdown string `json:"markdown" db:"markdown"` }
type MessageType ¶
type MessageType int8
const ( NormalMessage MessageType = iota JoinMessage LeaveMessage DeletedMessage // soft delete )
type PrivateRoom ¶
type Relationship ¶
type Relationship struct { TargetID ID `json:"target_id,string" db:"target_id"` Type RelationshipType `json:"type" db:"type"` }
type RelationshipType ¶
type RelationshipType uint8
const ( Stranger RelationshipType = iota Blocked Friend )
type Room ¶
type Room struct { ID ID `json:"id,string" db:"id"` Name string `json:"name" db:"name"` Topic string `json:"topic" db:"topic"` Level SecretLevel `json:"level" db:"level"` }
type SecretLevel ¶
type SecretLevel int8
const ( // Anonymous means that no username, avatar nor any personal information is // exposed. This is the equivalent of anonymous image boards. Anonymous SecretLevel = iota // HalfOpen exposes the username and avatar. HalfOpen // FullyOpen exposes all information, including social media accounts. FullyOpen // Private is reserved for private rooms. It is the same as FullyOpen. Private )
Click to show internal directories.
Click to hide internal directories.