packages feed

twitter-types 0.3.20140601 → 0.3.20140620

raw patch · 5 files changed

+66/−17 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Web.Twitter.Types: Coordinates :: [Double] -> Text -> Coordinates
+ Web.Twitter.Types: coordinates :: Coordinates -> [Double]
+ Web.Twitter.Types: coordinatesType :: Coordinates -> Text
+ Web.Twitter.Types: data Coordinates
+ Web.Twitter.Types: instance Eq Coordinates
+ Web.Twitter.Types: instance FromJSON Coordinates
+ Web.Twitter.Types: instance Show Coordinates
+ Web.Twitter.Types: statusCoordinates :: Status -> Maybe Coordinates
+ Web.Twitter.Types: statusExtendedEntities :: Status -> Maybe Entities
+ Web.Twitter.Types: statusLang :: Status -> Maybe Text
+ Web.Twitter.Types: statusPossiblySensitive :: Status -> Maybe Bool
+ Web.Twitter.Types.Lens: coordinates :: SimpleLens (Coordinates) ([Double])
+ Web.Twitter.Types.Lens: coordinatesType :: SimpleLens (Coordinates) (Text)
+ Web.Twitter.Types.Lens: data Coordinates
+ Web.Twitter.Types.Lens: statusExtendedEntities :: SimpleLens (Status) (Maybe Entities)
+ Web.Twitter.Types.Lens: statusLang :: SimpleLens (Status) (Maybe Text)
+ Web.Twitter.Types.Lens: statusPossiblySensitive :: SimpleLens (Status) (Maybe Bool)
- Web.Twitter.Types: Status :: DateString -> StatusId -> Text -> Text -> Bool -> Maybe Entities -> Maybe StatusId -> Maybe UserId -> Maybe Bool -> Maybe Integer -> User -> Maybe Status -> Maybe Place -> Integer -> Status
+ Web.Twitter.Types: Status :: DateString -> StatusId -> Text -> Text -> Bool -> Maybe Entities -> Maybe Entities -> Maybe StatusId -> Maybe UserId -> Maybe Bool -> Maybe Integer -> User -> Maybe Status -> Maybe Place -> Integer -> Maybe Text -> Maybe Bool -> Maybe Coordinates -> Status

Files

