smsaero 0.4 → 0.4.1
raw patch · 3 files changed
+16/−12 lines, 3 files
Files
- CHANGELOG.md +4/−0
- smsaero.cabal +1/−1
- src/SMSAero/API.hs +11/−11
CHANGELOG.md view
@@ -1,3 +1,7 @@+0.4.1+---+* Add `Eq` instances+ 0.4 --- * Rename `StatusResponse` to `MessageStatus` and add instance Read
smsaero.cabal view
@@ -1,5 +1,5 @@ name: smsaero-version: 0.4+version: 0.4.1 synopsis: SMSAero API and HTTP client based on servant library. description: Please see README.md homepage: https://github.com/GetShopTV/smsaero
src/SMSAero/API.hs view
@@ -95,13 +95,13 @@ action' = over params (|> toParam paramP) action -- | SMSAero sender's signature. This is used for the "from" field.-newtype Signature = Signature { getSignature :: Text } deriving (Show, FromJSON, ToJSON, ToText, FromText)+newtype Signature = Signature { getSignature :: Text } deriving (Eq, Show, FromJSON, ToJSON, ToText, FromText) -- | SMSAero sent message id.-newtype MessageId = MessageId Int64 deriving (Show, FromJSON, ToJSON, ToText, FromText)+newtype MessageId = MessageId Int64 deriving (Eq, Show, FromJSON, ToJSON, ToText, FromText) -- | SMSAero message body.-newtype MessageBody = MessageBody Text deriving (Show, FromJSON, ToJSON, ToText, FromText)+newtype MessageBody = MessageBody Text deriving (Eq, Show, FromJSON, ToJSON, ToText, FromText) -- | SMSAero authentication data. data SMSAeroAuth = SMSAeroAuth@@ -121,10 +121,10 @@ , "password" .= authPassword ] -- | Phone number.-newtype Phone = Phone { getPhone :: Int64 } deriving (Show, ToText, FromText)+newtype Phone = Phone { getPhone :: Int64 } deriving (Eq, Show, ToText, FromText) -- | Date. Textually @SMSAeroDate@ is represented as a number of seconds since 01 Jan 1970.-newtype SMSAeroDate = SMSAeroDate { getSMSAeroDate :: UTCTime } deriving (Show)+newtype SMSAeroDate = SMSAeroDate { getSMSAeroDate :: UTCTime } deriving (Eq, Show) instance ToText SMSAeroDate where toText (SMSAeroDate dt) = Text.pack (show (utcTimeToPOSIXSeconds dt))@@ -238,13 +238,13 @@ data SmsAeroResponse a = ResponseOK a -- ^ Some useful payload. | ResponseReject Text -- ^ Rejection reason.- deriving (Show, Generic)+ deriving (Eq, Show, Generic) -- | SMSAero response to a send request. data SendResponse = SendAccepted MessageId -- ^ Message accepted. | SendNoCredits -- ^ No credits to send a message.- deriving (Show, Generic)+ deriving (Eq, Show, Generic) instance ToSample (SmsAeroResponse SendResponse) (SmsAeroResponse SendResponse) where toSamples _ =@@ -260,7 +260,7 @@ | StatusSmscReject -- ^ Message rejected by SMSC. | StatusQueue -- ^ Message queued. | StatusWaitStatus -- ^ Wait for message status.- deriving (Enum, Bounded, Show, Read, Generic)+ deriving (Eq, Enum, Bounded, Show, Read, Generic) instance ToSample (SmsAeroResponse MessageStatus) (SmsAeroResponse MessageStatus) where toSamples _ =@@ -269,7 +269,7 @@ -- | SMSAero response to a balance request. -- This is a number of available messages to send.-newtype BalanceResponse = BalanceResponse Double deriving (Show)+newtype BalanceResponse = BalanceResponse Double deriving (Eq, Show) instance ToSample (SmsAeroResponse BalanceResponse) (SmsAeroResponse BalanceResponse) where toSamples _ =@@ -278,7 +278,7 @@ -- | SMSAero response to a senders request. -- This is just a list of available signatures.-newtype SendersResponse = SendersResponse [Signature] deriving (Show, FromJSON, ToJSON)+newtype SendersResponse = SendersResponse [Signature] deriving (Eq, Show, FromJSON, ToJSON) instance ToSample (SmsAeroResponse SendersResponse) (SmsAeroResponse SendersResponse) where toSample _ = Just (ResponseOK (SendersResponse [Signature "TEST", Signature "My Company"]))@@ -288,7 +288,7 @@ = SignApproved -- ^ Signature is approved. | SignRejected -- ^ Signature is rejected. | SignPending -- ^ Signature is pending.- deriving (Enum, Bounded, Show, Generic)+ deriving (Eq, Enum, Bounded, Show, Generic) instance ToSample (SmsAeroResponse SignResponse) (SmsAeroResponse SignResponse) where toSamples _ =