module Conduit.Features.Account.Types where import Conduit.Utils (InObj(..)) import Data.Aeson (ToJSON(..), object, (.=)) import Data.Aeson.Types (Value) newtype UserID = UserID { UserID -> Int64 unID :: Int64 } deriving newtype (Int -> UserID -> ShowS [UserID] -> ShowS UserID -> String (Int -> UserID -> ShowS) -> (UserID -> String) -> ([UserID] -> ShowS) -> Show UserID forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> UserID -> ShowS showsPrec :: Int -> UserID -> ShowS $cshow :: UserID -> String show :: UserID -> String $cshowList :: [UserID] -> ShowS showList :: [UserID] -> ShowS Show, ReadPrec [UserID] ReadPrec UserID Int -> ReadS UserID ReadS [UserID] (Int -> ReadS UserID) -> ReadS [UserID] -> ReadPrec UserID -> ReadPrec [UserID] -> Read UserID forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a $creadsPrec :: Int -> ReadS UserID readsPrec :: Int -> ReadS UserID $creadList :: ReadS [UserID] readList :: ReadS [UserID] $creadPrec :: ReadPrec UserID readPrec :: ReadPrec UserID $creadListPrec :: ReadPrec [UserID] readListPrec :: ReadPrec [UserID] Read, UserID -> UserID -> Bool (UserID -> UserID -> Bool) -> (UserID -> UserID -> Bool) -> Eq UserID forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: UserID -> UserID -> Bool == :: UserID -> UserID -> Bool $c/= :: UserID -> UserID -> Bool /= :: UserID -> UserID -> Bool Eq, [UserID] -> Value [UserID] -> Encoding UserID -> Bool UserID -> Value UserID -> Encoding (UserID -> Value) -> (UserID -> Encoding) -> ([UserID] -> Value) -> ([UserID] -> Encoding) -> (UserID -> Bool) -> ToJSON UserID forall a. (a -> Value) -> (a -> Encoding) -> ([a] -> Value) -> ([a] -> Encoding) -> (a -> Bool) -> ToJSON a $ctoJSON :: UserID -> Value toJSON :: UserID -> Value $ctoEncoding :: UserID -> Encoding toEncoding :: UserID -> Encoding $ctoJSONList :: [UserID] -> Value toJSONList :: [UserID] -> Value $ctoEncodingList :: [UserID] -> Encoding toEncodingList :: [UserID] -> Encoding $comitField :: UserID -> Bool omitField :: UserID -> Bool ToJSON) data UserAuth = UserAuth { UserAuth -> Text email :: Text , UserAuth -> Text name :: Text , UserAuth -> Text token :: Text , UserAuth -> Maybe Text bio :: Maybe Text , UserAuth -> Text image :: Text } deriving (Int -> UserAuth -> ShowS [UserAuth] -> ShowS UserAuth -> String (Int -> UserAuth -> ShowS) -> (UserAuth -> String) -> ([UserAuth] -> ShowS) -> Show UserAuth forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> UserAuth -> ShowS showsPrec :: Int -> UserAuth -> ShowS $cshow :: UserAuth -> String show :: UserAuth -> String $cshowList :: [UserAuth] -> ShowS showList :: [UserAuth] -> ShowS Show) instance ToJSON UserAuth where toJSON :: UserAuth -> Value toJSON :: UserAuth -> Value toJSON UserAuth {Maybe Text Text $sel:email:UserAuth :: UserAuth -> Text $sel:name:UserAuth :: UserAuth -> Text $sel:token:UserAuth :: UserAuth -> Text $sel:bio:UserAuth :: UserAuth -> Maybe Text $sel:image:UserAuth :: UserAuth -> Text email :: Text name :: Text token :: Text bio :: Maybe Text image :: Text ..} = [Pair] -> Value object [ Key "username" Key -> Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Text name , Key "email" Key -> Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Text email , Key "token" Key -> Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Text token , Key "bio" Key -> Maybe Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Maybe Text bio , Key "image" Key -> Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Text image ] inUserObj :: obj -> InObj obj inUserObj :: forall obj. obj -> InObj obj inUserObj = Key -> obj -> InObj obj forall obj. Key -> obj -> InObj obj InObj Key "user" data UserProfile = UserProfile { UserProfile -> Text name :: Text , UserProfile -> Maybe Text bio :: Maybe Text , UserProfile -> Text image :: Text , UserProfile -> Bool followed :: Bool } deriving (Int -> UserProfile -> ShowS [UserProfile] -> ShowS UserProfile -> String (Int -> UserProfile -> ShowS) -> (UserProfile -> String) -> ([UserProfile] -> ShowS) -> Show UserProfile forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> UserProfile -> ShowS showsPrec :: Int -> UserProfile -> ShowS $cshow :: UserProfile -> String show :: UserProfile -> String $cshowList :: [UserProfile] -> ShowS showList :: [UserProfile] -> ShowS Show) instance ToJSON UserProfile where toJSON :: UserProfile -> Value toJSON :: UserProfile -> Value toJSON UserProfile {Bool Maybe Text Text $sel:name:UserProfile :: UserProfile -> Text $sel:bio:UserProfile :: UserProfile -> Maybe Text $sel:image:UserProfile :: UserProfile -> Text $sel:followed:UserProfile :: UserProfile -> Bool name :: Text bio :: Maybe Text image :: Text followed :: Bool ..} = [Pair] -> Value object [ Key "username" Key -> Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Text name , Key "image" Key -> Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Text image , Key "bio" Key -> Maybe Text -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Maybe Text bio , Key "following" Key -> Bool -> Pair forall v. ToJSON v => Key -> v -> Pair forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv .= Bool followed ] inProfileObj :: obj -> InObj obj inProfileObj :: forall obj. obj -> InObj obj inProfileObj = Key -> obj -> InObj obj forall obj. Key -> obj -> InObj obj InObj Key "profile"