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

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

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

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

Retrieve a user's reports

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

User agent of the client

Retrieve account of authenticated user

Returns Hunter version

Link to this section Functions

Link to this function

accept_follow_request(conn, id) View Source
accept_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()

Accepts a follow request

Parameters

  • conn - connection credentials
  • id - follow request id

Retrieve account

Parameters

  • conn - connection credentials
  • id - account identifier

Block a user

Parameters

  • conn - connection credentials
  • id - user identifier
Link to this function

block_domain(conn, domain) View Source

Block a domain

Parameters

  • conn - connection credentials
  • domain - domain to block
Link to this function

blocked_domains(conn, options \\ []) View Source

Fetch user's blocked domains

Parameters

  • conn - connection credentials
  • options - option list

Options

  • max_id - get a list of blocks with id less than or equal this value
  • since_id - get a list of blocks with id greater than this value
  • limit - maximum number of blocks to get, default: 40, max: 80

Retrieve user's blocks

Parameters

  • conn - connection credentials

Options

  • max_id - get a list of blocks with id less than or equal this value
  • since_id - get a list of blocks with id greater than this value
  • limit - maximum number of blocks to get, default: 40, max: 80
Link to this function

card_by_status(conn, id) View Source
card_by_status(Hunter.Client.t(), non_neg_integer()) :: Hunter.Card.t()

Retrieve a card associated with a status

Parameters

  • conn - connection credentials
  • id - status id
Link to this function

clear_notification(conn, id) View Source
clear_notification(Hunter.Client.t(), non_neg_integer()) :: boolean()

Dismiss a single notification

Parameters

  • conn - connection credentials
  • id - notification id
Link to this function

clear_notifications(conn) View Source
clear_notifications(Hunter.Client.t()) :: boolean()

Deletes all notifications from the Mastodon server for the authenticated user

Parameters

  • conn - connection credentials
Link to this function

create_app(name, redirect_uri \\ "urn:ietf:wg:oauth:2.0:oob", scopes \\ ["read"], website \\ nil, options \\ []) View Source
create_app(String.t(), String.t(), [String.t()], nil | String.t(), Keyword.t()) ::
  Hunter.Application.t() | no_return()

Register a new OAuth client app on the target instance

Parameters

  • name - name of your application
  • redirect_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 data
  • write - post statuses and upload media for statuses
  • follow - 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
Link to this function

create_status(conn, status, options \\ []) View Source
create_status(Hunter.Client.t(), String.t(), Keyword.t()) ::
  Hunter.Status.t() | no_return()

Create new status

Parameters

  • conn - connection credentials
  • status - text of the status
  • options - option list

Options

  • in_reply_to_id - local ID of the status you want to reply to
  • media_ids - list of media IDs to attach to the status (maximum: 4)
  • sensitive - whether the media of the status is NSFW
  • spoiler_text - text to be shown as a warning before the actual content
  • visibility - either direct, private, unlisted or public
Link to this function

destroy_status(conn, id) View Source
destroy_status(Hunter.Client.t(), non_neg_integer()) :: boolean()

Destroy status

Parameters

  • conn - connection credentials
  • id - status identifier

Favorite a status

Parameters

  • conn - connection credentials
  • id - status identifier
Link to this function

favourited_by(conn, id, options \\ []) View Source
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 credentials
  • id - status identifier
  • options - option list

Options

  • max_id - get a list of favourited by ids less than or equal this value
  • since_id - get a list of favourited by ids greater than this value
  • limit - maximum number of favourited by to get, default: 40, max: 80
Link to this function

favourites(conn, options \\ []) View Source
favourites(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]

Fetch a user's favourites

Parameters

  • conn - connection credentials
  • options - option list

Options

  • max_id - get a list of favourites with id less than or equal this value
  • since_id - get a list of favourites with id greater than this value
  • limit - maximum of favourites to get, default: 20, max: 40

Follow a user

Parameters

  • conn - connection credentials
  • id - user identifier
