Class: Account

Account()

Extends base Mastodon Account with additional helper methods and properties. The base class's properties are not documented here;

Constructor

new Account()

Properties:
Name Type Attributes Description
asBooleanFilterOption BooleanFilterOption Boolean filter option representation.
description string A string describing the account (displayName + webfingerURI).
homeserver string The account's home server domain.
isFollowed boolean <optional>
True if this account is followed by the Fedialgo user.
isFollower boolean <optional>
True if this account is following the Fedialgo user.*
isLocal boolean True if this account is on the same Mastodon server as the Fedialgo user.
localServerUrl string The account's URL on the user's home server.
webfingerURI string The webfinger URI for the account.
Implements:
  • AccountObj

Extends

  • mastodon.v1.Account

Methods

displayNameFullHTML(fontSizeopt) → {string}

Returns HTML-ish string combining the displayName (with custom emojis as <img> tags) and the webfingerURI.
Parameters:
Name Type Attributes Default Description
fontSize number <optional>
DEFAULT_FONT_SIZE Size in pixels of any emoji <img> tags. Should match surrounding txt.
Returns:
Type
string

displayNameWithEmojis(fontSizeopt) → {string}

Returns HTML-ish string that is the display name with custom emojis as <img> tags.
Parameters:
Name Type Attributes Default Description
fontSize number <optional>
DEFAULT_FONT_SIZE Size in pixels of any emoji <img> tags. Should match surrounding txt.
Returns:
Type
string

(async) homeInstanceInfo() → {Promise.<InstanceResponse>}

Get this account's Mastodon server (AKA Instance) from API. Note that not all servers provide this!
Returns:
Type
Promise.<InstanceResponse>

noteWithAccountInfo(fontSizeopt) → {Promise.<InstanceResponse>}

HTML combining the account bio (AKA the Account.note property) with createdAt, follower count, and toots count.
Parameters:
Name Type Attributes Default Description
fontSize number <optional>
DEFAULT_FONT_SIZE Size of returned HTML text (not just emoji <img> tags).
Returns:
Type
Promise.<InstanceResponse>

(static) build(account) → {module:api/objects/account~Account}

Alternate constructor because class-transformer doesn't work with constructor arguments.
Parameters:
Name Type Description
account AccountLike The Mastodon Account (or similar) to build from.
Returns:
Constructed Account instance with extra methods and properties.
Type
module:api/objects/account~Account

(static) buildAccountNames(accounts) → {AccountNames}

Build a dictionary from Accounts' webfingerURI to the Account object for easy lookup.
Parameters:
Name Type Description
accounts Array.<module:api/objects/account~Account> Array of Account objects.
Returns:
Dictionary from webfingerURI to Account.
Type
AccountNames

(static) countAccounts(accounts) → {StringNumberDict}

Dictionary from account's webfingerURI to number of times it appears in the accounts argument.
Parameters:
Name Type Description
accounts Array.<module:api/objects/account~Account> Array of Account objects.
Returns:
Dictionary from webfingerURI to count of appearances.
Type
StringNumberDict

(static) countAccountsWithObj(accounts) → {AccountCount}

Dictionary from account's webfingerURI to an object with the account and count.
Parameters:
Name Type Description
accounts Array.<module:api/objects/account~Account> Array of Account objects.
Returns:
Dictionary from webfingerURI to {account, count}.
Type
AccountCount

(static) logSuspendedAccounts(accounts, logPrefixopt)

Logs all suspended accounts in the provided array.
Parameters:
Name Type Attributes Default Description
accounts Array.<module:api/objects/account~Account> Array of Account objects.
logPrefix string <optional>
'logSuspendedAccounts()' Log prefix.