module TD.Data.InputPassportElementErrorSource
(InputPassportElementErrorSource(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.ByteString as BS
import qualified Data.Text as T
data InputPassportElementErrorSource
= InputPassportElementErrorSourceUnspecified
{ InputPassportElementErrorSource -> Maybe ByteString
element_hash :: Maybe BS.ByteString
}
| InputPassportElementErrorSourceDataField
{ InputPassportElementErrorSource -> Maybe Text
field_name :: Maybe T.Text
, InputPassportElementErrorSource -> Maybe ByteString
data_hash :: Maybe BS.ByteString
}
| InputPassportElementErrorSourceFrontSide
{ InputPassportElementErrorSource -> Maybe ByteString
file_hash :: Maybe BS.ByteString
}
| InputPassportElementErrorSourceReverseSide
{ file_hash :: Maybe BS.ByteString
}
| InputPassportElementErrorSourceSelfie
{ file_hash :: Maybe BS.ByteString
}
| InputPassportElementErrorSourceTranslationFile
{ file_hash :: Maybe BS.ByteString
}
| InputPassportElementErrorSourceTranslationFiles
{ InputPassportElementErrorSource -> Maybe [ByteString]
file_hashes :: Maybe [BS.ByteString]
}
| InputPassportElementErrorSourceFile
{ file_hash :: Maybe BS.ByteString
}
| InputPassportElementErrorSourceFiles
{ file_hashes :: Maybe [BS.ByteString]
}
deriving (InputPassportElementErrorSource
-> InputPassportElementErrorSource -> Bool
(InputPassportElementErrorSource
-> InputPassportElementErrorSource -> Bool)
-> (InputPassportElementErrorSource
-> InputPassportElementErrorSource -> Bool)
-> Eq InputPassportElementErrorSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputPassportElementErrorSource
-> InputPassportElementErrorSource -> Bool
== :: InputPassportElementErrorSource
-> InputPassportElementErrorSource -> Bool
$c/= :: InputPassportElementErrorSource
-> InputPassportElementErrorSource -> Bool
/= :: InputPassportElementErrorSource
-> InputPassportElementErrorSource -> Bool
Eq, Int -> InputPassportElementErrorSource -> ShowS
[InputPassportElementErrorSource] -> ShowS
InputPassportElementErrorSource -> String
(Int -> InputPassportElementErrorSource -> ShowS)
-> (InputPassportElementErrorSource -> String)
-> ([InputPassportElementErrorSource] -> ShowS)
-> Show InputPassportElementErrorSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputPassportElementErrorSource -> ShowS
showsPrec :: Int -> InputPassportElementErrorSource -> ShowS
$cshow :: InputPassportElementErrorSource -> String
show :: InputPassportElementErrorSource -> String
$cshowList :: [InputPassportElementErrorSource] -> ShowS
showList :: [InputPassportElementErrorSource] -> ShowS
Show)
instance I.ShortShow InputPassportElementErrorSource where
shortShow :: InputPassportElementErrorSource -> String
shortShow InputPassportElementErrorSourceUnspecified
{ element_hash :: InputPassportElementErrorSource -> Maybe ByteString
element_hash = Maybe ByteString
element_hash_
}
= String
"InputPassportElementErrorSourceUnspecified"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"element_hash" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
element_hash_
]
shortShow InputPassportElementErrorSourceDataField
{ field_name :: InputPassportElementErrorSource -> Maybe Text
field_name = Maybe Text
field_name_
, data_hash :: InputPassportElementErrorSource -> Maybe ByteString
data_hash = Maybe ByteString
data_hash_
}
= String
"InputPassportElementErrorSourceDataField"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"field_name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
field_name_
, String
"data_hash" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
data_hash_
]
shortShow InputPassportElementErrorSourceFrontSide
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= String
"InputPassportElementErrorSourceFrontSide"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"file_hash" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
file_hash_
]
shortShow InputPassportElementErrorSourceReverseSide
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= String
"InputPassportElementErrorSourceReverseSide"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"file_hash" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
file_hash_
]
shortShow InputPassportElementErrorSourceSelfie
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= String
"InputPassportElementErrorSourceSelfie"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"file_hash" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
file_hash_
]
shortShow InputPassportElementErrorSourceTranslationFile
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= String
"InputPassportElementErrorSourceTranslationFile"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"file_hash" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
file_hash_
]
shortShow InputPassportElementErrorSourceTranslationFiles
{ file_hashes :: InputPassportElementErrorSource -> Maybe [ByteString]
file_hashes = Maybe [ByteString]
file_hashes_
}
= String
"InputPassportElementErrorSourceTranslationFiles"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"file_hashes" String -> Maybe [ByteString] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [ByteString]
file_hashes_
]
shortShow InputPassportElementErrorSourceFile
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= String
"InputPassportElementErrorSourceFile"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"file_hash" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
file_hash_
]
shortShow InputPassportElementErrorSourceFiles
{ file_hashes :: InputPassportElementErrorSource -> Maybe [ByteString]
file_hashes = Maybe [ByteString]
file_hashes_
}
= String
"InputPassportElementErrorSourceFiles"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"file_hashes" String -> Maybe [ByteString] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [ByteString]
file_hashes_
]
instance AT.FromJSON InputPassportElementErrorSource where
parseJSON :: Value -> Parser InputPassportElementErrorSource
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
"inputPassportElementErrorSourceUnspecified" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceUnspecified Value
v
String
"inputPassportElementErrorSourceDataField" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceDataField Value
v
String
"inputPassportElementErrorSourceFrontSide" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFrontSide Value
v
String
"inputPassportElementErrorSourceReverseSide" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceReverseSide Value
v
String
"inputPassportElementErrorSourceSelfie" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceSelfie Value
v
String
"inputPassportElementErrorSourceTranslationFile" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceTranslationFile Value
v
String
"inputPassportElementErrorSourceTranslationFiles" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceTranslationFiles Value
v
String
"inputPassportElementErrorSourceFile" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFile Value
v
String
"inputPassportElementErrorSourceFiles" -> Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFiles Value
v
String
_ -> Parser InputPassportElementErrorSource
forall a. Monoid a => a
mempty
where
parseInputPassportElementErrorSourceUnspecified :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceUnspecified :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceUnspecified = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceUnspecified" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
element_hash_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
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
"element_hash"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceUnspecified
{ element_hash :: Maybe ByteString
element_hash = Maybe ByteString
element_hash_
}
parseInputPassportElementErrorSourceDataField :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceDataField :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceDataField = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceDataField" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
field_name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"field_name"
Maybe ByteString
data_hash_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
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
"data_hash"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceDataField
{ field_name :: Maybe Text
field_name = Maybe Text
field_name_
, data_hash :: Maybe ByteString
data_hash = Maybe ByteString
data_hash_
}
parseInputPassportElementErrorSourceFrontSide :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFrontSide :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFrontSide = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceFrontSide" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
file_hash_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
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
"file_hash"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceFrontSide
{ file_hash :: Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
parseInputPassportElementErrorSourceReverseSide :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceReverseSide :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceReverseSide = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceReverseSide" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
file_hash_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
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
"file_hash"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceReverseSide
{ file_hash :: Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
parseInputPassportElementErrorSourceSelfie :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceSelfie :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceSelfie = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceSelfie" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
file_hash_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
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
"file_hash"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceSelfie
{ file_hash :: Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
parseInputPassportElementErrorSourceTranslationFile :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceTranslationFile :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceTranslationFile = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceTranslationFile" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
file_hash_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
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
"file_hash"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceTranslationFile
{ file_hash :: Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
parseInputPassportElementErrorSourceTranslationFiles :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceTranslationFiles :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceTranslationFiles = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceTranslationFiles" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe [ByteString]
file_hashes_ <- ([String] -> [ByteString]) -> Maybe [String] -> Maybe [ByteString]
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((String -> ByteString) -> [String] -> [ByteString]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes) (Maybe [String] -> Maybe [ByteString])
-> Parser (Maybe [String]) -> Parser (Maybe [ByteString])
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
"file_hashes"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceTranslationFiles
{ file_hashes :: Maybe [ByteString]
file_hashes = Maybe [ByteString]
file_hashes_
}
parseInputPassportElementErrorSourceFile :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFile :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFile = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceFile" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
file_hash_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
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
"file_hash"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceFile
{ file_hash :: Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
parseInputPassportElementErrorSourceFiles :: A.Value -> AT.Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFiles :: Value -> Parser InputPassportElementErrorSource
parseInputPassportElementErrorSourceFiles = String
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementErrorSourceFiles" ((Object -> Parser InputPassportElementErrorSource)
-> Value -> Parser InputPassportElementErrorSource)
-> (Object -> Parser InputPassportElementErrorSource)
-> Value
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe [ByteString]
file_hashes_ <- ([String] -> [ByteString]) -> Maybe [String] -> Maybe [ByteString]
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((String -> ByteString) -> [String] -> [ByteString]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes) (Maybe [String] -> Maybe [ByteString])
-> Parser (Maybe [String]) -> Parser (Maybe [ByteString])
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
"file_hashes"
InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource)
-> InputPassportElementErrorSource
-> Parser InputPassportElementErrorSource
forall a b. (a -> b) -> a -> b
$ InputPassportElementErrorSourceFiles
{ file_hashes :: Maybe [ByteString]
file_hashes = Maybe [ByteString]
file_hashes_
}
parseJSON Value
_ = Parser InputPassportElementErrorSource
forall a. Monoid a => a
mempty
instance AT.ToJSON InputPassportElementErrorSource where
toJSON :: InputPassportElementErrorSource -> Value
toJSON InputPassportElementErrorSourceUnspecified
{ element_hash :: InputPassportElementErrorSource -> Maybe ByteString
element_hash = Maybe ByteString
element_hash_
}
= [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
"inputPassportElementErrorSourceUnspecified"
, Key
"element_hash" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
element_hash_
]
toJSON InputPassportElementErrorSourceDataField
{ field_name :: InputPassportElementErrorSource -> Maybe Text
field_name = Maybe Text
field_name_
, data_hash :: InputPassportElementErrorSource -> Maybe ByteString
data_hash = Maybe ByteString
data_hash_
}
= [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
"inputPassportElementErrorSourceDataField"
, Key
"field_name" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
field_name_
, Key
"data_hash" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
data_hash_
]
toJSON InputPassportElementErrorSourceFrontSide
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= [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
"inputPassportElementErrorSourceFrontSide"
, Key
"file_hash" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
file_hash_
]
toJSON InputPassportElementErrorSourceReverseSide
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= [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
"inputPassportElementErrorSourceReverseSide"
, Key
"file_hash" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
file_hash_
]
toJSON InputPassportElementErrorSourceSelfie
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= [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
"inputPassportElementErrorSourceSelfie"
, Key
"file_hash" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
file_hash_
]
toJSON InputPassportElementErrorSourceTranslationFile
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= [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
"inputPassportElementErrorSourceTranslationFile"
, Key
"file_hash" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
file_hash_
]
toJSON InputPassportElementErrorSourceTranslationFiles
{ file_hashes :: InputPassportElementErrorSource -> Maybe [ByteString]
file_hashes = Maybe [ByteString]
file_hashes_
}
= [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
"inputPassportElementErrorSourceTranslationFiles"
, Key
"file_hashes" Key -> Maybe [Value] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= ([ByteString] -> [Value]) -> Maybe [ByteString] -> Maybe [Value]
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((ByteString -> Value) -> [ByteString] -> [Value]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes ) Maybe [ByteString]
file_hashes_
]
toJSON InputPassportElementErrorSourceFile
{ file_hash :: InputPassportElementErrorSource -> Maybe ByteString
file_hash = Maybe ByteString
file_hash_
}
= [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
"inputPassportElementErrorSourceFile"
, Key
"file_hash" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
file_hash_
]
toJSON InputPassportElementErrorSourceFiles
{ file_hashes :: InputPassportElementErrorSource -> Maybe [ByteString]
file_hashes = Maybe [ByteString]
file_hashes_
}
= [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
"inputPassportElementErrorSourceFiles"
, Key
"file_hashes" Key -> Maybe [Value] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= ([ByteString] -> [Value]) -> Maybe [ByteString] -> Maybe [Value]
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((ByteString -> Value) -> [ByteString] -> [Value]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes ) Maybe [ByteString]
file_hashes_
]