-- 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.TLResponse
instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Types.TLStatus
instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Types.Warning
instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Types.Error


-- | Haskell wrapper for sending SMS using textlocal SMS gateway.
--   
--   Sending SMS
--   
--   <ol>
--   <li>Get an api key from <a>textlocal.in</a></li>
--   <li>Quick way to send:</li>
--   </ol>
--   
--   <pre>
--   &gt;&gt; import Network.Api.TextLocal
--   &gt;&gt; let cred = createUserHash "myemail@email.in" "my-secret-hash"
--   &gt;&gt; res &lt;- sendSMS "hello world" ["911234567890"] cred
--   &gt;&gt; res
--   Right (TLResponse {status = Success, warnings = Nothing, errors = Nothing})
--   </pre>
--   
--   Or in a more configurable way:
--   
--   <pre>
--   &gt;&gt; import Network.Api.TextLocal
--   &gt;&gt; let cred = createUserHash "myemail@email.in" "my-secret-hash"
--   &gt;&gt; let destNums = ["911234567890"]
--   &gt;&gt; let mySettings = setDestinationNumber destNums $  setAuth cred $ setTest True defaultSMSSettings
--   &gt;&gt; res &lt;- runSettings SendSMS (setMessage "hello world" mySettings)
--   &gt;&gt; res
--   Right (TLResponse {status = Success, warnings = Nothing, errors = Nothing})
--   </pre>
module Network.Api.TextLocal

-- | Credential for making request to textLocal server. There are multiple
--   ways for creating it. You can either use <a>createApiKey</a> or
--   <a>createUserHash</a> to create this type.
data Credential

-- | Create <a>Credential</a> for textLocal using api key.
createApiKey :: ByteString -> Credential

-- | Create <a>Credential</a> for textLocal using email and secure hash.
createUserHash :: ByteString -> ByteString -> Credential
data SMSSettings

-- | <a>defaultSMSSettings</a> has the default settings, duh! The
--   <a>settingsSender</a> has a value of <tt>TXTLCL</tt>. Using the
--   accessors <a>setMessage</a>, <a>setAuth</a>,
--   <a>setDestinationNumber</a> 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