Web/Twitter/Types.hs view
@@ -28,6 +28,7 @@        , URLEntity(..)        , MediaEntity(..)        , MediaSize(..)+       , Coordinates(..)        , Place(..)        , BoundingBox(..)        , checkError@@ -80,20 +81,24 @@  data Status =   Status-  { statusCreatedAt     :: DateString-  , statusId            :: StatusId-  , statusText          :: Text-  , statusSource        :: Text-  , statusTruncated     :: Bool-  , statusEntities      :: Maybe Entities-  , statusInReplyTo     :: Maybe StatusId-  , statusInReplyToUser :: Maybe UserId-  , statusFavorite      :: Maybe Bool-  , statusRetweetCount  :: Maybe Integer-  , statusUser          :: User-  , statusRetweet       :: Maybe Status-  , statusPlace         :: Maybe Place-  , statusFavoriteCount :: Integer+  { statusCreatedAt          :: DateString+  , statusId                 :: StatusId+  , statusText               :: Text+  , statusSource             :: Text+  , statusTruncated          :: Bool+  , statusEntities           :: Maybe Entities+  , statusExtendedEntities   :: Maybe Entities+  , statusInReplyTo          :: Maybe StatusId+  , statusInReplyToUser      :: Maybe UserId+  , statusFavorite           :: Maybe Bool+  , statusRetweetCount       :: Maybe Integer+  , statusUser               :: User+  , statusRetweet            :: Maybe Status+  , statusPlace              :: Maybe Place+  , statusFavoriteCount      :: Integer+  , statusLang               :: Maybe Text+  , statusPossiblySensitive  :: Maybe Bool+  , statusCoordinates        :: Maybe Coordinates   } deriving (Show, Eq)  instance FromJSON Status where@@ -104,6 +109,7 @@            <*> o .:  "source"            <*> o .:  "truncated"            <*> o .:? "entities"+           <*> o .:? "extended_entities"            <*> o .:? "in_reply_to_status_id"            <*> o .:? "in_reply_to_user_id"            <*> o .:? "favorited"@@ -111,7 +117,10 @@            <*> o .:  "user"            <*> o .:? "retweeted_status"            <*> o .:? "place"-           <*> ( ( o .:? "favorite_count" ) >>= return . maybe 0 id )+           <*> o .:? "favorite_count" .!= 0+           <*> o .:? "lang"+           <*> o .:? "possibly_sensitive"+           <*> o .:? "coordinates"   parseJSON _ = mzero  data SearchResult body =@@ -394,6 +403,18 @@     MediaSize <$> o .: "w"               <*> o .: "h"               <*> o .: "resize"+  parseJSON _ = mzero++data Coordinates =+  Coordinates+  { coordinates :: [Double]+  , coordinatesType :: Text+  } deriving (Show, Eq)++instance FromJSON Coordinates where+  parseJSON (Object o) =+    Coordinates <$> o .: "coordinates"+                <*> o .: "type"   parseJSON _ = mzero  data Place =
Web/Twitter/Types/Lens.hs view
@@ -28,6 +28,7 @@        , URLEntity        , MediaEntity        , MediaSize+       , Coordinates        , Place        , BoundingBox @@ -37,6 +38,7 @@        , statusSource        , statusTruncated        , statusEntities+       , statusExtendedEntities        , statusInReplyTo        , statusInReplyToUser        , statusFavorite@@ -45,6 +47,8 @@        , statusUser        , statusPlace        , statusFavoriteCount+       , statusLang+       , statusPossiblySensitive         , searchResultStatuses        , searchResultSearchMetadata@@ -136,6 +140,9 @@        , msHeight        , msResize +       , coordinates+       , coordinatesType+        , placeAttributes        , placeBoundingBox        , placeCountry@@ -192,6 +199,7 @@        , URLEntity        , MediaEntity        , MediaSize+       , Coordinates        , Place        , BoundingBox        )@@ -217,6 +225,7 @@ SIMPLE_LENS(statusSource              , Status,  Text                         ) SIMPLE_LENS(statusTruncated           , Status,  Bool                         ) SIMPLE_LENS(statusEntities            , Status,  Maybe Entities               )+SIMPLE_LENS(statusExtendedEntities    , Status,  Maybe Entities               ) SIMPLE_LENS(statusInReplyTo           , Status,  Maybe StatusId               ) SIMPLE_LENS(statusInReplyToUser       , Status,  Maybe UserId                 ) SIMPLE_LENS(statusFavorite            , Status,  Maybe Bool                   )@@ -225,6 +234,8 @@ SIMPLE_LENS(statusUser                , Status,  User                         ) SIMPLE_LENS(statusPlace               , Status,  Maybe Place                  ) SIMPLE_LENS(statusFavoriteCount       , Status,  Integer                      )+SIMPLE_LENS(statusLang                , Status,  Maybe Text                   )+SIMPLE_LENS(statusPossiblySensitive   , Status,  Maybe Bool                   )  TYPECHANGE_LENS(searchResultStatuses  , SearchResult                          ) SIMPLE_LENS(searchResultSearchMetadata, SearchResult body,  SearchMetadata    )@@ -315,6 +326,9 @@ SIMPLE_LENS(msWidth                   , MediaSize,  Int                       ) SIMPLE_LENS(msHeight                  , MediaSize,  Int                       ) SIMPLE_LENS(msResize                  , MediaSize,  Text                      )++SIMPLE_LENS(coordinates               , Coordinates,  [Double]                )+SIMPLE_LENS(coordinatesType           , Coordinates,  Text                    )  SIMPLE_LENS(placeAttributes           , Place,  HashMap Text Text             ) SIMPLE_LENS(placeBoundingBox          , Place,  BoundingBox                   )
tests/Fixtures.hs view
@@ -4,7 +4,7 @@ module Fixtures where  import Data.Aeson-import Data.Attoparsec+import Data.Attoparsec.ByteString import qualified Data.Text as T import qualified Data.Text.Encoding as T import Data.Maybe (fromJust)@@ -24,3 +24,6 @@  mediaEntityJson :: Value mediaEntityJson = fj [st|{"created_at":"Wed Sep 14 20:58:04 +0000 2011","id":114080493036773378,"id_str":"114080493036773378","text":"Hello America! http:\/\/t.co\/rJC5Pxsu","source":"web","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":373487136,"id_str":"373487136","name":"Y U No @rno?","screen_name":"yunorno","location":"Paris, France","url":"http:\/\/twitter.com\/rno","description":"Oui oui!","protected":false,"followers_count":32,"friends_count":3,"listed_count":2,"created_at":"Wed Sep 14 17:24:54 +0000 2011","favourites_count":0,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":27,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1542800106\/oui_normal.png","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1542800106\/oui_normal.png","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":4,"entities":{"hashtags":[],"urls":[],"user_mentions":[],"media":[{"id":114080493040967680,"id_str":"114080493040967680","indices":[15,35],"media_url":"http:\/\/pbs.twimg.com\/media\/AZVLmp-CIAAbkyy.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/AZVLmp-CIAAbkyy.jpg","url":"http:\/\/t.co\/rJC5Pxsu","display_url":"pic.twitter.com\/rJC5Pxsu","expanded_url":"http:\/\/twitter.com\/yunorno\/status\/114080493036773378\/photo\/1","type":"photo","sizes":{"large":{"w":226,"h":238,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":226,"h":238,"resize":"fit"},"small":{"w":226,"h":238,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false}|]++mediaExtendedEntityJson :: Value+mediaExtendedEntityJson = fj [st|{"in_reply_to_status_id":null,"id_str":"479666034073296896","truncated":false,"possibly_sensitive":false,"in_reply_to_screen_name":null,"extended_entities":{"media":[{"id_str":"479665892922376192","expanded_url":"http://twitter.com/thimura_test/status/479666034073296896/photo/1","url":"http://t.co/qOjPwmgLKO","media_url_https":"https://pbs.twimg.com/media/BqgdlpaCQAA5OSu.jpg","indices":[36,58],"id":479665892922376192,"media_url":"http://pbs.twimg.com/media/BqgdlpaCQAA5OSu.jpg","type":"photo","sizes":{"small":{"w":340,"resize":"fit","h":604},"large":{"w":576,"resize":"fit","h":1024},"medium":{"w":576,"resize":"fit","h":1024},"thumb":{"w":150,"resize":"crop","h":150}},"display_url":"pic.twitter.com/qOjPwmgLKO"},{"id_str":"479665897150234624","expanded_url":"http://twitter.com/thimura_test/status/479666034073296896/photo/1","url":"http://t.co/qOjPwmgLKO","media_url_https":"https://pbs.twimg.com/media/Bqgdl5KCQAA9g9V.jpg","indices":[36,58],"id":479665897150234624,"media_url":"http://pbs.twimg.com/media/Bqgdl5KCQAA9g9V.jpg","type":"photo","sizes":{"small":{"w":339,"resize":"fit","h":191},"large":{"w":1024,"resize":"fit","h":576},"medium":{"w":599,"resize":"fit","h":337},"thumb":{"w":150,"resize":"crop","h":150}},"display_url":"pic.twitter.com/qOjPwmgLKO"},{"id_str":"479665901545852929","expanded_url":"http://twitter.com/thimura_test/status/479666034073296896/photo/1","url":"http://t.co/qOjPwmgLKO","media_url_https":"https://pbs.twimg.com/media/BqgdmJiCEAEp0EI.jpg","indices":[36,58],"id":479665901545852929,"media_url":"http://pbs.twimg.com/media/BqgdmJiCEAEp0EI.jpg","type":"photo","sizes":{"small":{"w":339,"resize":"fit","h":225},"large":{"w":1024,"resize":"fit","h":678},"medium":{"w":599,"resize":"fit","h":397},"thumb":{"w":150,"resize":"crop","h":150}},"display_url":"pic.twitter.com/qOjPwmgLKO"},{"id_str":"479665905375256576","expanded_url":"http://twitter.com/thimura_test/status/479666034073296896/photo/1","url":"http://t.co/qOjPwmgLKO","media_url_https":"https://pbs.twimg.com/media/BqgdmXzCIAAa2lU.jpg","indices":[36,58],"id":479665905375256576,"media_url":"http://pbs.twimg.com/media/BqgdmXzCIAAa2lU.jpg","type":"photo","sizes":{"small":{"w":339,"resize":"fit","h":225},"large":{"w":1024,"resize":"fit","h":678},"medium":{"w":599,"resize":"fit","h":397},"thumb":{"w":150,"resize":"crop","h":150}},"display_url":"pic.twitter.com/qOjPwmgLKO"}]},"entities":{"symbols":[],"urls":[],"media":[{"id_str":"479665892922376192","expanded_url":"http://twitter.com/thimura_test/status/479666034073296896/photo/1","url":"http://t.co/qOjPwmgLKO","media_url_https":"https://pbs.twimg.com/media/BqgdlpaCQAA5OSu.jpg","indices":[36,58],"id":479665892922376192,"media_url":"http://pbs.twimg.com/media/BqgdlpaCQAA5OSu.jpg","type":"photo","sizes":{"small":{"w":340,"resize":"fit","h":604},"large":{"w":576,"resize":"fit","h":1024},"medium":{"w":576,"resize":"fit","h":1024},"thumb":{"w":150,"resize":"crop","h":150}},"display_url":"pic.twitter.com/qOjPwmgLKO"}],"user_mentions":[],"hashtags":[{"text":"testnyan","indices":[26,35]}]},"text":"multiple image tweet test #testnyan http://t.co/qOjPwmgLKO","in_reply_to_user_id_str":null,"favorited":false,"coordinates":null,"retweeted":false,"user":{"screen_name":"thimura_test","is_translation_enabled":false,"default_profile":true,"profile_image_url":"http://abs.twimg.com/sticky/default_profile_images/default_profile_6_normal.png","default_profile_image":true,"id_str":"2418883074","profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","protected":false,"location":"","entities":{"description":{"urls":[]}},"profile_background_color":"C0DEED","utc_offset":null,"url":null,"profile_text_color":"333333","profile_image_url_https":"https://abs.twimg.com/sticky/default_profile_images/default_profile_6_normal.png","verified":false,"statuses_count":5,"profile_background_tile":false,"following":false,"lang":"ja","follow_request_sent":false,"profile_sidebar_fill_color":"DDEEF6","time_zone":null,"name":"thimura test","profile_sidebar_border_color":"C0DEED","geo_enabled":false,"listed_count":0,"contributors_enabled":false,"created_at":"Sun Mar 30 11:47:17 +0000 2014","id":2418883074,"friends_count":2,"is_translator":false,"favourites_count":0,"notifications":false,"profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","profile_use_background_image":true,"description":"","profile_link_color":"0084B4","followers_count":2},"lang":"et","retweet_count":0,"in_reply_to_user_id":null,"created_at":"Thu Jun 19 16:44:28 +0000 2014","source":"\u003ca href=\"https://twitter.com/thimura\" rel=\"nofollow\"\u003e二階堂真紅\u003c/a\u003e","geo":null,"id":479666034073296896,"in_reply_to_status_id_str":null,"favorite_count":0,"contributors":null,"place":null}|]
tests/TypesTest.hs view
@@ -93,3 +93,14 @@      let HashTagEntity hashtag = entityBody . head . enHashTags $ entity     hashtag @?= "lol"++case_parseExtendedEntities :: Assertion+case_parseExtendedEntities = withJSON mediaExtendedEntityJson $ \obj -> do+    let entities = statusExtendedEntities obj+    assert $ isJust entities+    let Just ent = entities+        media = enMedia ent+    length media @?= 4+    let me = entityBody $ head media+    ueURL (meURL me) @?= "http://t.co/qOjPwmgLKO"+    meMediaURL me @?= "http://pbs.twimg.com/media/BqgdlpaCQAA5OSu.jpg"
twitter-types.cabal view
@@ -1,5 +1,5 @@ name:              twitter-types-version:           0.3.20140601+version:           0.3.20140620 license:           BSD3 license-file:      LICENSE author:            Takahiro HIMURA