{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Network.Mattermost.Types
( module Network.Mattermost.Types
, module Network.Mattermost.Types.Base
, ConnectionType(..)
, connectionDataURL
, ServerBaseURL(..)
)
where
import Control.Applicative
import Text.Printf ( PrintfArg(..), printf )
import Data.Hashable ( Hashable )
import qualified Data.Aeson as A
import Data.Aeson ( (.:), (.=), (.:?), (.!=) )
import Data.Aeson.Types ( ToJSONKey
, FromJSONKey
, FromJSON
, ToJSON
, Parser
, typeMismatch
)
import qualified Data.HashMap.Strict as HM
import Data.Maybe (fromMaybe)
import Data.Monoid ( (<>) )
import qualified Data.Pool as Pool
import Data.Ratio ( (%) )
import Data.Sequence (Seq)
import qualified Data.Sequence as S
import Data.Time (NominalDiffTime)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Time.Clock ( getCurrentTime )
import Data.Time.Clock.POSIX ( posixSecondsToUTCTime
, utcTimeToPOSIXSeconds )
import Network.Connection ( ConnectionContext
, initConnectionContext
)
import Network.Mattermost.Types.Base
import Network.Mattermost.Types.Internal
import Network.Mattermost.Util ( mkConnection )
newtype UserText = UserText Text
deriving (UserText -> UserText -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserText -> UserText -> Bool
$c/= :: UserText -> UserText -> Bool
== :: UserText -> UserText -> Bool
$c== :: UserText -> UserText -> Bool
Eq, Int -> UserText -> ShowS
[UserText] -> ShowS
UserText -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserText] -> ShowS
$cshowList :: [UserText] -> ShowS
show :: UserText -> String
$cshow :: UserText -> String
showsPrec :: Int -> UserText -> ShowS
$cshowsPrec :: Int -> UserText -> ShowS
Show, Eq UserText
UserText -> UserText -> Bool
UserText -> UserText -> Ordering
UserText -> UserText -> UserText
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: UserText -> UserText -> UserText
$cmin :: UserText -> UserText -> UserText
max :: UserText -> UserText -> UserText
$cmax :: UserText -> UserText -> UserText
>= :: UserText -> UserText -> Bool
$c>= :: UserText -> UserText -> Bool
> :: UserText -> UserText -> Bool
$c> :: UserText -> UserText -> Bool
<= :: UserText -> UserText -> Bool
$c<= :: UserText -> UserText -> Bool
< :: UserText -> UserText -> Bool
$c< :: UserText -> UserText -> Bool
compare :: UserText -> UserText -> Ordering
$ccompare :: UserText -> UserText -> Ordering
Ord, ReadPrec [UserText]
ReadPrec UserText
Int -> ReadS UserText
ReadS [UserText]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserText]
$creadListPrec :: ReadPrec [UserText]
readPrec :: ReadPrec UserText
$creadPrec :: ReadPrec UserText
readList :: ReadS [UserText]
$creadList :: ReadS [UserText]
readsPrec :: Int -> ReadS UserText
$creadsPrec :: Int -> ReadS UserText
Read)
instance A.ToJSON UserText where
toJSON :: UserText -> Value
toJSON (UserText Text
t) = forall a. ToJSON a => a -> Value
A.toJSON Text
t
instance A.FromJSON UserText where
parseJSON :: Value -> Parser UserText
parseJSON Value
v = Text -> UserText
UserText forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
v
unsafeUserText :: UserText -> Text
unsafeUserText :: UserText -> Text
unsafeUserText (UserText Text
t) = Text
t
runLogger :: ConnectionData -> String -> LogEventType -> IO ()
runLogger :: ConnectionData -> String -> LogEventType -> IO ()
runLogger ConnectionData { cdLogger :: ConnectionData -> Maybe Logger
cdLogger = Just Logger
l } String
n LogEventType
ev =
Logger
l (String -> LogEventType -> LogEvent
LogEvent String
n LogEventType
ev)
runLogger ConnectionData
_ String
_ LogEventType
_ = forall (m :: * -> *) a. Monad m => a -> m a
return ()
runLoggerS :: Session -> String -> LogEventType -> IO ()
runLoggerS :: Session -> String -> LogEventType -> IO ()
runLoggerS (Session ConnectionData
cd Token
_) = ConnectionData -> String -> LogEventType -> IO ()
runLogger ConnectionData
cd
maybeFail :: Parser a -> Parser (Maybe a)
maybeFail :: forall a. Parser a -> Parser (Maybe a)
maybeFail Parser a
p = (forall a. a -> Maybe a
Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser a
p) forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
Nothing)
mkConnectionData :: Hostname -> Port -> T.Text -> Pool.Pool MMConn -> ConnectionType -> ConnectionContext -> ConnectionData
mkConnectionData :: Text
-> Int
-> Text
-> Pool MMConn
-> ConnectionType
-> ConnectionContext
-> ConnectionData
mkConnectionData Text
host Int
port Text
path Pool MMConn
pool ConnectionType
connTy ConnectionContext
ctx = ConnectionData
{ cdHostname :: Text
cdHostname = Text
host
, cdPort :: Int
cdPort = Int
port
, cdUrlPath :: Text
cdUrlPath = Text
path
, cdConnectionCtx :: ConnectionContext
cdConnectionCtx = ConnectionContext
ctx
, cdAutoClose :: AutoClose
cdAutoClose = AutoClose
No
, cdConnectionPool :: Pool MMConn
cdConnectionPool = Pool MMConn
pool
, cdToken :: Maybe Token
cdToken = forall a. Maybe a
Nothing
, cdLogger :: Maybe Logger
cdLogger = forall a. Maybe a
Nothing
, cdConnectionType :: ConnectionType
cdConnectionType = ConnectionType
connTy
}
createPool :: Hostname -> Port -> ConnectionContext -> ConnectionPoolConfig -> ConnectionType -> IO (Pool.Pool MMConn)
createPool :: Text
-> Int
-> ConnectionContext
-> ConnectionPoolConfig
-> ConnectionType
-> IO (Pool MMConn)
createPool Text
host Int
port ConnectionContext
ctx ConnectionPoolConfig
cpc ConnectionType
connTy =
forall a.
IO a -> (a -> IO ()) -> Int -> POSIXTime -> Int -> IO (Pool a)
Pool.createPool (ConnectionContext -> Text -> Int -> ConnectionType -> IO Connection
mkConnection ConnectionContext
ctx Text
host Int
port ConnectionType
connTy forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Connection -> IO MMConn
newMMConn) MMConn -> IO ()
closeMMConn
(ConnectionPoolConfig -> Int
cpStripesCount ConnectionPoolConfig
cpc) (ConnectionPoolConfig -> POSIXTime
cpIdleConnTimeout ConnectionPoolConfig
cpc) (ConnectionPoolConfig -> Int
cpMaxConnCount ConnectionPoolConfig
cpc)
initConnectionData :: Hostname -> Port -> T.Text -> ConnectionType -> ConnectionPoolConfig -> IO ConnectionData
initConnectionData :: Text
-> Int
-> Text
-> ConnectionType
-> ConnectionPoolConfig
-> IO ConnectionData
initConnectionData Text
host Int
port Text
path ConnectionType
connTy ConnectionPoolConfig
cpc = do
ConnectionContext
ctx <- IO ConnectionContext
initConnectionContext
Pool MMConn
pool <- Text
-> Int
-> ConnectionContext
-> ConnectionPoolConfig
-> ConnectionType
-> IO (Pool MMConn)
createPool Text
host Int
port ConnectionContext
ctx ConnectionPoolConfig
cpc ConnectionType
connTy
forall (m :: * -> *) a. Monad m => a -> m a
return (Text
-> Int
-> Text
-> Pool MMConn
-> ConnectionType
-> ConnectionContext
-> ConnectionData
mkConnectionData Text
host Int
port Text
path Pool MMConn
pool ConnectionType
connTy ConnectionContext
ctx)
destroyConnectionData :: ConnectionData -> IO ()
destroyConnectionData :: ConnectionData -> IO ()
destroyConnectionData = forall a. Pool a -> IO ()
Pool.destroyAllResources forall b c a. (b -> c) -> (a -> b) -> a -> c
. ConnectionData -> Pool MMConn
cdConnectionPool
withLogger :: ConnectionData -> Logger -> ConnectionData
withLogger :: ConnectionData -> Logger -> ConnectionData
withLogger ConnectionData
cd Logger
logger = ConnectionData
cd { cdLogger :: Maybe Logger
cdLogger = forall a. a -> Maybe a
Just Logger
logger }
noLogger :: ConnectionData -> ConnectionData
noLogger :: ConnectionData -> ConnectionData
noLogger ConnectionData
cd = ConnectionData
cd { cdLogger :: Maybe Logger
cdLogger = forall a. Maybe a
Nothing }
data ConnectionPoolConfig = ConnectionPoolConfig
{ ConnectionPoolConfig -> Int
cpStripesCount :: Int
, ConnectionPoolConfig -> POSIXTime
cpIdleConnTimeout :: NominalDiffTime
, ConnectionPoolConfig -> Int
cpMaxConnCount :: Int
}
defaultConnectionPoolConfig :: ConnectionPoolConfig
defaultConnectionPoolConfig :: ConnectionPoolConfig
defaultConnectionPoolConfig = Int -> POSIXTime -> Int -> ConnectionPoolConfig
ConnectionPoolConfig Int
1 POSIXTime
30 Int
5
data Session = Session
{ Session -> ConnectionData
sessConn :: ConnectionData
, Session -> Token
sessTok :: Token
}
data Login
= Login
{ Login -> Text
username :: Text
, Login -> Maybe Text
otpToken :: Maybe Text
, Login -> Text
password :: Text
} deriving (Int -> Login -> ShowS
[Login] -> ShowS
Login -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Login] -> ShowS
$cshowList :: [Login] -> ShowS
show :: Login -> String
$cshow :: Login -> String
showsPrec :: Int -> Login -> ShowS
$cshowsPrec :: Int -> Login -> ShowS
Show)
instance A.ToJSON Login where
toJSON :: Login -> Value
toJSON Login
l = [Pair] -> Value
A.object [Key
"login_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Login -> Text
username Login
l
,Key
"token" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= (forall a. a -> Maybe a -> a
fromMaybe Text
"" forall a b. (a -> b) -> a -> b
$ Login -> Maybe Text
otpToken Login
l)
,Key
"password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Login -> Text
password Login
l
]
data =
{ :: ChannelId
, :: Text
} deriving (Int -> SetChannelHeader -> ShowS
[SetChannelHeader] -> ShowS
SetChannelHeader -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetChannelHeader] -> ShowS
$cshowList :: [SetChannelHeader] -> ShowS
show :: SetChannelHeader -> String
$cshow :: SetChannelHeader -> String
showsPrec :: Int -> SetChannelHeader -> ShowS
$cshowsPrec :: Int -> SetChannelHeader -> ShowS
Show)
instance A.ToJSON SetChannelHeader where
toJSON :: SetChannelHeader -> Value
toJSON (SetChannelHeader ChannelId
cId Text
p) =
[Pair] -> Value
A.object [Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ChannelId
cId
,Key
"channel_header" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
p
]
data SearchPosts = SearchPosts
{ SearchPosts -> Text
searchPostsTerms :: Text
, SearchPosts -> Bool
searchPostsIsOrSearch :: Bool
} deriving (Int -> SearchPosts -> ShowS
[SearchPosts] -> ShowS
SearchPosts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchPosts] -> ShowS
$cshowList :: [SearchPosts] -> ShowS
show :: SearchPosts -> String
$cshow :: SearchPosts -> String
showsPrec :: Int -> SearchPosts -> ShowS
$cshowsPrec :: Int -> SearchPosts -> ShowS
Show)
instance A.ToJSON SearchPosts where
toJSON :: SearchPosts -> Value
toJSON (SearchPosts Text
t Bool
os) =
[Pair] -> Value
A.object [Key
"terms" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
t
,Key
"is_or_search" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Bool
os
]
data Type = Ordinary
| Direct
| Private
| Group
| Unknown Text
deriving (ReadPrec [Type]
ReadPrec Type
Int -> ReadS Type
ReadS [Type]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Type]
$creadListPrec :: ReadPrec [Type]
readPrec :: ReadPrec Type
$creadPrec :: ReadPrec Type
readList :: ReadS [Type]
$creadList :: ReadS [Type]
readsPrec :: Int -> ReadS Type
$creadsPrec :: Int -> ReadS Type
Read, Int -> Type -> ShowS
[Type] -> ShowS
Type -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Type] -> ShowS
$cshowList :: [Type] -> ShowS
show :: Type -> String
$cshow :: Type -> String
showsPrec :: Int -> Type -> ShowS
$cshowsPrec :: Int -> Type -> ShowS
Show, Eq Type
Type -> Type -> Bool
Type -> Type -> Ordering
Type -> Type -> Type
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Type -> Type -> Type
$cmin :: Type -> Type -> Type
max :: Type -> Type -> Type
$cmax :: Type -> Type -> Type
>= :: Type -> Type -> Bool
$c>= :: Type -> Type -> Bool
> :: Type -> Type -> Bool
$c> :: Type -> Type -> Bool
<= :: Type -> Type -> Bool
$c<= :: Type -> Type -> Bool
< :: Type -> Type -> Bool
$c< :: Type -> Type -> Bool
compare :: Type -> Type -> Ordering
$ccompare :: Type -> Type -> Ordering
Ord, Type -> Type -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Type -> Type -> Bool
$c/= :: Type -> Type -> Bool
== :: Type -> Type -> Bool
$c== :: Type -> Type -> Bool
Eq)
instance A.FromJSON Type where
parseJSON :: Value -> Parser Type
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"Type" forall a b. (a -> b) -> a -> b
$ \Text
t ->
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ if | Text
t forall a. Eq a => a -> a -> Bool
== Text
"O" -> Type
Ordinary
| Text
t forall a. Eq a => a -> a -> Bool
== Text
"D" -> Type
Direct
| Text
t forall a. Eq a => a -> a -> Bool
== Text
"P" -> Type
Private
| Text
t forall a. Eq a => a -> a -> Bool
== Text
"G" -> Type
Group
| Bool
otherwise -> Text -> Type
Unknown Text
t
instance A.ToJSON Type where
toJSON :: Type -> Value
toJSON Type
Direct = forall a. ToJSON a => a -> Value
A.toJSON (Text
"D"::Text)
toJSON Type
Ordinary = forall a. ToJSON a => a -> Value
A.toJSON (Text
"O"::Text)
toJSON Type
Private = forall a. ToJSON a => a -> Value
A.toJSON (Text
"P"::Text)
toJSON Type
Group = forall a. ToJSON a => a -> Value
A.toJSON (Text
"G"::Text)
toJSON (Unknown Text
t) = forall a. ToJSON a => a -> Value
A.toJSON Text
t
class IsId x where
toId :: x -> Id
fromId :: Id -> x
class HasId x y | x -> y where
getId :: x -> y
newtype Id = Id { Id -> Text
unId :: Text }
deriving (ReadPrec [Id]
ReadPrec Id
Int -> ReadS Id
ReadS [Id]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Id]
$creadListPrec :: ReadPrec [Id]
readPrec :: ReadPrec Id
$creadPrec :: ReadPrec Id
readList :: ReadS [Id]
$creadList :: ReadS [Id]
readsPrec :: Int -> ReadS Id
$creadsPrec :: Int -> ReadS Id
Read, Int -> Id -> ShowS
[Id] -> ShowS
Id -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Id] -> ShowS
$cshowList :: [Id] -> ShowS
show :: Id -> String
$cshow :: Id -> String
showsPrec :: Int -> Id -> ShowS
$cshowsPrec :: Int -> Id -> ShowS
Show, Id -> Id -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Id -> Id -> Bool
$c/= :: Id -> Id -> Bool
== :: Id -> Id -> Bool
$c== :: Id -> Id -> Bool
Eq, Eq Id
Id -> Id -> Bool
Id -> Id -> Ordering
Id -> Id -> Id
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Id -> Id -> Id
$cmin :: Id -> Id -> Id
max :: Id -> Id -> Id
$cmax :: Id -> Id -> Id
>= :: Id -> Id -> Bool
$c>= :: Id -> Id -> Bool
> :: Id -> Id -> Bool
$c> :: Id -> Id -> Bool
<= :: Id -> Id -> Bool
$c<= :: Id -> Id -> Bool
< :: Id -> Id -> Bool
$c< :: Id -> Id -> Bool
compare :: Id -> Id -> Ordering
$ccompare :: Id -> Id -> Ordering
Ord, Eq Id
Int -> Id -> Int
Id -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Id -> Int
$chash :: Id -> Int
hashWithSalt :: Int -> Id -> Int
$chashWithSalt :: Int -> Id -> Int
Hashable, [Id] -> Encoding
[Id] -> Value
Id -> Encoding
Id -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Id] -> Encoding
$ctoEncodingList :: [Id] -> Encoding
toJSONList :: [Id] -> Value
$ctoJSONList :: [Id] -> Value
toEncoding :: Id -> Encoding
$ctoEncoding :: Id -> Encoding
toJSON :: Id -> Value
$ctoJSON :: Id -> Value
ToJSON, ToJSONKeyFunction [Id]
ToJSONKeyFunction Id
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [Id]
$ctoJSONKeyList :: ToJSONKeyFunction [Id]
toJSONKey :: ToJSONKeyFunction Id
$ctoJSONKey :: ToJSONKeyFunction Id
ToJSONKey, FromJSONKeyFunction [Id]
FromJSONKeyFunction Id
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [Id]
$cfromJSONKeyList :: FromJSONKeyFunction [Id]
fromJSONKey :: FromJSONKeyFunction Id
$cfromJSONKey :: FromJSONKeyFunction Id
FromJSONKey)
idString :: IsId x => x -> Text
idString :: forall x. IsId x => x -> Text
idString x
x = Id -> Text
unId Id
i
where i :: Id
i = forall x. IsId x => x -> Id
toId x
x
instance A.FromJSON Id where
parseJSON :: Value -> Parser Id
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"Id" forall a b. (a -> b) -> a -> b
$ \Text
t ->
case Text -> Bool
T.null Text
t of
Bool
False -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Text -> Id
Id Text
t
Bool
True -> forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Empty ID"
instance IsId Id where
toId :: Id -> Id
toId = forall a. a -> a
id
fromId :: Id -> Id
fromId = forall a. a -> a
id
instance HasId Id Id where
getId :: Id -> Id
getId = forall a. a -> a
id
newtype TeamId = TI { TeamId -> Id
unTI :: Id }
deriving (ReadPrec [TeamId]
ReadPrec TeamId
Int -> ReadS TeamId
ReadS [TeamId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TeamId]
$creadListPrec :: ReadPrec [TeamId]
readPrec :: ReadPrec TeamId
$creadPrec :: ReadPrec TeamId
readList :: ReadS [TeamId]
$creadList :: ReadS [TeamId]
readsPrec :: Int -> ReadS TeamId
$creadsPrec :: Int -> ReadS TeamId
Read, Int -> TeamId -> ShowS
[TeamId] -> ShowS
TeamId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TeamId] -> ShowS
$cshowList :: [TeamId] -> ShowS
show :: TeamId -> String
$cshow :: TeamId -> String
showsPrec :: Int -> TeamId -> ShowS
$cshowsPrec :: Int -> TeamId -> ShowS
Show, TeamId -> TeamId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TeamId -> TeamId -> Bool
$c/= :: TeamId -> TeamId -> Bool
== :: TeamId -> TeamId -> Bool
$c== :: TeamId -> TeamId -> Bool
Eq, Eq TeamId
TeamId -> TeamId -> Bool
TeamId -> TeamId -> Ordering
TeamId -> TeamId -> TeamId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TeamId -> TeamId -> TeamId
$cmin :: TeamId -> TeamId -> TeamId
max :: TeamId -> TeamId -> TeamId
$cmax :: TeamId -> TeamId -> TeamId
>= :: TeamId -> TeamId -> Bool
$c>= :: TeamId -> TeamId -> Bool
> :: TeamId -> TeamId -> Bool
$c> :: TeamId -> TeamId -> Bool
<= :: TeamId -> TeamId -> Bool
$c<= :: TeamId -> TeamId -> Bool
< :: TeamId -> TeamId -> Bool
$c< :: TeamId -> TeamId -> Bool
compare :: TeamId -> TeamId -> Ordering
$ccompare :: TeamId -> TeamId -> Ordering
Ord, Eq TeamId
Int -> TeamId -> Int
TeamId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TeamId -> Int
$chash :: TeamId -> Int
hashWithSalt :: Int -> TeamId -> Int
$chashWithSalt :: Int -> TeamId -> Int
Hashable, [TeamId] -> Encoding
[TeamId] -> Value
TeamId -> Encoding
TeamId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [TeamId] -> Encoding
$ctoEncodingList :: [TeamId] -> Encoding
toJSONList :: [TeamId] -> Value
$ctoJSONList :: [TeamId] -> Value
toEncoding :: TeamId -> Encoding
$ctoEncoding :: TeamId -> Encoding
toJSON :: TeamId -> Value
$ctoJSON :: TeamId -> Value
ToJSON, ToJSONKeyFunction [TeamId]
ToJSONKeyFunction TeamId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [TeamId]
$ctoJSONKeyList :: ToJSONKeyFunction [TeamId]
toJSONKey :: ToJSONKeyFunction TeamId
$ctoJSONKey :: ToJSONKeyFunction TeamId
ToJSONKey, FromJSONKeyFunction [TeamId]
FromJSONKeyFunction TeamId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [TeamId]
$cfromJSONKeyList :: FromJSONKeyFunction [TeamId]
fromJSONKey :: FromJSONKeyFunction TeamId
$cfromJSONKey :: FromJSONKeyFunction TeamId
FromJSONKey, Value -> Parser [TeamId]
Value -> Parser TeamId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [TeamId]
$cparseJSONList :: Value -> Parser [TeamId]
parseJSON :: Value -> Parser TeamId
$cparseJSON :: Value -> Parser TeamId
FromJSON)
instance IsId TeamId where
toId :: TeamId -> Id
toId = TeamId -> Id
unTI
fromId :: Id -> TeamId
fromId = Id -> TeamId
TI
instance PrintfArg TeamId where
formatArg :: TeamId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
data Team
= Team
{ Team -> TeamId
teamId :: TeamId
, Team -> ServerTime
teamCreateAt :: ServerTime
, Team -> ServerTime
teamUpdateAt :: ServerTime
, Team -> ServerTime
teamDeleteAt :: ServerTime
, Team -> UserText
teamDisplayName :: UserText
, Team -> UserText
teamName :: UserText
, Team -> UserText
teamEmail :: UserText
, Team -> Type
teamType :: Type
, Team -> UserText
teamCompanyName :: UserText
, Team -> UserText
teamAllowedDomains :: UserText
, Team -> Maybe Id
teamInviteId :: Maybe Id
, Team -> Bool
teamAllowOpenInvite :: Bool
}
deriving (ReadPrec [Team]
ReadPrec Team
Int -> ReadS Team
ReadS [Team]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Team]
$creadListPrec :: ReadPrec [Team]
readPrec :: ReadPrec Team
$creadPrec :: ReadPrec Team
readList :: ReadS [Team]
$creadList :: ReadS [Team]
readsPrec :: Int -> ReadS Team
$creadsPrec :: Int -> ReadS Team
Read, Int -> Team -> ShowS
[Team] -> ShowS
Team -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Team] -> ShowS
$cshowList :: [Team] -> ShowS
show :: Team -> String
$cshow :: Team -> String
showsPrec :: Int -> Team -> ShowS
$cshowsPrec :: Int -> Team -> ShowS
Show, Team -> Team -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Team -> Team -> Bool
$c/= :: Team -> Team -> Bool
== :: Team -> Team -> Bool
$c== :: Team -> Team -> Bool
Eq, Eq Team
Team -> Team -> Bool
Team -> Team -> Ordering
Team -> Team -> Team
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Team -> Team -> Team
$cmin :: Team -> Team -> Team
max :: Team -> Team -> Team
$cmax :: Team -> Team -> Team
>= :: Team -> Team -> Bool
$c>= :: Team -> Team -> Bool
> :: Team -> Team -> Bool
$c> :: Team -> Team -> Bool
<= :: Team -> Team -> Bool
$c<= :: Team -> Team -> Bool
< :: Team -> Team -> Bool
$c< :: Team -> Team -> Bool
compare :: Team -> Team -> Ordering
$ccompare :: Team -> Team -> Ordering
Ord)
instance HasId Team TeamId where
getId :: Team -> TeamId
getId = Team -> TeamId
teamId
instance A.FromJSON Team where
parseJSON :: Value -> Parser Team
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Team" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
TeamId
teamId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id"
ServerTime
teamCreateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"create_at"
ServerTime
teamUpdateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"update_at"
ServerTime
teamDeleteAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"delete_at"
UserText
teamDisplayName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"display_name"
UserText
teamName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name"
UserText
teamEmail <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"email"
Type
teamType <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type"
UserText
teamCompanyName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"company_name"
UserText
teamAllowedDomains <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"allowed_domains"
Maybe Id
teamInviteId <- forall a. Parser a -> Parser (Maybe a)
maybeFail (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"invite_id")
Bool
teamAllowOpenInvite <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"allow_open_invite"
forall (m :: * -> *) a. Monad m => a -> m a
return Team { Bool
Maybe Id
ServerTime
TeamId
Type
UserText
teamAllowOpenInvite :: Bool
teamInviteId :: Maybe Id
teamAllowedDomains :: UserText
teamCompanyName :: UserText
teamType :: Type
teamEmail :: UserText
teamName :: UserText
teamDisplayName :: UserText
teamDeleteAt :: ServerTime
teamUpdateAt :: ServerTime
teamCreateAt :: ServerTime
teamId :: TeamId
teamAllowOpenInvite :: Bool
teamInviteId :: Maybe Id
teamAllowedDomains :: UserText
teamCompanyName :: UserText
teamType :: Type
teamEmail :: UserText
teamName :: UserText
teamDisplayName :: UserText
teamDeleteAt :: ServerTime
teamUpdateAt :: ServerTime
teamCreateAt :: ServerTime
teamId :: TeamId
.. }
data TeamMember = TeamMember
{ TeamMember -> UserId
teamMemberUserId :: UserId
, TeamMember -> TeamId
teamMemberTeamId :: TeamId
, TeamMember -> Text
teamMemberRoles :: Text
} deriving (ReadPrec [TeamMember]
ReadPrec TeamMember
Int -> ReadS TeamMember
ReadS [TeamMember]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TeamMember]
$creadListPrec :: ReadPrec [TeamMember]
readPrec :: ReadPrec TeamMember
$creadPrec :: ReadPrec TeamMember
readList :: ReadS [TeamMember]
$creadList :: ReadS [TeamMember]
readsPrec :: Int -> ReadS TeamMember
$creadsPrec :: Int -> ReadS TeamMember
Read, Int -> TeamMember -> ShowS
[TeamMember] -> ShowS
TeamMember -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TeamMember] -> ShowS
$cshowList :: [TeamMember] -> ShowS
show :: TeamMember -> String
$cshow :: TeamMember -> String
showsPrec :: Int -> TeamMember -> ShowS
$cshowsPrec :: Int -> TeamMember -> ShowS
Show, TeamMember -> TeamMember -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TeamMember -> TeamMember -> Bool
$c/= :: TeamMember -> TeamMember -> Bool
== :: TeamMember -> TeamMember -> Bool
$c== :: TeamMember -> TeamMember -> Bool
Eq, Eq TeamMember
TeamMember -> TeamMember -> Bool
TeamMember -> TeamMember -> Ordering
TeamMember -> TeamMember -> TeamMember
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TeamMember -> TeamMember -> TeamMember
$cmin :: TeamMember -> TeamMember -> TeamMember
max :: TeamMember -> TeamMember -> TeamMember
$cmax :: TeamMember -> TeamMember -> TeamMember
>= :: TeamMember -> TeamMember -> Bool
$c>= :: TeamMember -> TeamMember -> Bool
> :: TeamMember -> TeamMember -> Bool
$c> :: TeamMember -> TeamMember -> Bool
<= :: TeamMember -> TeamMember -> Bool
$c<= :: TeamMember -> TeamMember -> Bool
< :: TeamMember -> TeamMember -> Bool
$c< :: TeamMember -> TeamMember -> Bool
compare :: TeamMember -> TeamMember -> Ordering
$ccompare :: TeamMember -> TeamMember -> Ordering
Ord)
instance A.FromJSON TeamMember where
parseJSON :: Value -> Parser TeamMember
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TeamMember" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
UserId
teamMemberUserId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"user_id"
TeamId
teamMemberTeamId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"team_id"
Text
teamMemberRoles <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"roles"
forall (m :: * -> *) a. Monad m => a -> m a
return TeamMember { Text
UserId
TeamId
teamMemberRoles :: Text
teamMemberTeamId :: TeamId
teamMemberUserId :: UserId
teamMemberRoles :: Text
teamMemberTeamId :: TeamId
teamMemberUserId :: UserId
.. }
instance A.ToJSON TeamMember where
toJSON :: TeamMember -> Value
toJSON TeamMember { Text
UserId
TeamId
teamMemberRoles :: Text
teamMemberTeamId :: TeamId
teamMemberUserId :: UserId
teamMemberRoles :: TeamMember -> Text
teamMemberTeamId :: TeamMember -> TeamId
teamMemberUserId :: TeamMember -> UserId
.. } = [Pair] -> Value
A.object
[ Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= UserId
teamMemberUserId
, Key
"team_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= TeamId
teamMemberTeamId
, Key
"roles" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
teamMemberRoles
]
data WithDefault a
= IsValue a
| Default
deriving (ReadPrec [WithDefault a]
ReadPrec (WithDefault a)
ReadS [WithDefault a]
forall a. Read a => ReadPrec [WithDefault a]
forall a. Read a => ReadPrec (WithDefault a)
forall a. Read a => Int -> ReadS (WithDefault a)
forall a. Read a => ReadS [WithDefault a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WithDefault a]
$creadListPrec :: forall a. Read a => ReadPrec [WithDefault a]
readPrec :: ReadPrec (WithDefault a)
$creadPrec :: forall a. Read a => ReadPrec (WithDefault a)
readList :: ReadS [WithDefault a]
$creadList :: forall a. Read a => ReadS [WithDefault a]
readsPrec :: Int -> ReadS (WithDefault a)
$creadsPrec :: forall a. Read a => Int -> ReadS (WithDefault a)
Read, Int -> WithDefault a -> ShowS
forall a. Show a => Int -> WithDefault a -> ShowS
forall a. Show a => [WithDefault a] -> ShowS
forall a. Show a => WithDefault a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithDefault a] -> ShowS
$cshowList :: forall a. Show a => [WithDefault a] -> ShowS
show :: WithDefault a -> String
$cshow :: forall a. Show a => WithDefault a -> String
showsPrec :: Int -> WithDefault a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> WithDefault a -> ShowS
Show, WithDefault a -> WithDefault a -> Bool
forall a. Eq a => WithDefault a -> WithDefault a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithDefault a -> WithDefault a -> Bool
$c/= :: forall a. Eq a => WithDefault a -> WithDefault a -> Bool
== :: WithDefault a -> WithDefault a -> Bool
$c== :: forall a. Eq a => WithDefault a -> WithDefault a -> Bool
Eq, WithDefault a -> WithDefault a -> Bool
WithDefault a -> WithDefault a -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (WithDefault a)
forall a. Ord a => WithDefault a -> WithDefault a -> Bool
forall a. Ord a => WithDefault a -> WithDefault a -> Ordering
forall a. Ord a => WithDefault a -> WithDefault a -> WithDefault a
min :: WithDefault a -> WithDefault a -> WithDefault a
$cmin :: forall a. Ord a => WithDefault a -> WithDefault a -> WithDefault a
max :: WithDefault a -> WithDefault a -> WithDefault a
$cmax :: forall a. Ord a => WithDefault a -> WithDefault a -> WithDefault a
>= :: WithDefault a -> WithDefault a -> Bool
$c>= :: forall a. Ord a => WithDefault a -> WithDefault a -> Bool
> :: WithDefault a -> WithDefault a -> Bool
$c> :: forall a. Ord a => WithDefault a -> WithDefault a -> Bool
<= :: WithDefault a -> WithDefault a -> Bool
$c<= :: forall a. Ord a => WithDefault a -> WithDefault a -> Bool
< :: WithDefault a -> WithDefault a -> Bool
$c< :: forall a. Ord a => WithDefault a -> WithDefault a -> Bool
compare :: WithDefault a -> WithDefault a -> Ordering
$ccompare :: forall a. Ord a => WithDefault a -> WithDefault a -> Ordering
Ord)
instance A.ToJSON t => A.ToJSON (WithDefault t) where
toJSON :: WithDefault t -> Value
toJSON WithDefault t
Default = Text -> Value
A.String Text
"default"
toJSON (IsValue t
x) = forall a. ToJSON a => a -> Value
A.toJSON t
x
instance A.FromJSON t => A.FromJSON (WithDefault t) where
parseJSON :: Value -> Parser (WithDefault t)
parseJSON (A.String Text
"default") = forall (m :: * -> *) a. Monad m => a -> m a
return forall a. WithDefault a
Default
parseJSON Value
t = forall a. a -> WithDefault a
IsValue forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
t
instance Functor WithDefault where
fmap :: forall a b. (a -> b) -> WithDefault a -> WithDefault b
fmap a -> b
f (IsValue a
x) = forall a. a -> WithDefault a
IsValue (a -> b
f a
x)
fmap a -> b
_ WithDefault a
Default = forall a. WithDefault a
Default
data NotifyOption
= NotifyOptionAll
| NotifyOptionMention
| NotifyOptionNone
deriving (ReadPrec [NotifyOption]
ReadPrec NotifyOption
Int -> ReadS NotifyOption
ReadS [NotifyOption]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyOption]
$creadListPrec :: ReadPrec [NotifyOption]
readPrec :: ReadPrec NotifyOption
$creadPrec :: ReadPrec NotifyOption
readList :: ReadS [NotifyOption]
$creadList :: ReadS [NotifyOption]
readsPrec :: Int -> ReadS NotifyOption
$creadsPrec :: Int -> ReadS NotifyOption
Read, Int -> NotifyOption -> ShowS
[NotifyOption] -> ShowS
NotifyOption -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyOption] -> ShowS
$cshowList :: [NotifyOption] -> ShowS
show :: NotifyOption -> String
$cshow :: NotifyOption -> String
showsPrec :: Int -> NotifyOption -> ShowS
$cshowsPrec :: Int -> NotifyOption -> ShowS
Show, NotifyOption -> NotifyOption -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyOption -> NotifyOption -> Bool
$c/= :: NotifyOption -> NotifyOption -> Bool
== :: NotifyOption -> NotifyOption -> Bool
$c== :: NotifyOption -> NotifyOption -> Bool
Eq, Eq NotifyOption
NotifyOption -> NotifyOption -> Bool
NotifyOption -> NotifyOption -> Ordering
NotifyOption -> NotifyOption -> NotifyOption
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NotifyOption -> NotifyOption -> NotifyOption
$cmin :: NotifyOption -> NotifyOption -> NotifyOption
max :: NotifyOption -> NotifyOption -> NotifyOption
$cmax :: NotifyOption -> NotifyOption -> NotifyOption
>= :: NotifyOption -> NotifyOption -> Bool
$c>= :: NotifyOption -> NotifyOption -> Bool
> :: NotifyOption -> NotifyOption -> Bool
$c> :: NotifyOption -> NotifyOption -> Bool
<= :: NotifyOption -> NotifyOption -> Bool
$c<= :: NotifyOption -> NotifyOption -> Bool
< :: NotifyOption -> NotifyOption -> Bool
$c< :: NotifyOption -> NotifyOption -> Bool
compare :: NotifyOption -> NotifyOption -> Ordering
$ccompare :: NotifyOption -> NotifyOption -> Ordering
Ord)
instance A.ToJSON NotifyOption where
toJSON :: NotifyOption -> Value
toJSON NotifyOption
NotifyOptionAll = Text -> Value
A.String Text
"all"
toJSON NotifyOption
NotifyOptionMention = Text -> Value
A.String Text
"mention"
toJSON NotifyOption
NotifyOptionNone = Text -> Value
A.String Text
"none"
instance A.FromJSON NotifyOption where
parseJSON :: Value -> Parser NotifyOption
parseJSON (A.String Text
"all") = forall (m :: * -> *) a. Monad m => a -> m a
return NotifyOption
NotifyOptionAll
parseJSON (A.String Text
"mention") = forall (m :: * -> *) a. Monad m => a -> m a
return NotifyOption
NotifyOptionMention
parseJSON (A.String Text
"none") = forall (m :: * -> *) a. Monad m => a -> m a
return NotifyOption
NotifyOptionNone
parseJSON Value
xs = forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
"Unknown NotifyOption value: " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Value
xs)
data UserNotifyProps = UserNotifyProps
{ UserNotifyProps -> [UserText]
userNotifyPropsMentionKeys :: [UserText]
, UserNotifyProps -> Bool
userNotifyPropsEmail :: Bool
, UserNotifyProps -> NotifyOption
userNotifyPropsPush :: NotifyOption
, UserNotifyProps -> NotifyOption
userNotifyPropsDesktop :: NotifyOption
, UserNotifyProps -> Bool
userNotifyPropsDesktopSound :: Bool
, UserNotifyProps -> Bool
userNotifyPropsChannel :: Bool
, UserNotifyProps -> Bool
userNotifyPropsFirstName :: Bool
} deriving (UserNotifyProps -> UserNotifyProps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserNotifyProps -> UserNotifyProps -> Bool
$c/= :: UserNotifyProps -> UserNotifyProps -> Bool
== :: UserNotifyProps -> UserNotifyProps -> Bool
$c== :: UserNotifyProps -> UserNotifyProps -> Bool
Eq, Int -> UserNotifyProps -> ShowS
[UserNotifyProps] -> ShowS
UserNotifyProps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserNotifyProps] -> ShowS
$cshowList :: [UserNotifyProps] -> ShowS
show :: UserNotifyProps -> String
$cshow :: UserNotifyProps -> String
showsPrec :: Int -> UserNotifyProps -> ShowS
$cshowsPrec :: Int -> UserNotifyProps -> ShowS
Show, ReadPrec [UserNotifyProps]
ReadPrec UserNotifyProps
Int -> ReadS UserNotifyProps
ReadS [UserNotifyProps]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserNotifyProps]
$creadListPrec :: ReadPrec [UserNotifyProps]
readPrec :: ReadPrec UserNotifyProps
$creadPrec :: ReadPrec UserNotifyProps
readList :: ReadS [UserNotifyProps]
$creadList :: ReadS [UserNotifyProps]
readsPrec :: Int -> ReadS UserNotifyProps
$creadsPrec :: Int -> ReadS UserNotifyProps
Read, Eq UserNotifyProps
UserNotifyProps -> UserNotifyProps -> Bool
UserNotifyProps -> UserNotifyProps -> Ordering
UserNotifyProps -> UserNotifyProps -> UserNotifyProps
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: UserNotifyProps -> UserNotifyProps -> UserNotifyProps
$cmin :: UserNotifyProps -> UserNotifyProps -> UserNotifyProps
max :: UserNotifyProps -> UserNotifyProps -> UserNotifyProps
$cmax :: UserNotifyProps -> UserNotifyProps -> UserNotifyProps
>= :: UserNotifyProps -> UserNotifyProps -> Bool
$c>= :: UserNotifyProps -> UserNotifyProps -> Bool
> :: UserNotifyProps -> UserNotifyProps -> Bool
$c> :: UserNotifyProps -> UserNotifyProps -> Bool
<= :: UserNotifyProps -> UserNotifyProps -> Bool
$c<= :: UserNotifyProps -> UserNotifyProps -> Bool
< :: UserNotifyProps -> UserNotifyProps -> Bool
$c< :: UserNotifyProps -> UserNotifyProps -> Bool
compare :: UserNotifyProps -> UserNotifyProps -> Ordering
$ccompare :: UserNotifyProps -> UserNotifyProps -> Ordering
Ord)
data ChannelNotifyProps = ChannelNotifyProps
{ ChannelNotifyProps -> WithDefault Bool
channelNotifyPropsEmail :: WithDefault Bool
, ChannelNotifyProps -> WithDefault NotifyOption
channelNotifyPropsDesktop :: WithDefault NotifyOption
, ChannelNotifyProps -> WithDefault NotifyOption
channelNotifyPropsPush :: WithDefault NotifyOption
, ChannelNotifyProps -> WithDefault NotifyOption
channelNotifyPropsMarkUnread :: WithDefault NotifyOption
, ChannelNotifyProps -> WithDefault Bool
channelNotifyPropsIgnoreChannelMentions :: WithDefault Bool
} deriving (ChannelNotifyProps -> ChannelNotifyProps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
$c/= :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
== :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
$c== :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
Eq, Int -> ChannelNotifyProps -> ShowS
[ChannelNotifyProps] -> ShowS
ChannelNotifyProps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelNotifyProps] -> ShowS
$cshowList :: [ChannelNotifyProps] -> ShowS
show :: ChannelNotifyProps -> String
$cshow :: ChannelNotifyProps -> String
showsPrec :: Int -> ChannelNotifyProps -> ShowS
$cshowsPrec :: Int -> ChannelNotifyProps -> ShowS
Show, ReadPrec [ChannelNotifyProps]
ReadPrec ChannelNotifyProps
Int -> ReadS ChannelNotifyProps
ReadS [ChannelNotifyProps]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelNotifyProps]
$creadListPrec :: ReadPrec [ChannelNotifyProps]
readPrec :: ReadPrec ChannelNotifyProps
$creadPrec :: ReadPrec ChannelNotifyProps
readList :: ReadS [ChannelNotifyProps]
$creadList :: ReadS [ChannelNotifyProps]
readsPrec :: Int -> ReadS ChannelNotifyProps
$creadsPrec :: Int -> ReadS ChannelNotifyProps
Read, Eq ChannelNotifyProps
ChannelNotifyProps -> ChannelNotifyProps -> Bool
ChannelNotifyProps -> ChannelNotifyProps -> Ordering
ChannelNotifyProps -> ChannelNotifyProps -> ChannelNotifyProps
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ChannelNotifyProps -> ChannelNotifyProps -> ChannelNotifyProps
$cmin :: ChannelNotifyProps -> ChannelNotifyProps -> ChannelNotifyProps
max :: ChannelNotifyProps -> ChannelNotifyProps -> ChannelNotifyProps
$cmax :: ChannelNotifyProps -> ChannelNotifyProps -> ChannelNotifyProps
>= :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
$c>= :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
> :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
$c> :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
<= :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
$c<= :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
< :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
$c< :: ChannelNotifyProps -> ChannelNotifyProps -> Bool
compare :: ChannelNotifyProps -> ChannelNotifyProps -> Ordering
$ccompare :: ChannelNotifyProps -> ChannelNotifyProps -> Ordering
Ord)
emptyUserNotifyProps :: UserNotifyProps
emptyUserNotifyProps :: UserNotifyProps
emptyUserNotifyProps = UserNotifyProps
{ userNotifyPropsMentionKeys :: [UserText]
userNotifyPropsMentionKeys = []
, userNotifyPropsEmail :: Bool
userNotifyPropsEmail = Bool
False
, userNotifyPropsPush :: NotifyOption
userNotifyPropsPush = NotifyOption
NotifyOptionNone
, userNotifyPropsDesktop :: NotifyOption
userNotifyPropsDesktop = NotifyOption
NotifyOptionNone
, userNotifyPropsDesktopSound :: Bool
userNotifyPropsDesktopSound = Bool
False
, userNotifyPropsChannel :: Bool
userNotifyPropsChannel = Bool
False
, userNotifyPropsFirstName :: Bool
userNotifyPropsFirstName = Bool
False
}
emptyChannelNotifyProps :: ChannelNotifyProps
emptyChannelNotifyProps :: ChannelNotifyProps
emptyChannelNotifyProps = ChannelNotifyProps
{ channelNotifyPropsEmail :: WithDefault Bool
channelNotifyPropsEmail = forall a. WithDefault a
Default
, channelNotifyPropsPush :: WithDefault NotifyOption
channelNotifyPropsPush = forall a. WithDefault a
Default
, channelNotifyPropsDesktop :: WithDefault NotifyOption
channelNotifyPropsDesktop = forall a. WithDefault a
Default
, channelNotifyPropsMarkUnread :: WithDefault NotifyOption
channelNotifyPropsMarkUnread = forall a. WithDefault a
Default
, channelNotifyPropsIgnoreChannelMentions :: WithDefault Bool
channelNotifyPropsIgnoreChannelMentions = forall a. WithDefault a
Default
}
newtype BoolString = BoolString { BoolString -> Bool
fromBoolString :: Bool }
instance A.FromJSON BoolString where
parseJSON :: Value -> Parser BoolString
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"bool as string" forall a b. (a -> b) -> a -> b
$ \Text
v ->
case Text
v of
Text
"true" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> BoolString
BoolString Bool
True)
Text
"false" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> BoolString
BoolString Bool
False)
Text
_ -> forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Expected \"true\" or \"false\""
instance A.ToJSON BoolString where
toJSON :: BoolString -> Value
toJSON (BoolString Bool
True) = Text -> Value
A.String Text
"true"
toJSON (BoolString Bool
False) = Text -> Value
A.String Text
"false"
newtype OnOffString = OnOffString{ OnOffString -> Bool
fromOnOffString :: Bool }
instance A.FromJSON OnOffString where
parseJSON :: Value -> Parser OnOffString
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"on/off setting" forall a b. (a -> b) -> a -> b
$ \Text
v ->
case Text
v of
Text
"on" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> OnOffString
OnOffString Bool
True)
Text
"off" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> OnOffString
OnOffString Bool
False)
Text
_ -> forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Expected \"on\" or \"off\""
instance A.ToJSON OnOffString where
toJSON :: OnOffString -> Value
toJSON (OnOffString Bool
True) = Text -> Value
A.String Text
"on"
toJSON (OnOffString Bool
False) = Text -> Value
A.String Text
"off"
instance A.FromJSON UserNotifyProps where
parseJSON :: Value -> Parser UserNotifyProps
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"UserNotifyProps" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
[UserText]
userNotifyPropsMentionKeys <- (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> UserText
UserText) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Char -> Bool) -> Text -> [Text]
T.split (forall a. Eq a => a -> a -> Bool
==Char
',') forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
(Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mention_keys" forall a. Parser (Maybe a) -> a -> Parser a
.!= Text
"")
NotifyOption
userNotifyPropsPush <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"push" forall a. Parser (Maybe a) -> a -> Parser a
.!= NotifyOption
NotifyOptionMention
NotifyOption
userNotifyPropsDesktop <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"desktop" forall a. Parser (Maybe a) -> a -> Parser a
.!= NotifyOption
NotifyOptionAll
Bool
userNotifyPropsEmail <- BoolString -> Bool
fromBoolString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"email" forall a. Parser (Maybe a) -> a -> Parser a
.!= Bool -> BoolString
BoolString Bool
True)
Bool
userNotifyPropsDesktopSound <- BoolString -> Bool
fromBoolString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"desktop_sound" forall a. Parser (Maybe a) -> a -> Parser a
.!= Bool -> BoolString
BoolString Bool
True)
Bool
userNotifyPropsChannel <- BoolString -> Bool
fromBoolString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"channel" forall a. Parser (Maybe a) -> a -> Parser a
.!= Bool -> BoolString
BoolString Bool
True)
Bool
userNotifyPropsFirstName <- BoolString -> Bool
fromBoolString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"first_name" forall a. Parser (Maybe a) -> a -> Parser a
.!= Bool -> BoolString
BoolString Bool
False)
forall (m :: * -> *) a. Monad m => a -> m a
return UserNotifyProps { Bool
[UserText]
NotifyOption
userNotifyPropsFirstName :: Bool
userNotifyPropsChannel :: Bool
userNotifyPropsDesktopSound :: Bool
userNotifyPropsEmail :: Bool
userNotifyPropsDesktop :: NotifyOption
userNotifyPropsPush :: NotifyOption
userNotifyPropsMentionKeys :: [UserText]
userNotifyPropsFirstName :: Bool
userNotifyPropsChannel :: Bool
userNotifyPropsDesktopSound :: Bool
userNotifyPropsDesktop :: NotifyOption
userNotifyPropsPush :: NotifyOption
userNotifyPropsEmail :: Bool
userNotifyPropsMentionKeys :: [UserText]
.. }
instance A.ToJSON UserNotifyProps where
toJSON :: UserNotifyProps -> Value
toJSON UserNotifyProps { Bool
[UserText]
NotifyOption
userNotifyPropsFirstName :: Bool
userNotifyPropsChannel :: Bool
userNotifyPropsDesktopSound :: Bool
userNotifyPropsDesktop :: NotifyOption
userNotifyPropsPush :: NotifyOption
userNotifyPropsEmail :: Bool
userNotifyPropsMentionKeys :: [UserText]
userNotifyPropsFirstName :: UserNotifyProps -> Bool
userNotifyPropsChannel :: UserNotifyProps -> Bool
userNotifyPropsDesktopSound :: UserNotifyProps -> Bool
userNotifyPropsDesktop :: UserNotifyProps -> NotifyOption
userNotifyPropsPush :: UserNotifyProps -> NotifyOption
userNotifyPropsEmail :: UserNotifyProps -> Bool
userNotifyPropsMentionKeys :: UserNotifyProps -> [UserText]
.. } = [Pair] -> Value
A.object
[ Key
"mention_keys" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> [Text] -> Text
T.intercalate Text
"," (UserText -> Text
unsafeUserText forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [UserText]
userNotifyPropsMentionKeys)
, Key
"push" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= NotifyOption
userNotifyPropsPush
, Key
"desktop" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= NotifyOption
userNotifyPropsDesktop
, Key
"email" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool -> BoolString
BoolString Bool
userNotifyPropsEmail
, Key
"desktop_sound" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool -> BoolString
BoolString Bool
userNotifyPropsDesktopSound
, Key
"channel" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool -> BoolString
BoolString Bool
userNotifyPropsChannel
, Key
"first_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool -> BoolString
BoolString Bool
userNotifyPropsFirstName
]
instance A.FromJSON ChannelNotifyProps where
parseJSON :: Value -> Parser ChannelNotifyProps
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"ChannelNotifyProps" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
WithDefault Bool
channelNotifyPropsEmail <- forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BoolString -> Bool
fromBoolString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
(Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"email" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. a -> WithDefault a
IsValue (Bool -> BoolString
BoolString Bool
True))
WithDefault NotifyOption
channelNotifyPropsPush <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"push" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. a -> WithDefault a
IsValue NotifyOption
NotifyOptionMention
WithDefault NotifyOption
channelNotifyPropsDesktop <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"desktop" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. a -> WithDefault a
IsValue NotifyOption
NotifyOptionAll
WithDefault NotifyOption
channelNotifyPropsMarkUnread <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mark_unread" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. a -> WithDefault a
IsValue NotifyOption
NotifyOptionAll
WithDefault Bool
channelNotifyPropsIgnoreChannelMentions <- forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap OnOffString -> Bool
fromOnOffString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
(Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"ignore_channel_mentions" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. WithDefault a
Default)
forall (m :: * -> *) a. Monad m => a -> m a
return ChannelNotifyProps { WithDefault Bool
WithDefault NotifyOption
channelNotifyPropsIgnoreChannelMentions :: WithDefault Bool
channelNotifyPropsMarkUnread :: WithDefault NotifyOption
channelNotifyPropsDesktop :: WithDefault NotifyOption
channelNotifyPropsPush :: WithDefault NotifyOption
channelNotifyPropsEmail :: WithDefault Bool
channelNotifyPropsIgnoreChannelMentions :: WithDefault Bool
channelNotifyPropsMarkUnread :: WithDefault NotifyOption
channelNotifyPropsPush :: WithDefault NotifyOption
channelNotifyPropsDesktop :: WithDefault NotifyOption
channelNotifyPropsEmail :: WithDefault Bool
.. }
instance A.ToJSON ChannelNotifyProps where
toJSON :: ChannelNotifyProps -> Value
toJSON ChannelNotifyProps { WithDefault Bool
WithDefault NotifyOption
channelNotifyPropsIgnoreChannelMentions :: WithDefault Bool
channelNotifyPropsMarkUnread :: WithDefault NotifyOption
channelNotifyPropsPush :: WithDefault NotifyOption
channelNotifyPropsDesktop :: WithDefault NotifyOption
channelNotifyPropsEmail :: WithDefault Bool
channelNotifyPropsIgnoreChannelMentions :: ChannelNotifyProps -> WithDefault Bool
channelNotifyPropsMarkUnread :: ChannelNotifyProps -> WithDefault NotifyOption
channelNotifyPropsPush :: ChannelNotifyProps -> WithDefault NotifyOption
channelNotifyPropsDesktop :: ChannelNotifyProps -> WithDefault NotifyOption
channelNotifyPropsEmail :: ChannelNotifyProps -> WithDefault Bool
.. } = [Pair] -> Value
A.object
[ Key
"email" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Bool -> BoolString
BoolString WithDefault Bool
channelNotifyPropsEmail
, Key
"push" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= WithDefault NotifyOption
channelNotifyPropsPush
, Key
"desktop" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= WithDefault NotifyOption
channelNotifyPropsDesktop
, Key
"mark_unread" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= WithDefault NotifyOption
channelNotifyPropsMarkUnread
, Key
"ignore_channel_mentions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Bool -> OnOffString
OnOffString WithDefault Bool
channelNotifyPropsIgnoreChannelMentions
]
newtype ChannelId = CI { ChannelId -> Id
unCI :: Id }
deriving (ReadPrec [ChannelId]
ReadPrec ChannelId
Int -> ReadS ChannelId
ReadS [ChannelId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelId]
$creadListPrec :: ReadPrec [ChannelId]
readPrec :: ReadPrec ChannelId
$creadPrec :: ReadPrec ChannelId
readList :: ReadS [ChannelId]
$creadList :: ReadS [ChannelId]
readsPrec :: Int -> ReadS ChannelId
$creadsPrec :: Int -> ReadS ChannelId
Read, Int -> ChannelId -> ShowS
[ChannelId] -> ShowS
ChannelId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelId] -> ShowS
$cshowList :: [ChannelId] -> ShowS
show :: ChannelId -> String
$cshow :: ChannelId -> String
showsPrec :: Int -> ChannelId -> ShowS
$cshowsPrec :: Int -> ChannelId -> ShowS
Show, ChannelId -> ChannelId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelId -> ChannelId -> Bool
$c/= :: ChannelId -> ChannelId -> Bool
== :: ChannelId -> ChannelId -> Bool
$c== :: ChannelId -> ChannelId -> Bool
Eq, Eq ChannelId
ChannelId -> ChannelId -> Bool
ChannelId -> ChannelId -> Ordering
ChannelId -> ChannelId -> ChannelId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ChannelId -> ChannelId -> ChannelId
$cmin :: ChannelId -> ChannelId -> ChannelId
max :: ChannelId -> ChannelId -> ChannelId
$cmax :: ChannelId -> ChannelId -> ChannelId
>= :: ChannelId -> ChannelId -> Bool
$c>= :: ChannelId -> ChannelId -> Bool
> :: ChannelId -> ChannelId -> Bool
$c> :: ChannelId -> ChannelId -> Bool
<= :: ChannelId -> ChannelId -> Bool
$c<= :: ChannelId -> ChannelId -> Bool
< :: ChannelId -> ChannelId -> Bool
$c< :: ChannelId -> ChannelId -> Bool
compare :: ChannelId -> ChannelId -> Ordering
$ccompare :: ChannelId -> ChannelId -> Ordering
Ord, Eq ChannelId
Int -> ChannelId -> Int
ChannelId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ChannelId -> Int
$chash :: ChannelId -> Int
hashWithSalt :: Int -> ChannelId -> Int
$chashWithSalt :: Int -> ChannelId -> Int
Hashable, [ChannelId] -> Encoding
[ChannelId] -> Value
ChannelId -> Encoding
ChannelId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ChannelId] -> Encoding
$ctoEncodingList :: [ChannelId] -> Encoding
toJSONList :: [ChannelId] -> Value
$ctoJSONList :: [ChannelId] -> Value
toEncoding :: ChannelId -> Encoding
$ctoEncoding :: ChannelId -> Encoding
toJSON :: ChannelId -> Value
$ctoJSON :: ChannelId -> Value
ToJSON, ToJSONKeyFunction [ChannelId]
ToJSONKeyFunction ChannelId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [ChannelId]
$ctoJSONKeyList :: ToJSONKeyFunction [ChannelId]
toJSONKey :: ToJSONKeyFunction ChannelId
$ctoJSONKey :: ToJSONKeyFunction ChannelId
ToJSONKey, FromJSONKeyFunction [ChannelId]
FromJSONKeyFunction ChannelId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [ChannelId]
$cfromJSONKeyList :: FromJSONKeyFunction [ChannelId]
fromJSONKey :: FromJSONKeyFunction ChannelId
$cfromJSONKey :: FromJSONKeyFunction ChannelId
FromJSONKey, Value -> Parser [ChannelId]
Value -> Parser ChannelId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ChannelId]
$cparseJSONList :: Value -> Parser [ChannelId]
parseJSON :: Value -> Parser ChannelId
$cparseJSON :: Value -> Parser ChannelId
FromJSON)
instance IsId ChannelId where
toId :: ChannelId -> Id
toId = ChannelId -> Id
unCI
fromId :: Id -> ChannelId
fromId = Id -> ChannelId
CI
instance PrintfArg ChannelId where
formatArg :: ChannelId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
data Channel
= Channel
{ Channel -> ChannelId
channelId :: ChannelId
, Channel -> ServerTime
channelCreateAt :: ServerTime
, Channel -> ServerTime
channelUpdateAt :: ServerTime
, Channel -> ServerTime
channelDeleteAt :: ServerTime
, Channel -> Maybe TeamId
channelTeamId :: Maybe TeamId
, Channel -> Type
channelType :: Type
, Channel -> UserText
channelDisplayName :: UserText
, Channel -> UserText
channelName :: UserText
, :: UserText
, Channel -> UserText
channelPurpose :: UserText
, Channel -> ServerTime
channelLastPostAt :: ServerTime
, Channel -> Int
channelTotalMsgCount :: Int
, Channel -> Maybe UserId
channelCreatorId :: Maybe UserId
} deriving (ReadPrec [Channel]
ReadPrec Channel
Int -> ReadS Channel
ReadS [Channel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Channel]
$creadListPrec :: ReadPrec [Channel]
readPrec :: ReadPrec Channel
$creadPrec :: ReadPrec Channel
readList :: ReadS [Channel]
$creadList :: ReadS [Channel]
readsPrec :: Int -> ReadS Channel
$creadsPrec :: Int -> ReadS Channel
Read, Int -> Channel -> ShowS
[Channel] -> ShowS
Channel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Channel] -> ShowS
$cshowList :: [Channel] -> ShowS
show :: Channel -> String
$cshow :: Channel -> String
showsPrec :: Int -> Channel -> ShowS
$cshowsPrec :: Int -> Channel -> ShowS
Show, Channel -> Channel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Channel -> Channel -> Bool
$c/= :: Channel -> Channel -> Bool
== :: Channel -> Channel -> Bool
$c== :: Channel -> Channel -> Bool
Eq, Eq Channel
Channel -> Channel -> Bool
Channel -> Channel -> Ordering
Channel -> Channel -> Channel
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Channel -> Channel -> Channel
$cmin :: Channel -> Channel -> Channel
max :: Channel -> Channel -> Channel
$cmax :: Channel -> Channel -> Channel
>= :: Channel -> Channel -> Bool
$c>= :: Channel -> Channel -> Bool
> :: Channel -> Channel -> Bool
$c> :: Channel -> Channel -> Bool
<= :: Channel -> Channel -> Bool
$c<= :: Channel -> Channel -> Bool
< :: Channel -> Channel -> Bool
$c< :: Channel -> Channel -> Bool
compare :: Channel -> Channel -> Ordering
$ccompare :: Channel -> Channel -> Ordering
Ord)
instance HasId Channel ChannelId where
getId :: Channel -> ChannelId
getId = Channel -> ChannelId
channelId
instance A.FromJSON Channel where
parseJSON :: Value -> Parser Channel
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Channel" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
ChannelId
channelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id"
ServerTime
channelCreateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"create_at"
ServerTime
channelUpdateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"update_at"
ServerTime
channelDeleteAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"delete_at"
Maybe TeamId
channelTeamId <- forall a. Parser a -> Parser (Maybe a)
maybeFail (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"team_id")
Type
channelType <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type"
UserText
channelDisplayName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"display_name"
UserText
channelName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name"
UserText
channelHeader <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"header"
UserText
channelPurpose <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"purpose"
ServerTime
channelLastPostAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"last_post_at"
Int
channelTotalMsgCount <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"total_msg_count"
Maybe UserId
channelCreatorId <- forall a. Parser a -> Parser (Maybe a)
maybeFail (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"creator_id")
forall (m :: * -> *) a. Monad m => a -> m a
return Channel { Int
Maybe UserId
Maybe TeamId
ServerTime
ChannelId
Type
UserText
channelCreatorId :: Maybe UserId
channelTotalMsgCount :: Int
channelLastPostAt :: ServerTime
channelPurpose :: UserText
channelHeader :: UserText
channelName :: UserText
channelDisplayName :: UserText
channelType :: Type
channelTeamId :: Maybe TeamId
channelDeleteAt :: ServerTime
channelUpdateAt :: ServerTime
channelCreateAt :: ServerTime
channelId :: ChannelId
channelCreatorId :: Maybe UserId
channelTotalMsgCount :: Int
channelLastPostAt :: ServerTime
channelPurpose :: UserText
channelHeader :: UserText
channelName :: UserText
channelDisplayName :: UserText
channelType :: Type
channelTeamId :: Maybe TeamId
channelDeleteAt :: ServerTime
channelUpdateAt :: ServerTime
channelCreateAt :: ServerTime
channelId :: ChannelId
.. }
newtype SingleChannel = SC Channel
deriving (ReadPrec [SingleChannel]
ReadPrec SingleChannel
Int -> ReadS SingleChannel
ReadS [SingleChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SingleChannel]
$creadListPrec :: ReadPrec [SingleChannel]
readPrec :: ReadPrec SingleChannel
$creadPrec :: ReadPrec SingleChannel
readList :: ReadS [SingleChannel]
$creadList :: ReadS [SingleChannel]
readsPrec :: Int -> ReadS SingleChannel
$creadsPrec :: Int -> ReadS SingleChannel
Read, Int -> SingleChannel -> ShowS
[SingleChannel] -> ShowS
SingleChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SingleChannel] -> ShowS
$cshowList :: [SingleChannel] -> ShowS
show :: SingleChannel -> String
$cshow :: SingleChannel -> String
showsPrec :: Int -> SingleChannel -> ShowS
$cshowsPrec :: Int -> SingleChannel -> ShowS
Show, SingleChannel -> SingleChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SingleChannel -> SingleChannel -> Bool
$c/= :: SingleChannel -> SingleChannel -> Bool
== :: SingleChannel -> SingleChannel -> Bool
$c== :: SingleChannel -> SingleChannel -> Bool
Eq, Eq SingleChannel
SingleChannel -> SingleChannel -> Bool
SingleChannel -> SingleChannel -> Ordering
SingleChannel -> SingleChannel -> SingleChannel
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SingleChannel -> SingleChannel -> SingleChannel
$cmin :: SingleChannel -> SingleChannel -> SingleChannel
max :: SingleChannel -> SingleChannel -> SingleChannel
$cmax :: SingleChannel -> SingleChannel -> SingleChannel
>= :: SingleChannel -> SingleChannel -> Bool
$c>= :: SingleChannel -> SingleChannel -> Bool
> :: SingleChannel -> SingleChannel -> Bool
$c> :: SingleChannel -> SingleChannel -> Bool
<= :: SingleChannel -> SingleChannel -> Bool
$c<= :: SingleChannel -> SingleChannel -> Bool
< :: SingleChannel -> SingleChannel -> Bool
$c< :: SingleChannel -> SingleChannel -> Bool
compare :: SingleChannel -> SingleChannel -> Ordering
$ccompare :: SingleChannel -> SingleChannel -> Ordering
Ord)
instance A.FromJSON SingleChannel where
parseJSON :: Value -> Parser SingleChannel
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"SingleChannel" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Channel
channel <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"channel"
forall (m :: * -> *) a. Monad m => a -> m a
return (Channel -> SingleChannel
SC Channel
channel)
instance HasId ChannelData ChannelId where
getId :: ChannelData -> ChannelId
getId = ChannelData -> ChannelId
channelDataChannelId
data ChannelData
= ChannelData
{ ChannelData -> ChannelId
channelDataChannelId :: ChannelId
, ChannelData -> UserId
channelDataUserId :: UserId
, ChannelData -> Text
channelDataRoles :: Text
, ChannelData -> ServerTime
channelDataLastViewedAt :: ServerTime
, ChannelData -> Int
channelDataMsgCount :: Int
, ChannelData -> Int
channelDataMentionCount :: Int
, ChannelData -> ChannelNotifyProps
channelDataNotifyProps :: ChannelNotifyProps
, ChannelData -> ServerTime
channelDataLastUpdateAt :: ServerTime
} deriving (ReadPrec [ChannelData]
ReadPrec ChannelData
Int -> ReadS ChannelData
ReadS [ChannelData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelData]
$creadListPrec :: ReadPrec [ChannelData]
readPrec :: ReadPrec ChannelData
$creadPrec :: ReadPrec ChannelData
readList :: ReadS [ChannelData]
$creadList :: ReadS [ChannelData]
readsPrec :: Int -> ReadS ChannelData
$creadsPrec :: Int -> ReadS ChannelData
Read, Int -> ChannelData -> ShowS
[ChannelData] -> ShowS
ChannelData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelData] -> ShowS
$cshowList :: [ChannelData] -> ShowS
show :: ChannelData -> String
$cshow :: ChannelData -> String
showsPrec :: Int -> ChannelData -> ShowS
$cshowsPrec :: Int -> ChannelData -> ShowS
Show, ChannelData -> ChannelData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelData -> ChannelData -> Bool
$c/= :: ChannelData -> ChannelData -> Bool
== :: ChannelData -> ChannelData -> Bool
$c== :: ChannelData -> ChannelData -> Bool
Eq)
instance A.FromJSON ChannelData where
parseJSON :: Value -> Parser ChannelData
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"ChannelData" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
ChannelId
channelDataChannelId <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"channel_id"
UserId
channelDataUserId <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"user_id"
Text
channelDataRoles <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"roles"
ServerTime
channelDataLastViewedAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"last_viewed_at"
Int
channelDataMsgCount <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"msg_count"
Int
channelDataMentionCount <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mention_count"
ChannelNotifyProps
channelDataNotifyProps <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"notify_props"
ServerTime
channelDataLastUpdateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"last_update_at"
forall (m :: * -> *) a. Monad m => a -> m a
return ChannelData { Int
Text
ServerTime
UserId
ChannelId
ChannelNotifyProps
channelDataLastUpdateAt :: ServerTime
channelDataNotifyProps :: ChannelNotifyProps
channelDataMentionCount :: Int
channelDataMsgCount :: Int
channelDataLastViewedAt :: ServerTime
channelDataRoles :: Text
channelDataUserId :: UserId
channelDataChannelId :: ChannelId
channelDataLastUpdateAt :: ServerTime
channelDataNotifyProps :: ChannelNotifyProps
channelDataMentionCount :: Int
channelDataMsgCount :: Int
channelDataLastViewedAt :: ServerTime
channelDataRoles :: Text
channelDataUserId :: UserId
channelDataChannelId :: ChannelId
.. }
data ChannelWithData = ChannelWithData Channel ChannelData
deriving (ReadPrec [ChannelWithData]
ReadPrec ChannelWithData
Int -> ReadS ChannelWithData
ReadS [ChannelWithData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelWithData]
$creadListPrec :: ReadPrec [ChannelWithData]
readPrec :: ReadPrec ChannelWithData
$creadPrec :: ReadPrec ChannelWithData
readList :: ReadS [ChannelWithData]
$creadList :: ReadS [ChannelWithData]
readsPrec :: Int -> ReadS ChannelWithData
$creadsPrec :: Int -> ReadS ChannelWithData
Read, Int -> ChannelWithData -> ShowS
[ChannelWithData] -> ShowS
ChannelWithData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelWithData] -> ShowS
$cshowList :: [ChannelWithData] -> ShowS
show :: ChannelWithData -> String
$cshow :: ChannelWithData -> String
showsPrec :: Int -> ChannelWithData -> ShowS
$cshowsPrec :: Int -> ChannelWithData -> ShowS
Show, ChannelWithData -> ChannelWithData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelWithData -> ChannelWithData -> Bool
$c/= :: ChannelWithData -> ChannelWithData -> Bool
== :: ChannelWithData -> ChannelWithData -> Bool
$c== :: ChannelWithData -> ChannelWithData -> Bool
Eq)
instance A.FromJSON ChannelWithData where
parseJSON :: Value -> Parser ChannelWithData
parseJSON (A.Object Object
v) =
Channel -> ChannelData -> ChannelWithData
ChannelWithData forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"channel")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"member")
parseJSON Value
v = forall a. String -> Value -> Parser a
typeMismatch String
"Invalid channel/data pair " Value
v
type Channels = Seq Channel
data MinChannel = MinChannel
{ MinChannel -> Text
minChannelName :: Text
, MinChannel -> Text
minChannelDisplayName :: Text
, MinChannel -> Maybe Text
minChannelPurpose :: Maybe Text
, :: Maybe Text
, MinChannel -> Type
minChannelType :: Type
, MinChannel -> TeamId
minChannelTeamId :: TeamId
} deriving (ReadPrec [MinChannel]
ReadPrec MinChannel
Int -> ReadS MinChannel
ReadS [MinChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MinChannel]
$creadListPrec :: ReadPrec [MinChannel]
readPrec :: ReadPrec MinChannel
$creadPrec :: ReadPrec MinChannel
readList :: ReadS [MinChannel]
$creadList :: ReadS [MinChannel]
readsPrec :: Int -> ReadS MinChannel
$creadsPrec :: Int -> ReadS MinChannel
Read, MinChannel -> MinChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MinChannel -> MinChannel -> Bool
$c/= :: MinChannel -> MinChannel -> Bool
== :: MinChannel -> MinChannel -> Bool
$c== :: MinChannel -> MinChannel -> Bool
Eq, Int -> MinChannel -> ShowS
[MinChannel] -> ShowS
MinChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MinChannel] -> ShowS
$cshowList :: [MinChannel] -> ShowS
show :: MinChannel -> String
$cshow :: MinChannel -> String
showsPrec :: Int -> MinChannel -> ShowS
$cshowsPrec :: Int -> MinChannel -> ShowS
Show)
instance A.ToJSON MinChannel where
toJSON :: MinChannel -> Value
toJSON MinChannel { Maybe Text
Text
TeamId
Type
minChannelTeamId :: TeamId
minChannelType :: Type
minChannelHeader :: Maybe Text
minChannelPurpose :: Maybe Text
minChannelDisplayName :: Text
minChannelName :: Text
minChannelTeamId :: MinChannel -> TeamId
minChannelType :: MinChannel -> Type
minChannelHeader :: MinChannel -> Maybe Text
minChannelPurpose :: MinChannel -> Maybe Text
minChannelDisplayName :: MinChannel -> Text
minChannelName :: MinChannel -> Text
.. } = [Pair] -> Value
A.object forall a b. (a -> b) -> a -> b
$
[ Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
minChannelName
, Key
"display_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
minChannelDisplayName
, Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Type
minChannelType
, Key
"team_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= TeamId
minChannelTeamId
] forall a. [a] -> [a] -> [a]
++
[ Key
"purpose" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
p | Just Text
p <- [Maybe Text
minChannelPurpose] ] forall a. [a] -> [a] -> [a]
++
[ Key
"header" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
h | Just Text
h <- [Maybe Text
minChannelHeader] ]
newtype UserId = UI { UserId -> Id
unUI :: Id }
deriving (ReadPrec [UserId]
ReadPrec UserId
Int -> ReadS UserId
ReadS [UserId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserId]
$creadListPrec :: ReadPrec [UserId]
readPrec :: ReadPrec UserId
$creadPrec :: ReadPrec UserId
readList :: ReadS [UserId]
$creadList :: ReadS [UserId]
readsPrec :: Int -> ReadS UserId
$creadsPrec :: Int -> ReadS UserId
Read, Int -> UserId -> ShowS
[UserId] -> ShowS
UserId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserId] -> ShowS
$cshowList :: [UserId] -> ShowS
show :: UserId -> String
$cshow :: UserId -> String
showsPrec :: Int -> UserId -> ShowS
$cshowsPrec :: Int -> UserId -> ShowS
Show, UserId -> UserId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserId -> UserId -> Bool
$c/= :: UserId -> UserId -> Bool
== :: UserId -> UserId -> Bool
$c== :: UserId -> UserId -> Bool
Eq, Eq UserId
UserId -> UserId -> Bool
UserId -> UserId -> Ordering
UserId -> UserId -> UserId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: UserId -> UserId -> UserId
$cmin :: UserId -> UserId -> UserId
max :: UserId -> UserId -> UserId
$cmax :: UserId -> UserId -> UserId
>= :: UserId -> UserId -> Bool
$c>= :: UserId -> UserId -> Bool
> :: UserId -> UserId -> Bool
$c> :: UserId -> UserId -> Bool
<= :: UserId -> UserId -> Bool
$c<= :: UserId -> UserId -> Bool
< :: UserId -> UserId -> Bool
$c< :: UserId -> UserId -> Bool
compare :: UserId -> UserId -> Ordering
$ccompare :: UserId -> UserId -> Ordering
Ord, Eq UserId
Int -> UserId -> Int
UserId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: UserId -> Int
$chash :: UserId -> Int
hashWithSalt :: Int -> UserId -> Int
$chashWithSalt :: Int -> UserId -> Int
Hashable, [UserId] -> Encoding
[UserId] -> Value
UserId -> Encoding
UserId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [UserId] -> Encoding
$ctoEncodingList :: [UserId] -> Encoding
toJSONList :: [UserId] -> Value
$ctoJSONList :: [UserId] -> Value
toEncoding :: UserId -> Encoding
$ctoEncoding :: UserId -> Encoding
toJSON :: UserId -> Value
$ctoJSON :: UserId -> Value
ToJSON, ToJSONKeyFunction [UserId]
ToJSONKeyFunction UserId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [UserId]
$ctoJSONKeyList :: ToJSONKeyFunction [UserId]
toJSONKey :: ToJSONKeyFunction UserId
$ctoJSONKey :: ToJSONKeyFunction UserId
ToJSONKey, FromJSONKeyFunction [UserId]
FromJSONKeyFunction UserId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [UserId]
$cfromJSONKeyList :: FromJSONKeyFunction [UserId]
fromJSONKey :: FromJSONKeyFunction UserId
$cfromJSONKey :: FromJSONKeyFunction UserId
FromJSONKey, Value -> Parser [UserId]
Value -> Parser UserId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [UserId]
$cparseJSONList :: Value -> Parser [UserId]
parseJSON :: Value -> Parser UserId
$cparseJSON :: Value -> Parser UserId
FromJSON)
instance IsId UserId where
toId :: UserId -> Id
toId = UserId -> Id
unUI
fromId :: Id -> UserId
fromId = Id -> UserId
UI
instance PrintfArg UserId where
formatArg :: UserId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
data UserParam
= UserById UserId
| UserMe
deriving (ReadPrec [UserParam]
ReadPrec UserParam
Int -> ReadS UserParam
ReadS [UserParam]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserParam]
$creadListPrec :: ReadPrec [UserParam]
readPrec :: ReadPrec UserParam
$creadPrec :: ReadPrec UserParam
readList :: ReadS [UserParam]
$creadList :: ReadS [UserParam]
readsPrec :: Int -> ReadS UserParam
$creadsPrec :: Int -> ReadS UserParam
Read, Int -> UserParam -> ShowS
[UserParam] -> ShowS
UserParam -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserParam] -> ShowS
$cshowList :: [UserParam] -> ShowS
show :: UserParam -> String
$cshow :: UserParam -> String
showsPrec :: Int -> UserParam -> ShowS
$cshowsPrec :: Int -> UserParam -> ShowS
Show, UserParam -> UserParam -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserParam -> UserParam -> Bool
$c/= :: UserParam -> UserParam -> Bool
== :: UserParam -> UserParam -> Bool
$c== :: UserParam -> UserParam -> Bool
Eq, Eq UserParam
UserParam -> UserParam -> Bool
UserParam -> UserParam -> Ordering
UserParam -> UserParam -> UserParam
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: UserParam -> UserParam -> UserParam
$cmin :: UserParam -> UserParam -> UserParam
max :: UserParam -> UserParam -> UserParam
$cmax :: UserParam -> UserParam -> UserParam
>= :: UserParam -> UserParam -> Bool
$c>= :: UserParam -> UserParam -> Bool
> :: UserParam -> UserParam -> Bool
$c> :: UserParam -> UserParam -> Bool
<= :: UserParam -> UserParam -> Bool
$c<= :: UserParam -> UserParam -> Bool
< :: UserParam -> UserParam -> Bool
$c< :: UserParam -> UserParam -> Bool
compare :: UserParam -> UserParam -> Ordering
$ccompare :: UserParam -> UserParam -> Ordering
Ord)
instance PrintfArg UserParam where
formatArg :: UserParam -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. UserParam -> Text
userParamString
userParamString :: UserParam -> Text
userParamString :: UserParam -> Text
userParamString (UserById UserId
uid) = forall x. IsId x => x -> Text
idString UserId
uid
userParamString UserParam
UserMe = Text
"me"
data InitialLoad
= InitialLoad
{ InitialLoad -> User
initialLoadUser :: User
, InitialLoad -> Seq Team
initialLoadTeams :: Seq Team
} deriving (InitialLoad -> InitialLoad -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitialLoad -> InitialLoad -> Bool
$c/= :: InitialLoad -> InitialLoad -> Bool
== :: InitialLoad -> InitialLoad -> Bool
$c== :: InitialLoad -> InitialLoad -> Bool
Eq, Int -> InitialLoad -> ShowS
[InitialLoad] -> ShowS
InitialLoad -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitialLoad] -> ShowS
$cshowList :: [InitialLoad] -> ShowS
show :: InitialLoad -> String
$cshow :: InitialLoad -> String
showsPrec :: Int -> InitialLoad -> ShowS
$cshowsPrec :: Int -> InitialLoad -> ShowS
Show)
instance A.FromJSON InitialLoad where
parseJSON :: Value -> Parser InitialLoad
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InitialLoad" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
User
initialLoadUser <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"user"
Seq Team
initialLoadTeams <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"teams"
forall (m :: * -> *) a. Monad m => a -> m a
return InitialLoad { Seq Team
User
initialLoadTeams :: Seq Team
initialLoadUser :: User
initialLoadTeams :: Seq Team
initialLoadUser :: User
.. }
instance HasId User UserId where
getId :: User -> UserId
getId = User -> UserId
userId
data User
= User
{ User -> UserId
userId :: UserId
, User -> Maybe ServerTime
userCreateAt :: Maybe ServerTime
, User -> Maybe ServerTime
userUpdateAt :: Maybe ServerTime
, User -> ServerTime
userDeleteAt :: ServerTime
, User -> Text
userUsername :: Text
, User -> Maybe Text
userAuthData :: Maybe Text
, User -> Text
userAuthService :: Text
, User -> UserText
userEmail :: UserText
, User -> Bool
userEmailVerified :: Bool
, User -> UserText
userNickname :: UserText
, User -> UserText
userFirstName :: UserText
, User -> UserText
userLastName :: UserText
, User -> Text
userRoles :: Text
, User -> UserNotifyProps
userNotifyProps :: UserNotifyProps
, User -> Maybe ServerTime
userLastPasswordUpdate :: Maybe ServerTime
, User -> Maybe ServerTime
userLastPictureUpdate :: Maybe ServerTime
, User -> Text
userLocale :: Text
} deriving (ReadPrec [User]
ReadPrec User
Int -> ReadS User
ReadS [User]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [User]
$creadListPrec :: ReadPrec [User]
readPrec :: ReadPrec User
$creadPrec :: ReadPrec User
readList :: ReadS [User]
$creadList :: ReadS [User]
readsPrec :: Int -> ReadS User
$creadsPrec :: Int -> ReadS User
Read, Int -> User -> ShowS
[User] -> ShowS
User -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [User] -> ShowS
$cshowList :: [User] -> ShowS
show :: User -> String
$cshow :: User -> String
showsPrec :: Int -> User -> ShowS
$cshowsPrec :: Int -> User -> ShowS
Show, User -> User -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: User -> User -> Bool
$c/= :: User -> User -> Bool
== :: User -> User -> Bool
$c== :: User -> User -> Bool
Eq)
instance A.FromJSON User where
parseJSON :: Value -> Parser User
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"User" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
UserId
userId <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id"
Maybe ServerTime
userCreateAt <- (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"create_at"
Maybe ServerTime
userUpdateAt <- (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"update_at"
ServerTime
userDeleteAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"delete_at"
Text
userUsername <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"username"
Maybe Text
userAuthData <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"auth_data"
Text
userAuthService <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"auth_service"
UserText
userEmail <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"email"
Bool
userEmailVerified <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"email_verified" forall a. Parser (Maybe a) -> a -> Parser a
.!= Bool
False
UserText
userNickname <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"nickname"
UserText
userFirstName <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"first_name"
UserText
userLastName <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"last_name"
Text
userRoles <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"roles"
UserNotifyProps
userNotifyProps <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"notify_props" forall a. Parser (Maybe a) -> a -> Parser a
.!= UserNotifyProps
emptyUserNotifyProps
Maybe ServerTime
userLastPasswordUpdate <- (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
(Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"last_password_update")
Maybe ServerTime
userLastPictureUpdate <- (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"last_picture_update")
Text
userLocale <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"locale"
forall (m :: * -> *) a. Monad m => a -> m a
return User { Bool
Maybe Text
Maybe ServerTime
Text
ServerTime
UserId
UserNotifyProps
UserText
userLocale :: Text
userLastPictureUpdate :: Maybe ServerTime
userLastPasswordUpdate :: Maybe ServerTime
userNotifyProps :: UserNotifyProps
userRoles :: Text
userLastName :: UserText
userFirstName :: UserText
userNickname :: UserText
userEmailVerified :: Bool
userEmail :: UserText
userAuthService :: Text
userAuthData :: Maybe Text
userUsername :: Text
userDeleteAt :: ServerTime
userUpdateAt :: Maybe ServerTime
userCreateAt :: Maybe ServerTime
userId :: UserId
userLocale :: Text
userLastPictureUpdate :: Maybe ServerTime
userLastPasswordUpdate :: Maybe ServerTime
userNotifyProps :: UserNotifyProps
userRoles :: Text
userLastName :: UserText
userFirstName :: UserText
userNickname :: UserText
userEmailVerified :: Bool
userEmail :: UserText
userAuthService :: Text
userAuthData :: Maybe Text
userUsername :: Text
userDeleteAt :: ServerTime
userUpdateAt :: Maybe ServerTime
userCreateAt :: Maybe ServerTime
userId :: UserId
.. }
data PostPropAttachmentField = PostPropAttachmentField
{ PostPropAttachmentField -> Text
ppafTitle :: Text
, PostPropAttachmentField -> Text
ppafValue :: Text
, PostPropAttachmentField -> Bool
ppafShort :: Bool
} deriving (ReadPrec [PostPropAttachmentField]
ReadPrec PostPropAttachmentField
Int -> ReadS PostPropAttachmentField
ReadS [PostPropAttachmentField]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostPropAttachmentField]
$creadListPrec :: ReadPrec [PostPropAttachmentField]
readPrec :: ReadPrec PostPropAttachmentField
$creadPrec :: ReadPrec PostPropAttachmentField
readList :: ReadS [PostPropAttachmentField]
$creadList :: ReadS [PostPropAttachmentField]
readsPrec :: Int -> ReadS PostPropAttachmentField
$creadsPrec :: Int -> ReadS PostPropAttachmentField
Read, Int -> PostPropAttachmentField -> ShowS
[PostPropAttachmentField] -> ShowS
PostPropAttachmentField -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostPropAttachmentField] -> ShowS
$cshowList :: [PostPropAttachmentField] -> ShowS
show :: PostPropAttachmentField -> String
$cshow :: PostPropAttachmentField -> String
showsPrec :: Int -> PostPropAttachmentField -> ShowS
$cshowsPrec :: Int -> PostPropAttachmentField -> ShowS
Show, PostPropAttachmentField -> PostPropAttachmentField -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPropAttachmentField -> PostPropAttachmentField -> Bool
$c/= :: PostPropAttachmentField -> PostPropAttachmentField -> Bool
== :: PostPropAttachmentField -> PostPropAttachmentField -> Bool
$c== :: PostPropAttachmentField -> PostPropAttachmentField -> Bool
Eq)
instance A.FromJSON PostPropAttachmentField where
parseJSON :: Value -> Parser PostPropAttachmentField
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PostPropAttachmentField" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Text
ppafTitle <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"title"
Text
ppafValue <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"value"
Bool
ppafShort <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"short"
forall (m :: * -> *) a. Monad m => a -> m a
return PostPropAttachmentField { Bool
Text
ppafShort :: Bool
ppafValue :: Text
ppafTitle :: Text
ppafShort :: Bool
ppafValue :: Text
ppafTitle :: Text
.. }
data PostPropAttachment
= PostPropAttachment
{ PostPropAttachment -> Int
ppaId :: Int
, PostPropAttachment -> Text
ppaFallback :: Text
, PostPropAttachment -> Text
ppaColor :: Text
, PostPropAttachment -> Text
ppaPretext :: Text
, PostPropAttachment -> Text
ppaAuthorName :: Text
, PostPropAttachment -> Text
ppaAuthorLink :: Text
, PostPropAttachment -> Text
ppaAuthorIcon :: Text
, PostPropAttachment -> Text
ppaTitle :: Text
, PostPropAttachment -> Text
ppaTitleLink :: Text
, PostPropAttachment -> Text
ppaText :: Text
, PostPropAttachment -> Seq PostPropAttachmentField
ppaFields :: Seq PostPropAttachmentField
, PostPropAttachment -> Text
ppaImageURL :: Text
, PostPropAttachment -> Text
ppaThumbURL :: Text
, :: Text
, :: Text
} deriving (ReadPrec [PostPropAttachment]
ReadPrec PostPropAttachment
Int -> ReadS PostPropAttachment
ReadS [PostPropAttachment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostPropAttachment]
$creadListPrec :: ReadPrec [PostPropAttachment]
readPrec :: ReadPrec PostPropAttachment
$creadPrec :: ReadPrec PostPropAttachment
readList :: ReadS [PostPropAttachment]
$creadList :: ReadS [PostPropAttachment]
readsPrec :: Int -> ReadS PostPropAttachment
$creadsPrec :: Int -> ReadS PostPropAttachment
Read, Int -> PostPropAttachment -> ShowS
[PostPropAttachment] -> ShowS
PostPropAttachment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostPropAttachment] -> ShowS
$cshowList :: [PostPropAttachment] -> ShowS
show :: PostPropAttachment -> String
$cshow :: PostPropAttachment -> String
showsPrec :: Int -> PostPropAttachment -> ShowS
$cshowsPrec :: Int -> PostPropAttachment -> ShowS
Show, PostPropAttachment -> PostPropAttachment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPropAttachment -> PostPropAttachment -> Bool
$c/= :: PostPropAttachment -> PostPropAttachment -> Bool
== :: PostPropAttachment -> PostPropAttachment -> Bool
$c== :: PostPropAttachment -> PostPropAttachment -> Bool
Eq)
instance A.FromJSON PostPropAttachment where
parseJSON :: Value -> Parser PostPropAttachment
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Attachment" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
let Object
x .:?? :: Object -> Key -> Parser a
.:?? Key
f = Object
x forall a. FromJSON a => Object -> Key -> Parser a
.: Key
f forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Monoid a => a
mempty
Int
ppaId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id" forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall (m :: * -> *) a. Monad m => a -> m a
return Int
0
Text
ppaFallback <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"fallback"
Text
ppaColor <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"color"
Text
ppaPretext <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"pretext"
Text
ppaAuthorName <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"author_name"
Text
ppaAuthorLink <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"author_link"
Text
ppaAuthorIcon <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"author_icon"
Text
ppaTitle <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"title"
Text
ppaTitleLink <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"title_link"
Text
ppaText <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"text"
Seq PostPropAttachmentField
ppaFields <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"fields"
Text
ppaImageURL <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"image_url"
Text
ppaThumbURL <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"thumb_url"
Text
ppaFooter <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"footer"
Text
ppaFooterIcon <- Object
v forall {a}. (FromJSON a, Monoid a) => Object -> Key -> Parser a
.:?? Key
"footer_icon"
forall (m :: * -> *) a. Monad m => a -> m a
return PostPropAttachment { Int
Text
Seq PostPropAttachmentField
ppaFooterIcon :: Text
ppaFooter :: Text
ppaThumbURL :: Text
ppaImageURL :: Text
ppaFields :: Seq PostPropAttachmentField
ppaText :: Text
ppaTitleLink :: Text
ppaTitle :: Text
ppaAuthorIcon :: Text
ppaAuthorLink :: Text
ppaAuthorName :: Text
ppaPretext :: Text
ppaColor :: Text
ppaFallback :: Text
ppaId :: Int
ppaFooterIcon :: Text
ppaFooter :: Text
ppaThumbURL :: Text
ppaImageURL :: Text
ppaFields :: Seq PostPropAttachmentField
ppaText :: Text
ppaTitleLink :: Text
ppaTitle :: Text
ppaAuthorIcon :: Text
ppaAuthorLink :: Text
ppaAuthorName :: Text
ppaPretext :: Text
ppaColor :: Text
ppaFallback :: Text
ppaId :: Int
.. }
instance A.ToJSON PostPropAttachment where
toJSON :: PostPropAttachment -> Value
toJSON PostPropAttachment { Int
Text
Seq PostPropAttachmentField
ppaFooterIcon :: Text
ppaFooter :: Text
ppaThumbURL :: Text
ppaImageURL :: Text
ppaFields :: Seq PostPropAttachmentField
ppaText :: Text
ppaTitleLink :: Text
ppaTitle :: Text
ppaAuthorIcon :: Text
ppaAuthorLink :: Text
ppaAuthorName :: Text
ppaPretext :: Text
ppaColor :: Text
ppaFallback :: Text
ppaId :: Int
ppaFooterIcon :: PostPropAttachment -> Text
ppaFooter :: PostPropAttachment -> Text
ppaThumbURL :: PostPropAttachment -> Text
ppaImageURL :: PostPropAttachment -> Text
ppaFields :: PostPropAttachment -> Seq PostPropAttachmentField
ppaText :: PostPropAttachment -> Text
ppaTitleLink :: PostPropAttachment -> Text
ppaTitle :: PostPropAttachment -> Text
ppaAuthorIcon :: PostPropAttachment -> Text
ppaAuthorLink :: PostPropAttachment -> Text
ppaAuthorName :: PostPropAttachment -> Text
ppaPretext :: PostPropAttachment -> Text
ppaColor :: PostPropAttachment -> Text
ppaFallback :: PostPropAttachment -> Text
ppaId :: PostPropAttachment -> Int
.. } = [Pair] -> Value
A.object
[ Key
"color" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
ppaColor
, Key
"text" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
ppaText
]
data PostProps
= PostProps
{ PostProps -> Maybe Text
postPropsOverrideIconUrl :: Maybe Text
, PostProps -> Maybe Text
postPropsOverrideUsername :: Maybe Text
, PostProps -> Maybe Bool
postPropsFromWebhook :: Maybe Bool
, PostProps -> Maybe (Seq PostPropAttachment)
postPropsAttachments :: Maybe (Seq PostPropAttachment)
, :: Maybe Text
, :: Maybe Text
} deriving (ReadPrec [PostProps]
ReadPrec PostProps
Int -> ReadS PostProps
ReadS [PostProps]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostProps]
$creadListPrec :: ReadPrec [PostProps]
readPrec :: ReadPrec PostProps
$creadPrec :: ReadPrec PostProps
readList :: ReadS [PostProps]
$creadList :: ReadS [PostProps]
readsPrec :: Int -> ReadS PostProps
$creadsPrec :: Int -> ReadS PostProps
Read, Int -> PostProps -> ShowS
[PostProps] -> ShowS
PostProps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostProps] -> ShowS
$cshowList :: [PostProps] -> ShowS
show :: PostProps -> String
$cshow :: PostProps -> String
showsPrec :: Int -> PostProps -> ShowS
$cshowsPrec :: Int -> PostProps -> ShowS
Show, PostProps -> PostProps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostProps -> PostProps -> Bool
$c/= :: PostProps -> PostProps -> Bool
== :: PostProps -> PostProps -> Bool
$c== :: PostProps -> PostProps -> Bool
Eq)
emptyPostProps :: PostProps
emptyPostProps :: PostProps
emptyPostProps
= PostProps
{ postPropsOverrideIconUrl :: Maybe Text
postPropsOverrideIconUrl = forall a. Maybe a
Nothing
, postPropsOverrideUsername :: Maybe Text
postPropsOverrideUsername = forall a. Maybe a
Nothing
, postPropsFromWebhook :: Maybe Bool
postPropsFromWebhook = forall a. Maybe a
Nothing
, postPropsAttachments :: Maybe (Seq PostPropAttachment)
postPropsAttachments = forall a. Maybe a
Nothing
, postPropsNewHeader :: Maybe Text
postPropsNewHeader = forall a. Maybe a
Nothing
, postPropsOldHeader :: Maybe Text
postPropsOldHeader = forall a. Maybe a
Nothing
}
instance A.FromJSON PostProps where
parseJSON :: Value -> Parser PostProps
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Props" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Maybe Text
postPropsOverrideIconUrl <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"override_icon_url"
Maybe Text
postPropsOverrideUsername <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"override_username"
Maybe Text
postPropsFromWebhookStr <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"from_webhook"
let postPropsFromWebhook :: Maybe Bool
postPropsFromWebhook = do
Text
s <- Maybe Text
postPropsFromWebhookStr
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Text
s forall a. Eq a => a -> a -> Bool
== (Text
"true"::Text)
Maybe (Seq PostPropAttachment)
postPropsAttachments <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"attachments"
Maybe Text
postPropsNewHeader <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"new_header"
Maybe Text
postPropsOldHeader <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"old_header"
forall (m :: * -> *) a. Monad m => a -> m a
return PostProps { Maybe Bool
Maybe Text
Maybe (Seq PostPropAttachment)
postPropsOldHeader :: Maybe Text
postPropsNewHeader :: Maybe Text
postPropsAttachments :: Maybe (Seq PostPropAttachment)
postPropsFromWebhook :: Maybe Bool
postPropsOverrideUsername :: Maybe Text
postPropsOverrideIconUrl :: Maybe Text
postPropsOldHeader :: Maybe Text
postPropsNewHeader :: Maybe Text
postPropsAttachments :: Maybe (Seq PostPropAttachment)
postPropsFromWebhook :: Maybe Bool
postPropsOverrideUsername :: Maybe Text
postPropsOverrideIconUrl :: Maybe Text
.. }
instance A.ToJSON PostProps where
toJSON :: PostProps -> Value
toJSON PostProps { Maybe Bool
Maybe Text
Maybe (Seq PostPropAttachment)
postPropsOldHeader :: Maybe Text
postPropsNewHeader :: Maybe Text
postPropsAttachments :: Maybe (Seq PostPropAttachment)
postPropsFromWebhook :: Maybe Bool
postPropsOverrideUsername :: Maybe Text
postPropsOverrideIconUrl :: Maybe Text
postPropsOldHeader :: PostProps -> Maybe Text
postPropsNewHeader :: PostProps -> Maybe Text
postPropsAttachments :: PostProps -> Maybe (Seq PostPropAttachment)
postPropsFromWebhook :: PostProps -> Maybe Bool
postPropsOverrideUsername :: PostProps -> Maybe Text
postPropsOverrideIconUrl :: PostProps -> Maybe Text
.. } = [Pair] -> Value
A.object forall a b. (a -> b) -> a -> b
$
[ Key
"override_icon_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
v | Just Text
v <- [Maybe Text
postPropsOverrideIconUrl ] ] forall a. [a] -> [a] -> [a]
++
[ Key
"override_username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
v | Just Text
v <- [Maybe Text
postPropsOverrideUsername] ] forall a. [a] -> [a] -> [a]
++
[ Key
"from_webhook" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool
v | Just Bool
v <- [Maybe Bool
postPropsFromWebhook ] ] forall a. [a] -> [a] -> [a]
++
[ Key
"attachments" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Seq PostPropAttachment
v | Just Seq PostPropAttachment
v <- [Maybe (Seq PostPropAttachment)
postPropsAttachments ] ] forall a. [a] -> [a] -> [a]
++
[ Key
"new_header" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
v | Just Text
v <- [Maybe Text
postPropsNewHeader ] ] forall a. [a] -> [a] -> [a]
++
[ Key
"old_header" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
v | Just Text
v <- [Maybe Text
postPropsOldHeader ] ]
newtype PostId = PI { PostId -> Id
unPI :: Id }
deriving (ReadPrec [PostId]
ReadPrec PostId
Int -> ReadS PostId
ReadS [PostId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostId]
$creadListPrec :: ReadPrec [PostId]
readPrec :: ReadPrec PostId
$creadPrec :: ReadPrec PostId
readList :: ReadS [PostId]
$creadList :: ReadS [PostId]
readsPrec :: Int -> ReadS PostId
$creadsPrec :: Int -> ReadS PostId
Read, Int -> PostId -> ShowS
[PostId] -> ShowS
PostId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostId] -> ShowS
$cshowList :: [PostId] -> ShowS
show :: PostId -> String
$cshow :: PostId -> String
showsPrec :: Int -> PostId -> ShowS
$cshowsPrec :: Int -> PostId -> ShowS
Show, PostId -> PostId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostId -> PostId -> Bool
$c/= :: PostId -> PostId -> Bool
== :: PostId -> PostId -> Bool
$c== :: PostId -> PostId -> Bool
Eq, Eq PostId
PostId -> PostId -> Bool
PostId -> PostId -> Ordering
PostId -> PostId -> PostId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: PostId -> PostId -> PostId
$cmin :: PostId -> PostId -> PostId
max :: PostId -> PostId -> PostId
$cmax :: PostId -> PostId -> PostId
>= :: PostId -> PostId -> Bool
$c>= :: PostId -> PostId -> Bool
> :: PostId -> PostId -> Bool
$c> :: PostId -> PostId -> Bool
<= :: PostId -> PostId -> Bool
$c<= :: PostId -> PostId -> Bool
< :: PostId -> PostId -> Bool
$c< :: PostId -> PostId -> Bool
compare :: PostId -> PostId -> Ordering
$ccompare :: PostId -> PostId -> Ordering
Ord, Eq PostId
Int -> PostId -> Int
PostId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: PostId -> Int
$chash :: PostId -> Int
hashWithSalt :: Int -> PostId -> Int
$chashWithSalt :: Int -> PostId -> Int
Hashable, [PostId] -> Encoding
[PostId] -> Value
PostId -> Encoding
PostId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [PostId] -> Encoding
$ctoEncodingList :: [PostId] -> Encoding
toJSONList :: [PostId] -> Value
$ctoJSONList :: [PostId] -> Value
toEncoding :: PostId -> Encoding
$ctoEncoding :: PostId -> Encoding
toJSON :: PostId -> Value
$ctoJSON :: PostId -> Value
ToJSON, ToJSONKeyFunction [PostId]
ToJSONKeyFunction PostId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [PostId]
$ctoJSONKeyList :: ToJSONKeyFunction [PostId]
toJSONKey :: ToJSONKeyFunction PostId
$ctoJSONKey :: ToJSONKeyFunction PostId
ToJSONKey, FromJSONKeyFunction [PostId]
FromJSONKeyFunction PostId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [PostId]
$cfromJSONKeyList :: FromJSONKeyFunction [PostId]
fromJSONKey :: FromJSONKeyFunction PostId
$cfromJSONKey :: FromJSONKeyFunction PostId
FromJSONKey, Value -> Parser [PostId]
Value -> Parser PostId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [PostId]
$cparseJSONList :: Value -> Parser [PostId]
parseJSON :: Value -> Parser PostId
$cparseJSON :: Value -> Parser PostId
FromJSON)
instance IsId PostId where
toId :: PostId -> Id
toId = PostId -> Id
unPI
fromId :: Id -> PostId
fromId = Id -> PostId
PI
instance PrintfArg PostId where
formatArg :: PostId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
newtype FileId = FI { FileId -> Id
unFI :: Id }
deriving (ReadPrec [FileId]
ReadPrec FileId
Int -> ReadS FileId
ReadS [FileId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileId]
$creadListPrec :: ReadPrec [FileId]
readPrec :: ReadPrec FileId
$creadPrec :: ReadPrec FileId
readList :: ReadS [FileId]
$creadList :: ReadS [FileId]
readsPrec :: Int -> ReadS FileId
$creadsPrec :: Int -> ReadS FileId
Read, Int -> FileId -> ShowS
[FileId] -> ShowS
FileId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileId] -> ShowS
$cshowList :: [FileId] -> ShowS
show :: FileId -> String
$cshow :: FileId -> String
showsPrec :: Int -> FileId -> ShowS
$cshowsPrec :: Int -> FileId -> ShowS
Show, FileId -> FileId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileId -> FileId -> Bool
$c/= :: FileId -> FileId -> Bool
== :: FileId -> FileId -> Bool
$c== :: FileId -> FileId -> Bool
Eq, Eq FileId
FileId -> FileId -> Bool
FileId -> FileId -> Ordering
FileId -> FileId -> FileId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FileId -> FileId -> FileId
$cmin :: FileId -> FileId -> FileId
max :: FileId -> FileId -> FileId
$cmax :: FileId -> FileId -> FileId
>= :: FileId -> FileId -> Bool
$c>= :: FileId -> FileId -> Bool
> :: FileId -> FileId -> Bool
$c> :: FileId -> FileId -> Bool
<= :: FileId -> FileId -> Bool
$c<= :: FileId -> FileId -> Bool
< :: FileId -> FileId -> Bool
$c< :: FileId -> FileId -> Bool
compare :: FileId -> FileId -> Ordering
$ccompare :: FileId -> FileId -> Ordering
Ord, Eq FileId
Int -> FileId -> Int
FileId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: FileId -> Int
$chash :: FileId -> Int
hashWithSalt :: Int -> FileId -> Int
$chashWithSalt :: Int -> FileId -> Int
Hashable, [FileId] -> Encoding
[FileId] -> Value
FileId -> Encoding
FileId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [FileId] -> Encoding
$ctoEncodingList :: [FileId] -> Encoding
toJSONList :: [FileId] -> Value
$ctoJSONList :: [FileId] -> Value
toEncoding :: FileId -> Encoding
$ctoEncoding :: FileId -> Encoding
toJSON :: FileId -> Value
$ctoJSON :: FileId -> Value
ToJSON, ToJSONKeyFunction [FileId]
ToJSONKeyFunction FileId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [FileId]
$ctoJSONKeyList :: ToJSONKeyFunction [FileId]
toJSONKey :: ToJSONKeyFunction FileId
$ctoJSONKey :: ToJSONKeyFunction FileId
ToJSONKey, FromJSONKeyFunction [FileId]
FromJSONKeyFunction FileId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [FileId]
$cfromJSONKeyList :: FromJSONKeyFunction [FileId]
fromJSONKey :: FromJSONKeyFunction FileId
$cfromJSONKey :: FromJSONKeyFunction FileId
FromJSONKey, Value -> Parser [FileId]
Value -> Parser FileId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [FileId]
$cparseJSONList :: Value -> Parser [FileId]
parseJSON :: Value -> Parser FileId
$cparseJSON :: Value -> Parser FileId
FromJSON)
instance IsId FileId where
toId :: FileId -> Id
toId = FileId -> Id
unFI
fromId :: Id -> FileId
fromId = Id -> FileId
FI
instance PrintfArg FileId where
formatArg :: FileId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
urlForFile :: FileId -> Text
urlForFile :: FileId -> Text
urlForFile FileId
fId =
Text
"/api/v4/files/" forall a. Semigroup a => a -> a -> a
<> forall x. IsId x => x -> Text
idString FileId
fId
data PostType
= PostTypeJoinChannel
| PostTypeLeaveChannel
| PostTypeAddToChannel
| PostTypeRemoveFromChannel
|
| PostTypeDisplayNameChange
| PostTypePurposeChange
| PostTypeChannelDeleted
| PostTypeEphemeral
| PostTypeUnknown T.Text
deriving (ReadPrec [PostType]
ReadPrec PostType
Int -> ReadS PostType
ReadS [PostType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostType]
$creadListPrec :: ReadPrec [PostType]
readPrec :: ReadPrec PostType
$creadPrec :: ReadPrec PostType
readList :: ReadS [PostType]
$creadList :: ReadS [PostType]
readsPrec :: Int -> ReadS PostType
$creadsPrec :: Int -> ReadS PostType
Read, Int -> PostType -> ShowS
[PostType] -> ShowS
PostType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostType] -> ShowS
$cshowList :: [PostType] -> ShowS
show :: PostType -> String
$cshow :: PostType -> String
showsPrec :: Int -> PostType -> ShowS
$cshowsPrec :: Int -> PostType -> ShowS
Show, PostType -> PostType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostType -> PostType -> Bool
$c/= :: PostType -> PostType -> Bool
== :: PostType -> PostType -> Bool
$c== :: PostType -> PostType -> Bool
Eq)
instance A.FromJSON PostType where
parseJSON :: Value -> Parser PostType
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"Post type" forall a b. (a -> b) -> a -> b
$ \ Text
t -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ case Text
t of
Text
"system_join_channel" -> PostType
PostTypeJoinChannel
Text
"system_leave_channel" -> PostType
PostTypeLeaveChannel
Text
"system_add_to_channel" -> PostType
PostTypeAddToChannel
Text
"system_remove_from_channel" -> PostType
PostTypeRemoveFromChannel
Text
"system_header_change" -> PostType
PostTypeHeaderChange
Text
"system_displayname_change" -> PostType
PostTypeDisplayNameChange
Text
"system_purpose_change" -> PostType
PostTypePurposeChange
Text
"system_channel_deleted" -> PostType
PostTypeChannelDeleted
Text
"system_ephemeral" -> PostType
PostTypeEphemeral
Text
_ -> Text -> PostType
PostTypeUnknown Text
t
instance A.ToJSON PostType where
toJSON :: PostType -> Value
toJSON PostType
typ = Text -> Value
A.String forall a b. (a -> b) -> a -> b
$ case PostType
typ of
PostType
PostTypeJoinChannel -> Text
"system_join_channel"
PostType
PostTypeLeaveChannel -> Text
"system_leave_channel"
PostType
PostTypeAddToChannel -> Text
"system_add_to_channel"
PostType
PostTypeRemoveFromChannel -> Text
"system_remove_from_channel"
PostType
PostTypeHeaderChange -> Text
"system_header_change"
PostType
PostTypeDisplayNameChange -> Text
"system_displayname_change"
PostType
PostTypePurposeChange -> Text
"system_purpose_change"
PostType
PostTypeChannelDeleted -> Text
"system_channel_deleted"
PostType
PostTypeEphemeral -> Text
"system_ephemeral"
PostTypeUnknown Text
t -> Text
t
data Post
= Post
{ Post -> Maybe PostId
postPendingPostId :: Maybe PostId
, Post -> Maybe PostId
postOriginalId :: Maybe PostId
, Post -> PostProps
postProps :: PostProps
, Post -> Maybe PostId
postRootId :: Maybe PostId
, Post -> Seq FileId
postFileIds :: Seq FileId
, Post -> PostId
postId :: PostId
, Post -> PostType
postType :: PostType
, Post -> UserText
postMessage :: UserText
, Post -> Maybe ServerTime
postDeleteAt :: Maybe ServerTime
, Post -> Text
postHashtags :: Text
, Post -> ServerTime
postUpdateAt :: ServerTime
, Post -> ServerTime
postEditAt :: ServerTime
, Post -> Maybe UserId
postUserId :: Maybe UserId
, Post -> ServerTime
postCreateAt :: ServerTime
, Post -> ChannelId
postChannelId :: ChannelId
, Post -> Bool
postHasReactions :: Bool
, Post -> Maybe Bool
postPinned :: Maybe Bool
, Post -> PostMetadata
postMetadata :: PostMetadata
} deriving (ReadPrec [Post]
ReadPrec Post
Int -> ReadS Post
ReadS [Post]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Post]
$creadListPrec :: ReadPrec [Post]
readPrec :: ReadPrec Post
$creadPrec :: ReadPrec Post
readList :: ReadS [Post]
$creadList :: ReadS [Post]
readsPrec :: Int -> ReadS Post
$creadsPrec :: Int -> ReadS Post
Read, Int -> Post -> ShowS
[Post] -> ShowS
Post -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Post] -> ShowS
$cshowList :: [Post] -> ShowS
show :: Post -> String
$cshow :: Post -> String
showsPrec :: Int -> Post -> ShowS
$cshowsPrec :: Int -> Post -> ShowS
Show, Post -> Post -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Post -> Post -> Bool
$c/= :: Post -> Post -> Bool
== :: Post -> Post -> Bool
$c== :: Post -> Post -> Bool
Eq)
instance HasId Post PostId where
getId :: Post -> PostId
getId = Post -> PostId
postId
instance A.FromJSON Post where
parseJSON :: Value -> Parser Post
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Post" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Maybe PostId
postPendingPostId <- forall a. Parser a -> Parser (Maybe a)
maybeFail (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"pending_post_id")
Maybe PostId
postOriginalId <- forall a. Parser a -> Parser (Maybe a)
maybeFail (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"original_id")
PostProps
postProps <- forall a. a -> Maybe a -> a
fromMaybe PostProps
emptyPostProps forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"props"
Maybe PostId
postRootId <- forall a. Parser a -> Parser (Maybe a)
maybeFail (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"root_id")
Seq FileId
postFileIds <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"file_ids" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. Monoid a => a
mempty
PostId
postId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id"
PostType
postType <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type"
UserText
postMessage <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"message"
Maybe ServerTime
postDeleteAt <- (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"delete_at"
Text
postHashtags <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"hashtags"
ServerTime
postUpdateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"update_at"
ServerTime
postEditAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"edit_at"
Maybe UserId
postUserId <- forall a. Parser a -> Parser (Maybe a)
maybeFail (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"user_id")
ServerTime
postCreateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"create_at"
ChannelId
postChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"channel_id"
Bool
postHasReactions <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"has_reactions" forall a. Parser (Maybe a) -> a -> Parser a
.!= Bool
False
Maybe Bool
postPinned <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"is_pinned"
PostMetadata
postMetadata <- (Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"metadata") forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Seq FileInfo -> Seq Reaction -> PostMetadata
PostMetadata forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty)
forall (m :: * -> *) a. Monad m => a -> m a
return Post { Bool
Maybe Bool
Maybe ServerTime
Maybe PostId
Maybe UserId
Text
Seq FileId
ServerTime
PostMetadata
PostType
PostId
PostProps
ChannelId
UserText
postMetadata :: PostMetadata
postPinned :: Maybe Bool
postHasReactions :: Bool
postChannelId :: ChannelId
postCreateAt :: ServerTime
postUserId :: Maybe UserId
postEditAt :: ServerTime
postUpdateAt :: ServerTime
postHashtags :: Text
postDeleteAt :: Maybe ServerTime
postMessage :: UserText
postType :: PostType
postId :: PostId
postFileIds :: Seq FileId
postRootId :: Maybe PostId
postProps :: PostProps
postOriginalId :: Maybe PostId
postPendingPostId :: Maybe PostId
postMetadata :: PostMetadata
postPinned :: Maybe Bool
postHasReactions :: Bool
postChannelId :: ChannelId
postCreateAt :: ServerTime
postUserId :: Maybe UserId
postEditAt :: ServerTime
postUpdateAt :: ServerTime
postHashtags :: Text
postDeleteAt :: Maybe ServerTime
postMessage :: UserText
postType :: PostType
postId :: PostId
postFileIds :: Seq FileId
postRootId :: Maybe PostId
postProps :: PostProps
postOriginalId :: Maybe PostId
postPendingPostId :: Maybe PostId
.. }
instance A.ToJSON Post where
toJSON :: Post -> Value
toJSON Post { Bool
Maybe Bool
Maybe ServerTime
Maybe PostId
Maybe UserId
Text
Seq FileId
ServerTime
PostMetadata
PostType
PostId
PostProps
ChannelId
UserText
postMetadata :: PostMetadata
postPinned :: Maybe Bool
postHasReactions :: Bool
postChannelId :: ChannelId
postCreateAt :: ServerTime
postUserId :: Maybe UserId
postEditAt :: ServerTime
postUpdateAt :: ServerTime
postHashtags :: Text
postDeleteAt :: Maybe ServerTime
postMessage :: UserText
postType :: PostType
postId :: PostId
postFileIds :: Seq FileId
postRootId :: Maybe PostId
postProps :: PostProps
postOriginalId :: Maybe PostId
postPendingPostId :: Maybe PostId
postMetadata :: Post -> PostMetadata
postPinned :: Post -> Maybe Bool
postHasReactions :: Post -> Bool
postChannelId :: Post -> ChannelId
postCreateAt :: Post -> ServerTime
postUserId :: Post -> Maybe UserId
postEditAt :: Post -> ServerTime
postUpdateAt :: Post -> ServerTime
postHashtags :: Post -> Text
postDeleteAt :: Post -> Maybe ServerTime
postMessage :: Post -> UserText
postType :: Post -> PostType
postId :: Post -> PostId
postFileIds :: Post -> Seq FileId
postRootId :: Post -> Maybe PostId
postProps :: Post -> PostProps
postOriginalId :: Post -> Maybe PostId
postPendingPostId :: Post -> Maybe PostId
.. } = [Pair] -> Value
A.object
[ Key
"pending_post_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe PostId
postPendingPostId
, Key
"original_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe PostId
postOriginalId
, Key
"props" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PostProps
postProps
, Key
"root_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe PostId
postRootId
, Key
"file_ids" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Seq FileId
postFileIds
, Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PostId
postId
, Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PostType
postType
, Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= UserText
postMessage
, Key
"delete_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (ServerTime -> Int
timeToServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe ServerTime
postDeleteAt)
, Key
"hashtags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
postHashtags
, Key
"update_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= ServerTime -> Int
timeToServer ServerTime
postUpdateAt
, Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe UserId
postUserId
, Key
"create_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= ServerTime -> Int
timeToServer ServerTime
postCreateAt
, Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= ChannelId
postChannelId
, Key
"has_reactions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool
postHasReactions
, Key
"is_pinned" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
postPinned
, Key
"metadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PostMetadata
postMetadata
]
data PostMetadata =
PostMetadata { PostMetadata -> Seq FileInfo
postMetadataFiles :: Seq FileInfo
, PostMetadata -> Seq Reaction
postMetadataReactions :: Seq Reaction
}
deriving (ReadPrec [PostMetadata]
ReadPrec PostMetadata
Int -> ReadS PostMetadata
ReadS [PostMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostMetadata]
$creadListPrec :: ReadPrec [PostMetadata]
readPrec :: ReadPrec PostMetadata
$creadPrec :: ReadPrec PostMetadata
readList :: ReadS [PostMetadata]
$creadList :: ReadS [PostMetadata]
readsPrec :: Int -> ReadS PostMetadata
$creadsPrec :: Int -> ReadS PostMetadata
Read, Int -> PostMetadata -> ShowS
[PostMetadata] -> ShowS
PostMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostMetadata] -> ShowS
$cshowList :: [PostMetadata] -> ShowS
show :: PostMetadata -> String
$cshow :: PostMetadata -> String
showsPrec :: Int -> PostMetadata -> ShowS
$cshowsPrec :: Int -> PostMetadata -> ShowS
Show, PostMetadata -> PostMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostMetadata -> PostMetadata -> Bool
$c/= :: PostMetadata -> PostMetadata -> Bool
== :: PostMetadata -> PostMetadata -> Bool
$c== :: PostMetadata -> PostMetadata -> Bool
Eq)
instance A.FromJSON PostMetadata where
parseJSON :: Value -> Parser PostMetadata
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PostMetadata" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Seq FileInfo -> Seq Reaction -> PostMetadata
PostMetadata forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"files" forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Monoid a => a
mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"reactions" forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Monoid a => a
mempty)
instance A.ToJSON PostMetadata where
toJSON :: PostMetadata -> Value
toJSON PostMetadata
pm =
[Pair] -> Value
A.object [ Key
"files" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= PostMetadata -> Seq FileInfo
postMetadataFiles PostMetadata
pm
, Key
"reactions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= PostMetadata -> Seq Reaction
postMetadataReactions PostMetadata
pm
]
data PendingPost
= PendingPost
{ PendingPost -> ChannelId
pendingPostChannelId :: ChannelId
, PendingPost -> Maybe ServerTime
pendingPostCreateAt :: Maybe ServerTime
, PendingPost -> Seq String
pendingPostFilenames :: Seq FilePath
, PendingPost -> Text
pendingPostMessage :: Text
, PendingPost -> PendingPostId
pendingPostId :: PendingPostId
, PendingPost -> UserId
pendingPostUserId :: UserId
, PendingPost -> Maybe PostId
pendingPostRootId :: Maybe PostId
} deriving (ReadPrec [PendingPost]
ReadPrec PendingPost
Int -> ReadS PendingPost
ReadS [PendingPost]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PendingPost]
$creadListPrec :: ReadPrec [PendingPost]
readPrec :: ReadPrec PendingPost
$creadPrec :: ReadPrec PendingPost
readList :: ReadS [PendingPost]
$creadList :: ReadS [PendingPost]
readsPrec :: Int -> ReadS PendingPost
$creadsPrec :: Int -> ReadS PendingPost
Read, Int -> PendingPost -> ShowS
[PendingPost] -> ShowS
PendingPost -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PendingPost] -> ShowS
$cshowList :: [PendingPost] -> ShowS
show :: PendingPost -> String
$cshow :: PendingPost -> String
showsPrec :: Int -> PendingPost -> ShowS
$cshowsPrec :: Int -> PendingPost -> ShowS
Show, PendingPost -> PendingPost -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PendingPost -> PendingPost -> Bool
$c/= :: PendingPost -> PendingPost -> Bool
== :: PendingPost -> PendingPost -> Bool
$c== :: PendingPost -> PendingPost -> Bool
Eq)
instance A.ToJSON PendingPost where
toJSON :: PendingPost -> Value
toJSON PendingPost
post = [Pair] -> Value
A.object
[ Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PendingPost -> ChannelId
pendingPostChannelId PendingPost
post
, Key
"create_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= forall b a. b -> (a -> b) -> Maybe a -> b
maybe Int
0 ServerTime -> Int
timeToServer (PendingPost -> Maybe ServerTime
pendingPostCreateAt PendingPost
post)
, Key
"filenames" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PendingPost -> Seq String
pendingPostFilenames PendingPost
post
, Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PendingPost -> Text
pendingPostMessage PendingPost
post
, Key
"pending_post_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PendingPost -> PendingPostId
pendingPostId PendingPost
post
, Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PendingPost -> UserId
pendingPostUserId PendingPost
post
, Key
"root_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PendingPost -> Maybe PostId
pendingPostRootId PendingPost
post
]
newtype PendingPostId = PPI { PendingPostId -> Id
unPPI :: Id }
deriving (ReadPrec [PendingPostId]
ReadPrec PendingPostId
Int -> ReadS PendingPostId
ReadS [PendingPostId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PendingPostId]
$creadListPrec :: ReadPrec [PendingPostId]
readPrec :: ReadPrec PendingPostId
$creadPrec :: ReadPrec PendingPostId
readList :: ReadS [PendingPostId]
$creadList :: ReadS [PendingPostId]
readsPrec :: Int -> ReadS PendingPostId
$creadsPrec :: Int -> ReadS PendingPostId
Read, Int -> PendingPostId -> ShowS
[PendingPostId] -> ShowS
PendingPostId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PendingPostId] -> ShowS
$cshowList :: [PendingPostId] -> ShowS
show :: PendingPostId -> String
$cshow :: PendingPostId -> String
showsPrec :: Int -> PendingPostId -> ShowS
$cshowsPrec :: Int -> PendingPostId -> ShowS
Show, PendingPostId -> PendingPostId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PendingPostId -> PendingPostId -> Bool
$c/= :: PendingPostId -> PendingPostId -> Bool
== :: PendingPostId -> PendingPostId -> Bool
$c== :: PendingPostId -> PendingPostId -> Bool
Eq, Eq PendingPostId
PendingPostId -> PendingPostId -> Bool
PendingPostId -> PendingPostId -> Ordering
PendingPostId -> PendingPostId -> PendingPostId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: PendingPostId -> PendingPostId -> PendingPostId
$cmin :: PendingPostId -> PendingPostId -> PendingPostId
max :: PendingPostId -> PendingPostId -> PendingPostId
$cmax :: PendingPostId -> PendingPostId -> PendingPostId
>= :: PendingPostId -> PendingPostId -> Bool
$c>= :: PendingPostId -> PendingPostId -> Bool
> :: PendingPostId -> PendingPostId -> Bool
$c> :: PendingPostId -> PendingPostId -> Bool
<= :: PendingPostId -> PendingPostId -> Bool
$c<= :: PendingPostId -> PendingPostId -> Bool
< :: PendingPostId -> PendingPostId -> Bool
$c< :: PendingPostId -> PendingPostId -> Bool
compare :: PendingPostId -> PendingPostId -> Ordering
$ccompare :: PendingPostId -> PendingPostId -> Ordering
Ord, Eq PendingPostId
Int -> PendingPostId -> Int
PendingPostId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: PendingPostId -> Int
$chash :: PendingPostId -> Int
hashWithSalt :: Int -> PendingPostId -> Int
$chashWithSalt :: Int -> PendingPostId -> Int
Hashable, [PendingPostId] -> Encoding
[PendingPostId] -> Value
PendingPostId -> Encoding
PendingPostId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [PendingPostId] -> Encoding
$ctoEncodingList :: [PendingPostId] -> Encoding
toJSONList :: [PendingPostId] -> Value
$ctoJSONList :: [PendingPostId] -> Value
toEncoding :: PendingPostId -> Encoding
$ctoEncoding :: PendingPostId -> Encoding
toJSON :: PendingPostId -> Value
$ctoJSON :: PendingPostId -> Value
ToJSON, ToJSONKeyFunction [PendingPostId]
ToJSONKeyFunction PendingPostId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [PendingPostId]
$ctoJSONKeyList :: ToJSONKeyFunction [PendingPostId]
toJSONKey :: ToJSONKeyFunction PendingPostId
$ctoJSONKey :: ToJSONKeyFunction PendingPostId
ToJSONKey, FromJSONKeyFunction [PendingPostId]
FromJSONKeyFunction PendingPostId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [PendingPostId]
$cfromJSONKeyList :: FromJSONKeyFunction [PendingPostId]
fromJSONKey :: FromJSONKeyFunction PendingPostId
$cfromJSONKey :: FromJSONKeyFunction PendingPostId
FromJSONKey, Value -> Parser [PendingPostId]
Value -> Parser PendingPostId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [PendingPostId]
$cparseJSONList :: Value -> Parser [PendingPostId]
parseJSON :: Value -> Parser PendingPostId
$cparseJSON :: Value -> Parser PendingPostId
FromJSON)
instance IsId PendingPostId where
toId :: PendingPostId -> Id
toId = PendingPostId -> Id
unPPI
fromId :: Id -> PendingPostId
fromId = Id -> PendingPostId
PPI
instance HasId PendingPost PendingPostId where
getId :: PendingPost -> PendingPostId
getId = PendingPost -> PendingPostId
pendingPostId
mkPendingPost :: Text -> UserId -> ChannelId -> IO PendingPost
mkPendingPost :: Text -> UserId -> ChannelId -> IO PendingPost
mkPendingPost Text
msg UserId
userid ChannelId
channelid = do
UTCTime
now <- IO UTCTime
getCurrentTime
let ms :: Int
ms = ServerTime -> Int
timeToServer (UTCTime -> ServerTime
ServerTime UTCTime
now) :: Int
pid :: Text
pid = String -> Text
T.pack forall a b. (a -> b) -> a -> b
$ forall r. PrintfType r => String -> r
printf String
"%s:%d" (forall x. IsId x => x -> Text
idString UserId
userid) Int
ms
forall (m :: * -> *) a. Monad m => a -> m a
return PendingPost
{ pendingPostId :: PendingPostId
pendingPostId = Id -> PendingPostId
PPI (Text -> Id
Id Text
pid)
, pendingPostChannelId :: ChannelId
pendingPostChannelId = ChannelId
channelid
, pendingPostCreateAt :: Maybe ServerTime
pendingPostCreateAt = forall a. Maybe a
Nothing
, pendingPostFilenames :: Seq String
pendingPostFilenames = forall a. Seq a
S.empty
, pendingPostMessage :: Text
pendingPostMessage = Text
msg
, pendingPostUserId :: UserId
pendingPostUserId = UserId
userid
, pendingPostRootId :: Maybe PostId
pendingPostRootId = forall a. Maybe a
Nothing
}
data FileInfo
= FileInfo
{ FileInfo -> FileId
fileInfoId :: FileId
, FileInfo -> UserId
fileInfoUserId :: UserId
, FileInfo -> Maybe PostId
fileInfoPostId :: Maybe PostId
, FileInfo -> ServerTime
fileInfoCreateAt :: ServerTime
, FileInfo -> ServerTime
fileInfoUpdateAt :: ServerTime
, FileInfo -> ServerTime
fileInfoDeleteAt :: ServerTime
, FileInfo -> Text
fileInfoName :: Text
, FileInfo -> Text
fileInfoExtension :: Text
, FileInfo -> Int
fileInfoSize :: Int
, FileInfo -> Text
fileInfoMimeType :: Text
, FileInfo -> Maybe Int
fileInfoWidth :: Maybe Int
, FileInfo -> Maybe Int
fileInfoHeight :: Maybe Int
, FileInfo -> Bool
fileInfoHasPreview :: Bool
} deriving (ReadPrec [FileInfo]
ReadPrec FileInfo
Int -> ReadS FileInfo
ReadS [FileInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileInfo]
$creadListPrec :: ReadPrec [FileInfo]
readPrec :: ReadPrec FileInfo
$creadPrec :: ReadPrec FileInfo
readList :: ReadS [FileInfo]
$creadList :: ReadS [FileInfo]
readsPrec :: Int -> ReadS FileInfo
$creadsPrec :: Int -> ReadS FileInfo
Read, Int -> FileInfo -> ShowS
[FileInfo] -> ShowS
FileInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileInfo] -> ShowS
$cshowList :: [FileInfo] -> ShowS
show :: FileInfo -> String
$cshow :: FileInfo -> String
showsPrec :: Int -> FileInfo -> ShowS
$cshowsPrec :: Int -> FileInfo -> ShowS
Show, FileInfo -> FileInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileInfo -> FileInfo -> Bool
$c/= :: FileInfo -> FileInfo -> Bool
== :: FileInfo -> FileInfo -> Bool
$c== :: FileInfo -> FileInfo -> Bool
Eq)
instance ToJSON FileInfo where
toJSON :: FileInfo -> Value
toJSON = forall a. HasCallStack => String -> a
error String
"file info"
instance FromJSON FileInfo where
parseJSON :: Value -> Parser FileInfo
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"file_info" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
FileId
fileInfoId <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id"
UserId
fileInfoUserId <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"user_id"
Maybe PostId
fileInfoPostId <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"post_id"
ServerTime
fileInfoCreateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"create_at"
ServerTime
fileInfoUpdateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"update_at"
ServerTime
fileInfoDeleteAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"delete_at"
Text
fileInfoName <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name"
Text
fileInfoExtension <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"extension"
Int
fileInfoSize <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"size"
Text
fileInfoMimeType <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mime_type"
Maybe Int
fileInfoWidth <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"width"
Maybe Int
fileInfoHeight <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"height"
Bool
fileInfoHasPreview <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"has_preview_image" forall a. Parser (Maybe a) -> a -> Parser a
.!= Bool
False
forall (m :: * -> *) a. Monad m => a -> m a
return FileInfo { Bool
Int
Maybe Int
Maybe PostId
Text
ServerTime
FileId
UserId
fileInfoHasPreview :: Bool
fileInfoHeight :: Maybe Int
fileInfoWidth :: Maybe Int
fileInfoMimeType :: Text
fileInfoSize :: Int
fileInfoExtension :: Text
fileInfoName :: Text
fileInfoDeleteAt :: ServerTime
fileInfoUpdateAt :: ServerTime
fileInfoCreateAt :: ServerTime
fileInfoPostId :: Maybe PostId
fileInfoUserId :: UserId
fileInfoId :: FileId
fileInfoHasPreview :: Bool
fileInfoHeight :: Maybe Int
fileInfoWidth :: Maybe Int
fileInfoMimeType :: Text
fileInfoSize :: Int
fileInfoExtension :: Text
fileInfoName :: Text
fileInfoDeleteAt :: ServerTime
fileInfoUpdateAt :: ServerTime
fileInfoCreateAt :: ServerTime
fileInfoPostId :: Maybe PostId
fileInfoUserId :: UserId
fileInfoId :: FileId
.. }
data Posts
= Posts
{ Posts -> HashMap PostId Post
postsPosts :: HM.HashMap PostId Post
, Posts -> Seq PostId
postsOrder :: Seq PostId
} deriving (ReadPrec [Posts]
ReadPrec Posts
Int -> ReadS Posts
ReadS [Posts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Posts]
$creadListPrec :: ReadPrec [Posts]
readPrec :: ReadPrec Posts
$creadPrec :: ReadPrec Posts
readList :: ReadS [Posts]
$creadList :: ReadS [Posts]
readsPrec :: Int -> ReadS Posts
$creadsPrec :: Int -> ReadS Posts
Read, Int -> Posts -> ShowS
[Posts] -> ShowS
Posts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Posts] -> ShowS
$cshowList :: [Posts] -> ShowS
show :: Posts -> String
$cshow :: Posts -> String
showsPrec :: Int -> Posts -> ShowS
$cshowsPrec :: Int -> Posts -> ShowS
Show, Posts -> Posts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Posts -> Posts -> Bool
$c/= :: Posts -> Posts -> Bool
== :: Posts -> Posts -> Bool
$c== :: Posts -> Posts -> Bool
Eq)
instance A.FromJSON Posts where
parseJSON :: Value -> Parser Posts
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Posts" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
HashMap PostId Post
postsPosts <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"posts" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall k v. HashMap k v
HM.empty
Seq PostId
postsOrder <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"order"
forall (m :: * -> *) a. Monad m => a -> m a
return Posts { HashMap PostId Post
Seq PostId
postsOrder :: Seq PostId
postsPosts :: HashMap PostId Post
postsOrder :: Seq PostId
postsPosts :: HashMap PostId Post
.. }
timeFromServer :: Integer -> ServerTime
timeFromServer :: Integer -> ServerTime
timeFromServer Integer
ms = UTCTime -> ServerTime
ServerTime forall a b. (a -> b) -> a -> b
$ POSIXTime -> UTCTime
posixSecondsToUTCTime (forall a. Fractional a => Rational -> a
fromRational (Integer
msforall a. Integral a => a -> a -> Ratio a
%Integer
1000))
timeToServer :: ServerTime -> Int
timeToServer :: ServerTime -> Int
timeToServer ServerTime
time = forall a b. (RealFrac a, Integral b) => a -> b
truncate ((UTCTime -> POSIXTime
utcTimeToPOSIXSeconds forall a b. (a -> b) -> a -> b
$ ServerTime -> UTCTime
withServerTime ServerTime
time)forall a. Num a => a -> a -> a
*POSIXTime
1000)
data MinCommand
= MinCommand
{ MinCommand -> ChannelId
minComChannelId :: ChannelId
, MinCommand -> Text
minComCommand :: Text
, MinCommand -> Maybe PostId
minComParentId :: Maybe PostId
, MinCommand -> Maybe PostId
minComRootId :: Maybe PostId
, MinCommand -> TeamId
minComTeamId :: TeamId
} deriving (ReadPrec [MinCommand]
ReadPrec MinCommand
Int -> ReadS MinCommand
ReadS [MinCommand]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MinCommand]
$creadListPrec :: ReadPrec [MinCommand]
readPrec :: ReadPrec MinCommand
$creadPrec :: ReadPrec MinCommand
readList :: ReadS [MinCommand]
$creadList :: ReadS [MinCommand]
readsPrec :: Int -> ReadS MinCommand
$creadsPrec :: Int -> ReadS MinCommand
Read, Int -> MinCommand -> ShowS
[MinCommand] -> ShowS
MinCommand -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MinCommand] -> ShowS
$cshowList :: [MinCommand] -> ShowS
show :: MinCommand -> String
$cshow :: MinCommand -> String
showsPrec :: Int -> MinCommand -> ShowS
$cshowsPrec :: Int -> MinCommand -> ShowS
Show, MinCommand -> MinCommand -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MinCommand -> MinCommand -> Bool
$c/= :: MinCommand -> MinCommand -> Bool
== :: MinCommand -> MinCommand -> Bool
$c== :: MinCommand -> MinCommand -> Bool
Eq)
instance A.ToJSON MinCommand where
toJSON :: MinCommand -> Value
toJSON MinCommand { Maybe PostId
Text
ChannelId
TeamId
minComTeamId :: TeamId
minComRootId :: Maybe PostId
minComParentId :: Maybe PostId
minComCommand :: Text
minComChannelId :: ChannelId
minComTeamId :: MinCommand -> TeamId
minComRootId :: MinCommand -> Maybe PostId
minComParentId :: MinCommand -> Maybe PostId
minComCommand :: MinCommand -> Text
minComChannelId :: MinCommand -> ChannelId
.. } = [Pair] -> Value
A.object
[ Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= ChannelId
minComChannelId
, Key
"command" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
minComCommand
, Key
"parent_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe PostId
minComParentId
, Key
"root_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe PostId
minComRootId
, Key
"team_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= TeamId
minComTeamId
]
data Command
= Command
{ Command -> Maybe CommandId
commandId :: Maybe CommandId
, Command -> Text
commandToken :: Text
, Command -> ServerTime
commandCreateAt :: ServerTime
, Command -> ServerTime
commandUpdateAt :: ServerTime
, Command -> ServerTime
commandDeleteAt :: ServerTime
, Command -> Maybe UserId
commandCreatorId :: Maybe UserId
, Command -> Maybe TeamId
commandTeamId :: Maybe TeamId
, Command -> Text
commandTrigger :: Text
, Command -> Text
commandMethod :: Text
, Command -> Text
commandUsername :: Text
, Command -> Text
commandIconURL :: Text
, Command -> Bool
commandAutoComplete :: Bool
, Command -> Text
commandAutoCompleteDesc :: Text
, Command -> Text
commandAutoCompleteHint :: Text
, Command -> Text
commandDisplayName :: Text
, Command -> Text
commandDescription :: Text
, Command -> Text
commandURL :: Text
} deriving (ReadPrec [Command]
ReadPrec Command
Int -> ReadS Command
ReadS [Command]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Command]
$creadListPrec :: ReadPrec [Command]
readPrec :: ReadPrec Command
$creadPrec :: ReadPrec Command
readList :: ReadS [Command]
$creadList :: ReadS [Command]
readsPrec :: Int -> ReadS Command
$creadsPrec :: Int -> ReadS Command
Read, Int -> Command -> ShowS
[Command] -> ShowS
Command -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Command] -> ShowS
$cshowList :: [Command] -> ShowS
show :: Command -> String
$cshow :: Command -> String
showsPrec :: Int -> Command -> ShowS
$cshowsPrec :: Int -> Command -> ShowS
Show, Command -> Command -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Command -> Command -> Bool
$c/= :: Command -> Command -> Bool
== :: Command -> Command -> Bool
$c== :: Command -> Command -> Bool
Eq)
instance A.FromJSON Command where
parseJSON :: Value -> Parser Command
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"command" forall a b. (a -> b) -> a -> b
$ \Object
o ->
Maybe CommandId
-> Text
-> ServerTime
-> ServerTime
-> ServerTime
-> Maybe UserId
-> Maybe TeamId
-> Text
-> Text
-> Text
-> Text
-> Bool
-> Text
-> Text
-> Text
-> Text
-> Text
-> Command
Command forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall a. Parser a -> Parser (Maybe a)
maybeFail forall a b. (a -> b) -> a -> b
$ Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"token"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"create_at"))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"update_at"))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"delete_at"))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall a. Parser a -> Parser (Maybe a)
maybeFail forall a b. (a -> b) -> a -> b
$ Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"creator_id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall a. Parser a -> Parser (Maybe a)
maybeFail forall a b. (a -> b) -> a -> b
$ Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"team_id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"trigger"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"method"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"username"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"icon_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"auto_complete"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"auto_complete_desc"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"auto_complete_hint"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"display_name"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"description"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"url"
instance A.ToJSON Command where toJSON :: Command -> Value
toJSON = forall a. HasCallStack => String -> a
error String
"to command"
newtype CommandId = CmdI { CommandId -> Id
unCmdI :: Id }
deriving (ReadPrec [CommandId]
ReadPrec CommandId
Int -> ReadS CommandId
ReadS [CommandId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CommandId]
$creadListPrec :: ReadPrec [CommandId]
readPrec :: ReadPrec CommandId
$creadPrec :: ReadPrec CommandId
readList :: ReadS [CommandId]
$creadList :: ReadS [CommandId]
readsPrec :: Int -> ReadS CommandId
$creadsPrec :: Int -> ReadS CommandId
Read, Int -> CommandId -> ShowS
[CommandId] -> ShowS
CommandId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandId] -> ShowS
$cshowList :: [CommandId] -> ShowS
show :: CommandId -> String
$cshow :: CommandId -> String
showsPrec :: Int -> CommandId -> ShowS
$cshowsPrec :: Int -> CommandId -> ShowS
Show, CommandId -> CommandId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandId -> CommandId -> Bool
$c/= :: CommandId -> CommandId -> Bool
== :: CommandId -> CommandId -> Bool
$c== :: CommandId -> CommandId -> Bool
Eq, Eq CommandId
CommandId -> CommandId -> Bool
CommandId -> CommandId -> Ordering
CommandId -> CommandId -> CommandId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CommandId -> CommandId -> CommandId
$cmin :: CommandId -> CommandId -> CommandId
max :: CommandId -> CommandId -> CommandId
$cmax :: CommandId -> CommandId -> CommandId
>= :: CommandId -> CommandId -> Bool
$c>= :: CommandId -> CommandId -> Bool
> :: CommandId -> CommandId -> Bool
$c> :: CommandId -> CommandId -> Bool
<= :: CommandId -> CommandId -> Bool
$c<= :: CommandId -> CommandId -> Bool
< :: CommandId -> CommandId -> Bool
$c< :: CommandId -> CommandId -> Bool
compare :: CommandId -> CommandId -> Ordering
$ccompare :: CommandId -> CommandId -> Ordering
Ord, Eq CommandId
Int -> CommandId -> Int
CommandId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CommandId -> Int
$chash :: CommandId -> Int
hashWithSalt :: Int -> CommandId -> Int
$chashWithSalt :: Int -> CommandId -> Int
Hashable, [CommandId] -> Encoding
[CommandId] -> Value
CommandId -> Encoding
CommandId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [CommandId] -> Encoding
$ctoEncodingList :: [CommandId] -> Encoding
toJSONList :: [CommandId] -> Value
$ctoJSONList :: [CommandId] -> Value
toEncoding :: CommandId -> Encoding
$ctoEncoding :: CommandId -> Encoding
toJSON :: CommandId -> Value
$ctoJSON :: CommandId -> Value
ToJSON, ToJSONKeyFunction [CommandId]
ToJSONKeyFunction CommandId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [CommandId]
$ctoJSONKeyList :: ToJSONKeyFunction [CommandId]
toJSONKey :: ToJSONKeyFunction CommandId
$ctoJSONKey :: ToJSONKeyFunction CommandId
ToJSONKey, FromJSONKeyFunction [CommandId]
FromJSONKeyFunction CommandId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [CommandId]
$cfromJSONKeyList :: FromJSONKeyFunction [CommandId]
fromJSONKey :: FromJSONKeyFunction CommandId
$cfromJSONKey :: FromJSONKeyFunction CommandId
FromJSONKey, Value -> Parser [CommandId]
Value -> Parser CommandId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [CommandId]
$cparseJSONList :: Value -> Parser [CommandId]
parseJSON :: Value -> Parser CommandId
$cparseJSON :: Value -> Parser CommandId
FromJSON)
instance IsId CommandId where
toId :: CommandId -> Id
toId = CommandId -> Id
unCmdI
fromId :: Id -> CommandId
fromId = Id -> CommandId
CmdI
instance PrintfArg CommandId where
formatArg :: CommandId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
data CommandResponseType
= CommandResponseInChannel
| CommandResponseEphemeral
deriving (ReadPrec [CommandResponseType]
ReadPrec CommandResponseType
Int -> ReadS CommandResponseType
ReadS [CommandResponseType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CommandResponseType]
$creadListPrec :: ReadPrec [CommandResponseType]
readPrec :: ReadPrec CommandResponseType
$creadPrec :: ReadPrec CommandResponseType
readList :: ReadS [CommandResponseType]
$creadList :: ReadS [CommandResponseType]
readsPrec :: Int -> ReadS CommandResponseType
$creadsPrec :: Int -> ReadS CommandResponseType
Read, Int -> CommandResponseType -> ShowS
[CommandResponseType] -> ShowS
CommandResponseType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandResponseType] -> ShowS
$cshowList :: [CommandResponseType] -> ShowS
show :: CommandResponseType -> String
$cshow :: CommandResponseType -> String
showsPrec :: Int -> CommandResponseType -> ShowS
$cshowsPrec :: Int -> CommandResponseType -> ShowS
Show, CommandResponseType -> CommandResponseType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandResponseType -> CommandResponseType -> Bool
$c/= :: CommandResponseType -> CommandResponseType -> Bool
== :: CommandResponseType -> CommandResponseType -> Bool
$c== :: CommandResponseType -> CommandResponseType -> Bool
Eq)
instance A.FromJSON CommandResponseType where
parseJSON :: Value -> Parser CommandResponseType
parseJSON (A.String Text
"in_channel") = forall (m :: * -> *) a. Monad m => a -> m a
return CommandResponseType
CommandResponseInChannel
parseJSON (A.String Text
"ephemeral") = forall (m :: * -> *) a. Monad m => a -> m a
return CommandResponseType
CommandResponseEphemeral
parseJSON Value
_ = forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Unknown command response type: expected `in_channel` or `ephemeral`"
data CommandResponse
= CommandResponse
{ CommandResponse -> Maybe CommandResponseType
commandResponseType :: Maybe CommandResponseType
, CommandResponse -> Text
commandResponseText :: Text
, CommandResponse -> Text
commandResponseUsername :: Text
, CommandResponse -> Text
commandResponseIconURL :: Text
, CommandResponse -> Text
commandResponseGotoLocation :: Text
, CommandResponse -> Seq PostPropAttachment
commandResponseAttachments :: Seq PostPropAttachment
} deriving (ReadPrec [CommandResponse]
ReadPrec CommandResponse
Int -> ReadS CommandResponse
ReadS [CommandResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CommandResponse]
$creadListPrec :: ReadPrec [CommandResponse]
readPrec :: ReadPrec CommandResponse
$creadPrec :: ReadPrec CommandResponse
readList :: ReadS [CommandResponse]
$creadList :: ReadS [CommandResponse]
readsPrec :: Int -> ReadS CommandResponse
$creadsPrec :: Int -> ReadS CommandResponse
Read, Int -> CommandResponse -> ShowS
[CommandResponse] -> ShowS
CommandResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandResponse] -> ShowS
$cshowList :: [CommandResponse] -> ShowS
show :: CommandResponse -> String
$cshow :: CommandResponse -> String
showsPrec :: Int -> CommandResponse -> ShowS
$cshowsPrec :: Int -> CommandResponse -> ShowS
Show, CommandResponse -> CommandResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandResponse -> CommandResponse -> Bool
$c/= :: CommandResponse -> CommandResponse -> Bool
== :: CommandResponse -> CommandResponse -> Bool
$c== :: CommandResponse -> CommandResponse -> Bool
Eq)
instance A.FromJSON CommandResponse where
parseJSON :: Value -> Parser CommandResponse
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"CommandResponse" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe CommandResponseType
commandResponseType <- forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"response_type")
Text
commandResponseText <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"text"
Text
commandResponseUsername <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"username"
Text
commandResponseIconURL <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"icon_url"
Text
commandResponseGotoLocation <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"goto_location"
Seq PostPropAttachment
commandResponseAttachments <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"attachments" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. Seq a
S.empty
forall (m :: * -> *) a. Monad m => a -> m a
return CommandResponse { Maybe CommandResponseType
Text
Seq PostPropAttachment
commandResponseAttachments :: Seq PostPropAttachment
commandResponseGotoLocation :: Text
commandResponseIconURL :: Text
commandResponseUsername :: Text
commandResponseText :: Text
commandResponseType :: Maybe CommandResponseType
commandResponseAttachments :: Seq PostPropAttachment
commandResponseGotoLocation :: Text
commandResponseIconURL :: Text
commandResponseUsername :: Text
commandResponseText :: Text
commandResponseType :: Maybe CommandResponseType
.. }
data UsersCreate
= UsersCreate
{ UsersCreate -> Text
usersCreateEmail :: Text
, UsersCreate -> Text
usersCreatePassword :: Text
, UsersCreate -> Text
usersCreateUsername :: Text
, UsersCreate -> Bool
usersCreateAllowMarketing :: Bool
} deriving (ReadPrec [UsersCreate]
ReadPrec UsersCreate
Int -> ReadS UsersCreate
ReadS [UsersCreate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsersCreate]
$creadListPrec :: ReadPrec [UsersCreate]
readPrec :: ReadPrec UsersCreate
$creadPrec :: ReadPrec UsersCreate
readList :: ReadS [UsersCreate]
$creadList :: ReadS [UsersCreate]
readsPrec :: Int -> ReadS UsersCreate
$creadsPrec :: Int -> ReadS UsersCreate
Read, Int -> UsersCreate -> ShowS
[UsersCreate] -> ShowS
UsersCreate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsersCreate] -> ShowS
$cshowList :: [UsersCreate] -> ShowS
show :: UsersCreate -> String
$cshow :: UsersCreate -> String
showsPrec :: Int -> UsersCreate -> ShowS
$cshowsPrec :: Int -> UsersCreate -> ShowS
Show, UsersCreate -> UsersCreate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsersCreate -> UsersCreate -> Bool
$c/= :: UsersCreate -> UsersCreate -> Bool
== :: UsersCreate -> UsersCreate -> Bool
$c== :: UsersCreate -> UsersCreate -> Bool
Eq)
instance A.ToJSON UsersCreate where
toJSON :: UsersCreate -> Value
toJSON UsersCreate { Bool
Text
usersCreateAllowMarketing :: Bool
usersCreateUsername :: Text
usersCreatePassword :: Text
usersCreateEmail :: Text
usersCreateAllowMarketing :: UsersCreate -> Bool
usersCreateUsername :: UsersCreate -> Text
usersCreatePassword :: UsersCreate -> Text
usersCreateEmail :: UsersCreate -> Text
.. } = [Pair] -> Value
A.object
[ Key
"email" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
usersCreateEmail
, Key
"allow_marketing" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Bool
usersCreateAllowMarketing
, Key
"password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
usersCreatePassword
, Key
"username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
usersCreateUsername
]
data TeamsCreate
= TeamsCreate
{ TeamsCreate -> Text
teamsCreateDisplayName :: Text
, TeamsCreate -> Text
teamsCreateName :: Text
, TeamsCreate -> Type
teamsCreateType :: Type
} deriving (ReadPrec [TeamsCreate]
ReadPrec TeamsCreate
Int -> ReadS TeamsCreate
ReadS [TeamsCreate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TeamsCreate]
$creadListPrec :: ReadPrec [TeamsCreate]
readPrec :: ReadPrec TeamsCreate
$creadPrec :: ReadPrec TeamsCreate
readList :: ReadS [TeamsCreate]
$creadList :: ReadS [TeamsCreate]
readsPrec :: Int -> ReadS TeamsCreate
$creadsPrec :: Int -> ReadS TeamsCreate
Read, Int -> TeamsCreate -> ShowS
[TeamsCreate] -> ShowS
TeamsCreate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TeamsCreate] -> ShowS
$cshowList :: [TeamsCreate] -> ShowS
show :: TeamsCreate -> String
$cshow :: TeamsCreate -> String
showsPrec :: Int -> TeamsCreate -> ShowS
$cshowsPrec :: Int -> TeamsCreate -> ShowS
Show, TeamsCreate -> TeamsCreate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TeamsCreate -> TeamsCreate -> Bool
$c/= :: TeamsCreate -> TeamsCreate -> Bool
== :: TeamsCreate -> TeamsCreate -> Bool
$c== :: TeamsCreate -> TeamsCreate -> Bool
Eq)
instance A.ToJSON TeamsCreate where
toJSON :: TeamsCreate -> Value
toJSON TeamsCreate { Text
Type
teamsCreateType :: Type
teamsCreateName :: Text
teamsCreateDisplayName :: Text
teamsCreateType :: TeamsCreate -> Type
teamsCreateName :: TeamsCreate -> Text
teamsCreateDisplayName :: TeamsCreate -> Text
.. } = [Pair] -> Value
A.object
[ Key
"display_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
teamsCreateDisplayName
, Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
teamsCreateName
, Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Type
teamsCreateType
]
data Reaction
= Reaction
{ Reaction -> UserId
reactionUserId :: UserId
, Reaction -> PostId
reactionPostId :: PostId
, Reaction -> Text
reactionEmojiName :: Text
, Reaction -> ServerTime
reactionCreateAt :: ServerTime
} deriving (ReadPrec [Reaction]
ReadPrec Reaction
Int -> ReadS Reaction
ReadS [Reaction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Reaction]
$creadListPrec :: ReadPrec [Reaction]
readPrec :: ReadPrec Reaction
$creadPrec :: ReadPrec Reaction
readList :: ReadS [Reaction]
$creadList :: ReadS [Reaction]
readsPrec :: Int -> ReadS Reaction
$creadsPrec :: Int -> ReadS Reaction
Read, Int -> Reaction -> ShowS
[Reaction] -> ShowS
Reaction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Reaction] -> ShowS
$cshowList :: [Reaction] -> ShowS
show :: Reaction -> String
$cshow :: Reaction -> String
showsPrec :: Int -> Reaction -> ShowS
$cshowsPrec :: Int -> Reaction -> ShowS
Show, Reaction -> Reaction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Reaction -> Reaction -> Bool
$c/= :: Reaction -> Reaction -> Bool
== :: Reaction -> Reaction -> Bool
$c== :: Reaction -> Reaction -> Bool
Eq)
instance A.FromJSON Reaction where
parseJSON :: Value -> Parser Reaction
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Reaction" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
UserId
reactionUserId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"user_id"
PostId
reactionPostId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"post_id"
Text
reactionEmojiName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"emoji_name"
ServerTime
reactionCreateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"create_at"
forall (m :: * -> *) a. Monad m => a -> m a
return Reaction { Text
ServerTime
PostId
UserId
reactionCreateAt :: ServerTime
reactionEmojiName :: Text
reactionPostId :: PostId
reactionUserId :: UserId
reactionCreateAt :: ServerTime
reactionEmojiName :: Text
reactionPostId :: PostId
reactionUserId :: UserId
.. }
instance A.ToJSON Reaction where
toJSON :: Reaction -> Value
toJSON Reaction {Text
ServerTime
PostId
UserId
reactionCreateAt :: ServerTime
reactionEmojiName :: Text
reactionPostId :: PostId
reactionUserId :: UserId
reactionCreateAt :: Reaction -> ServerTime
reactionEmojiName :: Reaction -> Text
reactionPostId :: Reaction -> PostId
reactionUserId :: Reaction -> UserId
.. } = [Pair] -> Value
A.object
[ Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= UserId
reactionUserId
, Key
"post_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PostId
reactionPostId
, Key
"emoji_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
reactionEmojiName
, Key
"create_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= ServerTime -> Int
timeToServer ServerTime
reactionCreateAt
]
data PreferenceCategory
= PreferenceCategoryDirectChannelShow
| PreferenceCategoryGroupChannelShow
| PreferenceCategoryFavoriteChannel
| PreferenceCategoryTutorialStep
| PreferenceCategoryAdvancedSettings
| PreferenceCategoryFlaggedPost
| PreferenceCategoryDisplaySettings
| PreferenceCategoryTheme
| PreferenceCategoryAuthorizedOAuthApp
| PreferenceCategoryNotifications
| PreferenceCategoryLast
| PreferenceCategoryTeamsOrder
| PreferenceCategoryOther Text
deriving (ReadPrec [PreferenceCategory]
ReadPrec PreferenceCategory
Int -> ReadS PreferenceCategory
ReadS [PreferenceCategory]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PreferenceCategory]
$creadListPrec :: ReadPrec [PreferenceCategory]
readPrec :: ReadPrec PreferenceCategory
$creadPrec :: ReadPrec PreferenceCategory
readList :: ReadS [PreferenceCategory]
$creadList :: ReadS [PreferenceCategory]
readsPrec :: Int -> ReadS PreferenceCategory
$creadsPrec :: Int -> ReadS PreferenceCategory
Read, Int -> PreferenceCategory -> ShowS
[PreferenceCategory] -> ShowS
PreferenceCategory -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PreferenceCategory] -> ShowS
$cshowList :: [PreferenceCategory] -> ShowS
show :: PreferenceCategory -> String
$cshow :: PreferenceCategory -> String
showsPrec :: Int -> PreferenceCategory -> ShowS
$cshowsPrec :: Int -> PreferenceCategory -> ShowS
Show, PreferenceCategory -> PreferenceCategory -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PreferenceCategory -> PreferenceCategory -> Bool
$c/= :: PreferenceCategory -> PreferenceCategory -> Bool
== :: PreferenceCategory -> PreferenceCategory -> Bool
$c== :: PreferenceCategory -> PreferenceCategory -> Bool
Eq)
instance A.FromJSON PreferenceCategory where
parseJSON :: Value -> Parser PreferenceCategory
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"PreferenceCategory" forall a b. (a -> b) -> a -> b
$ \Text
t -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ case Text
t of
Text
"direct_channel_show" -> PreferenceCategory
PreferenceCategoryDirectChannelShow
Text
"group_channel_show" -> PreferenceCategory
PreferenceCategoryGroupChannelShow
Text
"favorite_channel" -> PreferenceCategory
PreferenceCategoryFavoriteChannel
Text
"tutorial_step" -> PreferenceCategory
PreferenceCategoryTutorialStep
Text
"advanced_settings" -> PreferenceCategory
PreferenceCategoryAdvancedSettings
Text
"flagged_post" -> PreferenceCategory
PreferenceCategoryFlaggedPost
Text
"display_settings" -> PreferenceCategory
PreferenceCategoryDisplaySettings
Text
"theme" -> PreferenceCategory
PreferenceCategoryTheme
Text
"oauth_app" -> PreferenceCategory
PreferenceCategoryAuthorizedOAuthApp
Text
"notifications" -> PreferenceCategory
PreferenceCategoryNotifications
Text
"last" -> PreferenceCategory
PreferenceCategoryLast
Text
"teams_order" -> PreferenceCategory
PreferenceCategoryTeamsOrder
Text
_ -> Text -> PreferenceCategory
PreferenceCategoryOther Text
t
instance A.ToJSON PreferenceCategory where
toJSON :: PreferenceCategory -> Value
toJSON PreferenceCategory
cat = Text -> Value
A.String forall a b. (a -> b) -> a -> b
$ case PreferenceCategory
cat of
PreferenceCategory
PreferenceCategoryDirectChannelShow -> Text
"direct_channel_show"
PreferenceCategory
PreferenceCategoryGroupChannelShow -> Text
"group_channel_show"
PreferenceCategory
PreferenceCategoryFavoriteChannel -> Text
"favorite_channel"
PreferenceCategory
PreferenceCategoryTutorialStep -> Text
"tutorial_step"
PreferenceCategory
PreferenceCategoryAdvancedSettings -> Text
"advanced_settings"
PreferenceCategory
PreferenceCategoryFlaggedPost -> Text
"flagged_post"
PreferenceCategory
PreferenceCategoryDisplaySettings -> Text
"display_settings"
PreferenceCategory
PreferenceCategoryTheme -> Text
"theme"
PreferenceCategory
PreferenceCategoryAuthorizedOAuthApp -> Text
"oauth_app"
PreferenceCategory
PreferenceCategoryNotifications -> Text
"notifications"
PreferenceCategory
PreferenceCategoryLast -> Text
"last"
PreferenceCategory
PreferenceCategoryTeamsOrder -> Text
"teams_order"
PreferenceCategoryOther Text
t -> Text
t
data PreferenceName
= PreferenceName { PreferenceName -> Text
fromRawPreferenceName :: Text }
deriving (ReadPrec [PreferenceName]
ReadPrec PreferenceName
Int -> ReadS PreferenceName
ReadS [PreferenceName]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PreferenceName]
$creadListPrec :: ReadPrec [PreferenceName]
readPrec :: ReadPrec PreferenceName
$creadPrec :: ReadPrec PreferenceName
readList :: ReadS [PreferenceName]
$creadList :: ReadS [PreferenceName]
readsPrec :: Int -> ReadS PreferenceName
$creadsPrec :: Int -> ReadS PreferenceName
Read, Int -> PreferenceName -> ShowS
[PreferenceName] -> ShowS
PreferenceName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PreferenceName] -> ShowS
$cshowList :: [PreferenceName] -> ShowS
show :: PreferenceName -> String
$cshow :: PreferenceName -> String
showsPrec :: Int -> PreferenceName -> ShowS
$cshowsPrec :: Int -> PreferenceName -> ShowS
Show, PreferenceName -> PreferenceName -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PreferenceName -> PreferenceName -> Bool
$c/= :: PreferenceName -> PreferenceName -> Bool
== :: PreferenceName -> PreferenceName -> Bool
$c== :: PreferenceName -> PreferenceName -> Bool
Eq)
instance A.FromJSON PreferenceName where
parseJSON :: Value -> Parser PreferenceName
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"PreferenceName" (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> PreferenceName
PreferenceName)
instance A.ToJSON PreferenceName where
toJSON :: PreferenceName -> Value
toJSON = forall a. ToJSON a => a -> Value
A.toJSON forall b c a. (b -> c) -> (a -> b) -> a -> c
. PreferenceName -> Text
fromRawPreferenceName
data PreferenceValue
= PreferenceValue { PreferenceValue -> Text
fromRawPreferenceValue :: Text }
deriving (ReadPrec [PreferenceValue]
ReadPrec PreferenceValue
Int -> ReadS PreferenceValue
ReadS [PreferenceValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PreferenceValue]
$creadListPrec :: ReadPrec [PreferenceValue]
readPrec :: ReadPrec PreferenceValue
$creadPrec :: ReadPrec PreferenceValue
readList :: ReadS [PreferenceValue]
$creadList :: ReadS [PreferenceValue]
readsPrec :: Int -> ReadS PreferenceValue
$creadsPrec :: Int -> ReadS PreferenceValue
Read, Int -> PreferenceValue -> ShowS
[PreferenceValue] -> ShowS
PreferenceValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PreferenceValue] -> ShowS
$cshowList :: [PreferenceValue] -> ShowS
show :: PreferenceValue -> String
$cshow :: PreferenceValue -> String
showsPrec :: Int -> PreferenceValue -> ShowS
$cshowsPrec :: Int -> PreferenceValue -> ShowS
Show, PreferenceValue -> PreferenceValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PreferenceValue -> PreferenceValue -> Bool
$c/= :: PreferenceValue -> PreferenceValue -> Bool
== :: PreferenceValue -> PreferenceValue -> Bool
$c== :: PreferenceValue -> PreferenceValue -> Bool
Eq)
instance A.FromJSON PreferenceValue where
parseJSON :: Value -> Parser PreferenceValue
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
A.withText String
"PreferenceValue" (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> PreferenceValue
PreferenceValue)
instance A.ToJSON PreferenceValue where
toJSON :: PreferenceValue -> Value
toJSON = forall a. ToJSON a => a -> Value
A.toJSON forall b c a. (b -> c) -> (a -> b) -> a -> c
. PreferenceValue -> Text
fromRawPreferenceValue
data Preference
= Preference
{ Preference -> UserId
preferenceUserId :: UserId
, Preference -> PreferenceCategory
preferenceCategory :: PreferenceCategory
, Preference -> PreferenceName
preferenceName :: PreferenceName
, Preference -> PreferenceValue
preferenceValue :: PreferenceValue
} deriving (ReadPrec [Preference]
ReadPrec Preference
Int -> ReadS Preference
ReadS [Preference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Preference]
$creadListPrec :: ReadPrec [Preference]
readPrec :: ReadPrec Preference
$creadPrec :: ReadPrec Preference
readList :: ReadS [Preference]
$creadList :: ReadS [Preference]
readsPrec :: Int -> ReadS Preference
$creadsPrec :: Int -> ReadS Preference
Read, Int -> Preference -> ShowS
[Preference] -> ShowS
Preference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Preference] -> ShowS
$cshowList :: [Preference] -> ShowS
show :: Preference -> String
$cshow :: Preference -> String
showsPrec :: Int -> Preference -> ShowS
$cshowsPrec :: Int -> Preference -> ShowS
Show, Preference -> Preference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Preference -> Preference -> Bool
$c/= :: Preference -> Preference -> Bool
== :: Preference -> Preference -> Bool
$c== :: Preference -> Preference -> Bool
Eq)
instance A.FromJSON Preference where
parseJSON :: Value -> Parser Preference
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Preference" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
UserId
preferenceUserId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"user_id"
PreferenceCategory
preferenceCategory <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"category"
PreferenceName
preferenceName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name"
PreferenceValue
preferenceValue <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"value"
forall (m :: * -> *) a. Monad m => a -> m a
return Preference { PreferenceValue
PreferenceName
PreferenceCategory
UserId
preferenceValue :: PreferenceValue
preferenceName :: PreferenceName
preferenceCategory :: PreferenceCategory
preferenceUserId :: UserId
preferenceValue :: PreferenceValue
preferenceName :: PreferenceName
preferenceCategory :: PreferenceCategory
preferenceUserId :: UserId
.. }
instance A.ToJSON Preference where
toJSON :: Preference -> Value
toJSON Preference { PreferenceValue
PreferenceName
PreferenceCategory
UserId
preferenceValue :: PreferenceValue
preferenceName :: PreferenceName
preferenceCategory :: PreferenceCategory
preferenceUserId :: UserId
preferenceValue :: Preference -> PreferenceValue
preferenceName :: Preference -> PreferenceName
preferenceCategory :: Preference -> PreferenceCategory
preferenceUserId :: Preference -> UserId
.. } = [Pair] -> Value
A.object
[ Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= UserId
preferenceUserId
, Key
"category" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PreferenceCategory
preferenceCategory
, Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PreferenceName
preferenceName
, Key
"value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= PreferenceValue
preferenceValue
]
data FavoriteChannelPreference =
FavoriteChannelPreference { FavoriteChannelPreference -> ChannelId
favoriteChannelId :: ChannelId
, FavoriteChannelPreference -> Bool
favoriteChannelShow :: Bool
} deriving (ReadPrec [FavoriteChannelPreference]
ReadPrec FavoriteChannelPreference
Int -> ReadS FavoriteChannelPreference
ReadS [FavoriteChannelPreference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FavoriteChannelPreference]
$creadListPrec :: ReadPrec [FavoriteChannelPreference]
readPrec :: ReadPrec FavoriteChannelPreference
$creadPrec :: ReadPrec FavoriteChannelPreference
readList :: ReadS [FavoriteChannelPreference]
$creadList :: ReadS [FavoriteChannelPreference]
readsPrec :: Int -> ReadS FavoriteChannelPreference
$creadsPrec :: Int -> ReadS FavoriteChannelPreference
Read, Int -> FavoriteChannelPreference -> ShowS
[FavoriteChannelPreference] -> ShowS
FavoriteChannelPreference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FavoriteChannelPreference] -> ShowS
$cshowList :: [FavoriteChannelPreference] -> ShowS
show :: FavoriteChannelPreference -> String
$cshow :: FavoriteChannelPreference -> String
showsPrec :: Int -> FavoriteChannelPreference -> ShowS
$cshowsPrec :: Int -> FavoriteChannelPreference -> ShowS
Show, FavoriteChannelPreference -> FavoriteChannelPreference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FavoriteChannelPreference -> FavoriteChannelPreference -> Bool
$c/= :: FavoriteChannelPreference -> FavoriteChannelPreference -> Bool
== :: FavoriteChannelPreference -> FavoriteChannelPreference -> Bool
$c== :: FavoriteChannelPreference -> FavoriteChannelPreference -> Bool
Eq)
preferenceToFavoriteChannelPreference :: Preference -> Maybe FavoriteChannelPreference
preferenceToFavoriteChannelPreference :: Preference -> Maybe FavoriteChannelPreference
preferenceToFavoriteChannelPreference
Preference
{ preferenceCategory :: Preference -> PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryFavoriteChannel
, preferenceName :: Preference -> PreferenceName
preferenceName = PreferenceName Text
name
, preferenceValue :: Preference -> PreferenceValue
preferenceValue = PreferenceValue Text
value
} = forall a. a -> Maybe a
Just FavoriteChannelPreference
{ favoriteChannelId :: ChannelId
favoriteChannelId = Id -> ChannelId
CI (Text -> Id
Id Text
name)
, favoriteChannelShow :: Bool
favoriteChannelShow = Text
value forall a. Eq a => a -> a -> Bool
== Text
"true"
}
preferenceToFavoriteChannelPreference Preference
_ = forall a. Maybe a
Nothing
data GroupChannelPreference =
GroupChannelPreference { GroupChannelPreference -> ChannelId
groupChannelId :: ChannelId
, GroupChannelPreference -> Bool
groupChannelShow :: Bool
} deriving (ReadPrec [GroupChannelPreference]
ReadPrec GroupChannelPreference
Int -> ReadS GroupChannelPreference
ReadS [GroupChannelPreference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GroupChannelPreference]
$creadListPrec :: ReadPrec [GroupChannelPreference]
readPrec :: ReadPrec GroupChannelPreference
$creadPrec :: ReadPrec GroupChannelPreference
readList :: ReadS [GroupChannelPreference]
$creadList :: ReadS [GroupChannelPreference]
readsPrec :: Int -> ReadS GroupChannelPreference
$creadsPrec :: Int -> ReadS GroupChannelPreference
Read, Int -> GroupChannelPreference -> ShowS
[GroupChannelPreference] -> ShowS
GroupChannelPreference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupChannelPreference] -> ShowS
$cshowList :: [GroupChannelPreference] -> ShowS
show :: GroupChannelPreference -> String
$cshow :: GroupChannelPreference -> String
showsPrec :: Int -> GroupChannelPreference -> ShowS
$cshowsPrec :: Int -> GroupChannelPreference -> ShowS
Show, GroupChannelPreference -> GroupChannelPreference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupChannelPreference -> GroupChannelPreference -> Bool
$c/= :: GroupChannelPreference -> GroupChannelPreference -> Bool
== :: GroupChannelPreference -> GroupChannelPreference -> Bool
$c== :: GroupChannelPreference -> GroupChannelPreference -> Bool
Eq)
preferenceToGroupChannelPreference :: Preference -> Maybe GroupChannelPreference
preferenceToGroupChannelPreference :: Preference -> Maybe GroupChannelPreference
preferenceToGroupChannelPreference
Preference
{ preferenceCategory :: Preference -> PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryGroupChannelShow
, preferenceName :: Preference -> PreferenceName
preferenceName = PreferenceName Text
name
, preferenceValue :: Preference -> PreferenceValue
preferenceValue = PreferenceValue Text
value
} = forall a. a -> Maybe a
Just GroupChannelPreference
{ groupChannelId :: ChannelId
groupChannelId = Id -> ChannelId
CI (Text -> Id
Id Text
name)
, groupChannelShow :: Bool
groupChannelShow = Text
value forall a. Eq a => a -> a -> Bool
== Text
"true"
}
preferenceToGroupChannelPreference Preference
_ = forall a. Maybe a
Nothing
data FlaggedPost = FlaggedPost
{ FlaggedPost -> UserId
flaggedPostUserId :: UserId
, FlaggedPost -> PostId
flaggedPostId :: PostId
, FlaggedPost -> Bool
flaggedPostStatus :: Bool
} deriving (ReadPrec [FlaggedPost]
ReadPrec FlaggedPost
Int -> ReadS FlaggedPost
ReadS [FlaggedPost]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlaggedPost]
$creadListPrec :: ReadPrec [FlaggedPost]
readPrec :: ReadPrec FlaggedPost
$creadPrec :: ReadPrec FlaggedPost
readList :: ReadS [FlaggedPost]
$creadList :: ReadS [FlaggedPost]
readsPrec :: Int -> ReadS FlaggedPost
$creadsPrec :: Int -> ReadS FlaggedPost
Read, Int -> FlaggedPost -> ShowS
[FlaggedPost] -> ShowS
FlaggedPost -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlaggedPost] -> ShowS
$cshowList :: [FlaggedPost] -> ShowS
show :: FlaggedPost -> String
$cshow :: FlaggedPost -> String
showsPrec :: Int -> FlaggedPost -> ShowS
$cshowsPrec :: Int -> FlaggedPost -> ShowS
Show, FlaggedPost -> FlaggedPost -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlaggedPost -> FlaggedPost -> Bool
$c/= :: FlaggedPost -> FlaggedPost -> Bool
== :: FlaggedPost -> FlaggedPost -> Bool
$c== :: FlaggedPost -> FlaggedPost -> Bool
Eq)
data DirectChannelShowStatus =
DirectChannelShowStatus { DirectChannelShowStatus -> UserId
directChannelShowUserId :: UserId
, DirectChannelShowStatus -> Bool
directChannelShowValue :: Bool
}
hideGroupChannelPref :: ChannelId -> UserId -> Preference
hideGroupChannelPref :: ChannelId -> UserId -> Preference
hideGroupChannelPref ChannelId
cId UserId
uId =
Preference { preferenceCategory :: PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryGroupChannelShow
, preferenceValue :: PreferenceValue
preferenceValue = Text -> PreferenceValue
PreferenceValue Text
"false"
, preferenceName :: PreferenceName
preferenceName = Text -> PreferenceName
PreferenceName forall a b. (a -> b) -> a -> b
$ forall x. IsId x => x -> Text
idString ChannelId
cId
, preferenceUserId :: UserId
preferenceUserId = UserId
uId
}
showGroupChannelPref :: ChannelId -> UserId -> Preference
showGroupChannelPref :: ChannelId -> UserId -> Preference
showGroupChannelPref ChannelId
cId UserId
uId =
Preference { preferenceCategory :: PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryGroupChannelShow
, preferenceValue :: PreferenceValue
preferenceValue = Text -> PreferenceValue
PreferenceValue Text
"true"
, preferenceName :: PreferenceName
preferenceName = Text -> PreferenceName
PreferenceName forall a b. (a -> b) -> a -> b
$ forall x. IsId x => x -> Text
idString ChannelId
cId
, preferenceUserId :: UserId
preferenceUserId = UserId
uId
}
showDirectChannelPref :: UserId -> UserId -> Bool -> Preference
showDirectChannelPref :: UserId -> UserId -> Bool -> Preference
showDirectChannelPref UserId
myId UserId
otherId Bool
s =
Preference { preferenceCategory :: PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryDirectChannelShow
, preferenceValue :: PreferenceValue
preferenceValue = if Bool
s then Text -> PreferenceValue
PreferenceValue Text
"true"
else Text -> PreferenceValue
PreferenceValue Text
"false"
, preferenceName :: PreferenceName
preferenceName = Text -> PreferenceName
PreferenceName forall a b. (a -> b) -> a -> b
$ forall x. IsId x => x -> Text
idString UserId
otherId
, preferenceUserId :: UserId
preferenceUserId = UserId
myId
}
preferenceToTeamOrder :: Preference -> Maybe [TeamId]
preferenceToTeamOrder :: Preference -> Maybe [TeamId]
preferenceToTeamOrder
Preference
{ preferenceCategory :: Preference -> PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryTeamsOrder
, preferenceName :: Preference -> PreferenceName
preferenceName = PreferenceName Text
""
, preferenceValue :: Preference -> PreferenceValue
preferenceValue = PreferenceValue Text
value
} = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ (Id -> TeamId
TI forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Id
Id) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> Text -> [Text]
T.splitOn Text
"," Text
value
preferenceToTeamOrder Preference
_ = forall a. Maybe a
Nothing
teamOrderPref :: UserId -> [TeamId] -> Preference
teamOrderPref :: UserId -> [TeamId] -> Preference
teamOrderPref UserId
myId [TeamId]
tIds =
Preference { preferenceCategory :: PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryTeamsOrder
, preferenceValue :: PreferenceValue
preferenceValue = Text -> PreferenceValue
PreferenceValue forall a b. (a -> b) -> a -> b
$ Text -> [Text] -> Text
T.intercalate Text
"," forall a b. (a -> b) -> a -> b
$ (Id -> Text
unId forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TeamId -> Id
unTI forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [TeamId]
tIds)
, preferenceName :: PreferenceName
preferenceName = Text -> PreferenceName
PreferenceName Text
""
, preferenceUserId :: UserId
preferenceUserId = UserId
myId
}
preferenceToDirectChannelShowStatus :: Preference -> Maybe DirectChannelShowStatus
preferenceToDirectChannelShowStatus :: Preference -> Maybe DirectChannelShowStatus
preferenceToDirectChannelShowStatus
Preference
{ preferenceCategory :: Preference -> PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryDirectChannelShow
, preferenceName :: Preference -> PreferenceName
preferenceName = PreferenceName Text
name
, preferenceValue :: Preference -> PreferenceValue
preferenceValue = PreferenceValue Text
value
} = forall a. a -> Maybe a
Just DirectChannelShowStatus
{ directChannelShowUserId :: UserId
directChannelShowUserId = Id -> UserId
UI (Text -> Id
Id Text
name)
, directChannelShowValue :: Bool
directChannelShowValue = Text
value forall a. Eq a => a -> a -> Bool
== Text
"true"
}
preferenceToDirectChannelShowStatus Preference
_ = forall a. Maybe a
Nothing
preferenceToFlaggedPost :: Preference -> Maybe FlaggedPost
preferenceToFlaggedPost :: Preference -> Maybe FlaggedPost
preferenceToFlaggedPost
Preference
{ preferenceCategory :: Preference -> PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryFlaggedPost
, preferenceName :: Preference -> PreferenceName
preferenceName = PreferenceName Text
name
, preferenceValue :: Preference -> PreferenceValue
preferenceValue = PreferenceValue Text
value
, preferenceUserId :: Preference -> UserId
preferenceUserId = UserId
userId
} = forall a. a -> Maybe a
Just FlaggedPost
{ flaggedPostUserId :: UserId
flaggedPostUserId = UserId
userId
, flaggedPostId :: PostId
flaggedPostId = Id -> PostId
PI (Text -> Id
Id Text
name)
, flaggedPostStatus :: Bool
flaggedPostStatus = Text
value forall a. Eq a => a -> a -> Bool
== Text
"true"
}
preferenceToFlaggedPost Preference
_ = forall a. Maybe a
Nothing
instance A.ToJSON FlaggedPost where
toJSON :: FlaggedPost -> Value
toJSON FlaggedPost
{ flaggedPostUserId :: FlaggedPost -> UserId
flaggedPostUserId = UserId
userId
, flaggedPostId :: FlaggedPost -> PostId
flaggedPostId = PI (Id Text
name)
, flaggedPostStatus :: FlaggedPost -> Bool
flaggedPostStatus = Bool
status
} = forall a. ToJSON a => a -> Value
A.toJSON forall a b. (a -> b) -> a -> b
$ Preference
{ preferenceCategory :: PreferenceCategory
preferenceCategory = PreferenceCategory
PreferenceCategoryFlaggedPost
, preferenceName :: PreferenceName
preferenceName = Text -> PreferenceName
PreferenceName Text
name
, preferenceValue :: PreferenceValue
preferenceValue = Text -> PreferenceValue
PreferenceValue (if Bool
status then Text
"true" else Text
"false")
, preferenceUserId :: UserId
preferenceUserId = UserId
userId
}
newtype HookId = HI { HookId -> Id
unHI :: Id }
deriving (ReadPrec [HookId]
ReadPrec HookId
Int -> ReadS HookId
ReadS [HookId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HookId]
$creadListPrec :: ReadPrec [HookId]
readPrec :: ReadPrec HookId
$creadPrec :: ReadPrec HookId
readList :: ReadS [HookId]
$creadList :: ReadS [HookId]
readsPrec :: Int -> ReadS HookId
$creadsPrec :: Int -> ReadS HookId
Read, Int -> HookId -> ShowS
[HookId] -> ShowS
HookId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HookId] -> ShowS
$cshowList :: [HookId] -> ShowS
show :: HookId -> String
$cshow :: HookId -> String
showsPrec :: Int -> HookId -> ShowS
$cshowsPrec :: Int -> HookId -> ShowS
Show, HookId -> HookId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HookId -> HookId -> Bool
$c/= :: HookId -> HookId -> Bool
== :: HookId -> HookId -> Bool
$c== :: HookId -> HookId -> Bool
Eq, Eq HookId
HookId -> HookId -> Bool
HookId -> HookId -> Ordering
HookId -> HookId -> HookId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: HookId -> HookId -> HookId
$cmin :: HookId -> HookId -> HookId
max :: HookId -> HookId -> HookId
$cmax :: HookId -> HookId -> HookId
>= :: HookId -> HookId -> Bool
$c>= :: HookId -> HookId -> Bool
> :: HookId -> HookId -> Bool
$c> :: HookId -> HookId -> Bool
<= :: HookId -> HookId -> Bool
$c<= :: HookId -> HookId -> Bool
< :: HookId -> HookId -> Bool
$c< :: HookId -> HookId -> Bool
compare :: HookId -> HookId -> Ordering
$ccompare :: HookId -> HookId -> Ordering
Ord, Eq HookId
Int -> HookId -> Int
HookId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: HookId -> Int
$chash :: HookId -> Int
hashWithSalt :: Int -> HookId -> Int
$chashWithSalt :: Int -> HookId -> Int
Hashable, [HookId] -> Encoding
[HookId] -> Value
HookId -> Encoding
HookId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [HookId] -> Encoding
$ctoEncodingList :: [HookId] -> Encoding
toJSONList :: [HookId] -> Value
$ctoJSONList :: [HookId] -> Value
toEncoding :: HookId -> Encoding
$ctoEncoding :: HookId -> Encoding
toJSON :: HookId -> Value
$ctoJSON :: HookId -> Value
ToJSON, ToJSONKeyFunction [HookId]
ToJSONKeyFunction HookId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [HookId]
$ctoJSONKeyList :: ToJSONKeyFunction [HookId]
toJSONKey :: ToJSONKeyFunction HookId
$ctoJSONKey :: ToJSONKeyFunction HookId
ToJSONKey, FromJSONKeyFunction [HookId]
FromJSONKeyFunction HookId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [HookId]
$cfromJSONKeyList :: FromJSONKeyFunction [HookId]
fromJSONKey :: FromJSONKeyFunction HookId
$cfromJSONKey :: FromJSONKeyFunction HookId
FromJSONKey, Value -> Parser [HookId]
Value -> Parser HookId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [HookId]
$cparseJSONList :: Value -> Parser [HookId]
parseJSON :: Value -> Parser HookId
$cparseJSON :: Value -> Parser HookId
FromJSON)
instance IsId HookId where
toId :: HookId -> Id
toId = HookId -> Id
unHI
fromId :: Id -> HookId
fromId = Id -> HookId
HI
instance PrintfArg HookId where
formatArg :: HookId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
newtype InviteId = II { InviteId -> Id
unII :: Id }
deriving (ReadPrec [InviteId]
ReadPrec InviteId
Int -> ReadS InviteId
ReadS [InviteId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InviteId]
$creadListPrec :: ReadPrec [InviteId]
readPrec :: ReadPrec InviteId
$creadPrec :: ReadPrec InviteId
readList :: ReadS [InviteId]
$creadList :: ReadS [InviteId]
readsPrec :: Int -> ReadS InviteId
$creadsPrec :: Int -> ReadS InviteId
Read, Int -> InviteId -> ShowS
[InviteId] -> ShowS
InviteId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InviteId] -> ShowS
$cshowList :: [InviteId] -> ShowS
show :: InviteId -> String
$cshow :: InviteId -> String
showsPrec :: Int -> InviteId -> ShowS
$cshowsPrec :: Int -> InviteId -> ShowS
Show, InviteId -> InviteId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InviteId -> InviteId -> Bool
$c/= :: InviteId -> InviteId -> Bool
== :: InviteId -> InviteId -> Bool
$c== :: InviteId -> InviteId -> Bool
Eq, Eq InviteId
InviteId -> InviteId -> Bool
InviteId -> InviteId -> Ordering
InviteId -> InviteId -> InviteId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: InviteId -> InviteId -> InviteId
$cmin :: InviteId -> InviteId -> InviteId
max :: InviteId -> InviteId -> InviteId
$cmax :: InviteId -> InviteId -> InviteId
>= :: InviteId -> InviteId -> Bool
$c>= :: InviteId -> InviteId -> Bool
> :: InviteId -> InviteId -> Bool
$c> :: InviteId -> InviteId -> Bool
<= :: InviteId -> InviteId -> Bool
$c<= :: InviteId -> InviteId -> Bool
< :: InviteId -> InviteId -> Bool
$c< :: InviteId -> InviteId -> Bool
compare :: InviteId -> InviteId -> Ordering
$ccompare :: InviteId -> InviteId -> Ordering
Ord, Eq InviteId
Int -> InviteId -> Int
InviteId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: InviteId -> Int
$chash :: InviteId -> Int
hashWithSalt :: Int -> InviteId -> Int
$chashWithSalt :: Int -> InviteId -> Int
Hashable, [InviteId] -> Encoding
[InviteId] -> Value
InviteId -> Encoding
InviteId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [InviteId] -> Encoding
$ctoEncodingList :: [InviteId] -> Encoding
toJSONList :: [InviteId] -> Value
$ctoJSONList :: [InviteId] -> Value
toEncoding :: InviteId -> Encoding
$ctoEncoding :: InviteId -> Encoding
toJSON :: InviteId -> Value
$ctoJSON :: InviteId -> Value
ToJSON, ToJSONKeyFunction [InviteId]
ToJSONKeyFunction InviteId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [InviteId]
$ctoJSONKeyList :: ToJSONKeyFunction [InviteId]
toJSONKey :: ToJSONKeyFunction InviteId
$ctoJSONKey :: ToJSONKeyFunction InviteId
ToJSONKey, FromJSONKeyFunction [InviteId]
FromJSONKeyFunction InviteId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [InviteId]
$cfromJSONKeyList :: FromJSONKeyFunction [InviteId]
fromJSONKey :: FromJSONKeyFunction InviteId
$cfromJSONKey :: FromJSONKeyFunction InviteId
FromJSONKey, Value -> Parser [InviteId]
Value -> Parser InviteId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [InviteId]
$cparseJSONList :: Value -> Parser [InviteId]
parseJSON :: Value -> Parser InviteId
$cparseJSON :: Value -> Parser InviteId
FromJSON)
instance IsId InviteId where
toId :: InviteId -> Id
toId = InviteId -> Id
unII
fromId :: Id -> InviteId
fromId = Id -> InviteId
II
instance PrintfArg InviteId where
formatArg :: InviteId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
newtype TokenId = TkI { TokenId -> Id
unTkI :: Id }
deriving (ReadPrec [TokenId]
ReadPrec TokenId
Int -> ReadS TokenId
ReadS [TokenId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TokenId]
$creadListPrec :: ReadPrec [TokenId]
readPrec :: ReadPrec TokenId
$creadPrec :: ReadPrec TokenId
readList :: ReadS [TokenId]
$creadList :: ReadS [TokenId]
readsPrec :: Int -> ReadS TokenId
$creadsPrec :: Int -> ReadS TokenId
Read, Int -> TokenId -> ShowS
[TokenId] -> ShowS
TokenId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TokenId] -> ShowS
$cshowList :: [TokenId] -> ShowS
show :: TokenId -> String
$cshow :: TokenId -> String
showsPrec :: Int -> TokenId -> ShowS
$cshowsPrec :: Int -> TokenId -> ShowS
Show, TokenId -> TokenId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TokenId -> TokenId -> Bool
$c/= :: TokenId -> TokenId -> Bool
== :: TokenId -> TokenId -> Bool
$c== :: TokenId -> TokenId -> Bool
Eq, Eq TokenId
TokenId -> TokenId -> Bool
TokenId -> TokenId -> Ordering
TokenId -> TokenId -> TokenId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TokenId -> TokenId -> TokenId
$cmin :: TokenId -> TokenId -> TokenId
max :: TokenId -> TokenId -> TokenId
$cmax :: TokenId -> TokenId -> TokenId
>= :: TokenId -> TokenId -> Bool
$c>= :: TokenId -> TokenId -> Bool
> :: TokenId -> TokenId -> Bool
$c> :: TokenId -> TokenId -> Bool
<= :: TokenId -> TokenId -> Bool
$c<= :: TokenId -> TokenId -> Bool
< :: TokenId -> TokenId -> Bool
$c< :: TokenId -> TokenId -> Bool
compare :: TokenId -> TokenId -> Ordering
$ccompare :: TokenId -> TokenId -> Ordering
Ord, Eq TokenId
Int -> TokenId -> Int
TokenId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TokenId -> Int
$chash :: TokenId -> Int
hashWithSalt :: Int -> TokenId -> Int
$chashWithSalt :: Int -> TokenId -> Int
Hashable, [TokenId] -> Encoding
[TokenId] -> Value
TokenId -> Encoding
TokenId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [TokenId] -> Encoding
$ctoEncodingList :: [TokenId] -> Encoding
toJSONList :: [TokenId] -> Value
$ctoJSONList :: [TokenId] -> Value
toEncoding :: TokenId -> Encoding
$ctoEncoding :: TokenId -> Encoding
toJSON :: TokenId -> Value
$ctoJSON :: TokenId -> Value
ToJSON, ToJSONKeyFunction [TokenId]
ToJSONKeyFunction TokenId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [TokenId]
$ctoJSONKeyList :: ToJSONKeyFunction [TokenId]
toJSONKey :: ToJSONKeyFunction TokenId
$ctoJSONKey :: ToJSONKeyFunction TokenId
ToJSONKey, FromJSONKeyFunction [TokenId]
FromJSONKeyFunction TokenId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [TokenId]
$cfromJSONKeyList :: FromJSONKeyFunction [TokenId]
fromJSONKey :: FromJSONKeyFunction TokenId
$cfromJSONKey :: FromJSONKeyFunction TokenId
FromJSONKey, Value -> Parser [TokenId]
Value -> Parser TokenId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [TokenId]
$cparseJSONList :: Value -> Parser [TokenId]
parseJSON :: Value -> Parser TokenId
$cparseJSON :: Value -> Parser TokenId
FromJSON)
instance IsId TokenId where
toId :: TokenId -> Id
toId = TokenId -> Id
unTkI
fromId :: Id -> TokenId
fromId = Id -> TokenId
TkI
instance PrintfArg TokenId where
formatArg :: TokenId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
newtype AppId = AI { AppId -> Id
unAI :: Id }
deriving (ReadPrec [AppId]
ReadPrec AppId
Int -> ReadS AppId
ReadS [AppId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppId]
$creadListPrec :: ReadPrec [AppId]
readPrec :: ReadPrec AppId
$creadPrec :: ReadPrec AppId
readList :: ReadS [AppId]
$creadList :: ReadS [AppId]
readsPrec :: Int -> ReadS AppId
$creadsPrec :: Int -> ReadS AppId
Read, Int -> AppId -> ShowS
[AppId] -> ShowS
AppId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppId] -> ShowS
$cshowList :: [AppId] -> ShowS
show :: AppId -> String
$cshow :: AppId -> String
showsPrec :: Int -> AppId -> ShowS
$cshowsPrec :: Int -> AppId -> ShowS
Show, AppId -> AppId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppId -> AppId -> Bool
$c/= :: AppId -> AppId -> Bool
== :: AppId -> AppId -> Bool
$c== :: AppId -> AppId -> Bool
Eq, Eq AppId
AppId -> AppId -> Bool
AppId -> AppId -> Ordering
AppId -> AppId -> AppId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AppId -> AppId -> AppId
$cmin :: AppId -> AppId -> AppId
max :: AppId -> AppId -> AppId
$cmax :: AppId -> AppId -> AppId
>= :: AppId -> AppId -> Bool
$c>= :: AppId -> AppId -> Bool
> :: AppId -> AppId -> Bool
$c> :: AppId -> AppId -> Bool
<= :: AppId -> AppId -> Bool
$c<= :: AppId -> AppId -> Bool
< :: AppId -> AppId -> Bool
$c< :: AppId -> AppId -> Bool
compare :: AppId -> AppId -> Ordering
$ccompare :: AppId -> AppId -> Ordering
Ord, Eq AppId
Int -> AppId -> Int
AppId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: AppId -> Int
$chash :: AppId -> Int
hashWithSalt :: Int -> AppId -> Int
$chashWithSalt :: Int -> AppId -> Int
Hashable, [AppId] -> Encoding
[AppId] -> Value
AppId -> Encoding
AppId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AppId] -> Encoding
$ctoEncodingList :: [AppId] -> Encoding
toJSONList :: [AppId] -> Value
$ctoJSONList :: [AppId] -> Value
toEncoding :: AppId -> Encoding
$ctoEncoding :: AppId -> Encoding
toJSON :: AppId -> Value
$ctoJSON :: AppId -> Value
ToJSON, ToJSONKeyFunction [AppId]
ToJSONKeyFunction AppId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [AppId]
$ctoJSONKeyList :: ToJSONKeyFunction [AppId]
toJSONKey :: ToJSONKeyFunction AppId
$ctoJSONKey :: ToJSONKeyFunction AppId
ToJSONKey, FromJSONKeyFunction [AppId]
FromJSONKeyFunction AppId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [AppId]
$cfromJSONKeyList :: FromJSONKeyFunction [AppId]
fromJSONKey :: FromJSONKeyFunction AppId
$cfromJSONKey :: FromJSONKeyFunction AppId
FromJSONKey, Value -> Parser [AppId]
Value -> Parser AppId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AppId]
$cparseJSONList :: Value -> Parser [AppId]
parseJSON :: Value -> Parser AppId
$cparseJSON :: Value -> Parser AppId
FromJSON)
instance IsId AppId where
toId :: AppId -> Id
toId = AppId -> Id
unAI
fromId :: Id -> AppId
fromId = Id -> AppId
AI
instance PrintfArg AppId where
formatArg :: AppId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
newtype JobId = JI { JobId -> Id
unJI :: Id }
deriving (ReadPrec [JobId]
ReadPrec JobId
Int -> ReadS JobId
ReadS [JobId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobId]
$creadListPrec :: ReadPrec [JobId]
readPrec :: ReadPrec JobId
$creadPrec :: ReadPrec JobId
readList :: ReadS [JobId]
$creadList :: ReadS [JobId]
readsPrec :: Int -> ReadS JobId
$creadsPrec :: Int -> ReadS JobId
Read, Int -> JobId -> ShowS
[JobId] -> ShowS
JobId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobId] -> ShowS
$cshowList :: [JobId] -> ShowS
show :: JobId -> String
$cshow :: JobId -> String
showsPrec :: Int -> JobId -> ShowS
$cshowsPrec :: Int -> JobId -> ShowS
Show, JobId -> JobId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobId -> JobId -> Bool
$c/= :: JobId -> JobId -> Bool
== :: JobId -> JobId -> Bool
$c== :: JobId -> JobId -> Bool
Eq, Eq JobId
JobId -> JobId -> Bool
JobId -> JobId -> Ordering
JobId -> JobId -> JobId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: JobId -> JobId -> JobId
$cmin :: JobId -> JobId -> JobId
max :: JobId -> JobId -> JobId
$cmax :: JobId -> JobId -> JobId
>= :: JobId -> JobId -> Bool
$c>= :: JobId -> JobId -> Bool
> :: JobId -> JobId -> Bool
$c> :: JobId -> JobId -> Bool
<= :: JobId -> JobId -> Bool
$c<= :: JobId -> JobId -> Bool
< :: JobId -> JobId -> Bool
$c< :: JobId -> JobId -> Bool
compare :: JobId -> JobId -> Ordering
$ccompare :: JobId -> JobId -> Ordering
Ord, Eq JobId
Int -> JobId -> Int
JobId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: JobId -> Int
$chash :: JobId -> Int
hashWithSalt :: Int -> JobId -> Int
$chashWithSalt :: Int -> JobId -> Int
Hashable, [JobId] -> Encoding
[JobId] -> Value
JobId -> Encoding
JobId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [JobId] -> Encoding
$ctoEncodingList :: [JobId] -> Encoding
toJSONList :: [JobId] -> Value
$ctoJSONList :: [JobId] -> Value
toEncoding :: JobId -> Encoding
$ctoEncoding :: JobId -> Encoding
toJSON :: JobId -> Value
$ctoJSON :: JobId -> Value
ToJSON, ToJSONKeyFunction [JobId]
ToJSONKeyFunction JobId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [JobId]
$ctoJSONKeyList :: ToJSONKeyFunction [JobId]
toJSONKey :: ToJSONKeyFunction JobId
$ctoJSONKey :: ToJSONKeyFunction JobId
ToJSONKey, FromJSONKeyFunction [JobId]
FromJSONKeyFunction JobId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [JobId]
$cfromJSONKeyList :: FromJSONKeyFunction [JobId]
fromJSONKey :: FromJSONKeyFunction JobId
$cfromJSONKey :: FromJSONKeyFunction JobId
FromJSONKey, Value -> Parser [JobId]
Value -> Parser JobId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [JobId]
$cparseJSONList :: Value -> Parser [JobId]
parseJSON :: Value -> Parser JobId
$cparseJSON :: Value -> Parser JobId
FromJSON)
instance IsId JobId where
toId :: JobId -> Id
toId = JobId -> Id
unJI
fromId :: Id -> JobId
fromId = Id -> JobId
JI
instance PrintfArg JobId where
formatArg :: JobId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
newtype EmojiId = EI { EmojiId -> Id
unEI :: Id }
deriving (ReadPrec [EmojiId]
ReadPrec EmojiId
Int -> ReadS EmojiId
ReadS [EmojiId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EmojiId]
$creadListPrec :: ReadPrec [EmojiId]
readPrec :: ReadPrec EmojiId
$creadPrec :: ReadPrec EmojiId
readList :: ReadS [EmojiId]
$creadList :: ReadS [EmojiId]
readsPrec :: Int -> ReadS EmojiId
$creadsPrec :: Int -> ReadS EmojiId
Read, Int -> EmojiId -> ShowS
[EmojiId] -> ShowS
EmojiId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmojiId] -> ShowS
$cshowList :: [EmojiId] -> ShowS
show :: EmojiId -> String
$cshow :: EmojiId -> String
showsPrec :: Int -> EmojiId -> ShowS
$cshowsPrec :: Int -> EmojiId -> ShowS
Show, EmojiId -> EmojiId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmojiId -> EmojiId -> Bool
$c/= :: EmojiId -> EmojiId -> Bool
== :: EmojiId -> EmojiId -> Bool
$c== :: EmojiId -> EmojiId -> Bool
Eq, Eq EmojiId
EmojiId -> EmojiId -> Bool
EmojiId -> EmojiId -> Ordering
EmojiId -> EmojiId -> EmojiId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EmojiId -> EmojiId -> EmojiId
$cmin :: EmojiId -> EmojiId -> EmojiId
max :: EmojiId -> EmojiId -> EmojiId
$cmax :: EmojiId -> EmojiId -> EmojiId
>= :: EmojiId -> EmojiId -> Bool
$c>= :: EmojiId -> EmojiId -> Bool
> :: EmojiId -> EmojiId -> Bool
$c> :: EmojiId -> EmojiId -> Bool
<= :: EmojiId -> EmojiId -> Bool
$c<= :: EmojiId -> EmojiId -> Bool
< :: EmojiId -> EmojiId -> Bool
$c< :: EmojiId -> EmojiId -> Bool
compare :: EmojiId -> EmojiId -> Ordering
$ccompare :: EmojiId -> EmojiId -> Ordering
Ord, Eq EmojiId
Int -> EmojiId -> Int
EmojiId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: EmojiId -> Int
$chash :: EmojiId -> Int
hashWithSalt :: Int -> EmojiId -> Int
$chashWithSalt :: Int -> EmojiId -> Int
Hashable, [EmojiId] -> Encoding
[EmojiId] -> Value
EmojiId -> Encoding
EmojiId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [EmojiId] -> Encoding
$ctoEncodingList :: [EmojiId] -> Encoding
toJSONList :: [EmojiId] -> Value
$ctoJSONList :: [EmojiId] -> Value
toEncoding :: EmojiId -> Encoding
$ctoEncoding :: EmojiId -> Encoding
toJSON :: EmojiId -> Value
$ctoJSON :: EmojiId -> Value
ToJSON, ToJSONKeyFunction [EmojiId]
ToJSONKeyFunction EmojiId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [EmojiId]
$ctoJSONKeyList :: ToJSONKeyFunction [EmojiId]
toJSONKey :: ToJSONKeyFunction EmojiId
$ctoJSONKey :: ToJSONKeyFunction EmojiId
ToJSONKey, FromJSONKeyFunction [EmojiId]
FromJSONKeyFunction EmojiId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [EmojiId]
$cfromJSONKeyList :: FromJSONKeyFunction [EmojiId]
fromJSONKey :: FromJSONKeyFunction EmojiId
$cfromJSONKey :: FromJSONKeyFunction EmojiId
FromJSONKey, Value -> Parser [EmojiId]
Value -> Parser EmojiId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [EmojiId]
$cparseJSONList :: Value -> Parser [EmojiId]
parseJSON :: Value -> Parser EmojiId
$cparseJSON :: Value -> Parser EmojiId
FromJSON)
instance IsId EmojiId where
toId :: EmojiId -> Id
toId = EmojiId -> Id
unEI
fromId :: Id -> EmojiId
fromId = Id -> EmojiId
EI
instance PrintfArg EmojiId where
formatArg :: EmojiId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
newtype ReportId = RI { ReportId -> Id
unRI :: Id }
deriving (ReadPrec [ReportId]
ReadPrec ReportId
Int -> ReadS ReportId
ReadS [ReportId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportId]
$creadListPrec :: ReadPrec [ReportId]
readPrec :: ReadPrec ReportId
$creadPrec :: ReadPrec ReportId
readList :: ReadS [ReportId]
$creadList :: ReadS [ReportId]
readsPrec :: Int -> ReadS ReportId
$creadsPrec :: Int -> ReadS ReportId
Read, Int -> ReportId -> ShowS
[ReportId] -> ShowS
ReportId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportId] -> ShowS
$cshowList :: [ReportId] -> ShowS
show :: ReportId -> String
$cshow :: ReportId -> String
showsPrec :: Int -> ReportId -> ShowS
$cshowsPrec :: Int -> ReportId -> ShowS
Show, ReportId -> ReportId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportId -> ReportId -> Bool
$c/= :: ReportId -> ReportId -> Bool
== :: ReportId -> ReportId -> Bool
$c== :: ReportId -> ReportId -> Bool
Eq, Eq ReportId
ReportId -> ReportId -> Bool
ReportId -> ReportId -> Ordering
ReportId -> ReportId -> ReportId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ReportId -> ReportId -> ReportId
$cmin :: ReportId -> ReportId -> ReportId
max :: ReportId -> ReportId -> ReportId
$cmax :: ReportId -> ReportId -> ReportId
>= :: ReportId -> ReportId -> Bool
$c>= :: ReportId -> ReportId -> Bool
> :: ReportId -> ReportId -> Bool
$c> :: ReportId -> ReportId -> Bool
<= :: ReportId -> ReportId -> Bool
$c<= :: ReportId -> ReportId -> Bool
< :: ReportId -> ReportId -> Bool
$c< :: ReportId -> ReportId -> Bool
compare :: ReportId -> ReportId -> Ordering
$ccompare :: ReportId -> ReportId -> Ordering
Ord, Eq ReportId
Int -> ReportId -> Int
ReportId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ReportId -> Int
$chash :: ReportId -> Int
hashWithSalt :: Int -> ReportId -> Int
$chashWithSalt :: Int -> ReportId -> Int
Hashable, [ReportId] -> Encoding
[ReportId] -> Value
ReportId -> Encoding
ReportId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ReportId] -> Encoding
$ctoEncodingList :: [ReportId] -> Encoding
toJSONList :: [ReportId] -> Value
$ctoJSONList :: [ReportId] -> Value
toEncoding :: ReportId -> Encoding
$ctoEncoding :: ReportId -> Encoding
toJSON :: ReportId -> Value
$ctoJSON :: ReportId -> Value
ToJSON, ToJSONKeyFunction [ReportId]
ToJSONKeyFunction ReportId
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [ReportId]
$ctoJSONKeyList :: ToJSONKeyFunction [ReportId]
toJSONKey :: ToJSONKeyFunction ReportId
$ctoJSONKey :: ToJSONKeyFunction ReportId
ToJSONKey, FromJSONKeyFunction [ReportId]
FromJSONKeyFunction ReportId
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [ReportId]
$cfromJSONKeyList :: FromJSONKeyFunction [ReportId]
fromJSONKey :: FromJSONKeyFunction ReportId
$cfromJSONKey :: FromJSONKeyFunction ReportId
FromJSONKey, Value -> Parser [ReportId]
Value -> Parser ReportId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ReportId]
$cparseJSONList :: Value -> Parser [ReportId]
parseJSON :: Value -> Parser ReportId
$cparseJSON :: Value -> Parser ReportId
FromJSON)
instance IsId ReportId where
toId :: ReportId -> Id
toId = ReportId -> Id
unRI
fromId :: Id -> ReportId
fromId = Id -> ReportId
RI
instance PrintfArg ReportId where
formatArg :: ReportId -> FieldFormatter
formatArg = forall a. PrintfArg a => a -> FieldFormatter
formatArg forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. IsId x => x -> Text
idString
instance A.ToJSON User where toJSON :: User -> Value
toJSON = forall a. HasCallStack => String -> a
error String
"to user"
instance A.ToJSON Team where toJSON :: Team -> Value
toJSON = forall a. HasCallStack => String -> a
error String
"to team"
data MinChannelMember = MinChannelMember
{ MinChannelMember -> UserId
minChannelMemberUserId :: UserId
, MinChannelMember -> ChannelId
minChannelMemberChannelId :: ChannelId
} deriving (ReadPrec [MinChannelMember]
ReadPrec MinChannelMember
Int -> ReadS MinChannelMember
ReadS [MinChannelMember]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MinChannelMember]
$creadListPrec :: ReadPrec [MinChannelMember]
readPrec :: ReadPrec MinChannelMember
$creadPrec :: ReadPrec MinChannelMember
readList :: ReadS [MinChannelMember]
$creadList :: ReadS [MinChannelMember]
readsPrec :: Int -> ReadS MinChannelMember
$creadsPrec :: Int -> ReadS MinChannelMember
Read, Int -> MinChannelMember -> ShowS
[MinChannelMember] -> ShowS
MinChannelMember -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MinChannelMember] -> ShowS
$cshowList :: [MinChannelMember] -> ShowS
show :: MinChannelMember -> String
$cshow :: MinChannelMember -> String
showsPrec :: Int -> MinChannelMember -> ShowS
$cshowsPrec :: Int -> MinChannelMember -> ShowS
Show, MinChannelMember -> MinChannelMember -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MinChannelMember -> MinChannelMember -> Bool
$c/= :: MinChannelMember -> MinChannelMember -> Bool
== :: MinChannelMember -> MinChannelMember -> Bool
$c== :: MinChannelMember -> MinChannelMember -> Bool
Eq)
instance A.FromJSON MinChannelMember where
parseJSON :: Value -> Parser MinChannelMember
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"channelMember" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
UserId
minChannelMemberUserId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"user_id"
ChannelId
minChannelMemberChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"channel_id"
forall (m :: * -> *) a. Monad m => a -> m a
return MinChannelMember { UserId
ChannelId
minChannelMemberChannelId :: ChannelId
minChannelMemberUserId :: UserId
minChannelMemberChannelId :: ChannelId
minChannelMemberUserId :: UserId
.. }
instance A.ToJSON MinChannelMember where
toJSON :: MinChannelMember -> Value
toJSON MinChannelMember { UserId
ChannelId
minChannelMemberChannelId :: ChannelId
minChannelMemberUserId :: UserId
minChannelMemberChannelId :: MinChannelMember -> ChannelId
minChannelMemberUserId :: MinChannelMember -> UserId
.. } = [Pair] -> Value
A.object
[ Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= UserId
minChannelMemberUserId
, Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ChannelId
minChannelMemberChannelId
]
data ChannelMember = ChannelMember
{ ChannelMember -> Integer
channelMemberMsgCount :: Integer
, ChannelMember -> UserId
channelMemberUserId :: UserId
, ChannelMember -> Text
channelMemberRoles :: Text
, ChannelMember -> Int
channelMemberMentionCount :: Int
, ChannelMember -> ServerTime
channelMemberLastViewedAt :: ServerTime
, ChannelMember -> ChannelId
channelMemberChannelId :: ChannelId
, ChannelMember -> ServerTime
channelMemberLastUpdateAt :: ServerTime
, ChannelMember -> ChannelNotifyProps
channelMemberNotifyProps :: ChannelNotifyProps
} deriving (ReadPrec [ChannelMember]
ReadPrec ChannelMember
Int -> ReadS ChannelMember
ReadS [ChannelMember]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelMember]
$creadListPrec :: ReadPrec [ChannelMember]
readPrec :: ReadPrec ChannelMember
$creadPrec :: ReadPrec ChannelMember
readList :: ReadS [ChannelMember]
$creadList :: ReadS [ChannelMember]
readsPrec :: Int -> ReadS ChannelMember
$creadsPrec :: Int -> ReadS ChannelMember
Read, Int -> ChannelMember -> ShowS
[ChannelMember] -> ShowS
ChannelMember -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelMember] -> ShowS
$cshowList :: [ChannelMember] -> ShowS
show :: ChannelMember -> String
$cshow :: ChannelMember -> String
showsPrec :: Int -> ChannelMember -> ShowS
$cshowsPrec :: Int -> ChannelMember -> ShowS
Show, ChannelMember -> ChannelMember -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelMember -> ChannelMember -> Bool
$c/= :: ChannelMember -> ChannelMember -> Bool
== :: ChannelMember -> ChannelMember -> Bool
$c== :: ChannelMember -> ChannelMember -> Bool
Eq)
instance A.FromJSON ChannelMember where
parseJSON :: Value -> Parser ChannelMember
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"channelMember" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Integer
channelMemberMsgCount <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"msg_count"
UserId
channelMemberUserId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"user_id"
Text
channelMemberRoles <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"roles"
Int
channelMemberMentionCount <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"mention_count"
ServerTime
channelMemberLastViewedAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"last_viewed_at"
ChannelId
channelMemberChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"channel_id"
ServerTime
channelMemberLastUpdateAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"last_update_at"
ChannelNotifyProps
channelMemberNotifyProps <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"notify_props"
forall (m :: * -> *) a. Monad m => a -> m a
return ChannelMember { Int
Integer
Text
ServerTime
UserId
ChannelId
ChannelNotifyProps
channelMemberNotifyProps :: ChannelNotifyProps
channelMemberLastUpdateAt :: ServerTime
channelMemberChannelId :: ChannelId
channelMemberLastViewedAt :: ServerTime
channelMemberMentionCount :: Int
channelMemberRoles :: Text
channelMemberUserId :: UserId
channelMemberMsgCount :: Integer
channelMemberNotifyProps :: ChannelNotifyProps
channelMemberLastUpdateAt :: ServerTime
channelMemberChannelId :: ChannelId
channelMemberLastViewedAt :: ServerTime
channelMemberMentionCount :: Int
channelMemberRoles :: Text
channelMemberUserId :: UserId
channelMemberMsgCount :: Integer
.. }
instance A.ToJSON ChannelMember where
toJSON :: ChannelMember -> Value
toJSON ChannelMember { Int
Integer
Text
ServerTime
UserId
ChannelId
ChannelNotifyProps
channelMemberNotifyProps :: ChannelNotifyProps
channelMemberLastUpdateAt :: ServerTime
channelMemberChannelId :: ChannelId
channelMemberLastViewedAt :: ServerTime
channelMemberMentionCount :: Int
channelMemberRoles :: Text
channelMemberUserId :: UserId
channelMemberMsgCount :: Integer
channelMemberNotifyProps :: ChannelMember -> ChannelNotifyProps
channelMemberLastUpdateAt :: ChannelMember -> ServerTime
channelMemberChannelId :: ChannelMember -> ChannelId
channelMemberLastViewedAt :: ChannelMember -> ServerTime
channelMemberMentionCount :: ChannelMember -> Int
channelMemberRoles :: ChannelMember -> Text
channelMemberUserId :: ChannelMember -> UserId
channelMemberMsgCount :: ChannelMember -> Integer
.. } = [Pair] -> Value
A.object
[ Key
"msg_count" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Integer
channelMemberMsgCount
, Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= UserId
channelMemberUserId
, Key
"roles" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
channelMemberRoles
, Key
"mention_count" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Int
channelMemberMentionCount
, Key
"last_viewed_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ServerTime -> Int
timeToServer ServerTime
channelMemberLastViewedAt
, Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ChannelId
channelMemberChannelId
, Key
"last_update_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ServerTime -> Int
timeToServer ServerTime
channelMemberLastUpdateAt
, Key
"notify_props" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ChannelNotifyProps
channelMemberNotifyProps
]
data Status = Status
{ Status -> UserId
statusUserId :: UserId
, Status -> Text
statusStatus :: T.Text
, Status -> Bool
statusManual :: Bool
, Status -> ServerTime
statusLastActivityAt :: ServerTime
}
instance A.FromJSON Status where
parseJSON :: Value -> Parser Status
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"Status" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
UserId
statusUserId <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"user_id"
Text
statusStatus <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"status"
Bool
statusManual <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"manual"
ServerTime
statusLastActivityAt <- Integer -> ServerTime
timeFromServer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"last_activity_at"
forall (m :: * -> *) a. Monad m => a -> m a
return Status { Bool
Text
ServerTime
UserId
statusLastActivityAt :: ServerTime
statusManual :: Bool
statusStatus :: Text
statusUserId :: UserId
statusLastActivityAt :: ServerTime
statusManual :: Bool
statusStatus :: Text
statusUserId :: UserId
.. }
instance A.ToJSON Status where
toJSON :: Status -> Value
toJSON Status { Bool
Text
ServerTime
UserId
statusLastActivityAt :: ServerTime
statusManual :: Bool
statusStatus :: Text
statusUserId :: UserId
statusLastActivityAt :: Status -> ServerTime
statusManual :: Status -> Bool
statusStatus :: Status -> Text
statusUserId :: Status -> UserId
.. } = [Pair] -> Value
A.object
[ Key
"user_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= UserId
statusUserId
, Key
"status" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
statusStatus
, Key
"manual" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Bool
statusManual
, Key
"last_activity_at" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ServerTime -> Int
timeToServer ServerTime
statusLastActivityAt
]
data UserSearch = UserSearch
{ UserSearch -> Text
userSearchTerm :: Text
, UserSearch -> Bool
userSearchAllowInactive :: Bool
, UserSearch -> Bool
userSearchWithoutTeam :: Bool
, UserSearch -> Maybe ChannelId
userSearchInChannelId :: Maybe ChannelId
, UserSearch -> Maybe TeamId
userSearchNotInTeamId :: Maybe TeamId
, UserSearch -> Maybe ChannelId
userSearchNotInChannelId :: Maybe ChannelId
, UserSearch -> Maybe TeamId
userSearchTeamId :: Maybe TeamId
} deriving (ReadPrec [UserSearch]
ReadPrec UserSearch
Int -> ReadS UserSearch
ReadS [UserSearch]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserSearch]
$creadListPrec :: ReadPrec [UserSearch]
readPrec :: ReadPrec UserSearch
$creadPrec :: ReadPrec UserSearch
readList :: ReadS [UserSearch]
$creadList :: ReadS [UserSearch]
readsPrec :: Int -> ReadS UserSearch
$creadsPrec :: Int -> ReadS UserSearch
Read, Int -> UserSearch -> ShowS
[UserSearch] -> ShowS
UserSearch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserSearch] -> ShowS
$cshowList :: [UserSearch] -> ShowS
show :: UserSearch -> String
$cshow :: UserSearch -> String
showsPrec :: Int -> UserSearch -> ShowS
$cshowsPrec :: Int -> UserSearch -> ShowS
Show, UserSearch -> UserSearch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserSearch -> UserSearch -> Bool
$c/= :: UserSearch -> UserSearch -> Bool
== :: UserSearch -> UserSearch -> Bool
$c== :: UserSearch -> UserSearch -> Bool
Eq)
instance A.FromJSON UserSearch where
parseJSON :: Value -> Parser UserSearch
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"userSearch" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Text
userSearchTerm <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"term"
Bool
userSearchAllowInactive <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"allow_inactive"
Bool
userSearchWithoutTeam <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"without_team"
Maybe ChannelId
userSearchInChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"in_channel_id"
Maybe TeamId
userSearchNotInTeamId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"not_in_team_id"
Maybe ChannelId
userSearchNotInChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"not_in_channel_id"
Maybe TeamId
userSearchTeamId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"team_id"
forall (m :: * -> *) a. Monad m => a -> m a
return UserSearch { Bool
Maybe ChannelId
Maybe TeamId
Text
userSearchTeamId :: Maybe TeamId
userSearchNotInChannelId :: Maybe ChannelId
userSearchNotInTeamId :: Maybe TeamId
userSearchInChannelId :: Maybe ChannelId
userSearchWithoutTeam :: Bool
userSearchAllowInactive :: Bool
userSearchTerm :: Text
userSearchTeamId :: Maybe TeamId
userSearchNotInChannelId :: Maybe ChannelId
userSearchNotInTeamId :: Maybe TeamId
userSearchInChannelId :: Maybe ChannelId
userSearchWithoutTeam :: Bool
userSearchAllowInactive :: Bool
userSearchTerm :: Text
.. }
instance A.ToJSON UserSearch where
toJSON :: UserSearch -> Value
toJSON UserSearch { Bool
Maybe ChannelId
Maybe TeamId
Text
userSearchTeamId :: Maybe TeamId
userSearchNotInChannelId :: Maybe ChannelId
userSearchNotInTeamId :: Maybe TeamId
userSearchInChannelId :: Maybe ChannelId
userSearchWithoutTeam :: Bool
userSearchAllowInactive :: Bool
userSearchTerm :: Text
userSearchTeamId :: UserSearch -> Maybe TeamId
userSearchNotInChannelId :: UserSearch -> Maybe ChannelId
userSearchNotInTeamId :: UserSearch -> Maybe TeamId
userSearchInChannelId :: UserSearch -> Maybe ChannelId
userSearchWithoutTeam :: UserSearch -> Bool
userSearchAllowInactive :: UserSearch -> Bool
userSearchTerm :: UserSearch -> Text
.. } = [Pair] -> Value
A.object
[ Key
"term" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
userSearchTerm
, Key
"allow_inactive" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Bool
userSearchAllowInactive
, Key
"without_team" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Bool
userSearchWithoutTeam
, Key
"in_channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Maybe ChannelId
userSearchInChannelId
, Key
"not_in_team_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Maybe TeamId
userSearchNotInTeamId
, Key
"not_in_channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Maybe ChannelId
userSearchNotInChannelId
, Key
"team_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Maybe TeamId
userSearchTeamId
]
data RawPost = RawPost
{ RawPost -> ChannelId
rawPostChannelId :: ChannelId
, RawPost -> Text
rawPostMessage :: Text
, RawPost -> Seq FileId
rawPostFileIds :: Seq FileId
, RawPost -> Maybe PostId
rawPostRootId :: Maybe PostId
} deriving (ReadPrec [RawPost]
ReadPrec RawPost
Int -> ReadS RawPost
ReadS [RawPost]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RawPost]
$creadListPrec :: ReadPrec [RawPost]
readPrec :: ReadPrec RawPost
$creadPrec :: ReadPrec RawPost
readList :: ReadS [RawPost]
$creadList :: ReadS [RawPost]
readsPrec :: Int -> ReadS RawPost
$creadsPrec :: Int -> ReadS RawPost
Read, Int -> RawPost -> ShowS
[RawPost] -> ShowS
RawPost -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RawPost] -> ShowS
$cshowList :: [RawPost] -> ShowS
show :: RawPost -> String
$cshow :: RawPost -> String
showsPrec :: Int -> RawPost -> ShowS
$cshowsPrec :: Int -> RawPost -> ShowS
Show, RawPost -> RawPost -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RawPost -> RawPost -> Bool
$c/= :: RawPost -> RawPost -> Bool
== :: RawPost -> RawPost -> Bool
$c== :: RawPost -> RawPost -> Bool
Eq)
instance A.FromJSON RawPost where
parseJSON :: Value -> Parser RawPost
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"rawPost" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
ChannelId
rawPostChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"channel_id"
Text
rawPostMessage <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"message"
Seq FileId
rawPostFileIds <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"file_ids"
Maybe PostId
rawPostRootId <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"root_id"
forall (m :: * -> *) a. Monad m => a -> m a
return RawPost { Maybe PostId
Text
Seq FileId
ChannelId
rawPostRootId :: Maybe PostId
rawPostFileIds :: Seq FileId
rawPostMessage :: Text
rawPostChannelId :: ChannelId
rawPostRootId :: Maybe PostId
rawPostFileIds :: Seq FileId
rawPostMessage :: Text
rawPostChannelId :: ChannelId
.. }
instance A.ToJSON RawPost where
toJSON :: RawPost -> Value
toJSON RawPost { Maybe PostId
Text
Seq FileId
ChannelId
rawPostRootId :: Maybe PostId
rawPostFileIds :: Seq FileId
rawPostMessage :: Text
rawPostChannelId :: ChannelId
rawPostRootId :: RawPost -> Maybe PostId
rawPostFileIds :: RawPost -> Seq FileId
rawPostMessage :: RawPost -> Text
rawPostChannelId :: RawPost -> ChannelId
.. } = [Pair] -> Value
A.object
( Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= ChannelId
rawPostChannelId
forall a. a -> [a] -> [a]
: Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
rawPostMessage
forall a. a -> [a] -> [a]
: Key
"file_ids" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Seq FileId
rawPostFileIds
forall a. a -> [a] -> [a]
: case Maybe PostId
rawPostRootId of
Maybe PostId
Nothing -> []
Just PostId
rId -> [(Key
"root_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= PostId
rId)]
)
rawPost :: Text -> ChannelId -> RawPost
rawPost :: Text -> ChannelId -> RawPost
rawPost Text
message ChannelId
channelId = RawPost
{ rawPostChannelId :: ChannelId
rawPostChannelId = ChannelId
channelId
, rawPostMessage :: Text
rawPostMessage = Text
message
, rawPostFileIds :: Seq FileId
rawPostFileIds = forall a. Monoid a => a
mempty
, rawPostRootId :: Maybe PostId
rawPostRootId = forall a. Maybe a
Nothing
}
data PostUpdate = PostUpdate
{ PostUpdate -> Maybe Bool
postUpdateIsPinned :: Maybe Bool
, PostUpdate -> Text
postUpdateMessage :: Text
, PostUpdate -> Maybe Bool
postUpdateHasReactions :: Maybe Bool
, PostUpdate -> Maybe (Seq FileId)
postUpdateFileIds :: Maybe (Seq FileId)
, PostUpdate -> Maybe Text
postUpdateProps :: Maybe Text
} deriving (ReadPrec [PostUpdate]
ReadPrec PostUpdate
Int -> ReadS PostUpdate
ReadS [PostUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostUpdate]
$creadListPrec :: ReadPrec [PostUpdate]
readPrec :: ReadPrec PostUpdate
$creadPrec :: ReadPrec PostUpdate
readList :: ReadS [PostUpdate]
$creadList :: ReadS [PostUpdate]
readsPrec :: Int -> ReadS PostUpdate
$creadsPrec :: Int -> ReadS PostUpdate
Read, Int -> PostUpdate -> ShowS
[PostUpdate] -> ShowS
PostUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostUpdate] -> ShowS
$cshowList :: [PostUpdate] -> ShowS
show :: PostUpdate -> String
$cshow :: PostUpdate -> String
showsPrec :: Int -> PostUpdate -> ShowS
$cshowsPrec :: Int -> PostUpdate -> ShowS
Show, PostUpdate -> PostUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostUpdate -> PostUpdate -> Bool
$c/= :: PostUpdate -> PostUpdate -> Bool
== :: PostUpdate -> PostUpdate -> Bool
$c== :: PostUpdate -> PostUpdate -> Bool
Eq)
instance A.FromJSON PostUpdate where
parseJSON :: Value -> Parser PostUpdate
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"postUpdate" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Maybe Bool
postUpdateIsPinned <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_pinned" forall a. Parser (Maybe a) -> a -> Parser a
A..!= forall a. Maybe a
Nothing
Text
postUpdateMessage <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"message"
Maybe Bool
postUpdateHasReactions <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_reactions" forall a. Parser (Maybe a) -> a -> Parser a
A..!= forall a. Maybe a
Nothing
Maybe (Seq FileId)
postUpdateFileIds <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"file_ids" forall a. Parser (Maybe a) -> a -> Parser a
A..!= forall a. Maybe a
Nothing
Maybe Text
postUpdateProps <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"props" forall a. Parser (Maybe a) -> a -> Parser a
A..!= forall a. Maybe a
Nothing
forall (m :: * -> *) a. Monad m => a -> m a
return PostUpdate { Maybe Bool
Maybe Text
Maybe (Seq FileId)
Text
postUpdateProps :: Maybe Text
postUpdateFileIds :: Maybe (Seq FileId)
postUpdateHasReactions :: Maybe Bool
postUpdateMessage :: Text
postUpdateIsPinned :: Maybe Bool
postUpdateProps :: Maybe Text
postUpdateFileIds :: Maybe (Seq FileId)
postUpdateHasReactions :: Maybe Bool
postUpdateMessage :: Text
postUpdateIsPinned :: Maybe Bool
.. }
instance A.ToJSON PostUpdate where
toJSON :: PostUpdate -> Value
toJSON PostUpdate { Maybe Bool
Maybe Text
Maybe (Seq FileId)
Text
postUpdateProps :: Maybe Text
postUpdateFileIds :: Maybe (Seq FileId)
postUpdateHasReactions :: Maybe Bool
postUpdateMessage :: Text
postUpdateIsPinned :: Maybe Bool
postUpdateProps :: PostUpdate -> Maybe Text
postUpdateFileIds :: PostUpdate -> Maybe (Seq FileId)
postUpdateHasReactions :: PostUpdate -> Maybe Bool
postUpdateMessage :: PostUpdate -> Text
postUpdateIsPinned :: PostUpdate -> Maybe Bool
.. } = [Pair] -> Value
A.object forall a b. (a -> b) -> a -> b
$
[ Key
"is_pinned" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Bool
p | Just Bool
p <- [Maybe Bool
postUpdateIsPinned] ] forall a. [a] -> [a] -> [a]
++
[ Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
postUpdateMessage ] forall a. [a] -> [a] -> [a]
++
[ Key
"has_reactions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Bool
p | Just Bool
p <- [Maybe Bool
postUpdateHasReactions] ] forall a. [a] -> [a] -> [a]
++
[ Key
"file_ids" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Seq FileId
p | Just Seq FileId
p <- [Maybe (Seq FileId)
postUpdateFileIds] ] forall a. [a] -> [a] -> [a]
++
[ Key
"props" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
p | Just Text
p <- [Maybe Text
postUpdateProps] ]
postUpdateBody :: Text -> PostUpdate
postUpdateBody :: Text -> PostUpdate
postUpdateBody Text
message =
PostUpdate { postUpdateIsPinned :: Maybe Bool
postUpdateIsPinned = forall a. Maybe a
Nothing
, postUpdateMessage :: Text
postUpdateMessage = Text
message
, postUpdateHasReactions :: Maybe Bool
postUpdateHasReactions = forall a. Maybe a
Nothing
, postUpdateFileIds :: Maybe (Seq FileId)
postUpdateFileIds = forall a. Maybe a
Nothing
, postUpdateProps :: Maybe Text
postUpdateProps = forall a. Maybe a
Nothing
}
data ChannelPatch = ChannelPatch
{ :: Maybe Text
, ChannelPatch -> Maybe Text
channelPatchDisplayName :: Maybe Text
, ChannelPatch -> Maybe Text
channelPatchName :: Maybe Text
, ChannelPatch -> Maybe Text
channelPatchPurpose :: Maybe Text
} deriving (ReadPrec [ChannelPatch]
ReadPrec ChannelPatch
Int -> ReadS ChannelPatch
ReadS [ChannelPatch]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelPatch]
$creadListPrec :: ReadPrec [ChannelPatch]
readPrec :: ReadPrec ChannelPatch
$creadPrec :: ReadPrec ChannelPatch
readList :: ReadS [ChannelPatch]
$creadList :: ReadS [ChannelPatch]
readsPrec :: Int -> ReadS ChannelPatch
$creadsPrec :: Int -> ReadS ChannelPatch
Read, Int -> ChannelPatch -> ShowS
[ChannelPatch] -> ShowS
ChannelPatch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelPatch] -> ShowS
$cshowList :: [ChannelPatch] -> ShowS
show :: ChannelPatch -> String
$cshow :: ChannelPatch -> String
showsPrec :: Int -> ChannelPatch -> ShowS
$cshowsPrec :: Int -> ChannelPatch -> ShowS
Show, ChannelPatch -> ChannelPatch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelPatch -> ChannelPatch -> Bool
$c/= :: ChannelPatch -> ChannelPatch -> Bool
== :: ChannelPatch -> ChannelPatch -> Bool
$c== :: ChannelPatch -> ChannelPatch -> Bool
Eq)
instance A.FromJSON ChannelPatch where
parseJSON :: Value -> Parser ChannelPatch
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"channelPatch" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Maybe Text
channelPatchHeader <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"header"
Maybe Text
channelPatchDisplayName <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"display_name"
Maybe Text
channelPatchName <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"name"
Maybe Text
channelPatchPurpose <- Object
v forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"purpose"
forall (m :: * -> *) a. Monad m => a -> m a
return ChannelPatch { Maybe Text
channelPatchPurpose :: Maybe Text
channelPatchName :: Maybe Text
channelPatchDisplayName :: Maybe Text
channelPatchHeader :: Maybe Text
channelPatchPurpose :: Maybe Text
channelPatchName :: Maybe Text
channelPatchDisplayName :: Maybe Text
channelPatchHeader :: Maybe Text
.. }
instance A.ToJSON ChannelPatch where
toJSON :: ChannelPatch -> Value
toJSON ChannelPatch { Maybe Text
channelPatchPurpose :: Maybe Text
channelPatchName :: Maybe Text
channelPatchDisplayName :: Maybe Text
channelPatchHeader :: Maybe Text
channelPatchPurpose :: ChannelPatch -> Maybe Text
channelPatchName :: ChannelPatch -> Maybe Text
channelPatchDisplayName :: ChannelPatch -> Maybe Text
channelPatchHeader :: ChannelPatch -> Maybe Text
.. } = [Pair] -> Value
A.object forall a b. (a -> b) -> a -> b
$
[ Key
"header" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
x | Just Text
x <- [ Maybe Text
channelPatchHeader] ] forall a. [a] -> [a] -> [a]
++
[ Key
"display_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
x | Just Text
x <- [Maybe Text
channelPatchDisplayName] ] forall a. [a] -> [a] -> [a]
++
[ Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
x | Just Text
x <- [Maybe Text
channelPatchName] ] forall a. [a] -> [a] -> [a]
++
[ Key
"purpose" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
x | Just Text
x <- [Maybe Text
channelPatchPurpose] ]
defaultChannelPatch :: ChannelPatch
defaultChannelPatch :: ChannelPatch
defaultChannelPatch = ChannelPatch
{ channelPatchHeader :: Maybe Text
channelPatchHeader = forall a. Maybe a
Nothing
, channelPatchDisplayName :: Maybe Text
channelPatchDisplayName = forall a. Maybe a
Nothing
, channelPatchName :: Maybe Text
channelPatchName = forall a. Maybe a
Nothing
, channelPatchPurpose :: Maybe Text
channelPatchPurpose = forall a. Maybe a
Nothing
}
data InitialTeamData = InitialTeamData
{ InitialTeamData -> Text
initialTeamDataDisplayName :: Text
, InitialTeamData -> Text
initialTeamDataType :: Text
, InitialTeamData -> Text
initialTeamDataName :: Text
} deriving (ReadPrec [InitialTeamData]
ReadPrec InitialTeamData
Int -> ReadS InitialTeamData
ReadS [InitialTeamData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InitialTeamData]
$creadListPrec :: ReadPrec [InitialTeamData]
readPrec :: ReadPrec InitialTeamData
$creadPrec :: ReadPrec InitialTeamData
readList :: ReadS [InitialTeamData]
$creadList :: ReadS [InitialTeamData]
readsPrec :: Int -> ReadS InitialTeamData
$creadsPrec :: Int -> ReadS InitialTeamData
Read, Int -> InitialTeamData -> ShowS
[InitialTeamData] -> ShowS
InitialTeamData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitialTeamData] -> ShowS
$cshowList :: [InitialTeamData] -> ShowS
show :: InitialTeamData -> String
$cshow :: InitialTeamData -> String
showsPrec :: Int -> InitialTeamData -> ShowS
$cshowsPrec :: Int -> InitialTeamData -> ShowS
Show, InitialTeamData -> InitialTeamData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitialTeamData -> InitialTeamData -> Bool
$c/= :: InitialTeamData -> InitialTeamData -> Bool
== :: InitialTeamData -> InitialTeamData -> Bool
$c== :: InitialTeamData -> InitialTeamData -> Bool
Eq)
instance A.FromJSON InitialTeamData where
parseJSON :: Value -> Parser InitialTeamData
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"initialTeamData" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Text
initialTeamDataDisplayName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"display_name"
Text
initialTeamDataType <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"type"
Text
initialTeamDataName <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"name"
forall (m :: * -> *) a. Monad m => a -> m a
return InitialTeamData { Text
initialTeamDataName :: Text
initialTeamDataType :: Text
initialTeamDataDisplayName :: Text
initialTeamDataName :: Text
initialTeamDataType :: Text
initialTeamDataDisplayName :: Text
.. }
instance A.ToJSON InitialTeamData where
toJSON :: InitialTeamData -> Value
toJSON InitialTeamData { Text
initialTeamDataName :: Text
initialTeamDataType :: Text
initialTeamDataDisplayName :: Text
initialTeamDataName :: InitialTeamData -> Text
initialTeamDataType :: InitialTeamData -> Text
initialTeamDataDisplayName :: InitialTeamData -> Text
.. } = [Pair] -> Value
A.object
[ Key
"display_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
initialTeamDataDisplayName
, Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
initialTeamDataType
, Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
initialTeamDataName
]
data ChannelStats = ChannelStats
{ ChannelStats -> Text
channelStatsChannelId :: Text
, ChannelStats -> Int
channelStatsMemberCount :: Int
} deriving (ReadPrec [ChannelStats]
ReadPrec ChannelStats
Int -> ReadS ChannelStats
ReadS [ChannelStats]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelStats]
$creadListPrec :: ReadPrec [ChannelStats]
readPrec :: ReadPrec ChannelStats
$creadPrec :: ReadPrec ChannelStats
readList :: ReadS [ChannelStats]
$creadList :: ReadS [ChannelStats]
readsPrec :: Int -> ReadS ChannelStats
$creadsPrec :: Int -> ReadS ChannelStats
Read, Int -> ChannelStats -> ShowS
[ChannelStats] -> ShowS
ChannelStats -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelStats] -> ShowS
$cshowList :: [ChannelStats] -> ShowS
show :: ChannelStats -> String
$cshow :: ChannelStats -> String
showsPrec :: Int -> ChannelStats -> ShowS
$cshowsPrec :: Int -> ChannelStats -> ShowS
Show, ChannelStats -> ChannelStats -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelStats -> ChannelStats -> Bool
$c/= :: ChannelStats -> ChannelStats -> Bool
== :: ChannelStats -> ChannelStats -> Bool
$c== :: ChannelStats -> ChannelStats -> Bool
Eq)
instance A.FromJSON ChannelStats where
parseJSON :: Value -> Parser ChannelStats
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"channelStats" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Text
channelStatsChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"channel_id"
Int
channelStatsMemberCount <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"member_count"
forall (m :: * -> *) a. Monad m => a -> m a
return ChannelStats { Int
Text
channelStatsMemberCount :: Int
channelStatsChannelId :: Text
channelStatsMemberCount :: Int
channelStatsChannelId :: Text
.. }
instance A.ToJSON ChannelStats where
toJSON :: ChannelStats -> Value
toJSON ChannelStats { Int
Text
channelStatsMemberCount :: Int
channelStatsChannelId :: Text
channelStatsMemberCount :: ChannelStats -> Int
channelStatsChannelId :: ChannelStats -> Text
.. } = [Pair] -> Value
A.object
[ Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
channelStatsChannelId
, Key
"member_count" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Int
channelStatsMemberCount
]
data ChannelUnread = ChannelUnread
{ ChannelUnread -> Text
channelUnreadChannelId :: Text
, ChannelUnread -> Text
channelUnreadTeamId :: Text
, ChannelUnread -> Int
channelUnreadMsgCount :: Int
, ChannelUnread -> Int
channelUnreadMentionCount :: Int
} deriving (ReadPrec [ChannelUnread]
ReadPrec ChannelUnread
Int -> ReadS ChannelUnread
ReadS [ChannelUnread]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelUnread]
$creadListPrec :: ReadPrec [ChannelUnread]
readPrec :: ReadPrec ChannelUnread
$creadPrec :: ReadPrec ChannelUnread
readList :: ReadS [ChannelUnread]
$creadList :: ReadS [ChannelUnread]
readsPrec :: Int -> ReadS ChannelUnread
$creadsPrec :: Int -> ReadS ChannelUnread
Read, Int -> ChannelUnread -> ShowS
[ChannelUnread] -> ShowS
ChannelUnread -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelUnread] -> ShowS
$cshowList :: [ChannelUnread] -> ShowS
show :: ChannelUnread -> String
$cshow :: ChannelUnread -> String
showsPrec :: Int -> ChannelUnread -> ShowS
$cshowsPrec :: Int -> ChannelUnread -> ShowS
Show, ChannelUnread -> ChannelUnread -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelUnread -> ChannelUnread -> Bool
$c/= :: ChannelUnread -> ChannelUnread -> Bool
== :: ChannelUnread -> ChannelUnread -> Bool
$c== :: ChannelUnread -> ChannelUnread -> Bool
Eq)
instance A.FromJSON ChannelUnread where
parseJSON :: Value -> Parser ChannelUnread
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"channelUnread" forall a b. (a -> b) -> a -> b
$ \Object
v -> do
Text
channelUnreadChannelId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"channel_id"
Text
channelUnreadTeamId <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"team_id"
Int
channelUnreadMsgCount <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"msg_count"
Int
channelUnreadMentionCount <- Object
v forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"mention_count"
forall (m :: * -> *) a. Monad m => a -> m a
return ChannelUnread { Int
Text
channelUnreadMentionCount :: Int
channelUnreadMsgCount :: Int
channelUnreadTeamId :: Text
channelUnreadChannelId :: Text
channelUnreadMentionCount :: Int
channelUnreadMsgCount :: Int
channelUnreadTeamId :: Text
channelUnreadChannelId :: Text
.. }
instance A.ToJSON ChannelUnread where
toJSON :: ChannelUnread -> Value
toJSON ChannelUnread { Int
Text
channelUnreadMentionCount :: Int
channelUnreadMsgCount :: Int
channelUnreadTeamId :: Text
channelUnreadChannelId :: Text
channelUnreadMentionCount :: ChannelUnread -> Int
channelUnreadMsgCount :: ChannelUnread -> Int
channelUnreadTeamId :: ChannelUnread -> Text
channelUnreadChannelId :: ChannelUnread -> Text
.. } = [Pair] -> Value
A.object
[ Key
"channel_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
channelUnreadChannelId
, Key
"team_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
channelUnreadTeamId
, Key
"msg_count" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Int
channelUnreadMsgCount
, Key
"mention_count" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Int
channelUnreadMentionCount
]