Popularity
8.0
Stable
Activity
0.0
Stable
26
5
9

Monthly Downloads: 51
Programming language: Haskell
License: MIT License
Tags: Web    

Hastodon alternatives and similar packages

Based on the "Web" category.
Alternatively, view Hastodon alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Hastodon or a related project?

Add another 'Web' Package

README

Hastodon

Build Status Hackage-Deps

mastodon client module for Haskell

Quickstart

If you don't have client id and client secret, call postApps at first. (Alternatively, look in the web client, under the development section of your mastodon profile settings)

import Web.Hastodon
  appRes <- postApps "mastodon.social" "HastodonClientApp"
    case appRes of
      Right app -> do
        let clientId = oauthClientClientId app
        let clientSecret = oauthClientClientSecret app

Fill client id, client secret, the email address used to sign up for the instance and password, then call functions.

import Web.Hastodon

main :: IO ()
main = do
  let clientId = "???"
  let clientSecret = "???"
  let email = "???"
  let password = "???"
  maybeClient <- mkHastodonClient clientId clientSecret email password "mastodon.social"
  case maybeClient of
    Just client -> do
      timeline <- getAccountById client 93150
      print timeline
      result <- postStatus client "test toot from hastodon!"
      print result
    Nothing -> do
      putStrLn "Failed to log in.  Be careful regarding the spelling of your email and password."

Streaming

Streaming requires a little more ceremony, as well as familiarity with the Conduit library.

{-# LANGUAGE OverloadedStrings #-}
import Web.Hastodon
import Conduit
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  let inst = "mastodon.social"
  let token = "???" -- from /settings/applications
  let client = HastodonClient instance token -- or use mkHastodonClient as above
  runConduitRes $ streamUser client .| mapC showSR .| stdoutC
 where showSR (SNotification n) = "got notification: " `BS.append` (sb n) `BS.append` "\n"
       showSR (SUpdate s) = "got status: " `BS.append` (sb s) `BS.append` "\n"
       showSR (SDelete i) = "got delete: " `BS.append` (BS.pack i) `BS.append` "\n"
       showSR Thump = "got thump\n"
       sb v = BS.pack $ show v

Status of implementations

Mastodon APIs

  • [x] GET /api/v1/accounts/:id
  • [x] GET /api/v1/accounts/verify_credentials
  • [ ] PATCH /api/v1/accounts/update_credentials
  • [x] GET /api/v1/accounts/:id/followers
  • [x] GET /api/v1/accounts/:id/following
  • [x] GET /api/v1/accounts/:id/statuses
  • [x] POST /api/v1/accounts/:id/follow
  • [x] POST /api/v1/accounts/:id/unfollow
  • [x] POST /api/v1/accounts/:id/block
  • [x] POST /api/v1/accounts/:id/unblock
  • [x] POST /api/v1/accounts/:id/mute
  • [x] POST /api/v1/accounts/:id/unmute
  • [x] GET /api/v1/accounts/relationships
  • [x] GET /api/v1/accounts/search
  • [x] POST /api/v1/apps
  • [x] GET /api/v1/blocks
  • [x] GET /api/v1/favourites
  • [x] GET /api/v1/follow_requests
  • [x] POST /api/v1/follow_requests/:id/authorize
  • [x] POST /api/v1/follow_requests/:id/reject
  • [ ] POST /api/v1/follows
  • [x] GET /api/v1/instance
  • [x] POST /api/v1/media
  • [x] GET /api/v1/mutes
  • [x] GET /api/v1/notifications
  • [x] GET /api/v1/notifications/:id
  • [x] POST /api/v1/notifications/clear
  • [x] GET /api/v1/reports
  • [ ] POST /api/v1/reports
  • [x] GET /api/v1/search
  • [x] GET /api/v1/statuses/:id
  • [x] GET /api/v1/statuses/:id/context
  • [x] GET /api/v1/statuses/:id/card
  • [x] GET /api/v1/statuses/:id/reblogged_by
  • [x] GET /api/v1/statuses/:id/favourited_by
  • [x] POST /api/v1/statuses
  • [ ] DELETE /api/v1/statuses/:id
  • [x] POST /api/v1/statuses/:id/reblog
  • [x] POST /api/v1/statuses/:id/unreblog
  • [x] POST /api/v1/statuses/:id/favourite
  • [x] POST /api/v1/statuses/:id/unfavourite
  • [x] GET /api/v1/timelines/home
  • [x] GET /api/v1/timelines/public
  • [x] GET /api/v1/timelines/tag/:hashtag

Streaming

  • [x] GET /api/v1/streaming/user
  • [x] GET /api/v1/streaming/public
  • [x] GET /api/v1/streaming/public/local
  • [x] GET /api/v1/streaming/hashtag
  • [x] GET /api/v1/streaming/list

Auth

  • [x] the interface of POST /oauth/token

License

MIT

Author

Ryo Okubo [email protected]

Contributors


*Note that all licence references and agreements mentioned in the Hastodon README section above are relevant to that project's source code only.