packages feed

Hastodon 0.5.0 → 0.6.0

raw patch · 6 files changed

+77/−72 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Web.Hastodon: AccountId :: String -> AccountId
+ Web.Hastodon: AttachmentId :: String -> AttachmentId
+ Web.Hastodon: MediaId :: String -> MediaId
+ Web.Hastodon: NotificationId :: String -> NotificationId
+ Web.Hastodon: OAuthClientId :: String -> OAuthClientId
+ Web.Hastodon: OAuthResponse :: String -> OAuthResponse
+ Web.Hastodon: RelationshipId :: String -> RelationshipId
+ Web.Hastodon: ReportId :: String -> ReportId
+ Web.Hastodon: StatusId :: String -> StatusId
+ Web.Hastodon: [accessToken] :: OAuthResponse -> String
+ Web.Hastodon: [unAccountId] :: AccountId -> String
+ Web.Hastodon: [unAttachmentId] :: AttachmentId -> String
+ Web.Hastodon: [unMediaId] :: MediaId -> String
+ Web.Hastodon: [unNotificationId] :: NotificationId -> String
+ Web.Hastodon: [unOAuthClientId] :: OAuthClientId -> String
+ Web.Hastodon: [unRelationshipId] :: RelationshipId -> String
+ Web.Hastodon: [unReportId] :: ReportId -> String
+ Web.Hastodon: [unStatusId] :: StatusId -> String
+ Web.Hastodon: class IsOption a
+ Web.Hastodon: data OAuthResponse
+ Web.Hastodon: fromOptionImpl :: IsOption a => OptionImpl -> a
+ Web.Hastodon: newtype AccountId
+ Web.Hastodon: newtype AttachmentId
+ Web.Hastodon: newtype MediaId
+ Web.Hastodon: newtype NotificationId
+ Web.Hastodon: newtype OAuthClientId
+ Web.Hastodon: newtype RelationshipId
+ Web.Hastodon: newtype ReportId
+ Web.Hastodon: newtype StatusId
+ Web.Hastodon: toOptionImpl :: IsOption a => a -> OptionImpl
+ Web.Hastodon: type OptionImpl = Map ByteString OptionVal
+ Web.Hastodon: type OptionVal = Either [ByteString] (Maybe ByteString)
- Web.Hastodon: Account :: HastodonId -> String -> String -> String -> Bool -> String -> Int -> Int -> Int -> String -> String -> String -> String -> String -> String -> Account
+ Web.Hastodon: Account :: AccountId -> String -> String -> String -> Bool -> String -> Int -> Int -> Int -> String -> String -> String -> String -> String -> String -> Account
- Web.Hastodon: Attachment :: HastodonId -> String -> String -> Maybe String -> String -> Maybe String -> Attachment
+ Web.Hastodon: Attachment :: AttachmentId -> String -> String -> Maybe String -> String -> Maybe String -> Attachment
- Web.Hastodon: Mention :: String -> String -> String -> HastodonId -> Mention
+ Web.Hastodon: Mention :: String -> String -> String -> AccountId -> Mention
- Web.Hastodon: Notification :: HastodonId -> String -> String -> Account -> Maybe Status -> Notification
+ Web.Hastodon: Notification :: NotificationId -> String -> String -> Account -> Maybe Status -> Notification
- Web.Hastodon: OAuthClient :: HastodonId -> String -> String -> String -> OAuthClient
+ Web.Hastodon: OAuthClient :: OAuthClientId -> String -> String -> String -> OAuthClient
- Web.Hastodon: Relationship :: HastodonId -> Bool -> Bool -> Bool -> Bool -> Bool -> Relationship
+ Web.Hastodon: Relationship :: RelationshipId -> Bool -> Bool -> Bool -> Bool -> Bool -> Relationship
- Web.Hastodon: Report :: HastodonId -> String -> Report
+ Web.Hastodon: Report :: ReportId -> String -> Report
- Web.Hastodon: SDelete :: HastodonId -> StreamingPayload
+ Web.Hastodon: SDelete :: StatusId -> StreamingPayload
- Web.Hastodon: Status :: HastodonId -> String -> String -> Account -> Maybe Int -> Maybe Int -> Maybe Status -> String -> String -> Int -> Int -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> String -> String -> [Attachment] -> [Mention] -> [Tag] -> Maybe Application -> [Emoji] -> Maybe String -> Status
+ Web.Hastodon: Status :: StatusId -> String -> String -> Account -> Maybe Int -> Maybe Int -> Maybe Status -> String -> String -> Int -> Int -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> String -> String -> [Attachment] -> [Mention] -> [Tag] -> Maybe Application -> [Emoji] -> Maybe String -> Status
- Web.Hastodon: [accountId] :: Account -> HastodonId
+ Web.Hastodon: [accountId] :: Account -> AccountId
- Web.Hastodon: [attachmentId] :: Attachment -> HastodonId
+ Web.Hastodon: [attachmentId] :: Attachment -> AttachmentId
- Web.Hastodon: [mentionId] :: Mention -> HastodonId
+ Web.Hastodon: [mentionId] :: Mention -> AccountId
- Web.Hastodon: [notificationId] :: Notification -> HastodonId
+ Web.Hastodon: [notificationId] :: Notification -> NotificationId
- Web.Hastodon: [oauthClientId] :: OAuthClient -> HastodonId
+ Web.Hastodon: [oauthClientId] :: OAuthClient -> OAuthClientId
- Web.Hastodon: [relationshipId] :: Relationship -> HastodonId
+ Web.Hastodon: [relationshipId] :: Relationship -> RelationshipId
- Web.Hastodon: [reportId] :: Report -> HastodonId
+ Web.Hastodon: [reportId] :: Report -> ReportId
- Web.Hastodon: [statusId] :: Status -> HastodonId
+ Web.Hastodon: [statusId] :: Status -> StatusId
- Web.Hastodon: getAccountById :: HastodonClient -> Int -> IO (Either JSONException Account)
+ Web.Hastodon: getAccountById :: HastodonClient -> AccountId -> IO (Either JSONException Account)
- Web.Hastodon: getAccountStatuses :: HastodonClient -> Int -> IO (Either JSONException [Status])
+ Web.Hastodon: getAccountStatuses :: HastodonClient -> AccountId -> IO (Either JSONException [Status])
- Web.Hastodon: getAccountStatusesWithOption :: HastodonClient -> GetAccountStatusesOption -> Int -> IO (Either JSONException [Status])
+ Web.Hastodon: getAccountStatusesWithOption :: HastodonClient -> GetAccountStatusesOption -> AccountId -> IO (Either JSONException [Status])
- Web.Hastodon: getCard :: HastodonClient -> Int -> IO (Either JSONException Card)
+ Web.Hastodon: getCard :: HastodonClient -> StatusId -> IO (Either JSONException Card)
- Web.Hastodon: getContext :: HastodonClient -> Int -> IO (Either JSONException Context)
+ Web.Hastodon: getContext :: HastodonClient -> StatusId -> IO (Either JSONException Context)
- Web.Hastodon: getFavoritedBy :: HastodonClient -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getFavoritedBy :: HastodonClient -> StatusId -> IO (Either JSONException [Account])
- Web.Hastodon: getFavoritedByWithOption :: HastodonClient -> RangeOption -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getFavoritedByWithOption :: HastodonClient -> RangeOption -> StatusId -> IO (Either JSONException [Account])
- Web.Hastodon: getFollowers :: HastodonClient -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getFollowers :: HastodonClient -> AccountId -> IO (Either JSONException [Account])
- Web.Hastodon: getFollowersWithOption :: HastodonClient -> RangeOption -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getFollowersWithOption :: HastodonClient -> RangeOption -> AccountId -> IO (Either JSONException [Account])
- Web.Hastodon: getFollowing :: HastodonClient -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getFollowing :: HastodonClient -> AccountId -> IO (Either JSONException [Account])
- Web.Hastodon: getFollowingWithOption :: HastodonClient -> RangeOption -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getFollowingWithOption :: HastodonClient -> RangeOption -> AccountId -> IO (Either JSONException [Account])
- Web.Hastodon: getNotificationById :: HastodonClient -> Int -> IO (Either JSONException Notification)
+ Web.Hastodon: getNotificationById :: HastodonClient -> NotificationId -> IO (Either JSONException Notification)
- Web.Hastodon: getRebloggedBy :: HastodonClient -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getRebloggedBy :: HastodonClient -> StatusId -> IO (Either JSONException [Account])
- Web.Hastodon: getRebloggedByWithOption :: HastodonClient -> RangeOption -> Int -> IO (Either JSONException [Account])
+ Web.Hastodon: getRebloggedByWithOption :: HastodonClient -> RangeOption -> StatusId -> IO (Either JSONException [Account])
- Web.Hastodon: getRelationships :: HastodonClient -> [Int] -> IO (Either JSONException [Relationship])
+ Web.Hastodon: getRelationships :: HastodonClient -> [AccountId] -> IO (Either JSONException [Relationship])
- Web.Hastodon: getStatus :: HastodonClient -> Int -> IO (Either JSONException Status)
+ Web.Hastodon: getStatus :: HastodonClient -> StatusId -> IO (Either JSONException Status)
- Web.Hastodon: postAuthorizeRequest :: HastodonClient -> Int -> IO Bool
+ Web.Hastodon: postAuthorizeRequest :: HastodonClient -> AccountId -> IO Bool
- Web.Hastodon: postBlock :: HastodonClient -> Int -> IO (Either JSONException Relationship)
+ Web.Hastodon: postBlock :: HastodonClient -> AccountId -> IO (Either JSONException Relationship)
- Web.Hastodon: postFavorite :: HastodonClient -> Int -> IO (Either JSONException Status)
+ Web.Hastodon: postFavorite :: HastodonClient -> StatusId -> IO (Either JSONException Status)
- Web.Hastodon: postFollow :: HastodonClient -> Int -> IO (Either JSONException Relationship)
+ Web.Hastodon: postFollow :: HastodonClient -> AccountId -> IO (Either JSONException Relationship)
- Web.Hastodon: postMute :: HastodonClient -> Int -> IO (Either JSONException Relationship)
+ Web.Hastodon: postMute :: HastodonClient -> AccountId -> IO (Either JSONException Relationship)
- Web.Hastodon: postMuteWithOption :: HastodonClient -> PostMuteOption -> Int -> IO (Either JSONException Relationship)
+ Web.Hastodon: postMuteWithOption :: HastodonClient -> PostMuteOption -> AccountId -> IO (Either JSONException Relationship)
- Web.Hastodon: postReblog :: HastodonClient -> Int -> IO (Either JSONException Status)
+ Web.Hastodon: postReblog :: HastodonClient -> StatusId -> IO (Either JSONException Status)
- Web.Hastodon: postRejectRequest :: HastodonClient -> Int -> IO Bool
+ Web.Hastodon: postRejectRequest :: HastodonClient -> AccountId -> IO Bool
- Web.Hastodon: postStatusWithMediaIds :: HastodonClient -> String -> [HastodonId] -> IO (Either JSONException Status)
+ Web.Hastodon: postStatusWithMediaIds :: HastodonClient -> String -> [MediaId] -> IO (Either JSONException Status)
- Web.Hastodon: postUnblock :: HastodonClient -> Int -> IO (Either JSONException Relationship)
+ Web.Hastodon: postUnblock :: HastodonClient -> AccountId -> IO (Either JSONException Relationship)
- Web.Hastodon: postUnfavorite :: HastodonClient -> Int -> IO (Either JSONException Status)
+ Web.Hastodon: postUnfavorite :: HastodonClient -> StatusId -> IO (Either JSONException Status)
- Web.Hastodon: postUnfollow :: HastodonClient -> Int -> IO (Either JSONException Relationship)
+ Web.Hastodon: postUnfollow :: HastodonClient -> AccountId -> IO (Either JSONException Relationship)
- Web.Hastodon: postUnmute :: HastodonClient -> Int -> IO (Either JSONException Relationship)
+ Web.Hastodon: postUnmute :: HastodonClient -> AccountId -> IO (Either JSONException Relationship)
- Web.Hastodon: postUnreblog :: HastodonClient -> Int -> IO (Either JSONException Status)
+ Web.Hastodon: postUnreblog :: HastodonClient -> StatusId -> IO (Either JSONException Status)
- Web.Hastodon.Option: inReplyToId :: IsPostStatusOption a => Int -> a
+ Web.Hastodon.Option: inReplyToId :: IsPostStatusOption a => AccountId -> a
- Web.Hastodon.Option: maxId :: IsRangeOption a => String -> a
+ Web.Hastodon.Option: maxId :: IsRangeOption a => StatusId -> a
- Web.Hastodon.Option: mediaIds :: IsPostStatusOption a => [Int] -> a
+ Web.Hastodon.Option: mediaIds :: IsPostStatusOption a => [MediaId] -> a
- Web.Hastodon.Option: sinceId :: IsRangeOption a => String -> a
+ Web.Hastodon.Option: sinceId :: IsRangeOption a => StatusId -> a