Link to this function

follow_by_uri(conn, uri) View Source
follow_by_uri(Hunter.Client.t(), String.t()) :: Hunter.Account.t()

Follow a remote user

Parameters

  • conn - connection credentials
  • uri - URI of the remote user, in the format of username@domain
Link to this function

follow_requests(conn, options \\ []) View Source
follow_requests(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]

Retrieve a list of follow requests

Parameters

  • conn - connection credentials
  • options - option list

Options

  • max_id - get a list of follow requests with id less than or equal this value
  • since_id - get a list of follow requests with id greater than this value
  • limit - maximum number of requests to get, default: 40, max: 80
Link to this function

followers(conn, id, options \\ []) View Source

Get a list of followers

Parameters

  • conn - connection credentials
  • id - account identifier
  • options - options list

Options

  • max_id - get a list of followers with id less than or equal this value
  • since_id - get a list of followers with id greater than this value
  • limit - maximum number of followers to get, default: 40, maximum: 80
Link to this function

following(conn, id, options \\ []) View Source

Get a list of followed accounts

Parameters

  • conn - connection credentials
  • id - account identifier
  • options - options list

Options

  • max_id - get a list of followings with id less than or equal this value
  • since_id - get a list of followings with id greater than this value
  • limit - maximum number of followings to get, default: 40, maximum: 80
Link to this function

hashtag_timeline(conn, hashtag, options \\ []) View Source
hashtag_timeline(Hunter.Client.t(), [String.t()], Keyword.t()) :: [
  Hunter.Status.t()
]

Retrieve statuses from a hashtag

Parameters

  • conn - connection credentials
  • hashtag - string list
  • options - option list

Options

  • local - only return statuses originating from this instance
  • max_id - get a list of timelines with id less than or equal this value
  • since_id - get a list of timelines with id greater than this value
  • limit - maximum number of statuses on the requested timeline to get, default: 20, max: 40
Link to this function

home_timeline(conn, options \\ []) View Source
home_timeline(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]

Retrieve statuses from the home timeline

Parameters

  • conn - connection credentials
  • options - option list

Options

  • max_id - get a list of timelines with id less than or equal this value
  • since_id - get a list of timelines with id greater than this value
  • limit - maximum number of statuses on the requested timeline to get, default: 20, max: 40

Retrieve instance information

Parameters

  • conn - connection credentials
Link to this function

load_credentials(name) View Source
load_credentials(String.t()) :: Hunter.Application.t()

Load persisted application's credentials

Parameters

  • name - application's name
Link to this function

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 email
  • password - account's password
  • base_url - API base url, default: https://mastodon.social

Mute a user

Parameters

  • conn - connection credentials
  • id - user identifier

Retrieve user's mutes

Parameters

  • conn - connection credentials
  • options - option list

Options

  • max_id - get a list of mutes with id less than or equal this value
  • since_id - get a list of mutes with id greater than this value
  • limit - maximum number of mutes to get, default: 40, max: 80

Initializes a client

Options

  • base_url - URL of the instance you want to connect to
  • bearer_token - [String] OAuth access token for your authenticated user

Retrieve single notification

Parameters

  • conn - connection credentials
  • id - notification identifier
Link to this function

notifications(conn, options \\ []) View Source
notifications(Hunter.Client.t(), Keyword.t()) :: [Hunter.Notification.t()]

Retrieve user's notifications

Parameters

  • conn - connection credentials
  • options - option list

Options

  • max_id - get a list of notifications with id less than or equal this value
  • since_id - get a list of notifications with id greater than this value
  • limit - maximum number of notifications to get, default: 15, max: 30
Link to this function

public_timeline(conn, options \\ []) View Source
public_timeline(Hunter.Client.t(), Keyword.t()) :: [Hunter.Status.t()]

Retrieve statuses from the public timeline

Parameters

  • conn - connection credentials
  • options - option list

