smsaero-0.2: SMSAero API and HTTP client based on servant library.

Copyright(c) 2015, GetShopTV
LicenseBSD3
Maintainernickolay@getshoptv.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

SMSAero.API

Contents

Description

This module describes SMSAero API and defines corresponding types.

Synopsis

API

type SMSAeroAPI = RequireAuth :> (AnswerJson :> (("send" :> SendApi) :<|> (("status" :> StatusApi) :<|> (("balance" :> SmsAeroGet BalanceResponse) :<|> (("senders" :> SmsAeroGet SendersResponse) :<|> ("sign" :> SmsAeroGet SignResponse)))))) Source

SMSAero API.

type StatusApi = RequiredQueryParam "id" MessageId :> SmsAeroGet StatusResponse Source

SMSAero API to check message status.

Combinators

data SmsAeroJson Source

Content type for SMSAero JSON answer (it has JSON body but "text/plain" Content-Type).

data AnswerJson Source

Implicit parameter that tells SMSAero to respond with JSON.

Instances

HasClient sub => HasClient ((:>) * * AnswerJson sub) 
type Client ((:>) * * AnswerJson sub) = Client sub 

data RequireAuth Source

SMSAero authentication credentials.

Instances

HasClient sub => HasClient ((:>) * * RequireAuth sub) 
type Client ((:>) * * RequireAuth sub) = SMSAeroAuth -> Client sub 

data RequiredQueryParam sym a Source

Like QueryParam, but always required.

Instances

(HasClient sub, KnownSymbol sym, ToText a) => HasClient ((:>) * * (RequiredQueryParam sym a) sub) 
type Client ((:>) * * (RequiredQueryParam sym a) sub) = a -> Client sub 

type SmsAeroGet a = Get `[SmsAeroJson]` (SmsAeroResponse a) Source

Regular SMSAero GET API.

Types

data SMSAeroAuth Source

SMSAero authentication data.

Constructors

SMSAeroAuth 

Fields

authUser :: Text

Username.

authPassword :: Text

MD5 hash of a password.

newtype Signature Source

SMSAero sender's signature. This is used for the "from" field.

Constructors

Signature 

Fields

getSignature :: Text
 

newtype MessageId Source

SMSAero sent message id.

Constructors

MessageId Integer 

newtype Phone Source

Phone number.

Constructors

Phone 

Fields

getPhone :: Integer
 

newtype SMSAeroDate Source

Date. Textually SMSAeroDate is represented as a number of seconds since 01 Jan 1970.

Constructors

SMSAeroDate 

Responses

data SmsAeroResponse a Source

Every SMSAero response is either rejected or provides some info.

Constructors

ResponseOK a

Some useful payload.

ResponseReject Text

Rejection reason.

Instances

Show a => Show (SmsAeroResponse a) 
Generic (SmsAeroResponse a) 
ToJSON a => ToJSON (SmsAeroResponse a)

This is a generic instance and does not match FromJSON.

FromJSON a => FromJSON (SmsAeroResponse a) 
type Rep (SmsAeroResponse a) 

data SendResponse Source

SMSAero response to a send request.

Constructors

SendAccepted MessageId

Message accepted.

SendNoCredits

No credits to send a message.

Instances

Show SendResponse 
Generic SendResponse 
ToJSON SendResponse

This is a generic instance and does not match FromJSON.

FromJSON SendResponse 
type Rep SendResponse 

data StatusResponse Source

SMSAero response to a status request.

Constructors

StatusDeliverySuccess

Message is successfully delivered.

StatusDeliveryFailure

Message delivery has failed.

StatusSmscSubmit

Message submitted to SMSC.

StatusSmscReject

Message rejected by SMSC.

StatusQueue

Message queued.

StatusWaitStatus

Wait for message status.

Instances

Show StatusResponse 
Generic StatusResponse 
ToJSON StatusResponse

This is a generic instance and does not match FromJSON.

FromJSON StatusResponse 
type Rep StatusResponse 

newtype BalanceResponse Source

SMSAero response to a balance request. This is a number of available messages to send.

Constructors

BalanceResponse Double 

newtype SendersResponse Source

SMSAero response to a senders request. This is just a list of available signatures.

Constructors

SendersResponse [Signature] 

data SignResponse Source

SMSAero response to a sign request.

Constructors

SignApproved

Signature is approved.

SignRejected

Signature is rejected.

SignPending

Signature is pending.

Instances

Show SignResponse 
Generic SignResponse 
ToJSON SignResponse

This is a generic instance and does not match FromJSON.

FromJSON SignResponse 
type Rep SignResponse