-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Haskell library to interact with Mailchimp JSON API Version 3.0
--
-- This package contains the basic functions supported by Mailchimp JSON
-- API. For HTTP Authentication, it uses Basic HTTP Authentication.
@package MailchimpSimple
@version 0.2.0.0
-- | Types and functions for Logging the activities
module Utils.Logger
-- | Constructor for the Log levels.
data LogLevels
ERROR :: LogLevels
DEBUG :: LogLevels
INFO :: LogLevels
-- | This function appends a log entry to an external log file.
--
-- Error logs to 'error.log' file. Other logs to 'access.log' file.
writeLog :: LogLevels -> String -> String -> String -> IO ()
instance GHC.Classes.Eq Utils.Logger.Logger
instance GHC.Show.Show Utils.Logger.Logger
instance GHC.Classes.Eq Utils.Logger.LogLevels
instance GHC.Show.Show Utils.Logger.LogLevels
-- | JSON data structures to work with Mailchimp JSON API Version 3.0
module Utils.Types
-- | JSON structure containing a single subscription.
--
-- This structure includes the email_address, email_type, and
-- status to be shown in the member's profile.
-- email_type accepts the two values; html / text
data Subscription
Subscription :: String -> String -> String -> Subscription
[s_email] :: Subscription -> String
[s_email_type] :: Subscription -> String
[s_status] :: Subscription -> String
-- | Constructor to build the EmailId.
data EmailId
-- | from email address of the member
Email :: String -> EmailId
-- | from unique ID provided by Mailchimp
EmailUniqueId :: String -> EmailId
-- | from emailID of the member in the particular list
ListEmailId :: String -> EmailId
-- | JSON structure for Batch oprations.
data Batch
Batch :: [Operation] -> Batch
[operations] :: Batch -> [Operation]
-- | JSON structure to contain the Batch operation information.
--
-- For GET requests, o_param should be given the list of values.
-- For POST requests, o_body should be given the String
-- representation of the encoded JSON data.
data Operation
Operation :: String -> String -> Params -> String -> Operation
[o_method] :: Operation -> String
[o_path] :: Operation -> String
[o_params] :: Operation -> Params
[o_body] :: Operation -> String
-- | List of parameters to the URL in HTTP request
data Params
Params :: [String] -> Params
[params] :: Params -> [String]
-- | JSON structure to construct a Campaign
--
-- This takes a campaign_type, which accepts these possible
-- values; regular, plaintext, absplit, rss, and
-- variate.
data Campaign
Campaign :: String -> Settings -> Receipient -> Campaign
[c_type] :: Campaign -> String
[c_settings] :: Campaign -> Settings
[c_receipients] :: Campaign -> Receipient
-- | Settings for the Campaign creation
--
-- This includes the basic properties of the Campaign, like subject_line,
-- title, from_name, and reply_to address.
data Settings
Settings :: String -> String -> String -> String -> Settings
[s_subject] :: Settings -> String
[s_title] :: Settings -> String
[s_from_name] :: Settings -> String
[s_reply_to] :: Settings -> String
-- | Structure to hold the list of recipients of a Campaign
data Receipient
ListID :: String -> Receipient
-- | Data structure to hold the HTTP response of the request to list the
-- subscribers in a mailing-list.
data ListSubscribersResponse
ListSubscribersResponse :: Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> ListSubscribersResponse
[ls_name] :: ListSubscribersResponse -> Maybe String
[ls_euid] :: ListSubscribersResponse -> Maybe String
[ls_list_name] :: ListSubscribersResponse -> Maybe String
[ls_emailType] :: ListSubscribersResponse -> Maybe String
[ls_status] :: ListSubscribersResponse -> Maybe String
-- | Data structure to hold the HTTP response of the request to list the
-- mailing-lists in the account.
data MailListResponse
MailListResponse :: Maybe String -> Maybe String -> MailListResponse
[l_name] :: MailListResponse -> Maybe String
[l_id] :: MailListResponse -> Maybe String
-- | Data structure to hold the Template information.
--
-- This contains the template name and ID.
data TemplateResponse
TemplateResponse :: Maybe String -> Maybe Int -> TemplateResponse
[t_name] :: TemplateResponse -> Maybe String
[t_id] :: TemplateResponse -> Maybe Int
data SendMailResponse
SendMailResponse :: Bool -> SendMailResponse
[complete] :: SendMailResponse -> Bool
-- | Data structure to hold the HTTP response of the subscription request.
data SubscriptionResponse
SubscriptionResponse :: Maybe String -> Maybe String -> Maybe String -> Maybe String -> SubscriptionResponse
[email] :: SubscriptionResponse -> Maybe String
[euid] :: SubscriptionResponse -> Maybe String
[status] :: SubscriptionResponse -> Maybe String
[lname] :: SubscriptionResponse -> Maybe String
-- | Data structure to hold the response of the Batch request
data BatchSubscriptionResponse
BatchSubscriptionResponse :: Maybe String -> Maybe String -> BatchSubscriptionResponse
[b_id] :: BatchSubscriptionResponse -> Maybe String
[b_status] :: BatchSubscriptionResponse -> Maybe String
instance GHC.Generics.Selector Utils.Types.S1_0_1BatchSubscriptionResponse
instance GHC.Generics.Selector Utils.Types.S1_0_0BatchSubscriptionResponse
instance GHC.Generics.Constructor Utils.Types.C1_0BatchSubscriptionResponse
instance GHC.Generics.Datatype Utils.Types.D1BatchSubscriptionResponse
instance GHC.Generics.Selector Utils.Types.S1_0_3SubscriptionResponse
instance GHC.Generics.Selector Utils.Types.S1_0_2SubscriptionResponse
instance GHC.Generics.Selector Utils.Types.S1_0_1SubscriptionResponse
instance GHC.Generics.Selector Utils.Types.S1_0_0SubscriptionResponse
instance GHC.Generics.Constructor Utils.Types.C1_0SubscriptionResponse
instance GHC.Generics.Datatype Utils.Types.D1SubscriptionResponse
instance GHC.Generics.Selector Utils.Types.S1_0_0SendMailResponse
instance GHC.Generics.Constructor Utils.Types.C1_0SendMailResponse
instance GHC.Generics.Datatype Utils.Types.D1SendMailResponse
instance GHC.Generics.Selector Utils.Types.S1_0_1TemplateResponse
instance GHC.Generics.Selector Utils.Types.S1_0_0TemplateResponse
instance GHC.Generics.Constructor Utils.Types.C1_0TemplateResponse
instance GHC.Generics.Datatype Utils.Types.D1TemplateResponse
instance GHC.Generics.Selector Utils.Types.S1_0_1MailListResponse
instance GHC.Generics.Selector Utils.Types.S1_0_0MailListResponse
instance GHC.Generics.Constructor Utils.Types.C1_0MailListResponse
instance GHC.Generics.Datatype Utils.Types.D1MailListResponse
instance GHC.Generics.Selector Utils.Types.S1_0_4ListSubscribersResponse
instance GHC.Generics.Selector Utils.Types.S1_0_3ListSubscribersResponse
instance GHC.Generics.Selector Utils.Types.S1_0_2ListSubscribersResponse
instance GHC.Generics.Selector Utils.Types.S1_0_1ListSubscribersResponse
instance GHC.Generics.Selector Utils.Types.S1_0_0ListSubscribersResponse
instance GHC.Generics.Constructor Utils.Types.C1_0ListSubscribersResponse
instance GHC.Generics.Datatype Utils.Types.D1ListSubscribersResponse
instance GHC.Generics.Constructor Utils.Types.C1_2EmailId
instance GHC.Generics.Constructor Utils.Types.C1_1EmailId
instance GHC.Generics.Constructor Utils.Types.C1_0EmailId
instance GHC.Generics.Datatype Utils.Types.D1EmailId
instance GHC.Generics.Selector Utils.Types.S1_0_2Subscription
instance GHC.Generics.Selector Utils.Types.S1_0_1Subscription
instance GHC.Generics.Selector Utils.Types.S1_0_0Subscription
instance GHC.Generics.Constructor Utils.Types.C1_0Subscription
instance GHC.Generics.Datatype Utils.Types.D1Subscription
instance GHC.Generics.Generic Utils.Types.BatchSubscriptionResponse
instance GHC.Show.Show Utils.Types.BatchSubscriptionResponse
instance GHC.Generics.Generic Utils.Types.SubscriptionResponse
instance GHC.Show.Show Utils.Types.SubscriptionResponse
instance GHC.Generics.Generic Utils.Types.SendMailResponse
instance GHC.Show.Show Utils.Types.SendMailResponse
instance GHC.Generics.Generic Utils.Types.TemplateResponse
instance GHC.Show.Show Utils.Types.TemplateResponse
instance GHC.Generics.Generic Utils.Types.MailListResponse
instance GHC.Show.Show Utils.Types.MailListResponse
instance GHC.Generics.Generic Utils.Types.ListSubscribersResponse
instance GHC.Show.Show Utils.Types.ListSubscribersResponse
instance GHC.Show.Show Utils.Types.Campaign
instance GHC.Show.Show Utils.Types.Receipient
instance GHC.Show.Show Utils.Types.Settings
instance GHC.Show.Show Utils.Types.Batch
instance GHC.Show.Show Utils.Types.Operation
instance GHC.Show.Show Utils.Types.Params
instance GHC.Generics.Generic Utils.Types.EmailId
instance GHC.Show.Show Utils.Types.EmailId
instance GHC.Generics.Generic Utils.Types.Subscription
instance GHC.Show.Show Utils.Types.Subscription
instance Data.Aeson.Types.Class.FromJSON Utils.Types.Subscription
instance Data.Aeson.Types.Class.ToJSON Utils.Types.Subscription
instance Data.Aeson.Types.Class.ToJSON Utils.Types.EmailId
instance Data.Aeson.Types.Class.FromJSON Utils.Types.EmailId
instance Data.Aeson.Types.Class.ToJSON Utils.Types.Batch
instance Data.Aeson.Types.Class.ToJSON Utils.Types.Operation
instance Data.Aeson.Types.Class.ToJSON Utils.Types.Params
instance Data.Aeson.Types.Class.ToJSON Utils.Types.Campaign
instance Data.Aeson.Types.Class.ToJSON Utils.Types.Settings
instance Data.Aeson.Types.Class.ToJSON Utils.Types.Receipient
instance Data.Aeson.Types.Class.FromJSON Utils.Types.ListSubscribersResponse
instance Data.Aeson.Types.Class.FromJSON Utils.Types.MailListResponse
instance Data.Aeson.Types.Class.FromJSON Utils.Types.TemplateResponse
instance Data.Aeson.Types.Class.FromJSON Utils.Types.SendMailResponse
instance Data.Aeson.Types.Class.FromJSON Utils.Types.SubscriptionResponse
instance Data.Aeson.Types.Class.FromJSON Utils.Types.BatchSubscriptionResponse
-- | Types and functions for working with Mailchimp JSON API Version 3.0
module MailchimpSimple
-- | Takes an apiKey of a Mailchimp account, and gives all the
-- mailing-lists in the account.
--
-- This function lists the mailing lists in a particular account
listMailingLists :: String -> IO [MailListResponse]
-- | Takes an apiKey of the Mailchimp account, and a
-- listName. Retrieves all the members in the given list.
--
-- Request URL specifies which data to be returned from the response.
-- They are, email_address, unique_email_id, email_type,
-- list_id, and status for each member in the reponse.
--
-- This function lists subscribers in a mailing list
listSubscribers :: String -> String -> IO [ListSubscribersResponse]
-- | Taking apiKey, listName, emailAddress,
-- emailType, and memberStatus as input parameters in
-- the given order, this function creates and add the member to the given
-- list.
--
-- This function adds a new member to a given list
addSubscriber :: String -> String -> String -> String -> String -> IO SubscriptionResponse
-- | Giving an apiKey, emailAddress, and
-- listName which the member belongs to, this function
-- unsubscribe the member from the list. This function does not deletes
-- the particular user profile from the mailing-list.
--
-- This function removes a member from a given list
removeSubscriber :: String -> String -> String -> IO Bool
-- | Input parameters for this function is the apiKey of the
-- Mailchimp account.
--
-- This function retrieves all the templates in the account.
getTemplates :: String -> IO [TemplateResponse]
-- | Taking the apiKey of a Mailchimp account, this function
-- returns all the stored unsent Campaigns.
--
-- This function returns all the Campaigns in the account.
getCampaigns :: String -> IO [(Maybe String, Maybe String)]
-- | Usage of this function to create a new Campaign and save is as
-- follows;
--
-- createCampaign apiKey listName replyTo fromName cType
-- title subject -> campaignID
--
-- This function creates a new campaign and save it
createCampaign :: String -> String -> String -> String -> String -> String -> String -> IO (Maybe String)
-- | Input parameters for this function are apiKey and the
-- campaignID of the particular Campaign to be sent.
--
-- This function sends an email campaign
sendEmail :: String -> String -> IO (Either String SendMailResponse)
-- | Efficiently processes a batch subscription requests for a given list
-- of emailAddress and subscriptionStatus combinations.
--
-- This function can be re-implemented to perform other batch requests by
-- changing the body and path properties of
-- Operation data structure.
--
-- This function adds a batch of subscribers
batchSubscribe :: String -> String -> [(String, String)] -> IO BatchSubscriptionResponse