Hunter.Notification (hunter v0.6.0)

Copy Markdown View Source

Notification entity

This module defines a Hunter.Notification struct and the main functions for working with Notifications.

Fields

  • id - The notification ID
  • type - One of: "mention", "reblog", "favourite", "follow"
  • created_at - The time the notification was created
  • account - The Hunter.Account sending the notification to the user
  • status - The Hunter.Status associated with the notification, if applicable

Summary

Functions

Dismiss a single notification

Deletes all notifications from the Mastodon server for the authenticated user

Retrieve single notification

Retrieve user's notifications

Types

t()

@type t() :: %Hunter.Notification{
  account: Hunter.Account.t(),
  created_at: String.t(),
  id: String.t(),
  status: Hunter.Status.t(),
  type: String.t()
}

Functions

clear_notification(conn, id)

@spec clear_notification(Hunter.Client.t(), non_neg_integer()) :: boolean()

Dismiss a single notification

Parameters

  • conn - connection credentials
  • id - notification id

clear_notifications(conn)

@spec clear_notifications(Hunter.Client.t()) :: boolean()

Deletes all notifications from the Mastodon server for the authenticated user

Parameters

  • conn - connection credentials

notification(conn, id)

@spec notification(Hunter.Client.t(), non_neg_integer()) :: t()

Retrieve single notification

Parameters

  • conn - connection credentials
  • id - notification identifier

Examples

Hunter.Notification.notification(conn, 17_476)
#=> %Hunter.Notification{account: %{"acct" => "paperswelove@mstdn.io", ...}

notifications(conn, options \\ [])

@spec notifications(Hunter.Client.t(), Keyword.t()) :: [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

Examples

Hunter.Notification.notifications(conn)
#=> [%Hunter.Notification{account: %{"acct" => "paperswelove@mstdn.io", ...}]