Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Discord.Internal.Types
Description
Re-export ALL the internal type modules. Hiding is in Discord.Types
Synopsis
- module Discord.Internal.Types.Prelude
- module Discord.Internal.Types.ApplicationInfo
- module Discord.Internal.Types.Channel
- module Discord.Internal.Types.Color
- module Discord.Internal.Types.Events
- module Discord.Internal.Types.Gateway
- module Discord.Internal.Types.Guild
- module Discord.Internal.Types.User
- module Discord.Internal.Types.Embed
- module Discord.Internal.Types.Components
- module Discord.Internal.Types.Emoji
- module Discord.Internal.Types.RolePermissions
- module Discord.Internal.Types.AutoModeration
- data AuditLog = AuditLog {}
- data AuditLogEvent
- data AuditLogEntry = AuditLogEntry {}
- data AuditLogChange = AuditLogChange {}
- data AuditLogEntryOptions
- data AuditLogTiming
- data GetAuditLogOpts = GetAuditLogOpts {}
- toAuditLogEvent :: Int -> Maybe AuditLogEvent
- type Object = KeyMap Value
- class ToJSON a where
- data UTCTime = UTCTime {
- utctDay :: Day
- utctDayTime :: DiffTime
- userFacingEvent :: EventInternalParse -> Event
Documentation
module Discord.Internal.Types.Color
module Discord.Internal.Types.Guild
module Discord.Internal.Types.User
module Discord.Internal.Types.Embed
module Discord.Internal.Types.Emoji
Audit log object, along with the entries it also contains referenced users, integrations [...] and so on
Constructors
data AuditLogEvent Source #
Instances
FromJSON AuditLogEvent Source # | |
Defined in Discord.Internal.Types.AuditLog Methods parseJSON :: Value -> Parser AuditLogEvent # parseJSONList :: Value -> Parser [AuditLogEvent] # | |
Read AuditLogEvent Source # | |
Defined in Discord.Internal.Types.AuditLog Methods readsPrec :: Int -> ReadS AuditLogEvent # readList :: ReadS [AuditLogEvent] # | |
Show AuditLogEvent Source # | |
Defined in Discord.Internal.Types.AuditLog Methods showsPrec :: Int -> AuditLogEvent -> ShowS # show :: AuditLogEvent -> String # showList :: [AuditLogEvent] -> ShowS # | |
Eq AuditLogEvent Source # | |
Defined in Discord.Internal.Types.AuditLog Methods (==) :: AuditLogEvent -> AuditLogEvent -> Bool # (/=) :: AuditLogEvent -> AuditLogEvent -> Bool # |
data AuditLogEntry Source #
An audit log entry object, so to speak the actual event that took place
Constructors
AuditLogEntry | |
Instances
FromJSON AuditLogEntry Source # | |
Defined in Discord.Internal.Types.AuditLog Methods parseJSON :: Value -> Parser AuditLogEntry # parseJSONList :: Value -> Parser [AuditLogEntry] # | |
Read AuditLogEntry Source # | |
Defined in Discord.Internal.Types.AuditLog Methods readsPrec :: Int -> ReadS AuditLogEntry # readList :: ReadS [AuditLogEntry] # | |
Show AuditLogEntry Source # | |
Defined in Discord.Internal.Types.AuditLog Methods showsPrec :: Int -> AuditLogEntry -> ShowS # show :: AuditLogEntry -> String # showList :: [AuditLogEntry] -> ShowS # | |
Eq AuditLogEntry Source # | |
Defined in Discord.Internal.Types.AuditLog Methods (==) :: AuditLogEntry -> AuditLogEntry -> Bool # (/=) :: AuditLogEntry -> AuditLogEntry -> Bool # |
data AuditLogChange Source #
A change object, new value and old value fields are of Aesons Value
type,
because it can be pretty much any value from discord api
Constructors
AuditLogChange | |
Fields |
Instances
FromJSON AuditLogChange Source # | |
Defined in Discord.Internal.Types.AuditLog Methods parseJSON :: Value -> Parser AuditLogChange # parseJSONList :: Value -> Parser [AuditLogChange] # | |
Read AuditLogChange Source # | |
Defined in Discord.Internal.Types.AuditLog Methods readsPrec :: Int -> ReadS AuditLogChange # readList :: ReadS [AuditLogChange] # | |
Show AuditLogChange Source # | |
Defined in Discord.Internal.Types.AuditLog Methods showsPrec :: Int -> AuditLogChange -> ShowS # show :: AuditLogChange -> String # showList :: [AuditLogChange] -> ShowS # | |
Eq AuditLogChange Source # | |
Defined in Discord.Internal.Types.AuditLog Methods (==) :: AuditLogChange -> AuditLogChange -> Bool # (/=) :: AuditLogChange -> AuditLogChange -> Bool # |
data AuditLogEntryOptions Source #
Optional data for the Audit Log Entry object
Instances
FromJSON AuditLogEntryOptions Source # | |
Defined in Discord.Internal.Types.AuditLog Methods parseJSON :: Value -> Parser AuditLogEntryOptions # parseJSONList :: Value -> Parser [AuditLogEntryOptions] # | |
Read AuditLogEntryOptions Source # | |
Defined in Discord.Internal.Types.AuditLog Methods readsPrec :: Int -> ReadS AuditLogEntryOptions # readList :: ReadS [AuditLogEntryOptions] # | |
Show AuditLogEntryOptions Source # | |
Defined in Discord.Internal.Types.AuditLog Methods showsPrec :: Int -> AuditLogEntryOptions -> ShowS # show :: AuditLogEntryOptions -> String # showList :: [AuditLogEntryOptions] -> ShowS # | |
Eq AuditLogEntryOptions Source # | |
Defined in Discord.Internal.Types.AuditLog Methods (==) :: AuditLogEntryOptions -> AuditLogEntryOptions -> Bool # (/=) :: AuditLogEntryOptions -> AuditLogEntryOptions -> Bool # |
data AuditLogTiming Source #
Instances
Read AuditLogTiming Source # | |
Defined in Discord.Internal.Types.AuditLog Methods readsPrec :: Int -> ReadS AuditLogTiming # readList :: ReadS [AuditLogTiming] # | |
Show AuditLogTiming Source # | |
Defined in Discord.Internal.Types.AuditLog Methods showsPrec :: Int -> AuditLogTiming -> ShowS # show :: AuditLogTiming -> String # showList :: [AuditLogTiming] -> ShowS # | |
Eq AuditLogTiming Source # | |
Defined in Discord.Internal.Types.AuditLog Methods (==) :: AuditLogTiming -> AuditLogTiming -> Bool # (/=) :: AuditLogTiming -> AuditLogTiming -> Bool # | |
Ord AuditLogTiming Source # | |
Defined in Discord.Internal.Types.AuditLog Methods compare :: AuditLogTiming -> AuditLogTiming -> Ordering # (<) :: AuditLogTiming -> AuditLogTiming -> Bool # (<=) :: AuditLogTiming -> AuditLogTiming -> Bool # (>) :: AuditLogTiming -> AuditLogTiming -> Bool # (>=) :: AuditLogTiming -> AuditLogTiming -> Bool # max :: AuditLogTiming -> AuditLogTiming -> AuditLogTiming # min :: AuditLogTiming -> AuditLogTiming -> AuditLogTiming # |
data GetAuditLogOpts Source #
Options for GetAuditLog
request
Constructors
GetAuditLogOpts | |
Instances
Read GetAuditLogOpts Source # | |
Defined in Discord.Internal.Types.AuditLog Methods readsPrec :: Int -> ReadS GetAuditLogOpts # readList :: ReadS [GetAuditLogOpts] # | |
Show GetAuditLogOpts Source # | |
Defined in Discord.Internal.Types.AuditLog Methods showsPrec :: Int -> GetAuditLogOpts -> ShowS # show :: GetAuditLogOpts -> String # showList :: [GetAuditLogOpts] -> ShowS # | |
Default GetAuditLogOpts Source # | |
Defined in Discord.Internal.Types.AuditLog Methods def :: GetAuditLogOpts # | |
Eq GetAuditLogOpts Source # | |
Defined in Discord.Internal.Types.AuditLog Methods (==) :: GetAuditLogOpts -> GetAuditLogOpts -> Bool # (/=) :: GetAuditLogOpts -> GetAuditLogOpts -> Bool # |
toAuditLogEvent :: Int -> Maybe AuditLogEvent Source #
See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events for more information on Events
A type that can be converted to JSON.
Instances in general must specify toJSON
and should (but don't need
to) specify toEncoding
.
An example type and instance:
-- Allow ourselves to writeText
literals. {-# LANGUAGE OverloadedStrings #-} data Coord = Coord { x :: Double, y :: Double } instanceToJSON
Coord wheretoJSON
(Coord x y) =object
["x".=
x, "y".=
y]toEncoding
(Coord x y) =pairs
("x".=
x<>
"y".=
y)
Instead of manually writing your ToJSON
instance, there are two options
to do it automatically:
- Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time. The generated instance is optimized for your type so it will probably be more efficient than the following option.
- The compiler can provide a default generic implementation for
toJSON
.
To use the second, simply add a deriving
clause to your
datatype and declare a Generic
ToJSON
instance. If you require nothing other than
defaultOptions
, it is sufficient to write (and this is the only
alternative where the default toJSON
implementation is sufficient):
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics data Coord = Coord { x :: Double, y :: Double } derivingGeneric
instanceToJSON
Coord wheretoEncoding
=genericToEncoding
defaultOptions
or more conveniently using the DerivingVia extension
deriving viaGenerically
Coord instanceToJSON
Coord
If on the other hand you wish to customize the generic decoding, you have to implement both methods:
customOptions =defaultOptions
{fieldLabelModifier
=map
toUpper
} instanceToJSON
Coord wheretoJSON
=genericToJSON
customOptionstoEncoding
=genericToEncoding
customOptions
Previous versions of this library only had the toJSON
method. Adding
toEncoding
had two reasons:
toEncoding
is more efficient for the common case that the output oftoJSON
is directly serialized to aByteString
. Further, expressing either method in terms of the other would be non-optimal.- The choice of defaults allows a smooth transition for existing users:
Existing instances that do not define
toEncoding
still compile and have the correct semantics. This is ensured by making the default implementation oftoEncoding
usetoJSON
. This produces correct results, but since it performs an intermediate conversion to aValue
, it will be less efficient than directly emitting anEncoding
. (this also means that specifying nothing more thaninstance ToJSON Coord
would be sufficient as a generically decoding instance, but there probably exists no good reason to not specifytoEncoding
in new instances.)
Minimal complete definition
Nothing
Instances
This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.
Constructors
UTCTime | |
Fields
|
Instances
FromJSON UTCTime | |
Defined in Data.Aeson.Types.FromJSON | |
FromJSONKey UTCTime | |
Defined in Data.Aeson.Types.FromJSON Methods | |
ToJSON UTCTime | |
ToJSONKey UTCTime | |
Defined in Data.Aeson.Types.ToJSON | |
Data UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime # toConstr :: UTCTime -> Constr # dataTypeOf :: UTCTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) # gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # | |
NFData UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
Eq UTCTime | |
Ord UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
FromFormKey UTCTime | |
Defined in Web.Internal.FormUrlEncoded | |
ToFormKey UTCTime | |
Defined in Web.Internal.FormUrlEncoded | |
FromHttpApiData UTCTime |
|
Defined in Web.Internal.HttpApiData Methods parseUrlPiece :: Text -> Either Text UTCTime # parseHeader :: ByteString -> Either Text UTCTime # | |
ToHttpApiData UTCTime |
|
Defined in Web.Internal.HttpApiData Methods toUrlPiece :: UTCTime -> Text # toEncodedUrlPiece :: UTCTime -> Builder # toHeader :: UTCTime -> ByteString # toQueryParam :: UTCTime -> Text # toEncodedQueryParam :: UTCTime -> Builder # |
userFacingEvent :: EventInternalParse -> Event Source #
Converts an internal event to its user facing counterpart