smsaero-0.3: 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

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

data RequireAuth Source

SMSAero authentication credentials.

Instances

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

data RequiredQueryParam sym a Source

Like QueryParam, but always required.

Instances

(KnownSymbol sym, ToParam * (QueryParam * sym a), HasDocs * sub) => HasDocs * ((:>) * * (RequiredQueryParam sym a) sub) 
(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 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 SendResponse Source

SMSAero response to a send request.

Constructors

SendAccepted MessageId

Message accepted.

SendNoCredits

No credits to send a message.

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.

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]