phoityne-vscode-0.0.1.0: app/Phoityne/IO/GUI/VSCode/TH/NextResponseJSON.hs
{-# LANGUAGE TemplateHaskell #-}
module Phoityne.IO.GUI.VSCode.TH.NextResponseJSON where
import Data.Aeson.TH
import Phoityne.Utility
import Phoityne.IO.GUI.VSCode.TH.NextRequestJSON
-- |
-- Response to "next" request. This is just an acknowledgement, so no body field is required.
--
data NextResponse =
NextResponse {
seqNextResponse :: Int -- Sequence number
, typeNextResponse :: String -- One of "request", "response", or "event"
, request_seqNextResponse :: Int -- Sequence number of the corresponding request
, successNextResponse :: Bool -- Outcome of the request
, commandNextResponse :: String -- The command requested
, messageNextResponse :: String -- Contains error message if success == false.
} deriving (Show, Read, Eq)
$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "NextResponse") } ''NextResponse)
-- |
--
defaultNextResponse :: Int -> NextRequest -> NextResponse
defaultNextResponse seq (NextRequest reqSeq _ _ _) =
NextResponse seq "response" reqSeq True "next" ""