-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Haskell SDK for the LINE API
--   
--   This package exports bindings to LINE APIs.
--   
--   It provides the following features:
--   
--   <ul>
--   <li>Internal auth signature validator</li>
--   <li>Webhook handled with handler function, WAI application, or Scotty
--   action</li>
--   <li>Functions and types for
--   <a>https://developers.line.me/en/docs/messaging-api/reference/</a></li>
--   </ul>
--   
--   For example usages, please see the <a>examples</a> directory.
@package line
@version 4.0.1


-- | This module is to define aliases commonly used in other modules.
module Line.Messaging.Common.Types

-- | A type alias to specify an identifier of something.
type ID = Text

-- | A type alias to specify a URL.
type URL = Text

-- | A type alias to specify a channel secret. About issueing and using the
--   channel secret, please refer to corresponding LINE documentations.
type ChannelSecret = Text

-- | A type alias to specify a channel access token. About issueing and
--   using the channel access token, please refer to corresponding LINE
--   documentations.
type ChannelAccessToken = Text


-- | This module provides types to be used with <a>Line.Messaging.API</a>.
module Line.Messaging.API.Types

-- | A type class representing types to be converted into <a>Message</a>.
--   
--   It has <tt>toType</tt> and <tt>toObject</tt> as its minimal complete
--   definition, but it is not recommended to define any extra instance, as
--   the new type may not work with the LINE APIs.
--   
--   About existing messageable types, please refer to the following
--   instances. Each instance is matched with a message object described in
--   <a>the LINE documentation</a>.
class Messageable a

-- | A type representing a message to be sent.
--   
--   The data constructor converts <a>Messageable</a> into <a>Message</a>.
--   It allows different types of <a>Messageable</a> to be sent through a
--   single API call.
--   
--   An example usage is like below.
--   
--   <pre>
--   pushTextAndImage :: ID -&gt; APIIO ()
--   pushTextAndImage identifier = push identifier [
--     Message $ <a>Text</a> "hello",
--     Message $ <a>Image</a> "<a>https://example.com/image.jpg"</a> "<a>https://example.com/preview.jpg"</a>
--     ]
--   </pre>
data Message
Message :: a -> Message

-- | <a>Messageable</a> for text data.
--   
--   It contains <a>Text</a> of <a>Data.Text</a>. Its corresponding JSON
--   spec is described <a>here</a>.
--   
--   This type is also used to decode text event message from webhook
--   request. About the webhook usage, please refer to <a>EventMessage</a>
--   in <a>Line.Messaging.Webhook.Types</a>.
newtype Text
Text :: Text -> Text
[$sel:getText:Text] :: Text -> Text

-- | <a>Messageable</a> for image data.
--   
--   It contains URLs of an original image and its preview. Its
--   corresponding JSON spec is described <a>here</a>.
data Image
Image :: URL -> URL -> Image
[$sel:getURL:Image] :: Image -> URL
[$sel:getPreviewURL:Image] :: Image -> URL

-- | <a>Messageable</a> for video data.
--   
--   It contains URLs of an original video and its preview. Its
--   corresponding JSON spec is described <a>here</a>.
data Video
Video :: URL -> URL -> Video
[$sel:getURL:Video] :: Video -> URL
[$sel:getPreviewURL:Video] :: Video -> URL

-- | <a>Messageable</a> for audio data.
--   
--   It contains a URL of an audio, and its duration in milliseconds. Its
--   corresponding JSON spec is described <a>here</a>.
data Audio
Audio :: URL -> Integer -> Audio
[$sel:getURL:Audio] :: Audio -> URL
[$sel:getDuration:Audio] :: Audio -> Integer

-- | <a>Messageable</a> for location data.
--   
--   It contains a title, address, and geographic coordination of a
--   location. Its corresponding JSON spec is described <a>here</a>.
--   
--   This type is also used to decode location event message from webhook
--   request. About the webhook usage, please refer to <a>EventMessage</a>
--   in <a>Line.Messaging.Webhook.Types</a>.
data Location
Location :: Text -> Text -> Double -> Double -> Location
[$sel:getTitle:Location] :: Location -> Text
[$sel:getAddress:Location] :: Location -> Text
[$sel:getLatitude:Location] :: Location -> Double
[$sel:getLongitude:Location] :: Location -> Double

