{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedStrings #-} -- | -- Module: Network.Greskell.WebSocket.Request.Standard -- Description: Operation objects for standard OpProcessor -- Maintainer: Toshio Ito -- -- module Network.Greskell.WebSocket.Request.Standard ( -- * OpAuthentication OpAuthentication (..) -- * OpEval , OpEval (..) ) where import Data.Aeson (FromJSON (..), Object, ToJSON (..)) import Data.HashMap.Strict (HashMap) import Data.Text (Text) import GHC.Generics (Generic) import qualified Network.Greskell.WebSocket.Request.Aeson as GAeson import Network.Greskell.WebSocket.Request.Common (Base64, Operation (..), SASLMechanism) data OpAuthentication = OpAuthentication { batchSize :: !(Maybe Int) , sasl :: !Base64 , saslMechanism :: !SASLMechanism } deriving (Eq, Generic, Ord, Show) instance ToJSON OpAuthentication where toJSON = GAeson.genericToJSON GAeson.opt toEncoding = GAeson.genericToEncoding GAeson.opt instance FromJSON OpAuthentication where parseJSON = GAeson.genericParseJSON GAeson.opt instance Operation OpAuthentication where opProcessor _ = "" opName _ = "authentication" opArgs = GAeson.toObject data OpEval = OpEval { batchSize :: !(Maybe Int) , gremlin :: !Text , bindings :: !(Maybe Object) , language :: !(Maybe Text) , aliases :: !(Maybe (HashMap Text Text)) , scriptEvaluationTimeout :: !(Maybe Int) } deriving (Eq, Generic, Show) instance ToJSON OpEval where toJSON = GAeson.genericToJSON GAeson.opt toEncoding = GAeson.genericToEncoding GAeson.opt instance FromJSON OpEval where parseJSON = GAeson.genericParseJSON GAeson.opt instance Operation OpEval where opProcessor _ = "" opName _ = "eval" opArgs = GAeson.toObject