pinboard 0.2 → 0.3
raw patch · 4 files changed
+19/−17 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Pinboard.ApiTypes: posts :: Posts -> [Post]
+ Pinboard.ApiTypes: instance Data DoneResult
+ Pinboard.ApiTypes: instance Data JsonTagMap
+ Pinboard.ApiTypes: instance Data Note
+ Pinboard.ApiTypes: instance Data NoteList
+ Pinboard.ApiTypes: instance Data NoteListItem
+ Pinboard.ApiTypes: instance Data Post
+ Pinboard.ApiTypes: instance Data PostDates
+ Pinboard.ApiTypes: instance Data Posts
+ Pinboard.ApiTypes: instance Data Suggested
+ Pinboard.ApiTypes: instance Data TextResult
+ Pinboard.ApiTypes: instance Data UpdateTime
+ Pinboard.ApiTypes: instance Ord DoneResult
+ Pinboard.ApiTypes: instance Ord Note
+ Pinboard.ApiTypes: instance Ord NoteList
+ Pinboard.ApiTypes: instance Ord NoteListItem
+ Pinboard.ApiTypes: instance Ord Post
+ Pinboard.ApiTypes: instance Ord PostDates
+ Pinboard.ApiTypes: instance Ord Posts
+ Pinboard.ApiTypes: instance Ord Suggested
+ Pinboard.ApiTypes: instance Ord TextResult
+ Pinboard.ApiTypes: instance Ord UpdateTime
+ Pinboard.ApiTypes: instance Typeable DoneResult
+ Pinboard.ApiTypes: instance Typeable JsonTagMap
+ Pinboard.ApiTypes: instance Typeable Note
+ Pinboard.ApiTypes: instance Typeable NoteList
+ Pinboard.ApiTypes: instance Typeable NoteListItem
+ Pinboard.ApiTypes: instance Typeable Post
+ Pinboard.ApiTypes: instance Typeable PostDates
+ Pinboard.ApiTypes: instance Typeable Posts
+ Pinboard.ApiTypes: instance Typeable Suggested
+ Pinboard.ApiTypes: instance Typeable TextResult
+ Pinboard.ApiTypes: instance Typeable UpdateTime
+ Pinboard.ApiTypes: postsPosts :: Posts -> [Post]
- Pinboard.Api: getPostsAll :: Maybe [Tag] -> Maybe StartOffset -> Maybe NumResults -> Maybe FromDateTime -> Maybe ToDateTime -> Maybe Meta -> Pinboard Posts
+ Pinboard.Api: getPostsAll :: Maybe [Tag] -> Maybe StartOffset -> Maybe NumResults -> Maybe FromDateTime -> Maybe ToDateTime -> Maybe Meta -> Pinboard [Post]
- Pinboard.ApiTypes: Post :: Text -> Text -> Text -> Text -> Text -> UTCTime -> Bool -> Bool -> [Text] -> Post
+ Pinboard.ApiTypes: Post :: Text -> Text -> Text -> Text -> Text -> UTCTime -> Bool -> Bool -> [Tag] -> Post
- Pinboard.ApiTypes: postTags :: Post -> [Text]
+ Pinboard.ApiTypes: postTags :: Post -> [Tag]
- Pinboard.ApiTypes: type TagMap = HashMap Text Int
+ Pinboard.ApiTypes: type TagMap = HashMap Tag Int
Files
- pinboard.cabal +1/−1
- src/Pinboard/Api.hs +1/−1
- src/Pinboard/ApiTypes.hs +16/−14
- src/Pinboard/Client/Internal.hs +1/−1
pinboard.cabal view
@@ -1,5 +1,5 @@ name: pinboard-version: 0.2+version: 0.3 synopsis: Access to the Pinboard API license: MIT license-file: LICENSE
src/Pinboard/Api.hs view
@@ -64,7 +64,7 @@ -> Maybe FromDateTime -- ^ return only bookmarks created after this time -> Maybe ToDateTime -- ^ return only bookmarks created before this time -> Maybe Meta -- ^ include a change detection signature for each bookmark- -> Pinboard Posts+ -> Pinboard [Post] getPostsAll tags start results fromdt todt meta = pinboardJson (PinboardRequest path params) where
src/Pinboard/ApiTypes.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} @@ -14,6 +15,7 @@ import Data.Aeson (FromJSON (parseJSON), Value (String, Object), ( .:)) import Data.Aeson.Types (Parser) import Data.HashMap.Strict (HashMap, member, toList)+import Data.Data (Data, Typeable) import Data.Text (Text, words, unpack) import Data.Time (UTCTime) import Data.Time.Calendar (Day)@@ -27,8 +29,8 @@ data Posts = Posts { postsDate :: UTCTime , postsUser :: Text- , posts :: [Post]- } deriving (Show, Eq)+ , postsPosts :: [Post]+ } deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON Posts where parseJSON (Object o) =@@ -46,8 +48,8 @@ , postTime :: UTCTime , postShared :: Bool , postToread :: Bool- , postTags :: [Text]- } deriving (Show, Eq)+ , postTags :: [Tag]+ } deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON Post where parseJSON (Object o) =@@ -70,7 +72,7 @@ postDatesUser :: Text , postDatesTag :: Text , postDatesCount :: [DateCount]- } deriving (Show, Eq)+ } deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON PostDates where parseJSON (Object o) =@@ -93,7 +95,7 @@ data NoteList = NoteList { noteListCount :: Int , noteListItems :: [NoteListItem]- } deriving (Show, Eq)+ } deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON NoteList where parseJSON (Object o) =@@ -108,7 +110,7 @@ , noteListItemLength :: Int , noteListItemCreatedAt :: UTCTime , noteListItemUpdatedAt :: UTCTime- } deriving (Show, Eq)+ } deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON NoteListItem where parseJSON (Object o) =@@ -130,7 +132,7 @@ , noteLength :: Int , noteCreatedAt :: UTCTime , noteUpdatedAt :: UTCTime- } deriving (Show, Eq)+ } deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON Note where parseJSON (Object o) =@@ -149,10 +151,10 @@ -- * Tags -type TagMap = HashMap Text Int+type TagMap = HashMap Tag Int newtype JsonTagMap = ToJsonTagMap {fromJsonTagMap :: TagMap}- deriving (Show, Eq)+ deriving (Show, Eq, Data, Typeable) instance FromJSON JsonTagMap where parseJSON = return . toTags@@ -162,7 +164,7 @@ data Suggested = Popular [Text] | Recommended [Text]- deriving (Show, Eq)+ deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON Suggested where parseJSON (Object o)@@ -175,7 +177,7 @@ -- * Scalars newtype DoneResult = ToDoneResult {fromDoneResult :: ()}- deriving (Show, Eq)+ deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON DoneResult where parseJSON (Object o) = parseDone =<< (o .: "result" <|> o .: "result_code")@@ -186,14 +188,14 @@ parseJSON _ = error "bad parse" newtype TextResult = ToTextResult {fromTextResult :: Text}- deriving (Show, Eq)+ deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON TextResult where parseJSON (Object o) = ToTextResult <$> (o .: "result") parseJSON _ = error "bad parse" newtype UpdateTime = ToUpdateTime {fromUpdateTime :: UTCTime}- deriving (Show, Eq)+ deriving (Show, Eq, Data, Typeable, Ord) instance FromJSON UpdateTime where parseJSON (Object o) = ToUpdateTime <$> (o .: "update_time")
src/Pinboard/Client/Internal.hs view
@@ -149,7 +149,7 @@ buildReq url = buildRequest $ do http GET ("/v1/" <> url) setHeader "Connection" "Keep-Alive" - setHeader "User-Agent" "pinboard.hs/0.2" + setHeader "User-Agent" "pinboard.hs/0.3" --------------------------------------------------------------------------------