-- | <a>Messageable</a> for sticker data.
--   
--   It contains its package and sticker ID. Its corresponding JSON spec is
--   described <a>here</a>.
--   
--   This type is also used to decode sticker event message from webhook
--   request. About the webhook usage, please refer to <a>EventMessage</a>
--   in <a>Line.Messaging.Webhook.Types</a>.
data Sticker
Sticker :: ID -> ID -> Sticker
[$sel:getPackageID:Sticker] :: Sticker -> ID
[$sel:getStickerID:Sticker] :: Sticker -> ID

-- | <a>Messageable</a> for image map data.
--   
--   About how to send an image map message and what each field means,
--   please refer to <a>image map message spec</a>.
data ImageMap
ImageMap :: URL -> Text -> (Integer, Integer) -> [ImageMapAction] -> ImageMap

-- | <a>Base URL</a> of images
[$sel:getBaseImageURL:ImageMap] :: ImageMap -> URL

-- | Alt text for devices not supporting image map
[$sel:getAltText:ImageMap] :: ImageMap -> Text

-- | Image size tuple, (width, height) specifically. The width to be set to
--   1040, the height to be set to the value corresponding to a width of
--   1040.
[$sel:getBaseImageSize:ImageMap] :: ImageMap -> (Integer, Integer)

-- | Actions to be executed when each area is tapped
[$sel:getActions:ImageMap] :: ImageMap -> [ImageMapAction]

-- | A type representing actions when a specific area of an image map is
--   tapped.
--   
--   It contains action data and area information.
data ImageMapAction

-- | Open a web page when an area is tapped.
IMURIAction :: URL -> ImageMapArea -> ImageMapAction

-- | Send a text message from the user who tapped an area.
IMMessageAction :: Text -> ImageMapArea -> ImageMapAction

-- | A type representing a tappable area in an image map
--   
--   Each component means (x, y, width, height) correspondingly.
type ImageMapArea = (Integer, Integer, Integer, Integer)

-- | <a>Messageable</a> for template data.
--   
--   It has a type parameter <tt>t</tt> which means a template content
--   type. The type is polymolphic, but <a>Messageable</a> instances are
--   defined only for <a>Buttons</a>, <a>Confirm</a>, <a>Carousel</a>, and
--   <a>ImageCarousel</a>.
--   
--   About how to send template message and what each field means, please
--   refer to <a>template message spec</a>.
data Template t
Template :: Text -> t -> Template t

-- | Alt text for devices not supporting template message
[$sel:getAltText:Template] :: Template t -> Text

-- | Template content type
[$sel:getTemplateContent:Template] :: Template t -> t

-- | The buttons content type for template message.
--   
--   
--   For more details of each field, please refer to the <a>Buttons</a>
--   section in the LINE documentation.
data Buttons
Buttons :: Maybe URL -> Maybe Text -> Text -> [TemplateAction] -> Buttons

-- | URL for thumbnail image
[$sel:getThumbnailURL:Buttons] :: Buttons -> Maybe URL

-- | Title text
[$sel:getTitle:Buttons] :: Buttons -> Maybe Text

-- | Description text
[$sel:getText:Buttons] :: Buttons -> Text

-- | A list of template actions, each of which represents a button (max: 4)
[$sel:getActions:Buttons] :: Buttons -> [TemplateAction]

-- | The confirm content type for template message.
--   
--   
--   For more details of each field, please refer to the <a>Confirm</a>
--   section in the LINE documentation.
data Confirm
Confirm :: Text -> [TemplateAction] -> Confirm

-- | Confirm text
[$sel:getText:Confirm] :: Confirm -> Text

-- | A list of template actions, each of which represents a button (max: 2)
[$sel:getActions:Confirm] :: Confirm -> [TemplateAction]

-- | The carousel content type for template message.
--   
--   
--   For more details of each field, please refer to the <a>Carousel</a>
--   section in the LINE documentation.
data Carousel
Carousel :: [Column] -> Carousel

-- | A list of columns for a carousel template
[$sel:getColumns:Carousel] :: Carousel -> [Column]

-- | The image carousel content type for template message.
--   
--   
--   For more details of each field, please refer to the <a>Image
--   carousel</a> section in the LINE documentation.
data ImageCarousel
ImageCarousel :: [ImageColumn] -> ImageCarousel

-- | A list of columns for an image carousel template
[$sel:getColumns:ImageCarousel] :: ImageCarousel -> [ImageColumn]

