{-# LANGUAGE TemplateHaskell #-}

-- | User activities
module Calamity.Types.Model.Presence.Activity (
  Activity (..),
  activity,
  ActivityType (..),
  ActivityTimestamps (..),
  ActivityParty (..),
  ActivityAssets (..),
  ActivitySecrets (..),
) where

import Calamity.Internal.UnixTimestamp
import Calamity.Internal.Utils
import Calamity.Types.Snowflake
import Data.Aeson ((.:), (.:?))
import Data.Aeson qualified as Aeson
import Data.Scientific
import Data.Text (Text)
import Data.Time (UTCTime)
import Data.Word
import Optics.TH
import TextShow qualified
import TextShow.TH

data ActivityType
  = Game
  | Streaming
  | Listening
  | Custom
  | Other Int
  deriving (ActivityType -> ActivityType -> Bool
(ActivityType -> ActivityType -> Bool)
-> (ActivityType -> ActivityType -> Bool) -> Eq ActivityType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ActivityType -> ActivityType -> Bool
== :: ActivityType -> ActivityType -> Bool
$c/= :: ActivityType -> ActivityType -> Bool
/= :: ActivityType -> ActivityType -> Bool
Eq, Int -> ActivityType -> ShowS
[ActivityType] -> ShowS
ActivityType -> String
(Int -> ActivityType -> ShowS)
-> (ActivityType -> String)
-> ([ActivityType] -> ShowS)
-> Show ActivityType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ActivityType -> ShowS
showsPrec :: Int -> ActivityType -> ShowS
$cshow :: ActivityType -> String
show :: ActivityType -> String
$cshowList :: [ActivityType] -> ShowS
showList :: [ActivityType] -> ShowS
Show)

instance Aeson.ToJSON ActivityType where
  toJSON :: ActivityType -> Value
toJSON ActivityType
Game = Scientific -> Value
Aeson.Number Scientific
0
  toJSON ActivityType
Streaming = Scientific -> Value
Aeson.Number Scientific
1
  toJSON ActivityType
Listening = Scientific -> Value
Aeson.Number Scientific
2
  toJSON ActivityType
Custom = Scientific -> Value
Aeson.Number Scientific
4
  toJSON (Other Int
n) = Scientific -> Value
Aeson.Number (Scientific -> Value) -> Scientific -> Value
forall a b. (a -> b) -> a -> b
$ Int -> Scientific
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n

instance Aeson.FromJSON ActivityType where
  parseJSON :: Value -> Parser ActivityType
parseJSON = String
-> (Scientific -> Parser ActivityType)
-> Value
-> Parser ActivityType
forall a. String -> (Scientific -> Parser a) -> Value -> Parser a
Aeson.withScientific String
"ActivityType" ((Scientific -> Parser ActivityType)
 -> Value -> Parser ActivityType)
-> (Scientific -> Parser ActivityType)
-> Value
-> Parser ActivityType
forall a b. (a -> b) -> a -> b
$ \Scientific
n -> case forall i. (Integral i, Bounded i) => Scientific -> Maybe i
toBoundedInteger @Int Scientific
n of
    Just Int
v -> case Int
v of
      Int
0 -> ActivityType -> Parser ActivityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ActivityType
Game
      Int
1 -> ActivityType -> Parser ActivityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ActivityType
Streaming
      Int
2 -> ActivityType -> Parser ActivityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ActivityType
Listening
      Int
4 -> ActivityType -> Parser ActivityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ActivityType
Custom
      Int
n -> ActivityType -> Parser ActivityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ActivityType -> Parser ActivityType)
-> ActivityType -> Parser ActivityType
forall a b. (a -> b) -> a -> b
$ Int -> ActivityType
Other Int
n
    Maybe Int
Nothing -> String -> Parser ActivityType
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser ActivityType) -> String -> Parser ActivityType
forall a b. (a -> b) -> a -> b
$ String
"Invalid ActivityType: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Scientific -> String
forall a. Show a => a -> String
show Scientific
n