Files

Hastodon.cabal view
@@ -1,5 +1,5 @@ Name: Hastodon-Version: 0.5.0+Version: 0.6.0 Synopsis: mastodon client module for Haskell Category: Web Description: mastodon client module for Haskell
Web/Hastodon.hs view
@@ -1,24 +1,8 @@ module Web.Hastodon   ( module Web.Hastodon.Option-+  , module Web.Hastodon.Streaming+  , module Web.Hastodon.Types   , HastodonClient(..)-  , Account(..)-  , Application(..)-  , Attachment(..)-  , Card(..)-  , Context(..)-  , Instance(..)-  , Mention(..)-  , Notification(..)-  , OAuthClient(..)-  , Relationship(..)-  , Report(..)-  , Results(..)-  , Status(..)-  , StreamingPayload(..)-  , StreamingResponse-  , Tag(..)-   , mkHastodonClient   , getAccountById   , getCurrentAccount
Web/Hastodon/API.hs view
@@ -172,7 +172,7 @@     Left err -> return $ Nothing     Right oauthData -> return $ Just $ HastodonClient host (accessToken oauthData) -getAccountById :: HastodonClient -> Int -> IO (Either JSONException Account)+getAccountById :: HastodonClient -> AccountId -> IO (Either JSONException Account) getAccountById client id = do   res <- getHastodonResponseJSON (replace ":id" (show id) pAccountById) client   return (getResponseBody res :: Either JSONException Account)@@ -182,10 +182,10 @@   res <- getHastodonResponseJSON pCurrentAccounts client   return (getResponseBody res :: Either JSONException Account) -getFollowers :: HastodonClient -> Int -> IO (Either JSONException [Account])+getFollowers :: HastodonClient -> AccountId -> IO (Either JSONException [Account]) getFollowers client = getFollowersWithOption client mempty -getFollowersWithOption :: HastodonClient -> RangeOption -> Int -> IO (Either JSONException [Account])+getFollowersWithOption :: HastodonClient -> RangeOption -> AccountId -> IO (Either JSONException [Account]) getFollowersWithOption client opt id = do   res <- getHastodonResponseJSONWithOption            (optionAsQuery opt)@@ -193,10 +193,10 @@            client   return (getResponseBody res :: Either JSONException [Account]) -getFollowing :: HastodonClient -> Int -> IO (Either JSONException [Account])+getFollowing :: HastodonClient -> AccountId -> IO (Either JSONException [Account]) getFollowing client = getFollowingWithOption client mempty -getFollowingWithOption :: HastodonClient -> RangeOption -> Int -> IO (Either JSONException [Account])+getFollowingWithOption :: HastodonClient -> RangeOption -> AccountId -> IO (Either JSONException [Account]) getFollowingWithOption client opt id = do   res <- getHastodonResponseJSONWithOption            (optionAsQuery opt)@@ -204,7 +204,7 @@            client   return (getResponseBody res :: Either JSONException [Account]) -getAccountStatusesWithOption :: HastodonClient -> GetAccountStatusesOption -> Int -> IO (Either JSONException [Status])+getAccountStatusesWithOption :: HastodonClient -> GetAccountStatusesOption -> AccountId -> IO (Either JSONException [Status]) getAccountStatusesWithOption client opt id = do   res <- getHastodonResponseJSONWithOption            (optionAsQuery opt)@@ -212,10 +212,10 @@            client   return (getResponseBody res :: Either JSONException [Status]) -getAccountStatuses :: HastodonClient -> Int -> IO (Either JSONException [Status])+getAccountStatuses :: HastodonClient -> AccountId -> IO (Either JSONException [Status]) getAccountStatuses client = getAccountStatusesWithOption client mempty -getRelationships :: HastodonClient -> [Int] ->  IO (Either JSONException [Relationship])+getRelationships :: HastodonClient -> [AccountId] ->  IO (Either JSONException [Relationship]) getRelationships client ids = do   let intIds = map (show) ids   let params = foldl (\x y -> x ++ (if x == "" then "?" else "&") ++ "id%5b%5d=" ++ y) "" intIds@@ -231,37 +231,37 @@ getSearchedAccounts :: HastodonClient -> String ->  IO (Either JSONException [Account]) getSearchedAccounts client = getSearchedAccountsWithOption client mempty -postFollow :: HastodonClient -> Int ->  IO (Either JSONException Relationship)+postFollow :: HastodonClient -> AccountId ->  IO (Either JSONException Relationship) postFollow client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pFollow) [] client   return (getResponseBody res :: Either JSONException Relationship) -postUnfollow :: HastodonClient -> Int ->  IO (Either JSONException Relationship)+postUnfollow :: HastodonClient -> AccountId ->  IO (Either JSONException Relationship) postUnfollow client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pUnfollow) [] client   return (getResponseBody res :: Either JSONException Relationship) -postBlock :: HastodonClient -> Int ->  IO (Either JSONException Relationship)+postBlock :: HastodonClient -> AccountId ->  IO (Either JSONException Relationship) postBlock client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pBlock) [] client   return (getResponseBody res :: Either JSONException Relationship) -postUnblock :: HastodonClient -> Int ->  IO (Either JSONException Relationship)+postUnblock :: HastodonClient -> AccountId ->  IO (Either JSONException Relationship) postUnblock client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pUnblock) [] client   return (getResponseBody res :: Either JSONException Relationship)  postMuteWithOption ::-  HastodonClient -> PostMuteOption -> Int ->  IO (Either JSONException Relationship)+  HastodonClient -> PostMuteOption -> AccountId ->  IO (Either JSONException Relationship) postMuteWithOption client opt id = do   let prms = optionAsForm opt   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pMute) prms client   return (getResponseBody res :: Either JSONException Relationship) -postMute :: HastodonClient -> Int ->  IO (Either JSONException Relationship)+postMute :: HastodonClient -> AccountId ->  IO (Either JSONException Relationship) postMute client = postMuteWithOption client mempty -postUnmute :: HastodonClient -> Int ->  IO (Either JSONException Relationship)+postUnmute :: HastodonClient -> AccountId ->  IO (Either JSONException Relationship) postUnmute client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pUnmute) [] client   return (getResponseBody res :: Either JSONException Relationship)@@ -300,10 +300,10 @@ getFollowRequests :: HastodonClient -> IO (Either JSONException [Account]) getFollowRequests client = getFollowRequestsWithOption client mempty -postAuthorizeRequest :: HastodonClient -> Int ->  IO Bool+postAuthorizeRequest :: HastodonClient -> AccountId ->  IO Bool postAuthorizeRequest client id = postAndGetHastodonResult (replace ":id" (show id) pAuthorizeRequest) [] client -postRejectRequest :: HastodonClient -> Int ->  IO Bool+postRejectRequest :: HastodonClient -> AccountId ->  IO Bool postRejectRequest client id = postAndGetHastodonResult (replace ":id" (show id) pRejectRequest) [] client  getInstance :: HastodonClient -> IO (Either JSONException Instance)@@ -338,7 +338,7 @@   res <- getHastodonResponseJSONWithOption (optionAsQuery opt) pNotifications client   return (getResponseBody res :: Either JSONException [Notification]) -getNotificationById :: HastodonClient -> Int ->  IO (Either JSONException Notification)+getNotificationById :: HastodonClient -> NotificationId ->  IO (Either JSONException Notification) getNotificationById client id = do   res <- getHastodonResponseJSON (replace ":id" (show id) pNotificationById) client   return (getResponseBody res :: Either JSONException Notification)@@ -360,35 +360,35 @@   res <- getHastodonResponseJSONWithOption (optionAsQuery opt) (pSearch ++ "?q=" ++ query) client   return (getResponseBody res :: Either JSONException [Results]) -getStatus :: HastodonClient -> Int ->  IO (Either JSONException Status)+getStatus :: HastodonClient -> StatusId ->  IO (Either JSONException Status) getStatus client id = do   res <- getHastodonResponseJSON (replace ":id" (show id) pStatus) client   return (getResponseBody res :: Either JSONException Status) -getCard :: HastodonClient -> Int ->  IO (Either JSONException Card)+getCard :: HastodonClient -> StatusId ->  IO (Either JSONException Card) getCard client id = do   res <- getHastodonResponseJSON (replace ":id" (show id) pCard) client   return (getResponseBody res :: Either JSONException Card) -getContext :: HastodonClient -> Int ->  IO (Either JSONException Context)+getContext :: HastodonClient -> StatusId ->  IO (Either JSONException Context) getContext client id = do   res <- getHastodonResponseJSON (replace ":id" (show id) pContext) client   return (getResponseBody res :: Either JSONException Context) -getRebloggedByWithOption :: HastodonClient -> RangeOption -> Int ->  IO (Either JSONException [Account])+getRebloggedByWithOption :: HastodonClient -> RangeOption -> StatusId ->  IO (Either JSONException [Account]) getRebloggedByWithOption client opt id = do   res <- getHastodonResponseJSONWithOption (optionAsQuery opt) (replace ":id" (show id) pRebloggedBy) client   return (getResponseBody res :: Either JSONException [Account]) -getRebloggedBy :: HastodonClient -> Int ->  IO (Either JSONException [Account])+getRebloggedBy :: HastodonClient -> StatusId ->  IO (Either JSONException [Account]) getRebloggedBy client = getRebloggedByWithOption client mempty -getFavoritedByWithOption :: HastodonClient -> RangeOption -> Int -> IO (Either JSONException [Account])+getFavoritedByWithOption :: HastodonClient -> RangeOption -> StatusId -> IO (Either JSONException [Account]) getFavoritedByWithOption client opt id = do   res <- getHastodonResponseJSONWithOption (optionAsQuery opt) (replace ":id" (show id) pFavoritedBy) client   return (getResponseBody res :: Either JSONException [Account]) -getFavoritedBy :: HastodonClient -> Int -> IO (Either JSONException [Account])+getFavoritedBy :: HastodonClient -> StatusId -> IO (Either JSONException [Account]) getFavoritedBy client = getFavoritedByWithOption client mempty  postStatus :: HastodonClient -> String ->  IO (Either JSONException Status)@@ -401,29 +401,29 @@   res <- postAndGetHastodonResponseJSON pStatuses prms client   return (getResponseBody res :: Either JSONException Status) -postStatusWithMediaIds :: HastodonClient -> String -> [HastodonId] -> IO (Either JSONException Status)+postStatusWithMediaIds :: HastodonClient -> String -> [MediaId] -> IO (Either JSONException Status) postStatusWithMediaIds client status mediaIds = do-  let unpackedMediaIds = [(Char8.pack "media_ids[]",utf8ToChar8 media)|media <- mediaIds] -- Rails array parameter convention?+  let unpackedMediaIds = [(Char8.pack "media_ids[]", (utf8ToChar8 . unMediaId) media) | media <- mediaIds] -- Rails array parameter convention?   let body = (Char8.pack "status",utf8ToChar8 status):unpackedMediaIds   res <- postAndGetHastodonResponseJSON pStatuses body client   return (getResponseBody res :: Either JSONException Status) -postReblog :: HastodonClient -> Int ->  IO (Either JSONException Status)+postReblog :: HastodonClient -> StatusId ->  IO (Either JSONException Status) postReblog client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pReblog) [] client   return (getResponseBody res :: Either JSONException Status) -postUnreblog :: HastodonClient -> Int ->  IO (Either JSONException Status)+postUnreblog :: HastodonClient -> StatusId ->  IO (Either JSONException Status) postUnreblog client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pUnreblog) [] client   return (getResponseBody res :: Either JSONException Status) -postFavorite :: HastodonClient -> Int ->  IO (Either JSONException Status)+postFavorite :: HastodonClient -> StatusId ->  IO (Either JSONException Status) postFavorite client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pFavorite) [] client   return (getResponseBody res :: Either JSONException Status) -postUnfavorite :: HastodonClient -> Int ->  IO (Either JSONException Status)+postUnfavorite :: HastodonClient -> StatusId ->  IO (Either JSONException Status) postUnfavorite client id = do   res <- postAndGetHastodonResponseJSON (replace ":id" (show id) pUnfavorite) [] client   return (getResponseBody res :: Either JSONException Status)
Web/Hastodon/Option.hs view
@@ -97,11 +97,11 @@ instance IsLimitOption RangeOption where {} instance IsRangeOption RangeOption where {} -sinceId :: IsRangeOption a => String -> a-sinceId i = mkOption "since_id" $ Just i+sinceId :: IsRangeOption a => StatusId -> a+sinceId i = mkOption "since_id" $ Just $ show i -maxId :: IsRangeOption a => String -> a-maxId i = mkOption "max_id" $ Just i+maxId :: IsRangeOption a => StatusId -> a+maxId i = mkOption "max_id" $ Just $ show i  -- -- Timeline options@@ -280,10 +280,10 @@ formatVis VisibilityUnlisted = "unlisted" formatVis VisibilityPublic = "public" -inReplyToId :: IsPostStatusOption a => Int -> a+inReplyToId :: IsPostStatusOption a => AccountId -> a inReplyToId i = mkOption "in_reply_to_id" (Just $ show i) -mediaIds :: IsPostStatusOption a => [Int] -> a+mediaIds :: IsPostStatusOption a => [MediaId] -> a mediaIds l = mkArrayOption "media_ids" $ show <$> l  sensitive :: IsPostStatusOption a => a@@ -318,6 +318,3 @@  muteNotifications :: IsPostMuteOption a => a muteNotifications = mkOption "notifications" $ Nothing---
Web/Hastodon/Streaming.hs view
@@ -41,7 +41,7 @@  data StreamingPayload = SUpdate Status             |                         SNotification Notification |-                        SDelete HastodonId         |+                        SDelete StatusId           |                         Thump                         deriving (Show) @@ -97,7 +97,7 @@ parseDelete :: Parser StreamingPayload parseDelete = do   pd-  i <- many C8.digit+  i <- StatusId <$> many C8.digit   return $ SDelete i  
Web/Hastodon/Types.hs view
@@ -1,20 +1,28 @@+{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} module Web.Hastodon.Types-  ( HastodonId-  , OAuthResponse(..)+  ( OAuthResponse(..)   , Account(..)+  , AccountId(..)   , Application(..)   , Attachment(..)+  , AttachmentId(..)   , Card(..)   , Context(..)   , Instance(..)+  , MediaId(..)   , Mention(..)   , Notification(..)+  , NotificationId(..)   , OAuthClient(..)+  , OAuthClientId(..)   , Relationship(..)+  , RelationshipId(..)   , Report(..)+  , ReportId(..)   , Results(..)   , Status(..)+  , StatusId(..)   , Tag(..)   , OptionVal   , OptionImpl@@ -22,13 +30,29 @@   ) where  import Data.Aeson+import Data.String (IsString, fromString) import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.ByteString.Char8 as Char8 import qualified Data.Map as Map -type HastodonId = String+newtype AccountId = AccountId { unAccountId :: String } deriving (FromJSON, IsString, Show) +newtype AttachmentId = AttachmentId { unAttachmentId :: String } deriving (FromJSON, IsString, Show)++newtype OAuthClientId = OAuthClientId { unOAuthClientId :: String } deriving (FromJSON, IsString, Show)++newtype MediaId = MediaId { unMediaId :: String } deriving (FromJSON, IsString, Show)++newtype NotificationId = NotificationId { unNotificationId :: String } deriving (FromJSON, IsString, Show)++newtype RelationshipId = RelationshipId { unRelationshipId :: String } deriving (FromJSON, IsString, Show)++newtype ReportId = ReportId { unReportId :: String } deriving (FromJSON, IsString, Show)++newtype StatusId = StatusId { unStatusId :: String } deriving (FromJSON, IsString, Show)++ data OAuthResponse = OAuthResponse {   accessToken :: String   -- NOTE currently ignore other fields.@@ -38,7 +62,7 @@     OAuthResponse <$> (v .: "access_token")  data Account = Account {-  accountId :: HastodonId,+  accountId :: AccountId,   accountUsername :: String,   accountAcct :: String,   accountDisplayName :: String,@@ -82,7 +106,7 @@                 <*> (v .:? "website")  data Attachment = Attachment {-  attachmentId :: HastodonId,+  attachmentId :: AttachmentId,   attachmentType :: String,   attachmentUrl :: String,   attachmentRemoteUrl :: Maybe String,@@ -137,7 +161,7 @@   mentionUrl :: String,   mentionUsername :: String,   mentionAcct :: String,-  mentionId :: HastodonId+  mentionId :: AccountId } deriving (Show) instance FromJSON Mention where   parseJSON (Object v) =@@ -147,7 +171,7 @@             <*> (v .: "id")  data Notification = Notification {-  notificationId :: HastodonId,+  notificationId :: NotificationId,   notificationType :: String,   notificationCreatedAt :: String,   notificationAccount :: Account,@@ -162,7 +186,7 @@                  <*> (v .:? "status")  data OAuthClient = OAuthClient {-  oauthClientId :: HastodonId,+  oauthClientId :: OAuthClientId,   oauthClientRedirectUri :: String,   oauthClientClientId :: String,   oauthClientClientSecret :: String@@ -175,7 +199,7 @@                 <*> (v .: "client_secret")  data Relationship = Relationship {-  relationshipId :: HastodonId,+  relationshipId :: RelationshipId,   relationshipFollowing :: Bool,   relationshipFollowed_by :: Bool,   relationshipBlocking :: Bool,@@ -192,7 +216,7 @@                  <*> (v .: "requested")  data Report = Report {-  reportId :: HastodonId,+  reportId :: ReportId,   reportActionToken :: String } deriving (Show) instance FromJSON Report where@@ -223,7 +247,7 @@          <*> (v .: "url")  data Status = Status {-  statusId :: HastodonId,+  statusId :: StatusId,   statusUri :: String,   statusUrl :: String,   statusAccount :: Account,