在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):syucream/hastodon开源软件地址(OpenSource Url):https://github.com/syucream/hastodon开源编程语言(OpenSource Language):Haskell 100.0%开源软件介绍(OpenSource Introduction):Hastodonmastodon client module for Haskell QuickstartIf 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." StreamingStreaming requires a little more ceremony, as well as familiarity with the {-# 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 implementationsMastodon APIs
Streaming
Auth
LicenseMIT AuthorRyo Okubo [email protected] Contributors |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论