data Activity = Activity
  { Activity -> Text
name :: Text
  , Activity -> ActivityType
type_ :: ActivityType
  , Activity -> Maybe Text
url :: Maybe Text
  , Activity -> Maybe ActivityTimestamps
timestamps :: Maybe ActivityTimestamps
  , Activity -> Maybe (Snowflake ())
applicationID :: Maybe (Snowflake ())
  , Activity -> Maybe Text
details :: Maybe Text
  , Activity -> Maybe Text
state :: Maybe Text
  , Activity -> Maybe ActivityParty
party :: Maybe ActivityParty
  , Activity -> Maybe ActivityAssets
assets :: Maybe ActivityAssets
  , Activity -> Maybe ActivitySecrets
secrets :: Maybe ActivitySecrets
  , Activity -> Maybe Bool
instance_ :: Maybe Bool
  , Activity -> Maybe Word64
flags :: Maybe Word64
  }
  deriving (Activity -> Activity -> Bool
(Activity -> Activity -> Bool)
-> (Activity -> Activity -> Bool) -> Eq Activity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Activity -> Activity -> Bool
== :: Activity -> Activity -> Bool
$c/= :: Activity -> Activity -> Bool
/= :: Activity -> Activity -> Bool
Eq, Int -> Activity -> ShowS
[Activity] -> ShowS
Activity -> String
(Int -> Activity -> ShowS)
-> (Activity -> String) -> ([Activity] -> ShowS) -> Show Activity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Activity -> ShowS
showsPrec :: Int -> Activity -> ShowS
$cshow :: Activity -> String
show :: Activity -> String
$cshowList :: [Activity] -> ShowS
showList :: [Activity] -> ShowS
Show)
  deriving ([Activity] -> Value
[Activity] -> Encoding
Activity -> Value
Activity -> Encoding
(Activity -> Value)
-> (Activity -> Encoding)
-> ([Activity] -> Value)
-> ([Activity] -> Encoding)
-> ToJSON Activity
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: Activity -> Value
toJSON :: Activity -> Value
$ctoEncoding :: Activity -> Encoding
toEncoding :: Activity -> Encoding
$ctoJSONList :: [Activity] -> Value
toJSONList :: [Activity] -> Value
$ctoEncodingList :: [Activity] -> Encoding
toEncodingList :: [Activity] -> Encoding
Aeson.ToJSON) via CalamityToJSON Activity

instance CalamityToJSON' Activity where
  toPairs :: forall kv. KeyValue kv => Activity -> [Maybe kv]
toPairs Activity {Maybe Bool
Maybe Word64
Maybe Text
Maybe (Snowflake ())
Maybe ActivitySecrets
Maybe ActivityAssets
Maybe ActivityParty
Maybe ActivityTimestamps
Text
ActivityType
$sel:name:Activity :: Activity -> Text
$sel:type_:Activity :: Activity -> ActivityType
$sel:url:Activity :: Activity -> Maybe Text
$sel:timestamps:Activity :: Activity -> Maybe ActivityTimestamps
$sel:applicationID:Activity :: Activity -> Maybe (Snowflake ())
$sel:details:Activity :: Activity -> Maybe Text
$sel:state:Activity :: Activity -> Maybe Text
$sel:party:Activity :: Activity -> Maybe ActivityParty
$sel:assets:Activity :: Activity -> Maybe ActivityAssets
$sel:secrets:Activity :: Activity -> Maybe ActivitySecrets
$sel:instance_:Activity :: Activity -> Maybe Bool
$sel:flags:Activity :: Activity -> Maybe Word64
name :: Text
type_ :: ActivityType
url :: Maybe Text
timestamps :: Maybe ActivityTimestamps
applicationID :: Maybe (Snowflake ())
details :: Maybe Text
state :: Maybe Text
party :: Maybe ActivityParty
assets :: Maybe ActivityAssets
secrets :: Maybe ActivitySecrets
instance_ :: Maybe Bool
flags :: Maybe Word64
..} =
    [ Key
"name" Key -> Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> v -> Maybe kv
.= Text
name
    , Key
"type" Key -> ActivityType -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> v -> Maybe kv
.= ActivityType
type_
    , Key
"url" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
url
    , Key
"timestamps" Key -> Maybe ActivityTimestamps -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe ActivityTimestamps
timestamps
    , Key
"application_id" Key -> Maybe (Snowflake ()) -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe (Snowflake ())
applicationID
    , Key
"details" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
details
    , Key
"state" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
state
    , Key
"party" Key -> Maybe ActivityParty -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe ActivityParty
party
    , Key
"assets" Key -> Maybe ActivityAssets -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe ActivityAssets
assets
    , Key
"secrets" Key -> Maybe ActivitySecrets -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe ActivitySecrets
secrets
    , Key
"instance" Key -> Maybe Bool -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Bool
instance_
    , Key
"flags" Key -> Maybe Word64 -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Word64
flags
    ]

instance Aeson.FromJSON Activity where
  parseJSON :: Value -> Parser Activity
parseJSON = String -> (Object -> Parser Activity) -> Value -> Parser Activity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"Activity" ((Object -> Parser Activity) -> Value -> Parser Activity)
-> (Object -> Parser Activity) -> Value -> Parser Activity
forall a b. (a -> b) -> a -> b
$ \Object
v ->
    Text
