hunter v0.5.1 Hunter.Api.HTTPClient View Source
HTTP Client for Hunter
Link to this section Summary
Functions
Retrieve account
Block a user
Block a domain
Fetch user's blocked domains
Retrieve user's blocks
Retrieve a card associated with a status
Dismiss a single notification
Deletes all notifications from the Mastodon server for the authenticated user
Register a new OAuth client app on the target instance
Create new status
Destroy status
Favorite a status
Fetch the list of users who favourited the status
Fetch a user's favourites
Follow a user
Follow a remote user
Accepts or Rejects a follow request
Retrieve a list of follow requests
Get a list of followers
Get a list of followed accounts
Retrieve statuses from a hashtag
Retrieve statuses from the home timeline
Retrieve instance information
Retrieve access token
Mute a user
Retrieve user's mutes
Retrieve single notification
Retrieve user's notifications
Retrieve statuses from the public timeline
Reblog a status
Fetch the list of users who reblogged the status
Get the relationships of authenticated user towards given other users
Report a user
Retrieve a user's reports
Search for content
Search for accounts
Retrieve status
Retrieve status context
Get a list of statuses by a user
Unblock a user
Unblock a domain
Undo a favorite of a status
Unfollow a user
Unmute a user
Undo a reblog of a status
Make changes to the authenticated user
Upload a media file
Retrieve account of authenticated user
Link to this section Functions
account(conn, id) View Source
Retrieve account
Parameters
conn
- connection credentialsid
- account identifier
Callback implementation for Hunter.Api.account/2
.
block(conn, id) View Source
Block a user
Parameters
conn
- connection credentialsid
- user identifier
Callback implementation for Hunter.Api.block/2
.
block_domain(conn, domain) View Source
Block a domain
Parameters
conn
- connection credentialsdomain
- domain to block
Callback implementation for Hunter.Api.block_domain/2
.
blocked_domains(conn, options) View Source
Fetch user's blocked domains
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of blocks with id less than or equal this valuesince_id
- get a list of blocks with id greater than this valuelimit
- maximum number of blocks to get, default: 40, max: 80
Callback implementation for Hunter.Api.blocked_domains/2
.
blocks(conn, options) View Source
Retrieve user's blocks
Parameters
conn
- connection credentials
Options
max_id
- get a list of blocks with id less than or equal this valuesince_id
- get a list of blocks with id greater than this valuelimit
- maximum number of blocks to get, default: 40, max: 80
Callback implementation for Hunter.Api.blocks/2
.
card_by_status(conn, id) View Source
Retrieve a card associated with a status
Parameters
conn
- connection credentialsid
- status id
Callback implementation for Hunter.Api.card_by_status/2
.
clear_notification(conn, id) View Source
Dismiss a single notification
Parameters
conn
- connection credentialsid
- notification id
Callback implementation for Hunter.Api.clear_notification/2
.
clear_notifications(conn) View Source
Deletes all notifications from the Mastodon server for the authenticated user
Parameters
conn
- connection credentials
Callback implementation for Hunter.Api.clear_notifications/1
.
create_app(name, redirect_uri, scopes, website, base_url) View Source
Register a new OAuth client app on the target instance
Parameters
name
- name of your applicationredirect_uri
- where the user should be redirected after authorization, for no redirect, useurn:ietf:wg:oauth:2.0:oob
scopes
- scope list, see the scope section for more detailswebsite
- URL to the homepage of your appbase_url
- base url
Scopes
read
- read datawrite
- post statuses and upload media for statusesfollow
- follow, unfollow, block, unblock
Multiple scopes can be requested during the authorization phase with the scope
query param
Callback implementation for Hunter.Api.create_app/5
.
create_status(conn, status, options) View Source
Create new status
Parameters
conn
- connection credentialsstatus
- text of the statusoptions
- option list
Options
in_reply_to_id
- local ID of the status you want to reply tomedia_ids
- list of media IDs to attach to the status (maximum: 4)sensitive
- whether the media of the status is NSFWspoiler_text
- text to be shown as a warning before the actual contentvisibility
- eitherdirect
,private
,unlisted
orpublic
Callback implementation for Hunter.Api.create_status/3
.
destroy_status(conn, id) View Source
Destroy status
Parameters
conn
- connection credentialsid
- status identifier
Callback implementation for Hunter.Api.destroy_status/2
.
favourite(conn, id) View Source
Favorite a status
Parameters
conn
- connection credentialsid
- status identifier
Callback implementation for Hunter.Api.favourite/2
.
favourited_by(conn, id, options) View Source
Fetch the list of users who favourited the status.
Parameters
conn
- connection credentialsid
- status identifieroptions
- option list
Options
max_id
- get a list of favourited by ids less than or equal this valuesince_id
- get a list of favourited by ids greater than this valuelimit
- maximum number of favourited by to get, default: 40, max: 80
Callback implementation for Hunter.Api.favourited_by/3
.
favourites(conn, options) View Source
Fetch a user's favourites
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of favourites with id less than or equal this valuesince_id
- get a list of favourites with id greater than this valuelimit
- maximum of favourites to get, default: 20, max: 40
Callback implementation for Hunter.Api.favourites/2
.
follow(conn, id) View Source
Follow a user
Parameters
conn
- connection credentialsid
- user id
Callback implementation for Hunter.Api.follow/2
.
follow_by_uri(conn, uri) View Source
Follow a remote user
Parameters
conn
- connection credentialsuri
- URI of the remote user, in the format ofusername@domain
Callback implementation for Hunter.Api.follow_by_uri/2
.
follow_request_action(conn, id, action) View Source
Accepts or Rejects a follow request
Parameters
conn
- connection credentialsid
- follow request idaction
- action to take
Actions
:authorize
- authorize a follow request:reject
- reject a follow request
Callback implementation for Hunter.Api.follow_request_action/3
.
follow_requests(conn, options) View Source
Retrieve a list of follow requests
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of follow requests with id less than or equal this valuesince_id
- get a list of follow requests with id greater than this valuelimit
- maximum number of requests to get, default: 40, max: 80
Callback implementation for Hunter.Api.follow_requests/2
.
followers(conn, id, options) View Source
Get a list of followers
Parameters
conn
- connection credentialsid
- account identifieroptions
- options list
Options
max_id
- get a list of followings with id less than or equal this valuesince_id
- get a list of followings with id greater than this valuelimit
- maximum number of followings to get, default: 40, maximum: 80
Callback implementation for Hunter.Api.followers/3
.
following(conn, id, options) View Source
Get a list of followed accounts
Parameters
conn
- connection credentialsid
- account identifieroptions
- options list
Options
max_id
- get a list of followings with id less than or equal this valuesince_id
- get a list of followings with id greater than this valuelimit
- maximum number of followings to get, default: 40, maximum: 80
Callback implementation for Hunter.Api.following/3
.
hashtag_timeline(conn, hashtag, options) View Source
Retrieve statuses from a hashtag
Parameters
conn
- connection credentialshashtag
- list of stringsoptions
- option list
Options
local
- only return statuses originating from this instancemax_id
- get a list of timelines with id less than or equal this valuesince_id
- get a list of timelines with id greater than this valuelimit
- maximum number of statuses on the requested timeline to get, default: 20, max: 40
Callback implementation for Hunter.Api.hashtag_timeline/3
.
home_timeline(conn, options) View Source
Retrieve statuses from the home timeline
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of timelines with id less than or equal this valuesince_id
- get a list of timelines with id greater than this valuelimit
- maximum number of statuses on the requested timeline to get, default: 20, max: 40
Callback implementation for Hunter.Api.home_timeline/2
.
instance_info(conn) View Source
Retrieve instance information
Parameters
conn
- connection credentials
Callback implementation for Hunter.Api.instance_info/1
.
log_in(application, username, password, base_url) View Source
Retrieve access token
Parameters
app
- application details, see:Hunter.Application.create_app/5
for more details.username
- your account's emailpassword
- your passwordbase_url
- API base url, default:https://mastodon.social
Callback implementation for Hunter.Api.log_in/4
.
mute(conn, id) View Source
Mute a user
Parameters
conn
- connection credentialsid
- user identifier
Callback implementation for Hunter.Api.mute/2
.
mutes(conn, options) View Source
Retrieve user's mutes
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of mutes with id less than or equal this valuesince_id
- get a list of mutes with id greater than this valuelimit
- maximum number of mutes to get, default: 40, max: 80
Callback implementation for Hunter.Api.mutes/2
.
notification(conn, id) View Source
Retrieve single notification
Parameters
conn
- connection credentialsid
- notification identifier
Callback implementation for Hunter.Api.notification/2
.
notifications(conn, options) View Source
Retrieve user's notifications
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of notifications with id less than or equal this valuesince_id
- get a list of notifications with id greater than this valuelimit
- maximum number of notifications to get, default: 15, max: 30
Callback implementation for Hunter.Api.notifications/2
.
public_timeline(conn, options) View Source
Retrieve statuses from the public timeline
Parameters
conn
- connection credentialsoptions
- option list
Options
local
- only return statuses originating from this instancemax_id
- get a list of timelines with id less than or equal this valuesince_id
- get a list of timelines with id greater than this valuelimit
- maximum number of statuses on the requested timeline to get, default: 20, max: 40
Callback implementation for Hunter.Api.public_timeline/2
.
reblog(conn, id) View Source
Reblog a status
Parameters
conn
- connection credentialsid
- status identifier
Callback implementation for Hunter.Api.reblog/2
.
reblogged_by(conn, id, options) View Source
Fetch the list of users who reblogged the status.
Parameters
conn
- connection credentialsid
- status identifieroptions
- option list
Options
max_id
- get a list of reblogged by ids less than or equal this valuesince_id
- get a list of reblogged by ids greater than this valuelimit
- maximum number of reblogged by to get, default: 40, max: 80
Callback implementation for Hunter.Api.reblogged_by/3
.
relationships(conn, ids) View Source
Get the relationships of authenticated user towards given other users
Parameters
conn
- connection credentialsid
- list of relationship IDs
Callback implementation for Hunter.Api.relationships/2
.
report(conn, account_id, status_ids, comment) View Source
Report a user
Parameters
conn
- connection credentialsaccount_id
- the ID of the account to reportstatus_ids
- the IDs of statuses to reportcomment
- a comment to associate with the report
Callback implementation for Hunter.Api.report/4
.
reports(conn) View Source
Retrieve a user's reports
Parameters
conn
- connection credentials
Callback implementation for Hunter.Api.reports/1
.
search(conn, query, options) View Source
Search for content
Parameters
conn
- connection credentialsq
- the search queryoptions
- option list
Options
resolve
- whether to resolve non-local accounts
Callback implementation for Hunter.Api.search/3
.
search_account(conn, options) View Source
Search for accounts
Parameters
conn
- connection credentialsoptions
- option list
Options
q
: what to search forlimit
: maximum number of matching accounts to return, default: 40
Callback implementation for Hunter.Api.search_account/2
.
status(conn, id) View Source
Retrieve status
Parameters
conn
- connection credentialsid
- status identifier
Callback implementation for Hunter.Api.status/2
.
status_context(conn, id) View Source
Retrieve status context
Parameters
conn
- connection credentialsid
- status identifier
Callback implementation for Hunter.Api.status_context/2
.
statuses(conn, account_id, options) View Source
Get a list of statuses by a user
Parameters
conn
- connection credentialsaccount_id
- account identifieroptions
- option list
Options
only_media
- only returnHunter.Status.t
that have media attachmentsexclude_replies
- skip statuses that reply to other statusesmax_id
- get a list of statuses with id less than or equal this valuesince_id
- get a list of statuses with id greater than this valuelimit
- maximum number of statuses to get, default: 20, max: 40
Callback implementation for Hunter.Api.statuses/3
.
unblock(conn, id) View Source
Unblock a user
conn
- connection credentialsid
- user identifier
Callback implementation for Hunter.Api.unblock/2
.
unblock_domain(conn, domain) View Source
Unblock a domain
Parameters
conn
- connection credentialsdomain
- domain to unblock
Callback implementation for Hunter.Api.unblock_domain/2
.
unfavourite(conn, id) View Source
Undo a favorite of a status
Parameters
conn
- connection credentialsid
- status identifier
Callback implementation for Hunter.Api.unfavourite/2
.
unfollow(conn, id) View Source
Unfollow a user
Parameters
conn
- connection credentialsid
- user identifier
Callback implementation for Hunter.Api.unfollow/2
.
unmute(conn, id) View Source
Unmute a user
Parameters
conn
- connection credentialsid
- user identifier
Callback implementation for Hunter.Api.unmute/2
.
unreblog(conn, id) View Source
Undo a reblog of a status
Parameters
conn
- connection credentialsid
- status identifier
Callback implementation for Hunter.Api.unreblog/2
.
update_credentials(conn, data) View Source
Make changes to the authenticated user
Parameters
conn
- connection credentialsdata
- data payload
Possible keys for payload
display_name
- name to display in the user's profilenote
- new biography for the useravatar
- base64 encoded image to display as the user's avatar (e.g.data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAADrCAYAAAA...
)header
- base64 encoded image to display as the user's header image (e.g.data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAADrCAYAAAA...
)
Callback implementation for Hunter.Api.update_credentials/2
.
upload_media(conn, file, options) View Source
Upload a media file
Parameters
conn
- connection credentialsfile
- media to be uploadedoptions
- option list
Options
description
- plain-text description of the media for accessibility (max 420 chars)focus
- two floating points, comma-delimited.
Callback implementation for Hunter.Api.upload_media/3
.
verify_credentials(conn) View Source
Retrieve account of authenticated user
Parameters
conn
- connection credentials
Callback implementation for Hunter.Api.verify_credentials/1
.