Options

  • local - only return statuses originating from this instance
  • max_id - get a list of timelines with id less than or equal this value
  • since_id - get a list of timelines with id greater than this value
  • limit - maximum number of statuses on the requested timeline to get, default: 20, max: 40

Reblog a status

Parameters

  • conn - connection credentials
  • id - status identifier
Link to this function

reblogged_by(conn, id, options \\ []) View Source

Fetch the list of users who reblogged the status.

Parameters

  • conn - connection credentials
  • id - status identifier
  • options - option list

Options

  • max_id - get a list of reblogged by ids less than or equal this value
  • since_id - get a list of reblogged by ids greater than this value
  • limit - maximum number of reblogged by to get, default: 40, max: 80
Link to this function

reject_follow_request(conn, id) View Source
reject_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()

Rejects a follow request

Parameters

  • conn - connection credentials
  • id - follow request id
Link to this function

relationships(conn, ids) View Source
relationships(Hunter.Client.t(), [non_neg_integer()]) :: [
  Hunter.Relationship.t()
]

Get the relationships of authenticated user towards given other users

Parameters

  • conn - connection credentials
  • id - list of relationship IDs
Link to this function

report(conn, account_id, status_ids, comment) View Source

Report a user

Parameters

  • conn - connection credentials
  • account_id - the ID of the account to report
  • status_ids - the IDs of statuses to report
  • comment - a comment to associate with the report

Retrieve a user's reports

Parameters

  • conn - connection credentials
Link to this function

search(conn, query, options \\ []) View Source

Search for content

Parameters

  • conn - connection credentials
  • q - the search query
  • options - option list

Options

  • resolve - whether to resolve non-local accounts
Link to this function

search_account(conn, options) View Source
search_account(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]

Search for accounts

Parameters

  • conn - connection credentials
  • options - option list

Options

  • q: what to search for
  • limit: maximum number of matching accounts to return, default: 40

Retrieve status

Parameters

  • conn - connection credentials
  • id - status identifier

Retrieve status context

Parameters

  • conn - connection credentials
  • id - status identifier
Link to this function

statuses(conn, account_id, options \\ []) View Source

Get a list of statuses by a user

Parameters

  • conn - connection credentials -
  • account_id - account identifier
  • options - option list

Options

  • only_media - only return Hunter.Status.t that have media attachments
  • exclude_replies - skip statuses that reply to other statuses
  • max_id - get a list of statuses with id less than or equal this value
  • since_id - get a list of statuses with id greater than this value
  • limit - maximum number of statuses to get, default: 20, max: 40

Unblock a user

  • conn - connection credentials
  • id - user identifier
Link to this function

unblock_domain(conn, domain) View Source

Unblock a domain

Parameters

  • conn - connection credentials
  • domain - domain to unblock

Undo a favorite of a status

Parameters

  • conn - connection credentials
  • id - status identifier

Unfollow a user

Parameters

  • conn - connection credentials
  • id - user identifier

Unmute a user

Parameters

  • conn - connection credentials
  • id - user identifier

Undo a reblog of a status

Parameters

  • conn - connection credentials
  • id - status identifier
Link to this function

update_credentials(conn, data) View Source
update_credentials(Hunter.Client.t(), map()) :: Hunter.Account.t()

Make changes to the authenticated user

Parameters

  • conn - connection credentials
  • data - data payload

Possible keys for payload

  • display_name - name to display in the user's profile
  • note - new biography for the user
  • avatar - 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...)
Link to this function

upload_media(conn, file, options \\ []) View Source

Upload a media file

Parameters

  • conn - connection credentials
  • file - media to be uploaded
  • options - option list

Options

  • description - plain-text description of the media for accessibility (max 420 chars)
  • focus - two floating points, comma-delimited
Link to this function

user_agent() View Source
user_agent() :: String.t()

User agent of the client

Link to this function

verify_credentials(conn) View Source
verify_credentials(Hunter.Client.t()) :: Hunter.Account.t()

Retrieve account of authenticated user

Parameters

  • conn - connection credentials

Returns Hunter version