module Network.Nakadi.EventTypes
( module Network.Nakadi.EventTypes.CursorDistances
, module Network.Nakadi.EventTypes.CursorsLag
, module Network.Nakadi.EventTypes.Events
, module Network.Nakadi.EventTypes.EventType
, module Network.Nakadi.EventTypes.Partitions
, module Network.Nakadi.EventTypes.ShiftedCursors
, module Network.Nakadi.EventTypes.Schemas
, eventTypesList
, eventTypesListR
, eventTypeCreate
, eventTypeCreateR
) where
import Network.Nakadi.Internal.Prelude
import Control.Lens
import Network.Nakadi.EventTypes.CursorDistances
import Network.Nakadi.EventTypes.CursorsLag
import Network.Nakadi.EventTypes.Events
import Network.Nakadi.EventTypes.EventType
import Network.Nakadi.EventTypes.Partitions
import Network.Nakadi.EventTypes.Schemas
import Network.Nakadi.EventTypes.ShiftedCursors
import Network.Nakadi.Internal.Http
import qualified Network.Nakadi.Internal.Lenses as L
path :: ByteString
path = "/event-types"
eventTypesList ::
MonadNakadi m
=> Config
-> m [EventType]
eventTypesList config =
httpJsonBody config status200 []
(setRequestMethod "GET" . setRequestPath path)
eventTypesListR ::
MonadNakadiEnv r m
=> m [EventType]
eventTypesListR = do
config <- asks (view L.nakadiConfig)
eventTypesList config
eventTypeCreate ::
MonadNakadi m
=> Config
-> EventType
-> m ()
eventTypeCreate config eventType =
httpJsonNoBody config status201 []
(setRequestMethod "POST" . setRequestPath path . setRequestBodyJSON eventType)
eventTypeCreateR ::
MonadNakadiEnv r m
=> EventType
-> m ()
eventTypeCreateR eventType = do
config <- asks (view L.nakadiConfig)
eventTypeCreate config eventType