在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):milmazz/hunter开源软件地址(OpenSource Url):https://github.com/milmazz/hunter开源编程语言(OpenSource Language):Elixir 100.0%开源软件介绍(OpenSource Introduction):HunterA Elixir client for Mastodon, a GNU social-compatible micro-blogging service Installationdef deps do
[{:hunter, "~> 0.4"}]
end Then, update your dependencies: $ mix deps.get If you want to run the automated tests for this project: $ mix test ContributingPlease read CONTRIBUTING.md for details on the process for submitting pull request to us. Code of ConductPlease read CODE_OF_CONDUCT.md for details on our code of conduct. VersioningWe use SemVer for versioning. For the versions available, see the tags on this repository. UsageRegistering an applicationiex> app = Hunter.create_app("hunter", "urn:ietf:wg:oauth:2.0:oob", ["read", "write", "follow"], nil, [save?: true, api_base_url: "https://example.com"])
%Hunter.Application{client_id: "1234567890",
client_secret: "1234567890",
id: 1234} You can also load the application's saved credentials: iex> app = Hunter.Application.load_credentials("hunter")
%Hunter.Application{client_id: "1234567890",
client_secret: "1234567890",
id: 1234} Acquire an access tokenOnce you have a registered app you can do the following: iex> conn = Hunter.log_in(app, "[email protected]", "your_password", "https://example.com")
%Hunter.Client{base_url: "https://example.com",
bearer_token: "123456"} Or, if you want to use OAuth code for authentication: iex> conn = Hunter.log_in_oauth(app, "123456code", "https://example.com")
%Hunter.Client{base_url: "https://example.com",
bearer_token: "123456"} Now you can use If you don't want to register an application but you already know your instance and your bearer token you can do the following: iex> conn = Hunter.new([base_url: "https://example.com", bearer_token: "123456"])
%Hunter.Client{base_url: "https://example.com",
bearer_token: "123456"} Returns Getting the current useriex> Hunter.verify_credentials(conn)
%Hunter.Account{acct: "milmazz",
avatar: "https://social.lou.lt/avatars/original/missing.png",
created_at: "2017-04-06T17:43:55.325Z", display_name: "Milton Mazzarri",
followers_count: 2, following_count: 3,
header: "https://social.lou.lt/headers/original/missing.png", id: 8039,
locked: false, note: "", statuses_count: 1,
url: "https://social.lou.lt/@milmazz", username: "milmazz"} Returns a Fetching an accountiex> Hunter.account(conn, 8039)
%Hunter.Account{acct: "milmazz",
avatar: "https://social.lou.lt/avatars/original/missing.png",
created_at: "2017-04-06T17:43:55.325Z", display_name: "Milton Mazzarri",
followers_count: 2, following_count: 3,
header: "https://social.lou.lt/headers/original/missing.png", id: 8039,
locked: false, note: "", statuses_count: 1,
url: "https://social.lou.lt/@milmazz", username: "milmazz"} Returns a Getting an account's followersiex> Hunter.followers(conn, 8039)
[%Hunter.Account{acct: "[email protected]",
avatar: "https://social.lou.lt/system/accounts/avatars/000/008/518/original/7715529d4ceb4554.jpg?1491509276",
created_at: "2017-04-06T20:07:57.119Z", display_name: "Carlos Gustavo Ruiz",
followers_count: 2, following_count: 2,
header: "https://social.lou.lt/system/accounts/headers/000/008/518/original/394f31473de7c64a.png?1491509277",
id: 8518, locked: false,
note: "Programmer, Pythonista, Web Creature, Blogger, C++ and Haskell Fan. Never stop learning, because life never stops teaching.",
statuses_count: 1, url: "https://mastodon.club/@atmantree",
username: "atmantree"},
...
] Returns a list of Getting who account is followingiex> Hunter.following(conn, 8039)
[%Hunter.Account{acct: "[email protected]",
avatar: "https://social.lou.lt/system/accounts/avatars/000/007/899/original/19b4d8c1e9d4e68a.jpg?1491498458",
created_at: "2017-04-06T17:07:38.912Z",
display_name: "Sebastián Ramírez Magrí", followers_count: 2,
following_count: 1,
header: "https://social.lou.lt/system/accounts/headers/000/007/899/original/missing.png?1491498458",
id: 7899, locked: false, note: "", statuses_count: 2,
url: "https://mastodon.cloud/@sebasmagri", username: "sebasmagri"},
...] Returns a list of Following a remote useriex> Hunter.follow_by_uri(conn, "[email protected]")
%Hunter.Account{acct: "[email protected]",
avatar: "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
created_at: "2017-04-06T13:44:18.281Z", display_name: "Papers We Love",
followers_count: 1, following_count: 0,
header: "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
id: 7126, locked: false,
note: "Building Bridges Between Academia and Industry\r\n\r\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\r\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
statuses_count: 1, url: "https://mstdn.io/@paperswelove",
username: "paperswelove"} Returns a Muting/unmuting an accountiex> Hunter.mute(conn, 7899)
%Hunter.Relationship{blocking: false, followed_by: false, following: true,
muting: true, requested: false}
iex> Hunter.unmute(conn, 7899)
%Hunter.Relationship{blocking: false, followed_by: false, following: true,
muting: false, requested: false} Returns the target account's Getting an account's statusesiex> Hunter.statuses(conn, 8039)
[%Hunter.Status{account: %Hunter.Account{acct: "milmazz",
avatar: "https://social.lou.lt/avatars/original/missing.png",
created_at: "2017-04-06T17:43:55.325Z", display_name: "Milton Mazzarri",
followers_count: 4, following_count: 4,
header: "https://social.lou.lt/headers/original/missing.png", id: 8039,
locked: false, note: "", statuses_count: 2,
url: "https://social.lou.lt/@milmazz", username: "milmazz"},
application: %Hunter.Application{client_id: nil, client_secret: nil, id: nil},
content: "<p>Hunter is a Elixir client for Mastodon: <a href=\"https://github.com/milmazz/hunter\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">github.com/milmazz/hunter</span><span class=\"invisible\"></span></a> <a href=\"https://social.lou.lt/tags/myelixirstatus\" class=\"mention hashtag\">#<span>myelixirstatus</span></a></p>",
created_at: "2017-04-08T04:41:38.643Z", favourited: nil, favourites_count: 1,
id: 118635, in_reply_to_account_id: nil, in_reply_to_id: nil,
media_attachments: [], mentions: [], reblog: nil, reblogged: nil,
reblogs_count: 0, sensitive: nil, spoiler_text: "",
tags: [%Hunter.Tag{name: "myelixirstatus",
url: "https://social.lou.lt/tags/myelixirstatus"}],
uri: "tag:social.lou.lt,2017-04-08:objectId=118635:objectType=Status",
url: "https://social.lou.lt/@milmazz/118635", visibility: "public"},
...
] Returns a list of Fetching a user's favourites
Returns a list of Favouriting/unfavouriting a status全部评论
专题导读
热门推荐
热门话题
阅读排行榜
|
请发表评论