packages feed

line 4.0.0 → 4.0.1

raw patch · 7 files changed

+51/−47 lines, 7 files

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## 4.0.1 (27 Sep 2017)++* Update documentation links+ ## 4.0.0 (19 Sep 2017)  * Use the latest Stack resolver 9.5
README.md view
@@ -1,13 +1,13 @@-# line [!['travis-ci/noraesae/line](https://travis-ci.org/noraesae/line.svg?branch=master)](https://travis-ci.org/noraesae/line)+# line [!['travis-ci/utatti/line](https://travis-ci.org/utatti/line.svg?branch=master)](https://travis-ci.org/utatti/line)  Haskell SDK for the [LINE](https://line.me) API  ## Features -* Internal [auth signature validator](https://devdocs.line.me/en/#webhook-authentication)+* Internal [auth signature validator](https://developers.line.me/en/docs/messaging-api/reference/#signature-validation) * Webhook handled with handler function, [WAI](https://hackage.haskell.org/package/wai) application,   or [Scotty](https://hackage.haskell.org/package/scotty) action-* Functions and types for [LINE Messaging API](https://devdocs.line.me/en/#messaging-api)+* Functions and types for [LINE Messaging API](https://developers.line.me/en/docs/messaging-api/reference/)  ## Documentation 
line.cabal view
@@ -1,7 +1,7 @@ name:                line-version:             4.0.0+version:             4.0.1 synopsis:            Haskell SDK for the LINE API-homepage:            https://github.com/noraesae/line+homepage:            https://github.com/utatti/line license:             BSD3 license-file:        LICENSE author:              Jun@@ -23,10 +23,10 @@   .   * Webhook handled with handler function, WAI application, or Scotty action   .-  * Functions and types for <https://devdocs.line.me/en/#messaging-api LINE Messaging API>+  * Functions and types for <https://developers.line.me/en/docs/messaging-api/reference/>   .   For example usages, please see the-  <https://github.com/noraesae/line/tree/master/examples examples> directory.+  <https://github.com/utatti/line/tree/master/examples examples> directory.  library   hs-source-dirs:      src@@ -85,4 +85,4 @@  source-repository head   type:     git-  location: https://github.com/noraesae/line+  location: https://github.com/utatti/line
src/Line/Messaging/API.hs view
@@ -3,7 +3,7 @@ one on one.  For more details about the APIs themselves, please refer to the-<https://devdocs.line.me/en/#messaging-api API references>.+<https://developers.line.me/en/docs/messaging-api/reference/ API references>. -}  module Line.Messaging.API (@@ -111,7 +111,7 @@ -- a group, specified by 'ID'. -- -- A 'Message' represents a message object. For types of the message object,--- please refer to the <https://devdocs.line.me/en/#send-message-object Send message object>+-- please refer to the <https://developers.line.me/en/docs/messaging-api/reference/#message-objects Send message object> -- section of the LINE documentation. -- -- An example usage of 'Message' is like below:@@ -129,7 +129,7 @@ -- @ -- -- For more information about the API, please refer to--- <https://devdocs.line.me/en/#push-message the API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#send-push-message the API reference>. push :: ID -> [Message] -> APIIO () push id' ms = do   let url = "https://api.line.me/v2/bot/message/push"@@ -143,7 +143,7 @@ -- Messages cannot be sent to groups or rooms. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#multicast its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#send-multicast-messages its API reference>. multicast :: [ID] -> [Message] -> APIIO () multicast ids ms = do   let url = "https://api.line.me/v2/bot/message/multicast"@@ -159,7 +159,7 @@ -- <./Line-Messaging-Webhook-Types.html#t:ReplyableEvent replyable events> on a webhook server. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#reply-message its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#send-reply-message its API reference>. reply :: ReplyToken -> [Message] -> APIIO () reply replyToken ms = do   let url = "https://api.line.me/v2/bot/message/reply"@@ -176,7 +176,7 @@ -- 'getContent' to downloaded the content only when it is really needed. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#get-content its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#get-content its API reference>. getContent :: ID -> APIIO BL.ByteString getContent id' = do   let url = concat [ "https://api.line.me/v2/bot/message/"@@ -190,7 +190,7 @@ -- The user identifier can be obtained via <./Line-Messaging-Webhook-Types.html#t:EventSource EventSource>. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#bot-api-get-profile its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#get-profile its API reference>. getProfile :: ID -> APIIO Profile getProfile id' = do   let url = "https://api.line.me/v2/bot/profile/" ++ T.unpack id'@@ -201,7 +201,7 @@  -- | Get a profile of a user in a group, specified by the group ID and the user ID. ----- Please refer to <https://devdocs.line.me/en/#get-group-room-member-profile its API reference>+-- Please refer to <https://developers.line.me/en/docs/messaging-api/reference/#get-group-member-profile its API reference> -- for the difference between this API and 'getProfile'. getGroupMemberProfile :: ID -> ID -> APIIO Profile getGroupMemberProfile groupId userId = do@@ -213,7 +213,7 @@  -- | Get a profile of a user in a room, specified by the room ID and the user ID. ----- Please refer to <https://devdocs.line.me/en/#get-group-room-member-profile its API reference>+-- Please refer to <https://developers.line.me/en/docs/messaging-api/reference/#get-room-member-profile its API reference> -- for the difference between this API and 'getProfile'. getRoomMemberProfile :: ID -> ID -> APIIO Profile getRoomMemberProfile roomId userId = do@@ -244,7 +244,7 @@ -- FYI: This feature is only available for LINE@ Approved accounts or official accounts. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#get-group-room-member-ids its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#get-group-member-user-ids its API reference>. getGroupMemberIDs :: ID -> APIIO [ID] getGroupMemberIDs = getMemberIDs "https://api.line.me/v2/bot/group/" Nothing @@ -253,7 +253,7 @@ -- FYI: This feature is only available for LINE@ Approved accounts or official accounts. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#get-group-room-member-ids its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#get-room-member-user-ids its API reference>. getRoomMemberIDs :: ID -> APIIO [ID] getRoomMemberIDs = getMemberIDs "https://api.line.me/v2/bot/room/" Nothing @@ -271,13 +271,13 @@ -- | Leave a room, specified by @'ID'@. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#leave its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#leave-room its API reference>. leaveRoom :: ID -> APIIO () leaveRoom = leave "room"  -- | Leave a group, specified by @'ID'@. -- -- For more information, please refer to--- <https://devdocs.line.me/en/#leave its API reference>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#leave-group its API reference>. leaveGroup :: ID -> APIIO () leaveGroup = leave "group"
src/Line/Messaging/API/Types.hs view
@@ -65,7 +65,7 @@ -- -- About existing messageable types, please refer to the following instances. -- Each instance is matched with a message object described in--- <https://devdocs.line.me/en/#send-message-object the LINE documentation>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#message-objects the LINE documentation>. class Messageable a where   toType :: a -> T.Text   toObject :: a -> [Pair]@@ -97,7 +97,7 @@ -- | 'Messageable' for text data. -- -- It contains 'T.Text' of "Data.Text". Its corresponding JSON spec is described--- <https://devdocs.line.me/en/#text here>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#text here>. -- -- This type is also used to decode text event message from webhook request. -- About the webhook usage, please refer to@@ -118,7 +118,7 @@ -- | 'Messageable' for image data. -- -- It contains URLs of an original image and its preview. Its corresponding JSON--- spec is described <https://devdocs.line.me/en/#image here>.+-- spec is described <https://developers.line.me/en/docs/messaging-api/reference/#image here>. data Image = Image { getURL :: URL                    , getPreviewURL :: URL                    }@@ -133,7 +133,7 @@ -- | 'Messageable' for video data. -- -- It contains URLs of an original video and its preview. Its corresponding JSON--- spec is described <https://devdocs.line.me/en/#video here>.+-- spec is described <https://developers.line.me/en/docs/messaging-api/reference/#video here>. data Video = Video { getURL :: URL                    , getPreviewURL :: URL                    }@@ -149,7 +149,7 @@ -- -- It contains a URL of an audio, and its duration in milliseconds. Its -- corresponding JSON spec is described--- <https://devdocs.line.me/en/#audio here>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#audio here>. data Audio = Audio { getURL :: URL                    , getDuration :: Integer                    }@@ -165,7 +165,7 @@ -- -- It contains a title, address, and geographic coordination of a location. -- Its corresponding JSON spec is described--- <https://devdocs.line.me/en/#location here>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#location here>. -- -- This type is also used to decode location event message from webhook request. -- About the webhook usage, please refer to@@ -196,7 +196,7 @@ -- | 'Messageable' for sticker data. -- -- It contains its package and sticker ID.  Its corresponding JSON spec is--- described <https://devdocs.line.me/en/#sticker here>.+-- described <https://developers.line.me/en/docs/messaging-api/reference/#sticker here>. -- -- This type is also used to decode sticker event message from webhook request. -- About the webhook usage, please refer to@@ -222,9 +222,9 @@ -- -- About how to send an image map message and what each field means, please -- refer to--- <https://devdocs.line.me/en/#imagemap-message image map message spec>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#imagemap-message image map message spec>. data ImageMap = ImageMap { getBaseImageURL :: URL-                           -- ^ <https://devdocs.line.me/en/#base-url Base URL> of images+                           -- ^ <https://developers.line.me/en/docs/messaging-api/reference/#base-url Base URL> of images                          , getAltText :: T.Text                            -- ^ Alt text for devices not supporting image map                          , getBaseImageSize :: (Integer, Integer)@@ -281,7 +281,7 @@ -- -- About how to send template message and what each field means, please -- refer to--- <https://devdocs.line.me/en/#template-messages template message spec>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#template-messages template message spec>. data Template t = Template { getAltText :: T.Text                              -- ^ Alt text for devices not supporting template message                            , getTemplateContent :: t@@ -315,10 +315,10 @@  -- | The buttons content type for template message. ----- <<https://devdocs.line.me/images/buttons.png Buttons template>>+-- <<https://developers.line.me/media/messaging-api/messages/buttons.png Buttons template>> -- -- For more details of each field, please refer to the--- <https://devdocs.line.me/en/#buttons Buttons> section in the LINE+-- <https://developers.line.me/en/docs/messaging-api/reference/#buttons Buttons> section in the LINE -- documentation. data Buttons = Buttons { getThumbnailURL :: Maybe URL                        -- ^ URL for thumbnail image@@ -345,10 +345,10 @@  -- | The confirm content type for template message. ----- <<https://devdocs.line.me/images/confirm.png Confirm template>>+-- <<https://developers.line.me/media/messaging-api/messages/confirm.png Confirm template>> -- -- For more details of each field, please refer to the--- <https://devdocs.line.me/en/#confirm Confirm> section in the LINE+-- <https://developers.line.me/en/docs/messaging-api/reference/#confirm Confirm> section in the LINE -- documentation. data Confirm = Confirm { getText :: T.Text                        -- ^ Confirm text@@ -366,10 +366,10 @@  -- | The carousel content type for template message. ----- <<https://devdocs.line.me/images/carousel.png Carousel template>>+-- <<https://developers.line.me/media/messaging-api/messages/carousel.png Carousel template>> -- -- For more details of each field, please refer to the--- <https://devdocs.line.me/en/#carousel Carousel> section in the LINE+-- <https://developers.line.me/en/docs/messaging-api/reference/#carousel Carousel> section in the LINE -- documentation. data Carousel = Carousel { getColumns :: [Column]                          -- ^ A list of columns for a carousel template@@ -409,10 +409,10 @@  -- | The image carousel content type for template message. ----- <<https://devdocs.line.me/images/image_carousel.png Image carousel template>>+-- <<https://developers.line.me/media/messaging-api/messages/image-carousel.png Image carousel template>> -- -- For more details of each field, please refer to the--- <https://devdocs.line.me/en/#image-carousel Image carousel> section in the LINE+-- <https://developers.line.me/en/docs/messaging-api/reference/#image-carousel Image carousel> section in the LINE -- documentation. data ImageCarousel = ImageCarousel { getColumns :: [ImageColumn]                                    -- ^ A list of columns for an image carousel template@@ -470,7 +470,7 @@                       -- 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 <https://devdocs.line.me/en/#datetime-picker-action official documentation>.+                      -- to the <https://developers.line.me/en/docs/messaging-api/reference/#datetime-picker-action official documentation>.                     deriving (Eq, Show)  instance ToJSON TemplateAction where@@ -533,8 +533,8 @@ -- which may rarely occur if used properly, does not. -- -- For more details of error types, please refer to--- <https://devdocs.line.me/en/#status-codes Status codes> and--- <https://devdocs.line.me/en/#error-response Error response> sections in the+-- <https://developers.line.me/en/docs/messaging-api/reference/#status-codes Status codes> and+-- <https://developers.line.me/en/docs/messaging-api/reference/#error-responses Error response> sections in the -- LINE documentation. data APIError = BadRequest (Maybe APIErrorBody)               -- ^ 400 Bad Request with a parsed error body, caused by badly@@ -547,7 +547,7 @@               -- unauthorized account or plan.               | TooManyRequests (Maybe APIErrorBody)               -- ^ 429 Too Many Requests with a parsed error body, caused by-              -- exceeding the <https://devdocs.line.me/en/#rate-limits rate limit>.+              -- exceeding the <https://developers.line.me/en/docs/messaging-api/reference/#rate-limits rate limit>.               | InternalServerError (Maybe APIErrorBody)               -- ^ 500 Internal Server Error with a parsed error body.               | UndefinedStatusCode Int BL.ByteString
src/Line/Messaging/Webhook/Types.hs view
@@ -21,7 +21,7 @@   -- (e.g. 'FromJSON') are implemented here.   --   -- For the event spec, please refer to-  -- <https://devdocs.line.me/en/#webhook-event-object the LINE documentation>.+  -- <https://developers.line.me/en/docs/messaging-api/reference/#webhook-event-objects the LINE documentation>.   Event (..),   EventTuple,   ReplyToken,@@ -214,7 +214,7 @@ -- @<./Line-Messaging-API.html#v:getContent getContent>@ API. -- -- For more details of event messages, please refer to the--- <https://devdocs.line.me/en/#message-event Message event> section of the LINE+-- <https://developers.line.me/en/docs/messaging-api/reference/#message-event Message event> section of the LINE -- documentation. data EventMessage = TextEM ID Text -- ^ Text event message.                   | ImageEM ID -- ^ Image event message.@@ -252,7 +252,7 @@ -- | Represent params of Postback data. -- -- It's currently used only for the datetime picker action. For the detail,--- please refer to the <https://devdocs.line.me/en/#postback-params-object official documentation>.+-- please refer to the <https://developers.line.me/en/docs/messaging-api/reference/#postback-params-object official documentation>. data PostbackParams = PostbackParamsDate T.Text                     | PostbackParamsTime T.Text                     | PostbackParamsDatetime T.Text
src/Line/Messaging/Webhook/Validation.hs view
@@ -21,7 +21,7 @@ -- valid LINE server. -- -- For more details of webhook authentication, please refer to--- <https://devdocs.line.me/en/#webhook-authentication the LINE documentation>.+-- <https://developers.line.me/en/docs/messaging-api/reference/#signature-validation the LINE documentation>. validateSignature :: ChannelSecret -> BL.ByteString -> Signature -> Bool validateSignature secret body signature = hash == signature   where hash = Base64.encode $ hmaclazy (encodeUtf8 secret) body