{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Network.Livy.Client.Interactive.GetSessionStatement
(
GetSessionStatement (..)
, getSessionStatement
, gsstmSessionId
, gsstmStatementId
, GetSessionStatementResponse (..)
, gsstmrStatement
) where
import Control.Lens
import Data.Aeson.TH
import Data.Typeable
import Network.Livy.Client.Types.Session
import Network.Livy.Client.Types.Statement
import Network.Livy.Internal.Text
import Network.Livy.Request
import Network.Livy.Types
data GetSessionStatement = GetSessionStatement
{ _gsstmSessionId :: SessionId
, _gsstmStatementId :: StatementId
} deriving (Eq, Show, Typeable)
makeLenses ''GetSessionStatement
instance ToPath GetSessionStatement where
toPath r = toPath
[ "sessions", toText $ r ^. gsstmSessionId
, "statements", toText $ r ^. gsstmStatementId
]
instance LivyRequest GetSessionStatement where
request = get
getSessionStatement :: SessionId -> StatementId -> GetSessionStatement
getSessionStatement = GetSessionStatement
newtype GetSessionStatementResponse = GetSessionStatementResponse
{ _gsstmrStatement :: Statement
} deriving (Eq, Show, Typeable)
makeLenses ''GetSessionStatementResponse
deriveFromJSON (defaultOptions { unwrapUnaryRecords = True }) ''GetSessionStatementResponse
type instance LivyResponse GetSessionStatement = GetSessionStatementResponse