-> ActivityType
-> Maybe Text
-> Maybe ActivityTimestamps
-> Maybe (Snowflake ())
-> Maybe Text
-> Maybe Text
-> Maybe ActivityParty
-> Maybe ActivityAssets
-> Maybe ActivitySecrets
-> Maybe Bool
-> Maybe Word64
-> Activity
Activity
      (Text
 -> ActivityType
 -> Maybe Text
 -> Maybe ActivityTimestamps
 -> Maybe (Snowflake ())
 -> Maybe Text
 -> Maybe Text
 -> Maybe ActivityParty
 -> Maybe ActivityAssets
 -> Maybe ActivitySecrets
 -> Maybe Bool
 -> Maybe Word64
 -> Activity)
-> Parser Text
-> Parser
     (ActivityType
      -> Maybe Text
      -> Maybe ActivityTimestamps
      -> Maybe (Snowflake ())
      -> Maybe Text
      -> Maybe Text
      -> Maybe ActivityParty
      -> Maybe ActivityAssets
      -> Maybe ActivitySecrets
      -> Maybe Bool
      -> Maybe Word64
      -> Activity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name"
      Parser
  (ActivityType
   -> Maybe Text
   -> Maybe ActivityTimestamps
   -> Maybe (Snowflake ())
   -> Maybe Text
   -> Maybe Text
   -> Maybe ActivityParty
   -> Maybe ActivityAssets
   -> Maybe ActivitySecrets
   -> Maybe Bool
   -> Maybe Word64
   -> Activity)
-> Parser ActivityType
-> Parser
     (Maybe Text
      -> Maybe ActivityTimestamps
      -> Maybe (Snowflake ())
      -> Maybe Text
      -> Maybe Text
      -> Maybe ActivityParty
      -> Maybe ActivityAssets
      -> Maybe ActivitySecrets
      -> Maybe Bool
      -> Maybe Word64
      -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser ActivityType
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type"
      Parser
  (Maybe Text
   -> Maybe ActivityTimestamps
   -> Maybe (Snowflake ())
   -> Maybe Text
   -> Maybe Text
   -> Maybe ActivityParty
   -> Maybe ActivityAssets
   -> Maybe ActivitySecrets
   -> Maybe Bool
   -> Maybe Word64
   -> Activity)
-> Parser (Maybe Text)
-> Parser
     (Maybe ActivityTimestamps
      -> Maybe (Snowflake ())
      -> Maybe Text
      -> Maybe Text
      -> Maybe ActivityParty
      -> Maybe ActivityAssets
      -> Maybe ActivitySecrets
      -> Maybe Bool
      -> Maybe Word64
      -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"url"
      Parser
  (Maybe ActivityTimestamps
   -> Maybe (Snowflake ())
   -> Maybe Text
   -> Maybe Text
   -> Maybe ActivityParty
   -> Maybe ActivityAssets
   -> Maybe ActivitySecrets
   -> Maybe Bool
   -> Maybe Word64
   -> Activity)
-> Parser (Maybe ActivityTimestamps)
-> Parser
     (Maybe (Snowflake ())
      -> Maybe Text
      -> Maybe Text
      -> Maybe ActivityParty
      -> Maybe ActivityAssets
      -> Maybe ActivitySecrets
      -> Maybe Bool
      -> Maybe Word64
      -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe ActivityTimestamps)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"timestamps"
      Parser
  (Maybe (Snowflake ())
   -> Maybe Text
   -> Maybe Text
   -> Maybe ActivityParty
   -> Maybe ActivityAssets
   -> Maybe ActivitySecrets
   -> Maybe Bool
   -> Maybe Word64
   -> Activity)
-> Parser (Maybe (Snowflake ()))
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ActivityParty
      -> Maybe ActivityAssets
      -> Maybe ActivitySecrets
      -> Maybe Bool
      -> Maybe Word64
      -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (Snowflake ()))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"application_id"
      Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe ActivityParty
   -> Maybe ActivityAssets
   -> Maybe ActivitySecrets
   -> Maybe Bool
   -> Maybe Word64
   -> Activity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ActivityParty
      -> Maybe ActivityAssets
      -> Maybe ActivitySecrets
      -> Maybe Bool
      -> Maybe Word64
      -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"details"
      Parser
  (Maybe Text
   -> Maybe ActivityParty
   -> Maybe ActivityAssets
   -> Maybe ActivitySecrets
   -> Maybe Bool
   -> Maybe Word64
   -> Activity)
-> Parser (Maybe Text)
-> Parser
     (Maybe ActivityParty
      -> Maybe ActivityAssets
      -> Maybe ActivitySecrets
      -> Maybe Bool
      -> Maybe Word64
      -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"state"
      Parser
  (Maybe ActivityParty
   -> Maybe ActivityAssets
   -> Maybe ActivitySecrets
   -> Maybe Bool
   -> Maybe Word64
   -> Activity)
-> Parser (Maybe ActivityParty)
-> Parser
     (Maybe ActivityAssets
      -> Maybe ActivitySecrets -> Maybe Bool -> Maybe Word64 -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe ActivityParty)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"party"
      Parser
  (Maybe ActivityAssets
   -> Maybe ActivitySecrets -> Maybe Bool -> Maybe Word64 -> Activity)
-> Parser (Maybe ActivityAssets)
-> Parser
     (Maybe ActivitySecrets -> Maybe Bool -> Maybe Word64 -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe ActivityAssets)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"assets"
      Parser
  (Maybe ActivitySecrets -> Maybe Bool -> Maybe Word64 -> Activity)
-> Parser (Maybe ActivitySecrets)
-> Parser (Maybe Bool -> Maybe Word64 -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe ActivitySecrets)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"secrets"
      Parser (Maybe Bool -> Maybe Word64 -> Activity)
-> Parser (Maybe Bool) -> Parser (Maybe Word64 -> Activity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"instance"
      Parser (Maybe Word64 -> Activity)
-> Parser (Maybe Word64) -> Parser Activity
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Word64)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"flags"

-- | Make an 'Activity' with all optional fields set to Nothing
activity :: Text -> ActivityType -> Activity
activity :: Text -> ActivityType -> Activity
activity !Text
name !ActivityType
type_ =
  Activity
    { $sel:name:Activity :: Text
name = Text
name
    , $sel:type_:Activity :: ActivityType
type_ = ActivityType
type_
    , $sel:url:Activity :: Maybe Text
url = Maybe Text
forall a. Maybe a
Nothing
    , $sel:timestamps:Activity :: Maybe ActivityTimestamps
timestamps = Maybe ActivityTimestamps
forall a. Maybe a
Nothing
    , $sel:applicationID:Activity :: Maybe (Snowflake ())
applicationID = Maybe (Snowflake ())
forall a. Maybe a
Nothing
    , $sel:details:Activity :: Maybe Text
details = Maybe Text
forall a. Maybe a
Nothing
    , $sel:state:Activity :: Maybe Text
state = Maybe Text
forall a. Maybe a
Nothing
    , $sel:party:Activity :: Maybe ActivityParty
party = Maybe ActivityParty
forall a. Maybe a
Nothing
    , $sel:assets:Activity :: Maybe ActivityAssets
assets = Maybe ActivityAssets
forall a. Maybe a
Nothing
    , $sel:secrets:Activity :: Maybe ActivitySecrets
secrets = Maybe ActivitySecrets
forall a. Maybe a
Nothing
    , $sel:instance_:Activity :: Maybe Bool
instance_ = Maybe Bool
forall a. Maybe a
Nothing
    , $sel:flags:Activity :: Maybe Word64
flags = Maybe Word64
forall a. Maybe a
Nothing
    }

data ActivityTimestamps = ActivityTimestamps
  { ActivityTimestamps -> Maybe UTCTime
start :: Maybe UTCTime
  , ActivityTimestamps -> Maybe UTCTime
end :: Maybe UTCTime
  }
  deriving (ActivityTimestamps -> ActivityTimestamps -> Bool
(ActivityTimestamps -> ActivityTimestamps -> Bool)
-> (ActivityTimestamps -> ActivityTimestamps -> Bool)
-> Eq ActivityTimestamps
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ActivityTimestamps -> ActivityTimestamps -> Bool
== :: ActivityTimestamps -> ActivityTimestamps -> Bool
$c/= :: ActivityTimestamps -> ActivityTimestamps -> Bool
/= :: ActivityTimestamps -> ActivityTimestamps -> Bool
Eq, Int -> ActivityTimestamps -> ShowS
[ActivityTimestamps] -> ShowS
ActivityTimestamps -> String
(Int -> ActivityTimestamps -> ShowS)
-> (ActivityTimestamps -> String)
-> ([ActivityTimestamps] -> ShowS)
-> Show ActivityTimestamps
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ActivityTimestamps -> ShowS
showsPrec :: Int -> ActivityTimestamps -> ShowS
$cshow :: ActivityTimestamps -> String
show :: ActivityTimestamps -> String
$cshowList :: [ActivityTimestamps] -> ShowS
showList :: [ActivityTimestamps] -> ShowS
Show)
  deriving (Int -> ActivityTimestamps -> Text
Int -> ActivityTimestamps -> Builder
Int -> ActivityTimestamps -> Text
[ActivityTimestamps] -> Text
[ActivityTimestamps] -> Builder
[ActivityTimestamps] -> Text
ActivityTimestamps -> Text
ActivityTimestamps -> Builder
ActivityTimestamps -> Text
(Int -> ActivityTimestamps -> Builder)
-> (ActivityTimestamps -> Builder)
-> ([ActivityTimestamps] -> Builder)
-> (Int -> ActivityTimestamps -> Text)
-> (ActivityTimestamps -> Text)
-> ([ActivityTimestamps] -> Text)
-> (Int -> ActivityTimestamps -> Text)
-> (ActivityTimestamps -> Text)
-> ([ActivityTimestamps] -> Text)
-> TextShow ActivityTimestamps
forall a.
(Int -> a -> Builder)
-> (a -> Builder)
-> ([a] -> Builder)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> TextShow a
$cshowbPrec :: Int -> ActivityTimestamps -> Builder
showbPrec :: Int -> ActivityTimestamps -> Builder
$cshowb :: ActivityTimestamps -> Builder
showb :: ActivityTimestamps -> Builder
$cshowbList :: [ActivityTimestamps] -> Builder
showbList :: [ActivityTimestamps] -> Builder
$cshowtPrec :: Int -> ActivityTimestamps -> Text
showtPrec :: Int -> ActivityTimestamps -> Text
$cshowt :: ActivityTimestamps -> Text
showt :: ActivityTimestamps -> Text
$cshowtList :: [ActivityTimestamps] -> Text
showtList :: [ActivityTimestamps] -> Text
$cshowtlPrec :: Int -> ActivityTimestamps -> Text
showtlPrec :: Int -> ActivityTimestamps -> Text
$cshowtl :: ActivityTimestamps -> Text
showtl :: ActivityTimestamps -> Text
$cshowtlList :: [ActivityTimestamps] -> Text
showtlList :: [ActivityTimestamps] -> Text
TextShow.TextShow) via TextShow.FromStringShow ActivityTimestamps
  deriving ([ActivityTimestamps] -> Value
[ActivityTimestamps] -> Encoding
ActivityTimestamps -> Value
ActivityTimestamps -> Encoding
(ActivityTimestamps -> Value)
-> (ActivityTimestamps -> Encoding)
-> ([ActivityTimestamps] -> Value)
-> ([ActivityTimestamps] -> Encoding)
-> ToJSON ActivityTimestamps
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: ActivityTimestamps -> Value
toJSON :: ActivityTimestamps -> Value
$ctoEncoding :: ActivityTimestamps -> Encoding
toEncoding :: ActivityTimestamps -> Encoding
$ctoJSONList :: [ActivityTimestamps] -> Value
toJSONList :: [ActivityTimestamps] -> Value
$ctoEncodingList :: [ActivityTimestamps] -> Encoding
toEncodingList :: [ActivityTimestamps] -> Encoding
Aeson.ToJSON) via CalamityToJSON ActivityTimestamps

instance CalamityToJSON' ActivityTimestamps where
  toPairs :: forall kv. KeyValue kv => ActivityTimestamps -> [Maybe kv]
toPairs ActivityTimestamps {Maybe UTCTime
$sel:start:ActivityTimestamps :: ActivityTimestamps -> Maybe UTCTime
$sel:end:ActivityTimestamps :: ActivityTimestamps -> Maybe UTCTime
start :: Maybe UTCTime
end :: Maybe UTCTime
..} =
    [ Key
"start" Key -> Maybe UnixTimestamp -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= (UTCTime -> UnixTimestamp) -> Maybe UTCTime -> Maybe UnixTimestamp
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap UTCTime -> UnixTimestamp
UnixTimestamp Maybe UTCTime
start
    , Key
"end" Key -> Maybe UnixTimestamp -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= (UTCTime -> UnixTimestamp) -> Maybe UTCTime -> Maybe UnixTimestamp
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap UTCTime -> UnixTimestamp
UnixTimestamp Maybe UTCTime
end
    ]

instance Aeson.FromJSON ActivityTimestamps where
  parseJSON :: Value -> Parser ActivityTimestamps
parseJSON = String
-> (Object -> Parser ActivityTimestamps)
-> Value
-> Parser ActivityTimestamps
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ActivityTimestamps" ((Object -> Parser ActivityTimestamps)
 -> Value -> Parser ActivityTimestamps)
-> (Object -> Parser ActivityTimestamps)
-> Value
-> Parser ActivityTimestamps
forall a b. (a -> b) -> a -> b
$ \Object
v ->
    Maybe UTCTime -> Maybe UTCTime -> ActivityTimestamps
ActivityTimestamps
      (Maybe UTCTime -> Maybe UTCTime -> ActivityTimestamps)
-> Parser (Maybe UTCTime)
-> Parser (Maybe UTCTime -> ActivityTimestamps)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((UnixTimestamp -> UTCTime) -> Maybe UnixTimestamp -> Maybe UTCTime
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap UnixTimestamp -> UTCTime
unUnixTimestamp (Maybe UnixTimestamp -> Maybe UTCTime)
-> Parser (Maybe UnixTimestamp) -> Parser (Maybe UTCTime)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser (Maybe UnixTimestamp)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"start")
      Parser (Maybe UTCTime -> ActivityTimestamps)
-> Parser (Maybe UTCTime) -> Parser ActivityTimestamps
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ((UnixTimestamp -> UTCTime) -> Maybe UnixTimestamp -> Maybe UTCTime
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap UnixTimestamp -> UTCTime
unUnixTimestamp (Maybe UnixTimestamp -> Maybe UTCTime)
-> Parser (Maybe UnixTimestamp) -> Parser (Maybe UTCTime)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser (Maybe UnixTimestamp)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"end")

data ActivityParty = ActivityParty
  { ActivityParty -> Maybe Text
id :: Maybe Text
  , ActivityParty -> Maybe (Int, Int)
size :: Maybe (Int, Int)
  }
  deriving (ActivityParty -> ActivityParty -> Bool
(ActivityParty -> ActivityParty -> Bool)
-> (ActivityParty -> ActivityParty -> Bool) -> Eq ActivityParty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ActivityParty -> ActivityParty -> Bool
== :: ActivityParty -> ActivityParty -> Bool
$c/= :: ActivityParty -> ActivityParty -> Bool
/= :: ActivityParty -> ActivityParty -> Bool
Eq, Int -> ActivityParty -> ShowS
[ActivityParty] -> ShowS
ActivityParty -> String
(Int -> ActivityParty -> ShowS)
-> (ActivityParty -> String)
-> ([ActivityParty] -> ShowS)
-> Show ActivityParty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ActivityParty -> ShowS
showsPrec :: Int -> ActivityParty -> ShowS
$cshow :: ActivityParty -> String
show :: ActivityParty -> String
$cshowList :: [ActivityParty] -> ShowS
showList :: [ActivityParty] -> ShowS
Show)
  deriving ([ActivityParty] -> Value
[ActivityParty] -> Encoding
ActivityParty -> Value
ActivityParty -> Encoding
(ActivityParty -> Value)
-> (ActivityParty -> Encoding)
-> ([ActivityParty] -> Value)
-> ([ActivityParty] -> Encoding)
-> ToJSON ActivityParty
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: ActivityParty -> Value
toJSON :: ActivityParty -> Value
$ctoEncoding :: ActivityParty -> Encoding
toEncoding :: ActivityParty -> Encoding
$ctoJSONList :: [ActivityParty] -> Value
toJSONList :: [ActivityParty] -> Value
$ctoEncodingList :: [ActivityParty] -> Encoding
toEncodingList :: [ActivityParty] -> Encoding
Aeson.ToJSON) via CalamityToJSON ActivityParty

instance CalamityToJSON' ActivityParty where
  toPairs :: forall kv. KeyValue kv => ActivityParty -> [Maybe kv]
toPairs ActivityParty {Maybe (Int, Int)
Maybe Text
$sel:id:ActivityParty :: ActivityParty -> Maybe Text
$sel:size:ActivityParty :: ActivityParty -> Maybe (Int, Int)
id :: Maybe Text
size :: Maybe (Int, Int)
..} =
    [ Key
"id" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
id
    , Key
"size" Key -> Maybe (Int, Int) -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe (Int, Int)
size
    ]

instance Aeson.FromJSON ActivityParty where
  parseJSON :: Value -> Parser ActivityParty
parseJSON = String
-> (Object -> Parser ActivityParty)
-> Value
-> Parser ActivityParty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ActivityParty" ((Object -> Parser ActivityParty) -> Value -> Parser ActivityParty)
-> (Object -> Parser ActivityParty)
-> Value
-> Parser ActivityParty
forall a b. (a -> b) -> a -> b
$ \Object
v ->
    Maybe Text -> Maybe (Int, Int) -> ActivityParty
ActivityParty
      (Maybe Text -> Maybe (Int, Int) -> ActivityParty)
-> Parser (Maybe Text)
-> Parser (Maybe (Int, Int) -> ActivityParty)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"id"
      Parser (Maybe (Int, Int) -> ActivityParty)
-> Parser (Maybe (Int, Int)) -> Parser ActivityParty
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (Int, Int))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"size"

data ActivityAssets = ActivityAssets
  { ActivityAssets -> Maybe Text
largeImage :: Maybe Text
  , ActivityAssets -> Maybe Text
largeText :: Maybe Text
  , ActivityAssets -> Maybe Text
smallImage :: Maybe Text
  , ActivityAssets -> Maybe Text
smallText :: Maybe Text
  }
  deriving (ActivityAssets -> ActivityAssets -> Bool
(ActivityAssets -> ActivityAssets -> Bool)
-> (ActivityAssets -> ActivityAssets -> Bool) -> Eq ActivityAssets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ActivityAssets -> ActivityAssets -> Bool
== :: ActivityAssets -> ActivityAssets -> Bool
$c/= :: ActivityAssets -> ActivityAssets -> Bool
/= :: ActivityAssets -> ActivityAssets -> Bool
Eq, Int -> ActivityAssets -> ShowS
[ActivityAssets] -> ShowS
ActivityAssets -> String
(Int -> ActivityAssets -> ShowS)
-> (ActivityAssets -> String)
-> ([ActivityAssets] -> ShowS)
-> Show ActivityAssets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ActivityAssets -> ShowS
showsPrec :: Int -> ActivityAssets -> ShowS
$cshow :: ActivityAssets -> String
show :: ActivityAssets -> String
$cshowList :: [ActivityAssets] -> ShowS
showList :: [ActivityAssets] -> ShowS
Show)
  deriving ([ActivityAssets] -> Value
[ActivityAssets] -> Encoding
ActivityAssets -> Value
ActivityAssets -> Encoding
(ActivityAssets -> Value)
-> (ActivityAssets -> Encoding)
-> ([ActivityAssets] -> Value)
-> ([ActivityAssets] -> Encoding)
-> ToJSON ActivityAssets
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: ActivityAssets -> Value
toJSON :: ActivityAssets -> Value
$ctoEncoding :: ActivityAssets -> Encoding
toEncoding :: ActivityAssets -> Encoding
$ctoJSONList :: [ActivityAssets] -> Value
toJSONList :: [ActivityAssets] -> Value
$ctoEncodingList :: [ActivityAssets] -> Encoding
toEncodingList :: [ActivityAssets] -> Encoding
Aeson.ToJSON) via CalamityToJSON ActivityAssets

instance CalamityToJSON' ActivityAssets where
  toPairs :: forall kv. KeyValue kv => ActivityAssets -> [Maybe kv]
toPairs ActivityAssets {Maybe Text
$sel:largeImage:ActivityAssets :: ActivityAssets -> Maybe Text
$sel:largeText:ActivityAssets :: ActivityAssets -> Maybe Text
$sel:smallImage:ActivityAssets :: ActivityAssets -> Maybe Text
$sel:smallText:ActivityAssets :: ActivityAssets -> Maybe Text
largeImage :: Maybe Text
largeText :: Maybe Text
smallImage :: Maybe Text
smallText :: Maybe Text
..} =
    [ Key
"large_image" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
largeImage
    , Key
"large_text" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
largeText
    , Key
"small_image" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
smallImage
    , Key
"small_text" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
smallText
    ]

instance Aeson.FromJSON ActivityAssets where
  parseJSON :: Value -> Parser ActivityAssets
parseJSON = String
-> (Object -> Parser ActivityAssets)
-> Value
-> Parser ActivityAssets
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ActivityAssets" ((Object -> Parser ActivityAssets)
 -> Value -> Parser ActivityAssets)