-- | Actual contents of carousel template.
--   
--   It has the same fields as <a>Buttons</a>, except that the number of
--   actions is up to 3.
data Column
Column :: Maybe URL -> Maybe Text -> Text -> [TemplateAction] -> Column

-- | URL for thumbnail image
[$sel:getThumbnailURL:Column] :: Column -> Maybe URL

-- | Title text
[$sel:getTitle:Column] :: Column -> Maybe Text

-- | Description text
[$sel:getText:Column] :: Column -> Text

-- | A list of template actions, each of which represents a button (max: 3)
[$sel:getActions:Column] :: Column -> [TemplateAction]

-- | Actual contents of carousel template.
--   
--   It has the same fields as <a>Buttons</a>, except that the number of
--   actions is up to 3.
data ImageColumn
ImageColumn :: URL -> TemplateAction -> ImageColumn

-- | URL for thumbnail image
[$sel:getImageURL:ImageColumn] :: ImageColumn -> URL

-- | A template action
[$sel:getAction:ImageColumn] :: ImageColumn -> TemplateAction

-- | Just a type alias for <a>Text</a>, used with <a>TemplateAction</a>.
type Label = Text

-- | A data type for possible template actions.
--   
--   Each action object represents a button in template message. A button
--   has a label and an actual action fired by click.
data TemplateAction

-- | Message action. When clicked, a specified text will be sent into the
--   same room by a user who clicked the button.
TplMessageAction :: Label -> Text -> TemplateAction

-- | Postback action. When clicked, a specified text will be sent, and
--   postback data will be sent to webhook server as a postback event.
TplPostbackAction :: Label -> Text -> (Maybe Text) -> TemplateAction

-- | URI action. When clicked, a web page with a specified URI will open in
--   the in-app browser.
TplURIAction :: Label -> URL -> TemplateAction

