packages feed

phoityne-vscode-0.0.1.0: app/Phoityne/IO/GUI/VSCode/TH/ContinueResponseJSON.hs

{-# LANGUAGE TemplateHaskell     #-}


module Phoityne.IO.GUI.VSCode.TH.ContinueResponseJSON where

import Data.Aeson.TH

import Phoityne.Utility
import Phoityne.IO.GUI.VSCode.TH.ContinueRequestJSON 

-- |
--   Response to "continue" request. This is just an acknowledgement, so no body field is required. 
--
data ContinueResponse =
  ContinueResponse {
    seqContinueResponse         :: Int     -- Sequence number
  , typeContinueResponse        :: String  -- One of "request", "response", or "event"
  , request_seqContinueResponse :: Int     -- Sequence number of the corresponding request
  , successContinueResponse     :: Bool    -- Outcome of the request
  , commandContinueResponse     :: String  -- The command requested 
  , messageContinueResponse     :: String  -- Contains error message if success == false.
  } deriving (Show, Read, Eq)

$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "ContinueResponse") } ''ContinueResponse)

-- |
--
defaultContinueResponse :: Int -> ContinueRequest ->  ContinueResponse
defaultContinueResponse seq (ContinueRequest reqSeq _ _ _) =
  ContinueResponse seq "response" reqSeq True "continue" ""