-> (Object -> Parser ActivityAssets)
-> Value
-> Parser ActivityAssets
forall a b. (a -> b) -> a -> b
$ \Object
v ->
    Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> ActivityAssets
ActivityAssets
      (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> ActivityAssets)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ActivityAssets)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"large_image"
      Parser (Maybe Text -> Maybe Text -> Maybe Text -> ActivityAssets)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ActivityAssets)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"large_text"
      Parser (Maybe Text -> Maybe Text -> ActivityAssets)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ActivityAssets)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"small_image"
      Parser (Maybe Text -> ActivityAssets)
-> Parser (Maybe Text) -> Parser ActivityAssets
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"small_text"

data ActivitySecrets = ActivitySecrets
  { ActivitySecrets -> Maybe Text
join :: Maybe Text
  , ActivitySecrets -> Maybe Text
spectate :: Maybe Text
  , ActivitySecrets -> Maybe Text
match :: Maybe Text
  }
  deriving (ActivitySecrets -> ActivitySecrets -> Bool
(ActivitySecrets -> ActivitySecrets -> Bool)
-> (ActivitySecrets -> ActivitySecrets -> Bool)
-> Eq ActivitySecrets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ActivitySecrets -> ActivitySecrets -> Bool
== :: ActivitySecrets -> ActivitySecrets -> Bool
$c/= :: ActivitySecrets -> ActivitySecrets -> Bool
/= :: ActivitySecrets -> ActivitySecrets -> Bool
Eq, Int -> ActivitySecrets -> ShowS
[ActivitySecrets] -> ShowS
ActivitySecrets -> String
(Int -> ActivitySecrets -> ShowS)
-> (ActivitySecrets -> String)
-> ([ActivitySecrets] -> ShowS)
-> Show ActivitySecrets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ActivitySecrets -> ShowS
showsPrec :: Int -> ActivitySecrets -> ShowS
$cshow :: ActivitySecrets -> String
show :: ActivitySecrets -> String
$cshowList :: [ActivitySecrets] -> ShowS
showList :: [ActivitySecrets] -> ShowS
Show)
  deriving ([ActivitySecrets] -> Value
[ActivitySecrets] -> Encoding
ActivitySecrets -> Value
ActivitySecrets -> Encoding
(ActivitySecrets -> Value)
-> (ActivitySecrets -> Encoding)
-> ([ActivitySecrets] -> Value)
-> ([ActivitySecrets] -> Encoding)
-> ToJSON ActivitySecrets
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: ActivitySecrets -> Value
toJSON :: ActivitySecrets -> Value
$ctoEncoding :: ActivitySecrets -> Encoding
toEncoding :: ActivitySecrets -> Encoding
$ctoJSONList :: [ActivitySecrets] -> Value
toJSONList :: [ActivitySecrets] -> Value
$ctoEncodingList :: [ActivitySecrets] -> Encoding
toEncodingList :: [ActivitySecrets] -> Encoding
Aeson.ToJSON) via CalamityToJSON ActivitySecrets

