classy-prelude
This commit is contained in:
@@ -20,20 +20,20 @@ ghc-options:
|
||||
- -Wincomplete-uni-patterns
|
||||
|
||||
default-extensions:
|
||||
- DeriveGeneric
|
||||
- DeriveAnyClass
|
||||
- DataKinds
|
||||
- DeriveGeneric
|
||||
- DuplicateRecordFields
|
||||
- FlexibleInstances
|
||||
- NoImplicitPrelude
|
||||
- OverloadedStrings
|
||||
- TypeOperators
|
||||
|
||||
|
||||
dependencies:
|
||||
- base >= 4.7 && < 5
|
||||
- aeson
|
||||
- base >= 4.7 && < 5
|
||||
- classy-prelude
|
||||
- lens
|
||||
- servant-server
|
||||
- servant-docs
|
||||
- servant-server
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
|
||||
@@ -4,7 +4,7 @@ cabal-version: 1.12
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 99136a96dd2c64b9aa7676ea7d38ebb39ed31a83ea08dcaf63b53c9c1a24003e
|
||||
-- hash: 0ccb821856e91efe2302b7718ec2477aa768ae2bdf82cdd9d352333d5a8bf829
|
||||
|
||||
name: simplex-definitions
|
||||
version: 0.1.0.0
|
||||
@@ -28,11 +28,12 @@ library
|
||||
Paths_simplex_definitions
|
||||
hs-source-dirs:
|
||||
src
|
||||
default-extensions: DeriveGeneric DeriveAnyClass DataKinds DuplicateRecordFields FlexibleInstances OverloadedStrings TypeOperators
|
||||
default-extensions: DeriveAnyClass DeriveGeneric DuplicateRecordFields FlexibleInstances NoImplicitPrelude OverloadedStrings
|
||||
ghc-options: -Wall -Wcompat -Worphans -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns
|
||||
build-depends:
|
||||
aeson
|
||||
, base >=4.7 && <5
|
||||
, classy-prelude
|
||||
, lens
|
||||
, servant-docs
|
||||
, servant-server
|
||||
@@ -46,11 +47,12 @@ executable api-docs
|
||||
Paths_simplex_definitions
|
||||
hs-source-dirs:
|
||||
src
|
||||
default-extensions: DeriveGeneric DeriveAnyClass DataKinds DuplicateRecordFields FlexibleInstances OverloadedStrings TypeOperators
|
||||
default-extensions: DeriveAnyClass DeriveGeneric DuplicateRecordFields FlexibleInstances NoImplicitPrelude OverloadedStrings
|
||||
ghc-options: -Wall -Wcompat -Worphans -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns
|
||||
build-depends:
|
||||
aeson
|
||||
, base >=4.7 && <5
|
||||
, classy-prelude
|
||||
, lens
|
||||
, servant-docs
|
||||
, servant-server
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
module Main where
|
||||
|
||||
import Simplex.Messaging.ServerAPI
|
||||
|
||||
import ClassyPrelude
|
||||
import Servant
|
||||
import Servant.Docs
|
||||
|
||||
@@ -12,4 +14,4 @@ apiDocs = docsWith
|
||||
(Proxy :: Proxy ServerAPI)
|
||||
|
||||
main :: IO ()
|
||||
main = (writeFile "../simplex-messaging-api.md" . markdown) apiDocs
|
||||
main = writeFile "../simplex-messaging-api.md" $ fromString $ markdown apiDocs
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
|
||||
module Simplex.Messaging.ServerAPI
|
||||
( ServerAPI
|
||||
@@ -7,6 +8,8 @@ module Simplex.Messaging.ServerAPI
|
||||
) where
|
||||
|
||||
import Simplex.Messaging.Types as T
|
||||
|
||||
import ClassyPrelude
|
||||
import Control.Lens
|
||||
import Data.Function()
|
||||
import Servant
|
||||
@@ -78,17 +81,17 @@ serverApiExtra =
|
||||
info p title comments =
|
||||
extraInfo p $ defAction & notes <>~ [ DocNote title comments ]
|
||||
|
||||
instance ToCapture (Capture "connectionId" String) where
|
||||
instance ToCapture (Capture "connectionId" Text) where
|
||||
toCapture _ =
|
||||
DocCapture "connectionId"
|
||||
"Recipient connection ID - unique connection ID to be used by connection recipient"
|
||||
|
||||
instance ToCapture (Capture "senderConnectionId" String) where
|
||||
instance ToCapture (Capture "senderConnectionId" Text) where
|
||||
toCapture _ =
|
||||
DocCapture "senderConnectionId"
|
||||
"Sender connection ID - unique connection ID to be used by connection sender"
|
||||
|
||||
instance ToCapture (Capture "messageId" String) where
|
||||
instance ToCapture (Capture "messageId" Text) where
|
||||
toCapture _ =
|
||||
DocCapture "messageId"
|
||||
"Message ID - unique message ID to be used by connection recipient"
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
module Simplex.Messaging.Types where
|
||||
|
||||
import GHC.Generics
|
||||
import ClassyPrelude
|
||||
import Data.Aeson
|
||||
import GHC.Generics
|
||||
|
||||
data NewConnectionReqBody = NewConnectionReqBody
|
||||
newtype NewConnectionReqBody = NewConnectionReqBody
|
||||
{ recipientKey :: Base64EncodedString
|
||||
} deriving (Show, Generic, ToJSON, FromJSON)
|
||||
|
||||
@@ -12,7 +13,7 @@ data NewConnectionResBody = NewConnectionResBody
|
||||
, senderId :: String
|
||||
} deriving (Show, Generic, ToJSON, FromJSON)
|
||||
|
||||
data SecureConnectionReqBody = SecureConnectionReqBody
|
||||
newtype SecureConnectionReqBody = SecureConnectionReqBody
|
||||
{ senderKey :: Base64EncodedString
|
||||
} deriving (Show, Generic, ToJSON, FromJSON)
|
||||
|
||||
@@ -27,9 +28,9 @@ data MessagesResBody = MessagesResBody
|
||||
, nextMessageId :: Maybe Base64EncodedString
|
||||
} deriving (Show, Generic, ToJSON, FromJSON)
|
||||
|
||||
data SendMessageReqBody = SendMessageReqBody
|
||||
newtype SendMessageReqBody = SendMessageReqBody
|
||||
{ msg :: Base64EncodedString
|
||||
} deriving (Show, Generic, ToJSON, FromJSON)
|
||||
|
||||
type Base64EncodedString = String
|
||||
type TimeStamp = String
|
||||
type Base64EncodedString = Text
|
||||
type TimeStamp = Text
|
||||
|
||||
Reference in New Issue
Block a user