hunter v0.5.1 Hunter View Source
A Elixir client for Mastodon, a GNU Social compatible micro-blogging service
Link to this section Summary
Functions
Accepts a follow request
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
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
Load persisted application's credentials
Retrieve access token
Mute a user
Retrieve user's mutes
Initializes a client
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
Rejects a follow request
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
User agent of the client
Retrieve account of authenticated user
Returns Hunter version
Link to this section Functions
accept_follow_request(conn, id)
View Source
accept_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
accept_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
Accepts a follow request
Parameters
conn
- connection credentialsid
- follow request id
account(conn, id)
View Source
account(Hunter.Client.t(), non_neg_integer()) :: Hunter.Account.t()
account(Hunter.Client.t(), non_neg_integer()) :: Hunter.Account.t()
Retrieve account
Parameters
conn
- connection credentialsid
- account identifier
block(conn, id)
View Source
block(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
block(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
Block a user
Parameters
conn
- connection credentialsid
- user identifier
block_domain(conn, domain) View Source
Block a domain
Parameters
conn
- connection credentialsdomain
- domain to block
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
blocks(conn, options \\ [])
View Source
blocks(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
blocks(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
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
card_by_status(conn, id)
View Source
card_by_status(Hunter.Client.t(), non_neg_integer()) :: Hunter.Card.t()
card_by_status(Hunter.Client.t(), non_neg_integer()) :: Hunter.Card.t()
Retrieve a card associated with a status
Parameters
conn
- connection credentialsid
- status id
clear_notification(conn, id)
View Source
clear_notification(Hunter.Client.t(), non_neg_integer()) :: boolean()
clear_notification(Hunter.Client.t(), non_neg_integer()) :: boolean()
Dismiss a single notification
Parameters
conn
- connection credentialsid
- notification id
clear_notifications(conn)
View Source
clear_notifications(Hunter.Client.t()) :: boolean()
clear_notifications(Hunter.Client.t()) :: boolean()
Deletes all notifications from the Mastodon server for the authenticated user
Parameters
conn
- connection credentials
create_app(name, redirect_uri \\ "urn:ietf:wg:oauth:2.0:oob", scopes \\ ["read"], website \\ nil, options \\ []) 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, default:urn:ietf:wg:oauth:2.0:oob
(no redirect)scopes
- scope list, see the scope section for more details, default:read
website
- URL to the homepage of your app, default:nil
options
- option list
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
Options
save?
- persists your application information to a file, so, you can use them later. default:false
api_base_url
- specifies if you want to register an application on a different instance. default:https://mastodon.social
create_status(conn, status, options \\ [])
View Source
create_status(Hunter.Client.t(), String.t(), Keyword.t()) ::
Hunter.Status.t() | no_return()
create_status(Hunter.Client.t(), String.t(), Keyword.t()) :: Hunter.Status.t() | no_return()
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
destroy_status(conn, id)
View Source
destroy_status(Hunter.Client.t(), non_neg_integer()) :: boolean()
destroy_status(Hunter.Client.t(), non_neg_integer()) :: boolean()
Destroy status
Parameters
conn
- connection credentialsid
- status identifier
favourite(conn, id)
View Source
favourite(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
favourite(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
Favorite a status
Parameters
conn
- connection credentialsid
- status identifier
favourited_by(conn, id, options \\ [])
View Source
favourited_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
favourited_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
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
favourites(conn, options \\ [])
View Source
favourites(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]
favourites(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]
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
follow(conn, id)
View Source
follow(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
follow(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
Follow a user
Parameters
conn
- connection credentialsid
- user identifier
follow_by_uri(conn, uri)
View Source
follow_by_uri(Hunter.Client.t(), String.t()) :: Hunter.Account.t()
follow_by_uri(Hunter.Client.t(), String.t()) :: Hunter.Account.t()
Follow a remote user
Parameters
conn
- connection credentialsuri
- URI of the remote user, in the format ofusername@domain
follow_requests(conn, options \\ [])
View Source
follow_requests(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
follow_requests(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
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
followers(conn, id, options \\ [])
View Source
followers(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
followers(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
Get a list of followers
Parameters
conn
- connection credentialsid
- account identifieroptions
- options list
Options
max_id
- get a list of followers with id less than or equal this valuesince_id
- get a list of followers with id greater than this valuelimit
- maximum number of followers to get, default: 40, maximum: 80
following(conn, id, options \\ [])
View Source
following(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
following(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
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
hashtag_timeline(conn, hashtag, options \\ [])
View Source
hashtag_timeline(Hunter.Client.t(), [String.t()], Keyword.t()) :: [
Hunter.Status.t()
]
hashtag_timeline(Hunter.Client.t(), [String.t()], Keyword.t()) :: [ Hunter.Status.t() ]
Retrieve statuses from a hashtag
Parameters
conn
- connection credentialshashtag
- string listoptions
- 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
home_timeline(conn, options \\ [])
View Source
home_timeline(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]
home_timeline(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]
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
instance_info(conn)
View Source
instance_info(Hunter.Client.t()) :: Hunter.Instance.t()
instance_info(Hunter.Client.t()) :: Hunter.Instance.t()
Retrieve instance information
Parameters
conn
- connection credentials
load_credentials(name)
View Source
load_credentials(String.t()) :: Hunter.Application.t()
load_credentials(String.t()) :: Hunter.Application.t()
Load persisted application's credentials
Parameters
name
- application's name
log_in(app, username, password, base_url \\ "https://mastodon.social") View Source
Retrieve access token
Parameters
app
- application details, see:Hunter.Application.create_app/5
for more details.username
- account's emailpassword
- account's passwordbase_url
- API base url, default:https://mastodon.social
mute(conn, id)
View Source
mute(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
mute(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
Mute a user
Parameters
conn
- connection credentialsid
- user identifier
mutes(conn, options \\ [])
View Source
mutes(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
mutes(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
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
new(options \\ [])
View Source
new(Keyword.t()) :: Hunter.Client.t()
new(Keyword.t()) :: Hunter.Client.t()
Initializes a client
Options
base_url
- URL of the instance you want to connect tobearer_token
- [String] OAuth access token for your authenticated user
notification(conn, id)
View Source
notification(Hunter.Client.t(), non_neg_integer()) :: Hunter.Notification.t()
notification(Hunter.Client.t(), non_neg_integer()) :: Hunter.Notification.t()
Retrieve single notification
Parameters
conn
- connection credentialsid
- notification identifier
notifications(conn, options \\ [])
View Source
notifications(Hunter.Client.t(), Keyword.t()) :: [Hunter.Notification.t()]
notifications(Hunter.Client.t(), Keyword.t()) :: [Hunter.Notification.t()]
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
public_timeline(conn, options \\ [])
View Source
public_timeline(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]
public_timeline(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]
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
reblog(conn, id)
View Source
reblog(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
reblog(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
Reblog a status
Parameters
conn
- connection credentialsid
- status identifier
reblogged_by(conn, id, options \\ [])
View Source
reblogged_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
reblogged_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
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
reject_follow_request(conn, id)
View Source
reject_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
reject_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
Rejects a follow request
Parameters
conn
- connection credentialsid
- follow request id
relationships(conn, ids)
View Source
relationships(Hunter.Client.t(), [non_neg_integer()]) :: [
Hunter.Relationship.t()
]
relationships(Hunter.Client.t(), [non_neg_integer()]) :: [ Hunter.Relationship.t() ]
Get the relationships of authenticated user towards given other users
Parameters
conn
- connection credentialsid
- list of relationship IDs
report(conn, account_id, status_ids, comment)
View Source
report(Hunter.Client.t(), non_neg_integer(), [non_neg_integer()], String.t()) ::
Hunter.Report.t()
report(Hunter.Client.t(), non_neg_integer(), [non_neg_integer()], String.t()) :: Hunter.Report.t()
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
reports(conn)
View Source
reports(Hunter.Client.t()) :: [Hunter.Report.t()]
reports(Hunter.Client.t()) :: [Hunter.Report.t()]
Retrieve a user's reports
Parameters
conn
- connection credentials
search(conn, query, options \\ [])
View Source
search(Hunter.Client.t(), String.t(), Keyword.t()) :: Hunter.Result.t()
search(Hunter.Client.t(), String.t(), Keyword.t()) :: Hunter.Result.t()
Search for content
Parameters
conn
- connection credentialsq
- the search queryoptions
- option list
Options
resolve
- whether to resolve non-local accounts
search_account(conn, options)
View Source
search_account(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
search_account(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
Search for accounts
Parameters
conn
- connection credentialsoptions
- option list
Options
q
: what to search forlimit
: maximum number of matching accounts to return, default: 40
status(conn, id)
View Source
status(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
status(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
Retrieve status
Parameters
conn
- connection credentialsid
- status identifier
status_context(conn, id)
View Source
status_context(Hunter.Client.t(), non_neg_integer()) :: Hunter.Context.t()
status_context(Hunter.Client.t(), non_neg_integer()) :: Hunter.Context.t()
Retrieve status context
Parameters
conn
- connection credentialsid
- status identifier
statuses(conn, account_id, options \\ [])
View Source
statuses(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Status.t()
]
statuses(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Status.t() ]
Get a list of statuses by a user
Parameters
conn
- connection credentials -account_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
unblock(conn, id)
View Source
unblock(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
unblock(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
Unblock a user
conn
- connection credentialsid
- user identifier
unblock_domain(conn, domain) View Source
Unblock a domain
Parameters
conn
- connection credentialsdomain
- domain to unblock
unfavourite(conn, id)
View Source
unfavourite(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
unfavourite(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
Undo a favorite of a status
Parameters
conn
- connection credentialsid
- status identifier
unfollow(conn, id)
View Source
unfollow(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
unfollow(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
Unfollow a user
Parameters
conn
- connection credentialsid
- user identifier
unmute(conn, id)
View Source
unmute(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
unmute(Hunter.Client.t(), non_neg_integer()) :: Hunter.Relationship.t()
Unmute a user
Parameters
conn
- connection credentialsid
- user identifier
unreblog(conn, id)
View Source
unreblog(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
unreblog(Hunter.Client.t(), non_neg_integer()) :: Hunter.Status.t()
Undo a reblog of a status
Parameters
conn
- connection credentialsid
- status identifier
update_credentials(conn, data)
View Source
update_credentials(Hunter.Client.t(), map()) :: Hunter.Account.t()
update_credentials(Hunter.Client.t(), map()) :: Hunter.Account.t()
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...
)
upload_media(conn, file, options \\ [])
View Source
upload_media(Hunter.Client.t(), Path.t(), Keyword.t()) :: Hunter.Attachment.t()
upload_media(Hunter.Client.t(), Path.t(), Keyword.t()) :: Hunter.Attachment.t()
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
user_agent()
View Source
user_agent() :: String.t()
user_agent() :: String.t()
User agent of the client
verify_credentials(conn)
View Source
verify_credentials(Hunter.Client.t()) :: Hunter.Account.t()
verify_credentials(Hunter.Client.t()) :: Hunter.Account.t()
Retrieve account of authenticated user
Parameters
conn
- connection credentials
version()
View Source
version() :: String.t()
version() :: String.t()
Returns Hunter version