Skip to content

Commit

Permalink
Build with aeson-1.0 (closes #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Catherine Galkina committed Sep 16, 2016
1 parent b520021 commit 56faab4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions src/SMSAero/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ import qualified Data.Text as Text
import Data.Map (Map)
import qualified Data.Map as Map

import Data.Maybe (catMaybes)
import Text.Read (readEither)

import Control.Applicative
import Control.Arrow ((***))
import GHC.TypeLits (Symbol, KnownSymbol)

import Servant.API
Expand Down Expand Up @@ -97,7 +95,7 @@ instance (HasClient sub, KnownSymbol sym, ToHttpApiData a) => HasClient (Require
type Client (RequiredQueryParam sym a :> sub) = a -> Client sub
clientWithRoute _ req param = clientWithRoute (Proxy :: Proxy (QueryParam sym a :> sub)) req (Just param)

instance (KnownSymbol sym, ToParam (QueryParam sym a), HasDocs sub) => HasDocs (RequiredQueryParam sym a :> sub) where
instance (ToParam (QueryParam sym a), HasDocs sub) => HasDocs (RequiredQueryParam sym a :> sub) where
docsFor _ (endpoint, action) =
docsFor subP (endpoint, action')

Expand Down Expand Up @@ -427,9 +425,3 @@ instance ToJSON SignResponse where
instance ToJSON CheckSendingResponse where
toJSON = toJSON . Map.mapKeys toQueryParam . fmap toQueryParam

instance FromJSON CheckSendingResponse where
parseJSON js =
Map.fromList . catMaybes . map dist . map (parseQueryParamMaybe *** parseQueryParamMaybe) . Map.toList <$> parseJSON js
where
dist (x, y) = (,) <$> x <*> y

2 changes: 1 addition & 1 deletion src/SMSAero/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import Web.HttpApiData.Internal
newtype Signature = Signature { getSignature :: Text } deriving (Eq, Show, FromJSON, ToJSON, ToHttpApiData, FromHttpApiData)

-- | SMSAero sent message id.
newtype MessageId = MessageId Int64 deriving (Eq, Show, Ord, FromJSON, ToJSON, ToHttpApiData, FromHttpApiData)
newtype MessageId = MessageId Int64 deriving (Eq, Show, Ord, FromJSON, FromJSONKey, ToJSON, ToHttpApiData, FromHttpApiData)

-- | SMSAero message body.
newtype MessageBody = MessageBody Text deriving (Eq, Show, FromJSON, ToJSON, ToHttpApiData, FromHttpApiData)
Expand Down

0 comments on commit 56faab4

Please sign in to comment.