-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell wrapper for textlocal SMS gateway -- -- Please see README.md @package textlocal @version 0.1.0.5 module Network.Api.Types data Error Error :: Int -> Text -> Error [ecode] :: Error -> Int [emessage] :: Error -> Text data Warning Warning :: Int -> Text -> Warning [wcode] :: Warning -> Int [wmessage] :: Warning -> Text data TLStatus Success :: TLStatus Failure :: TLStatus data TLResponse TLResponse :: TLStatus -> Maybe [Warning] -> Maybe [Error] -> TLResponse [status] :: TLResponse -> TLStatus [warnings] :: TLResponse -> Maybe [Warning] [errors] :: TLResponse -> Maybe [Error] instance GHC.Show.Show Network.Api.Types.TLResponse instance GHC.Classes.Ord Network.Api.Types.TLResponse instance GHC.Classes.Eq Network.Api.Types.TLResponse instance GHC.Classes.Ord Network.Api.Types.TLStatus instance GHC.Classes.Eq Network.Api.Types.TLStatus instance GHC.Show.Show Network.Api.Types.TLStatus instance GHC.Show.Show Network.Api.Types.Warning instance GHC.Classes.Ord Network.Api.Types.Warning instance GHC.Classes.Eq Network.Api.Types.Warning instance GHC.Show.Show Network.Api.Types.Error instance GHC.Classes.Ord Network.Api.Types.Error instance GHC.Classes.Eq Network.Api.Types.Error instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Types.Error instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Types.Warning instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Types.TLStatus instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Types.TLResponse -- | Haskell wrapper for sending SMS using textlocal SMS gateway. -- -- Sending SMS -- --
    --
  1. Get an api key from textlocal.in
  2. --
  3. Quick way to send:
  4. --
-- --
--   >> import Network.Api.TextLocal
--   >> let cred = createUserHash "myemail@email.in" "my-secret-hash"
--   >> res <- sendSMS "hello world" ["911234567890"] cred
--   >> res
--   Right (TLResponse {status = Success, warnings = Nothing, errors = Nothing})
--   
-- -- Or in a more configurable way: -- --
--   >> import Network.Api.TextLocal
--   >> let cred = createUserHash "myemail@email.in" "my-secret-hash"
--   >> let destNums = ["911234567890"]
--   >> let mySettings = setDestinationNumber destNums $  setAuth cred $ setTest True defaultSMSSettings
--   >> res <- runSettings SendSMS (setMessage "hello world" mySettings)
--   >> res
--   Right (TLResponse {status = Success, warnings = Nothing, errors = Nothing})
--   
module Network.Api.TextLocal -- | Credential for making request to textLocal server. There are multiple -- ways for creating it. You can either use createApiKey or -- createUserHash to create this type. data Credential -- | Create Credential for textLocal using api key. createApiKey :: ByteString -> Credential -- | Create Credential for textLocal using email and secure hash. createUserHash :: ByteString -> ByteString -> Credential data SMSSettings -- | defaultSMSSettings has the default settings, duh! The -- settingsSender has a value of TXTLCL. Using the -- accessors setMessage, setAuth, -- setDestinationNumber you should properly initialize their -- respective values. By default, these fields contain a value of bottom. defaultSMSSettings :: SMSSettings -- | Use an existing manager instead of creating a new one setManager :: Manager -> SMSSettings -> SMSSettings setDestinationNumber :: [ByteString] -> SMSSettings -> SMSSettings setMessage :: ByteString -> SMSSettings -> SMSSettings setAuth :: Credential -> SMSSettings -> SMSSettings -- | Set this field to true to enable test mode, no messages will be sent -- and your credit balance will be unaffected. It defaults to false. setTest :: Bool -> SMSSettings -> SMSSettings setSender :: ByteString -> SMSSettings -> SMSSettings runSettings :: Command -> SMSSettings -> IO (Either JSONException TLResponse) sendSMS :: ByteString -> [ByteString] -> Credential -> IO (Either JSONException TLResponse) data Command SendSMS :: Command instance GHC.Classes.Ord Network.Api.TextLocal.Command instance GHC.Classes.Eq Network.Api.TextLocal.Command instance GHC.Show.Show Network.Api.TextLocal.Command