hunter v0.5.1 Hunter.Api.HTTPClient View Source

HTTP Client for Hunter

Link to this section Summary

Functions

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

Register a new OAuth client app on the target instance

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

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

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

Retrieve account

Parameters

  • conn - connection credentials
  • id - account identifier

Callback implementation for Hunter.Api.account/2.

Block a user

Parameters

  • conn - connection credentials
  • id - user identifier

Callback implementation for Hunter.Api.block/2.

Link to this function

block_domain(conn, domain) View Source

Block a domain

Parameters

  • conn - connection credentials
  • domain - domain to block

Callback implementation for Hunter.Api.block_domain/2.

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

Callback implementation for Hunter.Api.blocked_domains/2.

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

Callback implementation for Hunter.Api.blocks/2.

Link to this function

card_by_status(conn, id) View Source

Retrieve a card associated with a status

Parameters

  • conn - connection credentials
  • id - status id

Callback implementation for Hunter.Api.card_by_status/2.

Link to this function

clear_notification(conn, id) View Source

Dismiss a single notification

Parameters

  • conn - connection credentials
  • id - notification id

Callback implementation for Hunter.Api.clear_notification/2.

Link to this function

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.

Link to this function

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 application
  • redirect_uri - where the user should be redirected after authorization, for no redirect, use urn:ietf:wg:oauth:2.0:oob
  • scopes - scope list, see the scope section for more details
  • website - URL to the homepage of your app
  • base_url - base url

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

Callback implementation for Hunter.Api.create_app/5.

Link to this function

create_status(conn, status, options) View Source

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

Callback implementation for Hunter.Api.create_status/3.

Link to this function

destroy_status(conn, id) View Source

Destroy status

Parameters

  • conn - connection credentials
  • id - status identifier

Callback implementation for Hunter.Api.destroy_status/2.

Favorite a status

Parameters

  • conn - connection credentials
  • id - status identifier

Callback implementation for Hunter.Api.favourite/2.

Link to this function

favourited_by(conn, id, options) View Source

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

Callback implementation for Hunter.Api.favourited_by/3.

Link to this function

favourites(conn, options) View Source

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

Callback implementation for Hunter.Api.favourites/2.

Follow a user

Parameters

  • conn - connection credentials
  • id - user id

Callback implementation for Hunter.Api.follow/2.

Link to this function

follow_by_uri(conn, uri) View Source

Follow a remote user

Parameters

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

Callback implementation for Hunter.Api.follow_by_uri/2.

Link to this function

follow_request_action(conn, id, action) View Source

Accepts or Rejects a follow request

Parameters

  • conn - connection credentials
  • id - follow request id
  • action - action to take

Actions

  • :authorize - authorize a follow request
  • :reject - reject a follow request

Callback implementation for Hunter.Api.follow_request_action/3.

Link to this function

follow_requests(conn, options) View Source

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

Callback implementation for Hunter.Api.follow_requests/2.

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 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

Callback implementation for Hunter.Api.followers/3.

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

Callback implementation for Hunter.Api.following/3.

Link to this function

hashtag_timeline(conn, hashtag, options) View Source

Retrieve statuses from a hashtag

Parameters

  • conn - connection credentials
  • hashtag - list of strings
  • 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

Callback implementation for Hunter.Api.hashtag_timeline/3.

Link to this function

home_timeline(conn, options) View Source

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

Callback implementation for Hunter.Api.home_timeline/2.

Retrieve instance information

Parameters

  • conn - connection credentials

Callback implementation for Hunter.Api.instance_info/1.

Link to this function

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

Callback implementation for Hunter.Api.log_in/4.

Mute a user

Parameters

  • conn - connection credentials
  • id - user identifier

Callback implementation for Hunter.Api.mute/2.

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

Callback implementation for Hunter.Api.mutes/2.

Retrieve single notification

Parameters

  • conn - connection credentials
  • id - notification identifier

Callback implementation for Hunter.Api.notification/2.

Link to this function

notifications(conn, options) View Source

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

Callback implementation for Hunter.Api.notifications/2.

Link to this function

public_timeline(conn, options) View Source

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

Callback implementation for Hunter.Api.public_timeline/2.

Reblog a status

Parameters

  • conn - connection credentials
  • id - status identifier

Callback implementation for Hunter.Api.reblog/2.

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

Callback implementation for Hunter.Api.reblogged_by/3.

Link to this function

relationships(conn, ids) View Source

Get the relationships of authenticated user towards given other users

Parameters

  • conn - connection credentials
  • id - list of relationship IDs

Callback implementation for Hunter.Api.relationships/2.

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

Callback implementation for Hunter.Api.report/4.

Retrieve a user's reports

Parameters

  • conn - connection credentials

Callback implementation for Hunter.Api.reports/1.

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

Callback implementation for Hunter.Api.search/3.

Link to this function

search_account(conn, options) View Source

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

Callback implementation for Hunter.Api.search_account/2.

Retrieve status

Parameters

  • conn - connection credentials
  • id - status identifier

Callback implementation for Hunter.Api.status/2.

Link to this function

status_context(conn, id) View Source

Retrieve status context

Parameters

  • conn - connection credentials
  • id - status identifier

Callback implementation for Hunter.Api.status_context/2.

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

Callback implementation for Hunter.Api.statuses/3.

Unblock a user

  • conn - connection credentials
  • id - user identifier

Callback implementation for Hunter.Api.unblock/2.

Link to this function

unblock_domain(conn, domain) View Source

Unblock a domain

Parameters

  • conn - connection credentials
  • domain - domain to unblock

Callback implementation for Hunter.Api.unblock_domain/2.

Undo a favorite of a status

Parameters

  • conn - connection credentials
  • id - status identifier

Callback implementation for Hunter.Api.unfavourite/2.

Unfollow a user

Parameters

  • conn - connection credentials
  • id - user identifier

Callback implementation for Hunter.Api.unfollow/2.

Unmute a user

Parameters

  • conn - connection credentials
  • id - user identifier

Callback implementation for Hunter.Api.unmute/2.

Undo a reblog of a status

Parameters

  • conn - connection credentials
  • id - status identifier

Callback implementation for Hunter.Api.unreblog/2.

Link to this function

update_credentials(conn, data) View Source

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...)

Callback implementation for Hunter.Api.update_credentials/2.

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.

Callback implementation for Hunter.Api.upload_media/3.

Link to this function

verify_credentials(conn) View Source

Retrieve account of authenticated user

Parameters

  • conn - connection credentials

Callback implementation for Hunter.Api.verify_credentials/1.