module TD.Data.TextEntityType
(TextEntityType(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
data TextEntityType
= TextEntityTypeMention
| TextEntityTypeHashtag
| TextEntityTypeCashtag
| TextEntityTypeBotCommand
| TextEntityTypeUrl
| TextEntityTypeEmailAddress
| TextEntityTypePhoneNumber
| TextEntityTypeBankCardNumber
| TextEntityTypeBold
| TextEntityTypeItalic
| TextEntityTypeUnderline
| TextEntityTypeStrikethrough
| TextEntityTypeSpoiler
| TextEntityTypeCode
| TextEntityTypePre
| TextEntityTypePreCode
{ TextEntityType -> Maybe Text
language :: Maybe T.Text
}
| TextEntityTypeBlockQuote
| TextEntityTypeExpandableBlockQuote
| TextEntityTypeTextUrl
{ TextEntityType -> Maybe Text
url :: Maybe T.Text
}
| TextEntityTypeMentionName
{ TextEntityType -> Maybe Int
user_id :: Maybe Int
}
| TextEntityTypeCustomEmoji
{ TextEntityType -> Maybe Int
custom_emoji_id :: Maybe Int
}
| TextEntityTypeMediaTimestamp
{ TextEntityType -> Maybe Int
media_timestamp :: Maybe Int
}
deriving (TextEntityType -> TextEntityType -> Bool
(TextEntityType -> TextEntityType -> Bool)
-> (TextEntityType -> TextEntityType -> Bool) -> Eq TextEntityType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextEntityType -> TextEntityType -> Bool
== :: TextEntityType -> TextEntityType -> Bool
$c/= :: TextEntityType -> TextEntityType -> Bool
/= :: TextEntityType -> TextEntityType -> Bool
Eq, Int -> TextEntityType -> ShowS
[TextEntityType] -> ShowS
TextEntityType -> String
(Int -> TextEntityType -> ShowS)
-> (TextEntityType -> String)
-> ([TextEntityType] -> ShowS)
-> Show TextEntityType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextEntityType -> ShowS
showsPrec :: Int -> TextEntityType -> ShowS
$cshow :: TextEntityType -> String
show :: TextEntityType -> String
$cshowList :: [TextEntityType] -> ShowS
showList :: [TextEntityType] -> ShowS
Show)
instance I.ShortShow TextEntityType where
shortShow :: TextEntityType -> String
shortShow TextEntityType
TextEntityTypeMention
= String
"TextEntityTypeMention"
shortShow TextEntityType
TextEntityTypeHashtag
= String
"TextEntityTypeHashtag"
shortShow TextEntityType
TextEntityTypeCashtag
= String
"TextEntityTypeCashtag"
shortShow TextEntityType
TextEntityTypeBotCommand
= String
"TextEntityTypeBotCommand"
shortShow TextEntityType
TextEntityTypeUrl
= String
"TextEntityTypeUrl"
shortShow TextEntityType
TextEntityTypeEmailAddress
= String
"TextEntityTypeEmailAddress"
shortShow TextEntityType
TextEntityTypePhoneNumber
= String
"TextEntityTypePhoneNumber"
shortShow TextEntityType
TextEntityTypeBankCardNumber
= String
"TextEntityTypeBankCardNumber"
shortShow TextEntityType
TextEntityTypeBold
= String
"TextEntityTypeBold"
shortShow TextEntityType
TextEntityTypeItalic
= String
"TextEntityTypeItalic"
shortShow TextEntityType
TextEntityTypeUnderline
= String
"TextEntityTypeUnderline"
shortShow TextEntityType
TextEntityTypeStrikethrough
= String
"TextEntityTypeStrikethrough"
shortShow TextEntityType
TextEntityTypeSpoiler
= String
"TextEntityTypeSpoiler"
shortShow TextEntityType
TextEntityTypeCode
= String
"TextEntityTypeCode"
shortShow TextEntityType
TextEntityTypePre
= String
"TextEntityTypePre"
shortShow TextEntityTypePreCode
{ language :: TextEntityType -> Maybe Text
language = Maybe Text
language_
}
= String
"TextEntityTypePreCode"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"language" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
language_
]
shortShow TextEntityType
TextEntityTypeBlockQuote
= String
"TextEntityTypeBlockQuote"
shortShow TextEntityType
TextEntityTypeExpandableBlockQuote
= String
"TextEntityTypeExpandableBlockQuote"
shortShow TextEntityTypeTextUrl
{ url :: TextEntityType -> Maybe Text
url = Maybe Text
url_
}
= String
"TextEntityTypeTextUrl"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"url" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
]
shortShow TextEntityTypeMentionName
{ user_id :: TextEntityType -> Maybe Int
user_id = Maybe Int
user_id_
}
= String
"TextEntityTypeMentionName"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
]
shortShow TextEntityTypeCustomEmoji
{ custom_emoji_id :: TextEntityType -> Maybe Int
custom_emoji_id = Maybe Int
custom_emoji_id_
}
= String
"TextEntityTypeCustomEmoji"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"custom_emoji_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
custom_emoji_id_
]
shortShow TextEntityTypeMediaTimestamp
{ media_timestamp :: TextEntityType -> Maybe Int
media_timestamp = Maybe Int
media_timestamp_
}
= String
"TextEntityTypeMediaTimestamp"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"media_timestamp" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
media_timestamp_
]
instance AT.FromJSON TextEntityType where
parseJSON :: Value -> Parser TextEntityType
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"textEntityTypeMention" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeMention
String
"textEntityTypeHashtag" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeHashtag
String
"textEntityTypeCashtag" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeCashtag
String
"textEntityTypeBotCommand" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeBotCommand
String
"textEntityTypeUrl" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeUrl
String
"textEntityTypeEmailAddress" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeEmailAddress
String
"textEntityTypePhoneNumber" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypePhoneNumber
String
"textEntityTypeBankCardNumber" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeBankCardNumber
String
"textEntityTypeBold" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeBold
String
"textEntityTypeItalic" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeItalic
String
"textEntityTypeUnderline" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeUnderline
String
"textEntityTypeStrikethrough" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeStrikethrough
String
"textEntityTypeSpoiler" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeSpoiler
String
"textEntityTypeCode" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeCode
String
"textEntityTypePre" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypePre
String
"textEntityTypePreCode" -> Value -> Parser TextEntityType
parseTextEntityTypePreCode Value
v
String
"textEntityTypeBlockQuote" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeBlockQuote
String
"textEntityTypeExpandableBlockQuote" -> TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TextEntityType
TextEntityTypeExpandableBlockQuote
String
"textEntityTypeTextUrl" -> Value -> Parser TextEntityType
parseTextEntityTypeTextUrl Value
v
String
"textEntityTypeMentionName" -> Value -> Parser TextEntityType
parseTextEntityTypeMentionName Value
v
String
"textEntityTypeCustomEmoji" -> Value -> Parser TextEntityType
parseTextEntityTypeCustomEmoji Value
v
String
"textEntityTypeMediaTimestamp" -> Value -> Parser TextEntityType
parseTextEntityTypeMediaTimestamp Value
v
String
_ -> Parser TextEntityType
forall a. Monoid a => a
mempty
where
parseTextEntityTypePreCode :: A.Value -> AT.Parser TextEntityType
parseTextEntityTypePreCode :: Value -> Parser TextEntityType
parseTextEntityTypePreCode = String
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TextEntityTypePreCode" ((Object -> Parser TextEntityType)
-> Value -> Parser TextEntityType)
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
language_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"language"
TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TextEntityType -> Parser TextEntityType)
-> TextEntityType -> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ TextEntityTypePreCode
{ language :: Maybe Text
language = Maybe Text
language_
}
parseTextEntityTypeTextUrl :: A.Value -> AT.Parser TextEntityType
parseTextEntityTypeTextUrl :: Value -> Parser TextEntityType
parseTextEntityTypeTextUrl = String
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TextEntityTypeTextUrl" ((Object -> Parser TextEntityType)
-> Value -> Parser TextEntityType)
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
url_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"url"
TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TextEntityType -> Parser TextEntityType)
-> TextEntityType -> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ TextEntityTypeTextUrl
{ url :: Maybe Text
url = Maybe Text
url_
}
parseTextEntityTypeMentionName :: A.Value -> AT.Parser TextEntityType
parseTextEntityTypeMentionName :: Value -> Parser TextEntityType
parseTextEntityTypeMentionName = String
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TextEntityTypeMentionName" ((Object -> Parser TextEntityType)
-> Value -> Parser TextEntityType)
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_id"
TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TextEntityType -> Parser TextEntityType)
-> TextEntityType -> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ TextEntityTypeMentionName
{ user_id :: Maybe Int
user_id = Maybe Int
user_id_
}
parseTextEntityTypeCustomEmoji :: A.Value -> AT.Parser TextEntityType
parseTextEntityTypeCustomEmoji :: Value -> Parser TextEntityType
parseTextEntityTypeCustomEmoji = String
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TextEntityTypeCustomEmoji" ((Object -> Parser TextEntityType)
-> Value -> Parser TextEntityType)
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
custom_emoji_id_ <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"custom_emoji_id"
TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TextEntityType -> Parser TextEntityType)
-> TextEntityType -> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ TextEntityTypeCustomEmoji
{ custom_emoji_id :: Maybe Int
custom_emoji_id = Maybe Int
custom_emoji_id_
}
parseTextEntityTypeMediaTimestamp :: A.Value -> AT.Parser TextEntityType
parseTextEntityTypeMediaTimestamp :: Value -> Parser TextEntityType
parseTextEntityTypeMediaTimestamp = String
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TextEntityTypeMediaTimestamp" ((Object -> Parser TextEntityType)
-> Value -> Parser TextEntityType)
-> (Object -> Parser TextEntityType)
-> Value
-> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
media_timestamp_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"media_timestamp"
TextEntityType -> Parser TextEntityType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TextEntityType -> Parser TextEntityType)
-> TextEntityType -> Parser TextEntityType
forall a b. (a -> b) -> a -> b
$ TextEntityTypeMediaTimestamp
{ media_timestamp :: Maybe Int
media_timestamp = Maybe Int
media_timestamp_
}
parseJSON Value
_ = Parser TextEntityType
forall a. Monoid a => a
mempty
instance AT.ToJSON TextEntityType where
toJSON :: TextEntityType -> Value
toJSON TextEntityType
TextEntityTypeMention
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeMention"
]
toJSON TextEntityType
TextEntityTypeHashtag
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeHashtag"
]
toJSON TextEntityType
TextEntityTypeCashtag
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeCashtag"
]
toJSON TextEntityType
TextEntityTypeBotCommand
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeBotCommand"
]
toJSON TextEntityType
TextEntityTypeUrl
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeUrl"
]
toJSON TextEntityType
TextEntityTypeEmailAddress
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeEmailAddress"
]
toJSON TextEntityType
TextEntityTypePhoneNumber
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypePhoneNumber"
]
toJSON TextEntityType
TextEntityTypeBankCardNumber
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeBankCardNumber"
]
toJSON TextEntityType
TextEntityTypeBold
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeBold"
]
toJSON TextEntityType
TextEntityTypeItalic
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeItalic"
]
toJSON TextEntityType
TextEntityTypeUnderline
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeUnderline"
]
toJSON TextEntityType
TextEntityTypeStrikethrough
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeStrikethrough"
]
toJSON TextEntityType
TextEntityTypeSpoiler
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeSpoiler"
]
toJSON TextEntityType
TextEntityTypeCode
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeCode"
]
toJSON TextEntityType
TextEntityTypePre
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypePre"
]
toJSON TextEntityTypePreCode
{ language :: TextEntityType -> Maybe Text
language = Maybe Text
language_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypePreCode"
, Key
"language" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
language_
]
toJSON TextEntityType
TextEntityTypeBlockQuote
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeBlockQuote"
]
toJSON TextEntityType
TextEntityTypeExpandableBlockQuote
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeExpandableBlockQuote"
]
toJSON TextEntityTypeTextUrl
{ url :: TextEntityType -> Maybe Text
url = Maybe Text
url_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeTextUrl"
, Key
"url" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
url_
]
toJSON TextEntityTypeMentionName
{ user_id :: TextEntityType -> Maybe Int
user_id = Maybe Int
user_id_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeMentionName"
, Key
"user_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
user_id_
]
toJSON TextEntityTypeCustomEmoji
{ custom_emoji_id :: TextEntityType -> Maybe Int
custom_emoji_id = Maybe Int
custom_emoji_id_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeCustomEmoji"
, Key
"custom_emoji_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 Maybe Int
custom_emoji_id_
]
toJSON TextEntityTypeMediaTimestamp
{ media_timestamp :: TextEntityType -> Maybe Int
media_timestamp = Maybe Int
media_timestamp_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"textEntityTypeMediaTimestamp"
, Key
"media_timestamp" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
media_timestamp_
]