Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data UserInfo = UserInfo {
- _uiName :: Text
- _uiId :: UserId
- _uiStatus :: UserStatus
- _uiInTeam :: Bool
- _uiNickName :: Maybe Text
- _uiFirstName :: Text
- _uiLastName :: Text
- _uiEmail :: Text
- _uiDeleted :: Bool
- data UserStatus
- type Users = AllMyUsers UserInfo
- uiName :: Lens' UserInfo Text
- uiId :: Lens' UserInfo UserId
- uiStatus :: Lens' UserInfo UserStatus
- uiInTeam :: Lens' UserInfo Bool
- uiNickName :: Lens' UserInfo (Maybe Text)
- uiFirstName :: Lens' UserInfo Text
- uiLastName :: Lens' UserInfo Text
- uiEmail :: Lens' UserInfo Text
- uiDeleted :: Lens' UserInfo Bool
- userInfoFromUser :: User -> Bool -> UserInfo
- getUsernameSet :: Users -> Set Text
- trimUserSigil :: Text -> Text
- addUserSigil :: Text -> Text
- statusFromText :: Text -> UserStatus
- findUserById :: UserId -> Users -> Maybe UserInfo
- findUserByUsername :: Text -> Users -> Maybe (UserId, UserInfo)
- findUserByNickname :: Text -> Users -> Maybe (UserId, UserInfo)
- noUsers :: Users
- addUser :: UserInfo -> Users -> Users
- allUsers :: Users -> [UserInfo]
- modifyUserById :: UserId -> (UserInfo -> UserInfo) -> Users -> Users
- userDeleted :: User -> Bool
- type TypingUsers = AllMyUsers (Max UTCTime)
- noTypingUsers :: TypingUsers
- addTypingUser :: UserId -> UTCTime -> TypingUsers -> TypingUsers
- allTypingUsers :: TypingUsers -> [UserId]
- expireTypingUsers :: UTCTime -> TypingUsers -> TypingUsers
- getAllUserIds :: Users -> [UserId]
Documentation
A UserInfo
value represents everything we need to know at
runtime about a user
UserInfo | |
|
data UserStatus Source #
The UserStatus
value represents possible current status for
a user
Instances
Show UserStatus Source # | |
Defined in Matterhorn.Types.Users showsPrec :: Int -> UserStatus -> ShowS # show :: UserStatus -> String # showList :: [UserStatus] -> ShowS # | |
Eq UserStatus Source # | |
Defined in Matterhorn.Types.Users (==) :: UserStatus -> UserStatus -> Bool # (/=) :: UserStatus -> UserStatus -> Bool # |
type Users = AllMyUsers UserInfo Source #
Define the exported typename which universally binds the collection to the UserInfo type.
Lenses created for accessing UserInfo fields
Various operations on UserInfo
Creating UserInfo objects
Miscellaneous
trimUserSigil :: Text -> Text Source #
addUserSigil :: Text -> Text Source #
statusFromText :: Text -> UserStatus Source #
findUserByUsername :: Text -> Users -> Maybe (UserId, UserInfo) Source #
Get the User information given the user's name. This is an exact match on the username field. It will automatically trim a user sigil from the input.
findUserByNickname :: Text -> Users -> Maybe (UserId, UserInfo) Source #
Get the User information given the user's name. This is an exact match on the nickname field, not necessarily the presented name. It will automatically trim a user sigil from the input.
modifyUserById :: UserId -> (UserInfo -> UserInfo) -> Users -> Users Source #
Extract a specific user from the collection and perform an endomorphism operation on it, then put it back into the collection.
userDeleted :: User -> Bool Source #
Is this user deleted?
type TypingUsers = AllMyUsers (Max UTCTime) Source #
Define the exported typename to represent the collection of users | who are currently typing. The values kept against the user id keys are the | latest timestamps of typing events from the server.
noTypingUsers :: TypingUsers Source #
Initial collection of TypingUsers with no members
addTypingUser :: UserId -> UTCTime -> TypingUsers -> TypingUsers Source #
Add a member to the existing collection of TypingUsers
allTypingUsers :: TypingUsers -> [UserId] Source #
Get a list of all typing users
expireTypingUsers :: UTCTime -> TypingUsers -> TypingUsers Source #
Remove all the expired users from the collection of TypingUsers. | Expiry is decided by the given timestamp.
getAllUserIds :: Users -> [UserId] Source #