-- | Datetime picker action. When clicked, a postback action will be sent
--   with the date and time selected by the user from the date and time
--   selection dialog. For the detailed information of datetime picker,
--   please refer to the <a>official documentation</a>.
TplDatetimePickerAction :: (Maybe Label) -> Text -> DatetimeMode -> (Maybe Text) -> (Maybe Text) -> (Maybe Text) -> TemplateAction
[$sel:label':TplMessageAction] :: TemplateAction -> (Maybe Label)
[$sel:data':TplMessageAction] :: TemplateAction -> Text
[$sel:mode':TplMessageAction] :: TemplateAction -> DatetimeMode
[$sel:initial':TplMessageAction] :: TemplateAction -> (Maybe Text)
[$sel:max':TplMessageAction] :: TemplateAction -> (Maybe Text)
[$sel:min':TplMessageAction] :: TemplateAction -> (Maybe Text)
data DatetimeMode
Date :: DatetimeMode
Time :: DatetimeMode
Datetime :: DatetimeMode

-- | A type to represent a user's profile.
--   
--   It is the return type of the <a>getProfile</a> API in the
--   <a>Line.Messaging.API</a> module.
data Profile
Profile :: ID -> Text -> Maybe URL -> Maybe Text -> Profile
[$sel:getUserID:Profile] :: Profile -> ID
[$sel:getDisplayName:Profile] :: Profile -> Text
[$sel:getPictureURL:Profile] :: Profile -> Maybe URL
[$sel:getStatusMessage:Profile] :: Profile -> Maybe Text

-- | An error type possibly returned from the <tt><a>APIIO</a></tt> type.
--   
--   State code errors may contain a parsed error body. Other types of
--   errors, which may rarely occur if used properly, does not.
--   
--   For more details of error types, please refer to <a>Status codes</a>
--   and <a>Error response</a> sections in the LINE documentation.
data APIError

-- | 400 Bad Request with a parsed error body, caused by badly formatted
--   request.
BadRequest :: (Maybe APIErrorBody) -> APIError

-- | 401 Unauthorized with a parsed error body, caused by invalid access
--   token.
Unauthorized :: (Maybe APIErrorBody) -> APIError

-- | 403 Forbidden with a parsed error body, caused by unauthorized account
--   or plan.
Forbidden :: (Maybe APIErrorBody) -> APIError

-- | 429 Too Many Requests with a parsed error body, caused by exceeding
--   the <a>rate limit</a>.
TooManyRequests :: (Maybe APIErrorBody) -> APIError

-- | 500 Internal Server Error with a parsed error body.
InternalServerError :: (Maybe APIErrorBody) -> APIError

-- | Caused by status codes other than 200 and listed statuses above, with
--   the status code and request body.
UndefinedStatusCode :: Int -> ByteString -> APIError

-- | Caused by badly formatted response body from APIs.
JSONDecodeError :: String -> APIError

-- | Any other exception caught as <a>SomeException</a>.
UndefinedError :: SomeException -> APIError

-- | An error body type.
--   
--   It contains error message, and may contain property information and
--   detailed error bodies.
data APIErrorBody
APIErrorBody :: Text -> Maybe Text -> Maybe [APIErrorBody] -> APIErrorBody
[$sel:getErrorMessage:APIErrorBody] :: APIErrorBody -> Text
[$sel:getErrorProperty:APIErrorBody] :: APIErrorBody -> Maybe Text
[$sel:getErrorDetails:APIErrorBody] :: APIErrorBody -> Maybe [APIErrorBody]
instance GHC.Show.Show Line.Messaging.API.Types.APIError
instance GHC.Show.Show Line.Messaging.API.Types.APIErrorBody
instance GHC.Classes.Eq Line.Messaging.API.Types.APIErrorBody
instance GHC.Show.Show Line.Messaging.API.Types.Profile
instance GHC.Classes.Eq Line.Messaging.API.Types.Profile
instance GHC.Show.Show Line.Messaging.API.Types.Buttons
instance GHC.Classes.Eq Line.Messaging.API.Types.Buttons
instance GHC.Show.Show Line.Messaging.API.Types.Confirm
instance GHC.Classes.Eq Line.Messaging.API.Types.Confirm
instance GHC.Show.Show Line.Messaging.API.Types.Carousel
instance GHC.Classes.Eq Line.Messaging.API.Types.Carousel
instance GHC.Show.Show Line.Messaging.API.Types.Column
instance GHC.Classes.Eq Line.Messaging.API.Types.Column
instance GHC.Show.Show Line.Messaging.API.Types.ImageCarousel
instance GHC.Classes.Eq Line.Messaging.API.Types.ImageCarousel
instance GHC.Show.Show Line.Messaging.API.Types.ImageColumn
instance GHC.Classes.Eq Line.Messaging.API.Types.ImageColumn
instance GHC.Show.Show Line.Messaging.API.Types.TemplateAction
instance GHC.Classes.Eq Line.Messaging.API.Types.TemplateAction
instance GHC.Show.Show Line.Messaging.API.Types.DatetimeMode
instance GHC.Classes.Eq Line.Messaging.API.Types.DatetimeMode
instance GHC.Show.Show t => GHC.Show.Show (Line.Messaging.API.Types.Template t)
instance GHC.Classes.Eq t => GHC.Classes.Eq (Line.Messaging.API.Types.Template t)
instance GHC.Show.Show Line.Messaging.API.Types.ImageMap
instance GHC.Classes.Eq Line.Messaging.API.Types.ImageMap
instance GHC.Show.Show Line.Messaging.API.Types.ImageMapAction
instance GHC.Classes.Eq Line.Messaging.API.Types.ImageMapAction
instance GHC.Show.Show Line.Messaging.API.Types.Sticker
instance GHC.Classes.Eq Line.Messaging.API.Types.Sticker
instance GHC.Show.Show Line.Messaging.API.Types.Location
instance GHC.Classes.Eq Line.Messaging.API.Types.Location
instance GHC.Show.Show Line.Messaging.API.Types.Audio
instance GHC.Classes.Eq Line.Messaging.API.Types.Audio
instance GHC.Show.Show Line.Messaging.API.Types.Video
instance GHC.Classes.Eq Line.Messaging.API.Types.Video
instance GHC.Show.Show Line.Messaging.API.Types.Image
instance GHC.Classes.Eq Line.Messaging.API.Types.Image
instance GHC.Show.Show Line.Messaging.API.Types.Text
instance GHC.Classes.Ord Line.Messaging.API.Types.Text
instance GHC.Classes.Eq Line.Messaging.API.Types.Text
instance GHC.Show.Show Line.Messaging.API.Types.Message
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.API.Types.APIErrorBody
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.API.Types.Profile
instance Line.Messaging.API.Types.Messageable (Line.Messaging.API.Types.Template Line.Messaging.API.Types.Buttons)
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.Buttons
instance Line.Messaging.API.Types.Messageable (Line.Messaging.API.Types.Template Line.Messaging.API.Types.Confirm)
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.Confirm
instance Line.Messaging.API.Types.Messageable (Line.Messaging.API.Types.Template Line.Messaging.API.Types.Carousel)
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.Carousel
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.Column
instance Line.Messaging.API.Types.Messageable (Line.Messaging.API.Types.Template Line.Messaging.API.Types.ImageCarousel)
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.ImageCarousel
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.ImageColumn
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.TemplateAction
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.DatetimeMode
instance Line.Messaging.API.Types.Messageable Line.Messaging.API.Types.ImageMap
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.ImageMapAction
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.API.Types.Sticker
instance Line.Messaging.API.Types.Messageable Line.Messaging.API.Types.Sticker
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.API.Types.Location
instance Line.Messaging.API.Types.Messageable Line.Messaging.API.Types.Location
instance Line.Messaging.API.Types.Messageable Line.Messaging.API.Types.Audio
instance Line.Messaging.API.Types.Messageable Line.Messaging.API.Types.Video
instance Line.Messaging.API.Types.Messageable Line.Messaging.API.Types.Image
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.API.Types.Text
instance Line.Messaging.API.Types.Messageable Line.Messaging.API.Types.Text
instance Data.Aeson.Types.ToJSON.ToJSON Line.Messaging.API.Types.Message


-- | This module provides types to be used with
--   <a>Line.Messaging.Webhook</a>.
module Line.Messaging.Webhook.Types

-- | A type alias for auth signature.
--   
--   It is set as <tt>X-Line-Signature</tt> header in webhook requests
type Signature = ByteString

-- | A failure type returned when a webhook request is malformed.
data WebhookFailure

-- | When the signature is not valid.
SignatureVerificationFailed :: WebhookFailure

-- | When the request body cannot be decoded into defined event types.
MessageDecodeFailed :: WebhookFailure

-- | This type represents a whole request body.
--   
--   It is mainly for JSON parsing, and users may not need to use this type
--   directly.
newtype Body
Body :: [Event] -> Body

-- | A type to represent each webhook event. The type of an event can be
--   determined with pattern matching.
--   
--   <pre>
--   handleEvent :: Event -&gt; IO ()
--   handleEvent (MessageEvent event) = handleMessageEvent event
--   handleEvent (BeaconEvent event) = handleBeaconEvent event
--   handleEvent _ = return ()
--   
--   handleMessageEvent :: ReplyableEvent EventMessage -&gt; IO ()
--   handleMessageEvent = undefined
--   
--   handleBeaconEvent :: ReplyableEvent BeaconData -&gt; IO ()
--   handleBeaconEvent = undefined
--   </pre>
--   
--   All the data contstructors have a type <tt><a>EventTuple</a> r a -&gt;
--   <a>Event</a></tt>.
data Event
MessageEvent :: (ReplyableEvent EventMessage) -> Event
FollowEvent :: (ReplyableEvent ()) -> Event
UnfollowEvent :: (NonReplyableEvent ()) -> Event
JoinEvent :: (ReplyableEvent ()) -> Event
LeaveEvent :: (NonReplyableEvent ()) -> Event
PostbackEvent :: (ReplyableEvent Postback) -> Event
BeaconEvent :: (ReplyableEvent BeaconData) -> Event

-- | The base type for an event. It is a type alias for 4-tuple containing
--   event data.
--   
--   The type variable <tt>r</tt> is for a reply token, which is
--   <tt>()</tt> in the case of non-replyable events. The type variable
--   <tt>a</tt> is a content type, which is <tt>()</tt> for events without
--   content.
type EventTuple r a = (EventSource, UTCTime, r, a)

-- | A type alias for reply token. It is also consumed by the
--   <tt><a>reply</a></tt> API.
type ReplyToken = Text

-- | A type alias to represent a replyable event.
type ReplyableEvent a = EventTuple ReplyToken a

-- | A type alias to represent a non-replyable event.
type NonReplyableEvent a = EventTuple () a

-- | Retrieve event source from an event.
getSource :: EventTuple r a -> EventSource

-- | Retrieve datetime when event is sent.
getDatetime :: EventTuple r a -> UTCTime

-- | Retrieve a reply token of an event. It can be used only for
--   <a>ReplyableEvent</a>.
getReplyToken :: ReplyableEvent a -> ReplyToken

-- | Retrieve event message from an event. It can be used only for events
--   whose content is a message.
--   
--   <pre>
--   handleMessageEvent :: ReplyableEvent EventMessage -&gt; IO ()
--   handleMessageEvent event = do
--     let message = getMessage event
--     print message
--   </pre>
getMessage :: ReplyableEvent EventMessage -> EventMessage

-- | Retrieve postback data from an event. It can be used only for events
--   whose content is postback data.
--   
--   <pre>
--   import qualified Data.Text.IO as TIO
--   
--   handlePostbackEvent :: ReplyableEvent Postback -&gt; IO ()
--   handlePostbackEvent event = do
--     let postback = getPostback event
--     TIO.putStrLn postback
--   </pre>
getPostback :: ReplyableEvent Postback -> Postback

-- | Retrieve beacon data from an event. It can be used only for events
--   whose content is beacon data.
--   
--   <pre>
--   handleBeaconEvent :: ReplyableEvent BeaconData -&gt; IO ()
--   handleBeaconEvent event = do
--     let beaconData = getBeacon event
--     print beaconData
--   </pre>
getBeacon :: ReplyableEvent BeaconData -> BeaconData

-- | A source from which an event is sent. It can be retrieved from events
--   with <a>getSource</a>.
data EventSource
User :: ID -> EventSource
[userID] :: EventSource -> ID
Group :: ID -> Maybe ID -> EventSource
[groupID] :: EventSource -> ID
[groupUserId] :: EventSource -> Maybe ID
Room :: ID -> Maybe ID -> EventSource
[roomID] :: EventSource -> ID
[roomUserId] :: EventSource -> Maybe ID

-- | Represent message types sent with <a>MessageEvent</a>. It can be
--   retrieved from message events with <a>getMessage</a>.
--   
--   There is no actual content body sent with image, video and audio
--   messages. It should be manually downloaded via the
--   <tt><a>getContent</a></tt> API.
--   
--   For more details of event messages, please refer to the <a>Message
--   event</a> section of the LINE documentation.
data EventMessage

-- | Text event message.
TextEM :: ID -> Text -> EventMessage

-- | Image event message.
ImageEM :: ID -> EventMessage

-- | Video event message.
VideoEM :: ID -> EventMessage

-- | Audio event message.
AudioEM :: ID -> EventMessage

-- | File event message.
FileEM :: ID -> Text -> Integer -> EventMessage

-- | Location event message.
LocationEM :: ID -> Location -> EventMessage

-- | Sticker event message.
StickerEM :: ID -> Sticker -> EventMessage

-- | Represent Postback data.
data Postback
Postback :: Text -> Maybe PostbackParams -> Postback
[data'] :: Postback -> Text
[params] :: Postback -> Maybe PostbackParams

-- | Represent params of Postback data.
--   
--   It's currently used only for the datetime picker action. For the
--   detail, please refer to the <a>official documentation</a>.
data PostbackParams
PostbackParamsDate :: Text -> PostbackParams
PostbackParamsTime :: Text -> PostbackParams
PostbackParamsDatetime :: Text -> PostbackParams
PostbackParamsUnknown :: PostbackParams

-- | Represent beacon data.
data BeaconData
BeaconEnter :: ID -> (Maybe Text) -> BeaconData
BeaconLeave :: ID -> (Maybe Text) -> BeaconData
BeaconBanner :: ID -> (Maybe Text) -> BeaconData

-- | Get hardware ID of the beacon.
getHWID :: BeaconData -> ID

-- | Get device message from the beacon, if exists.
getDeviceMessage :: BeaconData -> Maybe Text
instance GHC.Show.Show Line.Messaging.Webhook.Types.Body
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.Body
instance GHC.Show.Show Line.Messaging.Webhook.Types.Event
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.Event
instance GHC.Show.Show Line.Messaging.Webhook.Types.BeaconData
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.BeaconData
instance GHC.Show.Show Line.Messaging.Webhook.Types.Postback
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.Postback
instance GHC.Show.Show Line.Messaging.Webhook.Types.PostbackParams
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.PostbackParams
instance GHC.Show.Show Line.Messaging.Webhook.Types.EventMessage
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.EventMessage
instance GHC.Show.Show Line.Messaging.Webhook.Types.EventSource
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.EventSource
instance GHC.Show.Show Line.Messaging.Webhook.Types.WebhookFailure
instance GHC.Classes.Eq Line.Messaging.Webhook.Types.WebhookFailure
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.Webhook.Types.Body
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.Webhook.Types.Event
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.Webhook.Types.BeaconData
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.Webhook.Types.Postback
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.Webhook.Types.PostbackParams
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.Webhook.Types.EventMessage
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.Webhook.Types.EventSource


-- | This module just re-exports other <tt>Types</tt> modules.
module Line.Messaging.Types


-- | This module provides functions corresponding to the LINE Messaging
--   APIs, nearly one on one.
--   
--   For more details about the APIs themselves, please refer to the <a>API
--   references</a>.
module Line.Messaging.API

-- | A monad transformer for API calls. If translated into a human-readable
--   form, it means:
--   
--   <ol>
--   <li>An API call needs a channel access token to specify through which
--   channel it should send the call (<tt><a>ReaderT</a>
--   <a>ChannelAccessToken</a></tt>).</li>
--   <li>An API call effectfully returns a result if successful,
--   <tt><a>APIError</a></tt> otherwise (<tt><a>ExceptT</a>
--   <a>APIError</a></tt>).</li>
--   </ol>
type APIIO a = ReaderT ChannelAccessToken (ExceptT APIError IO) a

-- | <a>runAPI</a> resolves the <a>APIIO</a> monad transformer, and turns
--   it into a plain <tt><a>IO</a></tt> with
--   <tt><a>ChannelAccessToken</a></tt> provided.
--   
--   The reason the type of the first parameter is not
--   <tt><a>ChannelAccessToken</a></tt>, but <tt><a>IO</a>
--   <a>ChannelAccessToken</a></tt>, is that it is usually loaded via
--   effectful actions such as parsing command line arguments or reading a
--   config file.
--   
--   An example usage is like below:
--   
--   <pre>
--   api :: APIIO a -&gt; IO (Either APIError a)
--   api = runAPI getChannelAccessTokenFromConfig
--   
--   main :: IO ()
--   main = do
--     result &lt;- api $ push "some_receiver_id" [ Message $ Text "Hello, world!" ]
--     case result of
--       Right _ -&gt; return ()
--       Left err -&gt; print err
--   </pre>
runAPI :: IO ChannelAccessToken -> APIIO a -> IO (Either APIError a)

-- | Push messages into a receiver. The receiver can be a user, a room or a
--   group, specified by <a>ID</a>.
--   
--   A <a>Message</a> represents a message object. For types of the message
--   object, please refer to the <a>Send message object</a> section of the
--   LINE documentation.
--   
--   An example usage of <a>Message</a> is like below:
--   
--   <pre>
--   messages :: [Message]
--   messages = [ Message $ <a>Image</a> imageURL previewURL
--              , Message $ <a>Text</a> "hello, world!"
--              , Message $ <a>Template</a> "an example template"
--                  Confirm "a confirm template"
--                    [ TplMessageAction "ok label" "print this"
--                    , TplURIAction "link label" linkURL
--                    ]
--              ]
--   </pre>
--   
--   For more information about the API, please refer to <a>the API
--   reference</a>.
push :: ID -> [Message] -> APIIO ()

-- | Send messages to multiple users at any time.
--   
--   Messages cannot be sent to groups or rooms.
--   
--   For more information, please refer to <a>its API reference</a>.
multicast :: [ID] -> [Message] -> APIIO ()

-- | Send messages as a reply to specific webhook event.
--   
--   It works similarly to how <a>push</a> does for messages, except that
--   it can only reply through a specific reply token. The token can be
--   obtained from <a>replyable events</a> on a webhook server.
--   
--   For more information, please refer to <a>its API reference</a>.
reply :: ReplyToken -> [Message] -> APIIO ()

-- | Get content body of images, videos and audios sent with <a>event
--   messages</a>, specified by <a>ID</a>.
--   
--   In the event messages, the content body is not included. Users should
--   use <a>getContent</a> to downloaded the content only when it is really
--   needed.
--   
--   For more information, please refer to <a>its API reference</a>.
getContent :: ID -> APIIO ByteString

-- | Get a profile of a user, specified by <a>ID</a>.
--   
--   The user identifier can be obtained via <a>EventSource</a>.
--   
--   For more information, please refer to <a>its API reference</a>.
getProfile :: ID -> APIIO Profile

-- | Get a profile of a user in a group, specified by the group ID and the
--   user ID.
--   
--   Please refer to <a>its API reference</a> for the difference between
--   this API and <a>getProfile</a>.
getGroupMemberProfile :: ID -> ID -> APIIO Profile

-- | Get a profile of a user in a room, specified by the room ID and the
--   user ID.
--   
--   Please refer to <a>its API reference</a> for the difference between
--   this API and <a>getProfile</a>.
getRoomMemberProfile :: ID -> ID -> APIIO Profile

-- | Gets the user profile of a member of a group that the bot is in.
--   
--   FYI: This feature is only available for LINE@ Approved accounts or
--   official accounts.
--   
--   For more information, please refer to <a>its API reference</a>.
getGroupMemberIDs :: ID -> APIIO [ID]

-- | Gets the user profile of a member of a room that the bot is in.
--   
--   FYI: This feature is only available for LINE@ Approved accounts or
--   official accounts.
--   
--   For more information, please refer to <a>its API reference</a>.
getRoomMemberIDs :: ID -> APIIO [ID]

-- | Leave a room, specified by <tt><a>ID</a></tt>.
--   
--   For more information, please refer to <a>its API reference</a>.
leaveRoom :: ID -> APIIO ()

-- | Leave a group, specified by <tt><a>ID</a></tt>.
--   
--   For more information, please refer to <a>its API reference</a>.
leaveGroup :: ID -> APIIO ()
instance Data.Aeson.Types.FromJSON.FromJSON Line.Messaging.API.MemberIDs


-- | This module provides a function to check if a webhook request has a
--   correct signature.
module Line.Messaging.Webhook.Validation

-- | Provided a channel secret, request body and auth signature, it
--   determines the request is properly signatured, which probably means it
--   is sent from a valid LINE server.
--   
--   For more details of webhook authentication, please refer to <a>the
--   LINE documentation</a>.
validateSignature :: ChannelSecret -> ByteString -> Signature -> Bool


-- | This module provides webhook handlers both general and WAI-specific.
module Line.Messaging.Webhook

-- | A basic webhook function. It validates a request with a channel
--   secret, signature and body, and parses the body into a list of webhook
--   events.
--   
--   To handle failures, the result is in the form of <tt><a>ExceptT</a>
--   <a>WebhookFailure</a></tt>.
webhook :: (Monad m) => ChannelSecret -> ByteString -> Signature -> ExceptT WebhookFailure m [Event]

-- | A webhook handler for WAI. It uses <a>webhook</a> internally and
--   returns a WAI <a>Application</a>.
--   
--   An example webhook server using WAI will be like below:
--   
--   <pre>
--   app :: Application
--   app req f = case pathInfo req of
--     "webhook" : _ -&gt; do
--       secret &lt;- getChannelSecret
--       webhookApp secret handler defaultOnFailure req f
--     _ -&gt; undefined
--   
--   handler :: [Event] -&gt; IO ()
--   handler events = forM_ events handleEvent
--   
--   handleEvent :: Event -&gt; IO ()
--   handleEvent (MessageEvent event) = undefined -- handle a message event
--   handleEvent _ = return ()
--   </pre>
webhookApp :: ChannelSecret -> ([Event] -> IO ()) -> (WebhookFailure -> Application) -> Application

-- | A basic error handler to be used with <a>webhookApp</a>. It returns
--   400 Bad Request with the <a>WebhookFailure</a> code for its body.
defaultOnFailure :: WebhookFailure -> Application

-- | A webhook handler for Scotty. It uses <a>webhook</a> internally and
--   returns a Scotty action of type <tt>ActionM</tt> <tt>()</tt>
--   
--   An example webhook server using WAI will be like below:
--   
--   <pre>
--   main :: IO ()
--   main = scotty 3000 $ do
--     post "/webhook" $ webhookAction handler defaultOnFailure'
--   
--   handler :: [Event] -&gt; IO ()
--   handler events = forM_ events handleEvent
--   
--   handleEvent :: Event -&gt; IO ()
--   handleEvent (MessageEvent event) = undefined -- handle a message event
--   handleEvent _ = return ()
--   </pre>
webhookAction :: ChannelSecret -> ([Event] -> IO ()) -> (WebhookFailure -> ActionM ()) -> ActionM ()

-- | A basic error handler to be used with <a>webhookAction</a>. It returns
--   400 Bad Request with the <a>WebhookFailure</a> code for its body. It
--   has the same purpose as <a>defaultOnFailure</a>, except that it is for
--   Scotty.
defaultOnFailure' :: WebhookFailure -> ActionM ()
