{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
module Database.EventStore.Internal.Operation.ReadStreamEvents.Message where
import Data.Int
import Data.ProtocolBuffers
import Database.EventStore.Internal.Prelude
import Database.EventStore.Internal.Types
data Request
= Request
{ Request -> Required 1 (Value Text)
_streamId :: Required 1 (Value Text)
, Request -> Required 2 (Value Int64)
_eventNumber :: Required 2 (Value Int64)
, Request -> Required 3 (Value Int32)
_maxCount :: Required 3 (Value Int32)
, Request -> Required 4 (Value Bool)
_resolveLinkTos :: Required 4 (Value Bool)
, Request -> Required 5 (Value Bool)
_requireMaster :: Required 5 (Value Bool)
}
deriving (forall x. Rep Request x -> Request
forall x. Request -> Rep Request x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Request x -> Request
$cfrom :: forall x. Request -> Rep Request x
Generic, Int -> Request -> ShowS
[Request] -> ShowS
Request -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Request] -> ShowS
$cshowList :: [Request] -> ShowS
show :: Request -> String
$cshow :: Request -> String
showsPrec :: Int -> Request -> ShowS
$cshowsPrec :: Int -> Request -> ShowS
Show)
newRequest :: Text -> Int64 -> Int32 -> Bool -> Bool -> Request
newRequest :: Text -> Int64 -> Int32 -> Bool -> Bool -> Request
newRequest Text
stream_id Int64
evt_num Int32
max_c Bool
res_link_tos Bool
req_master =
Request
{ _streamId :: Required 1 (Value Text)
_streamId = forall a. HasField a => FieldType a -> a
putField Text
stream_id
, _eventNumber :: Required 2 (Value Int64)
_eventNumber = forall a. HasField a => FieldType a -> a
putField Int64
evt_num
, _maxCount :: Required 3 (Value Int32)
_maxCount = forall a. HasField a => FieldType a -> a
putField Int32
max_c
, _resolveLinkTos :: Required 4 (Value Bool)
_resolveLinkTos = forall a. HasField a => FieldType a -> a
putField Bool
res_link_tos
, _requireMaster :: Required 5 (Value Bool)
_requireMaster = forall a. HasField a => FieldType a -> a
putField Bool
req_master
}
instance Encode Request
data Result
= SUCCESS
| NO_STREAM
| STREAM_DELETED
| NOT_MODIFIED
| ERROR
| ACCESS_DENIED
deriving (Result -> Result -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Result -> Result -> Bool
$c/= :: Result -> Result -> Bool
== :: Result -> Result -> Bool
$c== :: Result -> Result -> Bool
Eq, Int -> Result
Result -> Int
Result -> [Result]
Result -> Result
Result -> Result -> [Result]
Result -> Result -> Result -> [Result]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Result -> Result -> Result -> [Result]
$cenumFromThenTo :: Result -> Result -> Result -> [Result]
enumFromTo :: Result -> Result -> [Result]
$cenumFromTo :: Result -> Result -> [Result]
enumFromThen :: Result -> Result -> [Result]
$cenumFromThen :: Result -> Result -> [Result]
enumFrom :: Result -> [Result]
$cenumFrom :: Result -> [Result]
fromEnum :: Result -> Int
$cfromEnum :: Result -> Int
toEnum :: Int -> Result
$ctoEnum :: Int -> Result
pred :: Result -> Result
$cpred :: Result -> Result
succ :: Result -> Result
$csucc :: Result -> Result
Enum, Int -> Result -> ShowS
[Result] -> ShowS
Result -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Result] -> ShowS
$cshowList :: [Result] -> ShowS
show :: Result -> String
$cshow :: Result -> String
showsPrec :: Int -> Result -> ShowS
$cshowsPrec :: Int -> Result -> ShowS
Show)
data Response
= Response
{ Response -> Repeated 1 (Message ResolvedIndexedEvent)
_events :: Repeated 1 (Message ResolvedIndexedEvent)
, Response -> Required 2 (Enumeration Result)
_result :: Required 2 (Enumeration Result)
, Response -> Required 3 (Value Int64)
_nextNumber :: Required 3 (Value Int64)
, Response -> Required 4 (Value Int64)
_lastNumber :: Required 4 (Value Int64)
, Response -> Required 5 (Value Bool)
_endOfStream :: Required 5 (Value Bool)
, Response -> Required 6 (Value Int64)
_lastCommitPosition :: Required 6 (Value Int64)
, Response -> Optional 7 (Value Text)
_error :: Optional 7 (Value Text)
}
deriving (forall x. Rep Response x -> Response
forall x. Response -> Rep Response x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Response x -> Response
$cfrom :: forall x. Response -> Rep Response x
Generic, Int -> Response -> ShowS
[Response] -> ShowS
Response -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Response] -> ShowS
$cshowList :: [Response] -> ShowS
show :: Response -> String
$cshow :: Response -> String
showsPrec :: Int -> Response -> ShowS
$cshowsPrec :: Int -> Response -> ShowS
Show)
instance Decode Response