instance CalamityToJSON' ActivitySecrets where
  toPairs :: forall kv. KeyValue kv => ActivitySecrets -> [Maybe kv]
toPairs ActivitySecrets {Maybe Text
$sel:join:ActivitySecrets :: ActivitySecrets -> Maybe Text
$sel:spectate:ActivitySecrets :: ActivitySecrets -> Maybe Text
$sel:match:ActivitySecrets :: ActivitySecrets -> Maybe Text
join :: Maybe Text
spectate :: Maybe Text
match :: Maybe Text
..} =
    [ Key
"join" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
join
    , Key
"spectate" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
spectate
    , Key
"match" Key -> Maybe Text -> Maybe kv
forall v kv. (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
.?= Maybe Text
match
    ]

instance Aeson.FromJSON ActivitySecrets where
  parseJSON :: Value -> Parser ActivitySecrets
parseJSON = String
-> (Object -> Parser ActivitySecrets)
-> Value
-> Parser ActivitySecrets
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ActivitySecrets" ((Object -> Parser ActivitySecrets)
 -> Value -> Parser ActivitySecrets)
-> (Object -> Parser ActivitySecrets)
-> Value
-> Parser ActivitySecrets
forall a b. (a -> b) -> a -> b
$ \Object
v ->
    Maybe Text -> Maybe Text -> Maybe Text -> ActivitySecrets
ActivitySecrets
      (Maybe Text -> Maybe Text -> Maybe Text -> ActivitySecrets)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ActivitySecrets)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"join"
      Parser (Maybe Text -> Maybe Text -> ActivitySecrets)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ActivitySecrets)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"spectate"
      Parser (Maybe Text -> ActivitySecrets)
-> Parser (Maybe Text) -> Parser ActivitySecrets
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"match"

$(deriveTextShow ''ActivityType)
$(deriveTextShow ''ActivityParty)
$(deriveTextShow ''ActivityAssets)
$(deriveTextShow ''ActivitySecrets)
$(deriveTextShow ''Activity)
$(makeFieldLabelsNoPrefix ''Activity)
$(makeFieldLabelsNoPrefix ''ActivityTimestamps)
$(makeFieldLabelsNoPrefix ''ActivityParty)
$(makeFieldLabelsNoPrefix ''ActivityAssets)
$(makeFieldLabelsNoPrefix ''ActivitySecrets)