ig 0.7 → 0.8
raw patch · 3 files changed
+14/−18 lines, 3 files
Files
- ig.cabal +1/−1
- src/Instagram.hs +1/−1
- src/Instagram/Types.hs +12/−16
ig.cabal view
@@ -1,5 +1,5 @@ name: ig-version: 0.7+version: 0.8 synopsis: Bindings to Instagram's API. homepage: https://github.com/prowdsponsor/ig license: BSD3
src/Instagram.hs view
@@ -30,7 +30,7 @@ ,ImageData(..) ,Images(..) ,Comment(..)- ,Collection(..)+ ,Count(..) ,NoResult -- user
src/Instagram/Types.hs view
@@ -25,7 +25,7 @@ ,Images(..) ,CommentID ,Comment(..)- ,Collection(..)+ ,Count(..) ,Aspect(..) ,media ,CallbackUrl@@ -281,8 +281,8 @@ ,mFilter :: Maybe Text ,mTags :: [Text] ,mLocation :: Maybe Location- ,mComments :: Collection Comment- ,mLikes :: Collection User+ ,mComments :: Count+ ,mLikes :: Count ,mUserHasLiked :: Bool ,mAttribution :: Maybe Object -- ^ seems to be open format https://groups.google.com/forum/?fromgroups#!topic/instagram-api-developers/KvGH1cnjljQ }@@ -310,8 +310,8 @@ v .:? "filter" <*> v .: "tags" <*> v .:? "location" <*>- v .:? "comments" .!= Collection 0 [] <*>- v .:? "likes" .!= Collection 0 [] <*>+ v .:? "comments" .!= Count 0 <*>+ v .:? "likes" .!= Count 0 <*> v .:? "user_has_liked" .!= False <*> v .:? "attribution" parseJSON _= fail "Media"@@ -456,25 +456,21 @@ v .: "from" parseJSON _= fail "Caption" --- | a collection of items (count + data)--- data can only be a subset-data Collection a= Collection {+data Count = Count { cCount :: Integer- ,cData :: [a] } deriving (Show,Eq,Ord,Typeable) -- | to json as per Instagram format-instance (ToJSON a)=>ToJSON (Collection a) where- toJSON igc=object ["count" .= cCount igc,"data" .= cData igc]+instance ToJSON Count where+ toJSON igc=object ["count" .= cCount igc] -- | from json as per Instagram format-instance (FromJSON a)=>FromJSON (Collection a) where- parseJSON (Object v) = Collection <$>- v .: "count" <*>- v .: "data"- parseJSON _= fail "Collection"+instance FromJSON Count where+ parseJSON (Object v) = Count <$>+ v .: "count"+ parseJSON _= fail "Count" -- | the URL to receive notifications to