{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
module Hercules.API.Accounts.Account where
import Data.OpenApi qualified as O3
import Hercules.API.Forge.Forge (Forge)
import Hercules.API.Organizations.Organization qualified as Organization
import Hercules.API.Prelude
data AccountType = User | Organization
deriving ((forall x. AccountType -> Rep AccountType x)
-> (forall x. Rep AccountType x -> AccountType)
-> Generic AccountType
forall x. Rep AccountType x -> AccountType
forall x. AccountType -> Rep AccountType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AccountType -> Rep AccountType x
from :: forall x. AccountType -> Rep AccountType x
$cto :: forall x. Rep AccountType x -> AccountType
to :: forall x. Rep AccountType x -> AccountType
Generic, Int -> AccountType -> ShowS
[AccountType] -> ShowS
AccountType -> String
(Int -> AccountType -> ShowS)
-> (AccountType -> String)
-> ([AccountType] -> ShowS)
-> Show AccountType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AccountType -> ShowS
showsPrec :: Int -> AccountType -> ShowS
$cshow :: AccountType -> String
show :: AccountType -> String
$cshowList :: [AccountType] -> ShowS
showList :: [AccountType] -> ShowS
Show, AccountType -> AccountType -> Bool
(AccountType -> AccountType -> Bool)
-> (AccountType -> AccountType -> Bool) -> Eq AccountType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AccountType -> AccountType -> Bool
== :: AccountType -> AccountType -> Bool
$c/= :: AccountType -> AccountType -> Bool
/= :: AccountType -> AccountType -> Bool
Eq)
deriving anyclass (AccountType -> ()
(AccountType -> ()) -> NFData AccountType
forall a. (a -> ()) -> NFData a
$crnf :: AccountType -> ()
rnf :: AccountType -> ()
NFData, [AccountType] -> Value
[AccountType] -> Encoding
AccountType -> Value
AccountType -> Encoding
(AccountType -> Value)
-> (AccountType -> Encoding)
-> ([AccountType] -> Value)
-> ([AccountType] -> Encoding)
-> ToJSON AccountType
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: AccountType -> Value
toJSON :: AccountType -> Value
$ctoEncoding :: AccountType -> Encoding
toEncoding :: AccountType -> Encoding
$ctoJSONList :: [AccountType] -> Value
toJSONList :: [AccountType] -> Value
$ctoEncodingList :: [AccountType] -> Encoding
toEncodingList :: [AccountType] -> Encoding
ToJSON, Value -> Parser [AccountType]
Value -> Parser AccountType
(Value -> Parser AccountType)
-> (Value -> Parser [AccountType]) -> FromJSON AccountType
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser AccountType
parseJSON :: Value -> Parser AccountType
$cparseJSONList :: Value -> Parser [AccountType]
parseJSONList :: Value -> Parser [AccountType]
FromJSON, Proxy AccountType -> Declare (Definitions Schema) NamedSchema
(Proxy AccountType -> Declare (Definitions Schema) NamedSchema)
-> ToSchema AccountType
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy AccountType -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy AccountType -> Declare (Definitions Schema) NamedSchema
ToSchema, Typeable AccountType
Typeable AccountType
-> (Proxy AccountType -> Declare (Definitions Schema) NamedSchema)
-> ToSchema AccountType
Proxy AccountType -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a
-> (Proxy a -> Declare (Definitions Schema) NamedSchema)
-> ToSchema a
$cdeclareNamedSchema :: Proxy AccountType -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy AccountType -> Declare (Definitions Schema) NamedSchema
O3.ToSchema)
data MembershipRole = Member | Admin
deriving ((forall x. MembershipRole -> Rep MembershipRole x)
-> (forall x. Rep MembershipRole x -> MembershipRole)
-> Generic MembershipRole
forall x. Rep MembershipRole x -> MembershipRole
forall x. MembershipRole -> Rep MembershipRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MembershipRole -> Rep MembershipRole x
from :: forall x. MembershipRole -> Rep MembershipRole x
$cto :: forall x. Rep MembershipRole x -> MembershipRole
to :: forall x. Rep MembershipRole x -> MembershipRole
Generic, Int -> MembershipRole -> ShowS
[MembershipRole] -> ShowS
MembershipRole -> String
(Int -> MembershipRole -> ShowS)
-> (MembershipRole -> String)
-> ([MembershipRole] -> ShowS)
-> Show MembershipRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MembershipRole -> ShowS
showsPrec :: Int -> MembershipRole -> ShowS
$cshow :: MembershipRole -> String
show :: MembershipRole -> String
$cshowList :: [MembershipRole] -> ShowS
showList :: [MembershipRole] -> ShowS
Show, MembershipRole -> MembershipRole -> Bool
(MembershipRole -> MembershipRole -> Bool)
-> (MembershipRole -> MembershipRole -> Bool) -> Eq MembershipRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MembershipRole -> MembershipRole -> Bool
== :: MembershipRole -> MembershipRole -> Bool
$c/= :: MembershipRole -> MembershipRole -> Bool
/= :: MembershipRole -> MembershipRole -> Bool
Eq)
deriving anyclass (MembershipRole -> ()
(MembershipRole -> ()) -> NFData MembershipRole
forall a. (a -> ()) -> NFData a
$crnf :: MembershipRole -> ()
rnf :: MembershipRole -> ()
NFData, [MembershipRole] -> Value
[MembershipRole] -> Encoding
MembershipRole -> Value
MembershipRole -> Encoding
(MembershipRole -> Value)
-> (MembershipRole -> Encoding)
-> ([MembershipRole] -> Value)
-> ([MembershipRole] -> Encoding)
-> ToJSON MembershipRole
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: MembershipRole -> Value
toJSON :: MembershipRole -> Value
$ctoEncoding :: MembershipRole -> Encoding
toEncoding :: MembershipRole -> Encoding
$ctoJSONList :: [MembershipRole] -> Value
toJSONList :: [MembershipRole] -> Value
$ctoEncodingList :: [MembershipRole] -> Encoding
toEncodingList :: [MembershipRole] -> Encoding
ToJSON, Value -> Parser [MembershipRole]
Value -> Parser MembershipRole
(Value -> Parser MembershipRole)
-> (Value -> Parser [MembershipRole]) -> FromJSON MembershipRole
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser MembershipRole
parseJSON :: Value -> Parser MembershipRole
$cparseJSONList :: Value -> Parser [MembershipRole]
parseJSONList :: Value -> Parser [MembershipRole]
FromJSON, Proxy MembershipRole -> Declare (Definitions Schema) NamedSchema
(Proxy MembershipRole -> Declare (Definitions Schema) NamedSchema)
-> ToSchema MembershipRole
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy MembershipRole -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy MembershipRole -> Declare (Definitions Schema) NamedSchema
ToSchema, Typeable MembershipRole
Typeable MembershipRole
-> (Proxy MembershipRole
-> Declare (Definitions Schema) NamedSchema)
-> ToSchema MembershipRole
Proxy MembershipRole -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a
-> (Proxy a -> Declare (Definitions Schema) NamedSchema)
-> ToSchema a
$cdeclareNamedSchema :: Proxy MembershipRole -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy MembershipRole -> Declare (Definitions Schema) NamedSchema
O3.ToSchema)
data Account = Account
{ Account -> Id Account
id :: Id Account,
Account -> Text
sourceHostingSiteSlug :: Text,
Account -> Text
slug :: Text,
Account -> AccountType
typ :: AccountType,
Account -> Text
displayName :: Text,
Account -> Text
imageURL :: Text,
Account -> Maybe Organization
organization :: Maybe Organization.Organization,
Account -> Bool
isInstalled :: Bool,
Account -> Bool
isInstallable :: Bool,
Account -> Maybe MembershipRole
membershipRole :: Maybe MembershipRole,
Account -> Maybe (Map Text Forge)
sourceHostingSites :: Maybe (Map Text Forge),
Account -> Maybe Text
manageInstallationURL :: Maybe Text,
Account -> Maybe Bool
installationIsSelection :: Maybe Bool
}
deriving ((forall x. Account -> Rep Account x)
-> (forall x. Rep Account x -> Account) -> Generic Account
forall x. Rep Account x -> Account
forall x. Account -> Rep Account x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Account -> Rep Account x
from :: forall x. Account -> Rep Account x
$cto :: forall x. Rep Account x -> Account
to :: forall x. Rep Account x -> Account
Generic, Int -> Account -> ShowS
[Account] -> ShowS
Account -> String
(Int -> Account -> ShowS)
-> (Account -> String) -> ([Account] -> ShowS) -> Show Account
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Account -> ShowS
showsPrec :: Int -> Account -> ShowS
$cshow :: Account -> String
show :: Account -> String
$cshowList :: [Account] -> ShowS
showList :: [Account] -> ShowS
Show, Account -> Account -> Bool
(Account -> Account -> Bool)
-> (Account -> Account -> Bool) -> Eq Account
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Account -> Account -> Bool
== :: Account -> Account -> Bool
$c/= :: Account -> Account -> Bool
/= :: Account -> Account -> Bool
Eq)
deriving anyclass (Account -> ()
(Account -> ()) -> NFData Account
forall a. (a -> ()) -> NFData a
$crnf :: Account -> ()
rnf :: Account -> ()
NFData, [Account] -> Value
[Account] -> Encoding
Account -> Value
Account -> Encoding
(Account -> Value)
-> (Account -> Encoding)
-> ([Account] -> Value)
-> ([Account] -> Encoding)
-> ToJSON Account
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: Account -> Value
toJSON :: Account -> Value
$ctoEncoding :: Account -> Encoding
toEncoding :: Account -> Encoding
$ctoJSONList :: [Account] -> Value
toJSONList :: [Account] -> Value
$ctoEncodingList :: [Account] -> Encoding
toEncodingList :: [Account] -> Encoding
ToJSON, Value -> Parser [Account]
Value -> Parser Account
(Value -> Parser Account)
-> (Value -> Parser [Account]) -> FromJSON Account
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser Account
parseJSON :: Value -> Parser Account
$cparseJSONList :: Value -> Parser [Account]
parseJSONList :: Value -> Parser [Account]
FromJSON, Proxy Account -> Declare (Definitions Schema) NamedSchema
(Proxy Account -> Declare (Definitions Schema) NamedSchema)
-> ToSchema Account
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy Account -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy Account -> Declare (Definitions Schema) NamedSchema
ToSchema, Typeable Account
Typeable Account
-> (Proxy Account -> Declare (Definitions Schema) NamedSchema)
-> ToSchema Account
Proxy Account -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a
-> (Proxy a -> Declare (Definitions Schema) NamedSchema)
-> ToSchema a
$cdeclareNamedSchema :: Proxy Account -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy Account -> Declare (Definitions Schema) NamedSchema
O3.ToSchema)