pinboard 0.6.3 → 0.6.4
raw patch · 4 files changed
+31/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Pinboard.Api: addPostRec :: Post -> Replace -> Pinboard ()
+ Pinboard.ApiRequest: addPostRecRequest :: ResultFormatType -> Post -> Replace -> PinboardRequest
Files
- pinboard.cabal +1/−1
- src/Pinboard/Api.hs +11/−2
- src/Pinboard/ApiRequest.hs +18/−1
- src/Pinboard/Client.hs +1/−1
pinboard.cabal view
@@ -1,5 +1,5 @@ name: pinboard-version: 0.6.3+version: 0.6.4 synopsis: Access to the Pinboard API license: MIT license-file: LICENSE
src/Pinboard/Api.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE OverloadedStrings #-} -------------------------------------------@@ -22,6 +23,7 @@ getPostsMRUTime, getSuggestedTags, addPost,+ addPostRec, deletePost, -- ** Tags getTags,@@ -100,18 +102,25 @@ -> Pinboard () deletePost url = fromDoneResult <$> (pinboardJson $ deletePostRequest FormatJson url) --- | posts/add : Add a bookmark+-- | posts/add : Add or Update a bookmark addPost :: Url -- ^ the URL of the item -> Description -- ^ Title of the item. This field is unfortunately named 'description' for backwards compatibility with the delicious API -> Maybe Extended -- ^ Description of the item. Called 'extended' for backwards compatibility with delicious API -> Maybe [Tag] -- ^ List of up to 100 tags -> Maybe DateTime -- ^ creation time for this bookmark. Defaults to current time. Datestamps more than 10 minutes ahead of server time will be reset to current server time- -> Maybe Replace -- ^ Replace any existing bookmark with this URL. Default is yes. If set to no, will throw an error if bookmark exists+ -> Maybe Replace -- ^ Replace any existing bookmark with this URL. Default is yes. If set to no, will fail if bookmark exists -> Maybe Shared -- ^ Make bookmark public. Default is "yes" unless user has enabled the "save all bookmarks as private" user setting, in which case default is "no" -> Maybe ToRead -- ^ Marks the bookmark as unread. Default is "no" -> Pinboard () addPost url descr ext tags ctime repl shared toread = fromDoneResult <$> (pinboardJson $ addPostRequest FormatJson url descr ext tags ctime repl shared toread)++-- | posts/add : Add or Update a bookmark, from a Post record+addPostRec+ :: Post -- ^ a Post record+ -> Replace -- ^ Replace any existing bookmark with the Posts URL. If set to no, will fail if bookmark exists + -> Pinboard ()+addPostRec post replace = fromDoneResult <$> (pinboardJson $ addPostRecRequest FormatJson post replace) -- TAGS ----------------------------------------------------------------------
src/Pinboard/ApiRequest.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-} ------------------------------------------- -- |@@ -22,6 +23,7 @@ getPostsMRUTimeRequest, getSuggestedTagsRequest, addPostRequest,+ addPostRecRequest, deletePostRequest, -- ** Tags getTagsRequest,@@ -145,7 +147,7 @@ params = [Format fmt, Url url] --- | posts/add : Add a bookmark+-- | posts/add : Add or Update a bookmark addPostRequest :: ResultFormatType -> Url -- ^ the URL of the item@@ -170,6 +172,21 @@ , Replace <$> repl , Shared <$> shared , ToRead <$> toread ]++-- | posts/add : Add or Update a bookmark (from a Post record)+addPostRecRequest+ :: ResultFormatType+ -> Post -- ^ the Post record+ -> Replace -- ^ Replace any existing bookmark with the Posts URL. If set to no, will throw an error if bookmark exists + -> PinboardRequest+addPostRecRequest fmt Post{..} replace = addPostRequest fmt postHref + postDescription + ( Just postExtended ) + ( Just postTags ) + ( Just postTime ) + ( Just replace ) + ( Just postShared ) + ( Just postToread ) -- TAGS ----------------------------------------------------------------------
src/Pinboard/Client.hs view
@@ -160,7 +160,7 @@ buildReq url = buildRequest $ do http GET ("/v1/" <> url) setHeader "Connection" "Keep-Alive" - setHeader "User-Agent" "pinboard.hs/0.6.3" + setHeader "User-Agent" "pinboard.hs/0.6.4" --------------------------------------------------------------------------------