Constructor
new MastodonServer(domain)
Constructs a
MastodonServer
instance for the given domain.
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The domain of the Mastodon server. |
Properties:
Name | Type | Description |
---|---|---|
domain |
string | Domain of the server this MastodonServer instance interacts with. |
logger |
Logger | Logger instance for this server. |
Members
trendUrl
Build a URL for a trending type (tags, links, toots).
v1Url
Build a v1 API URL.
v2Url
Build a v2 API URL.
Methods
(async) fetchServerInfo() → {Promise.<InstanceResponse>}
Fetch the mastodon.v2.Instance (MAU,
version, languages, rules, etc) for this server.
Returns:
The instance info or null if not available.
- Type
- Promise.<InstanceResponse>
(async) fetchTrendingLinks() → {Promise.<Array.<TrendingLink>>}
Get the links that are trending on this server.
Returns:
Array of trending links.
- Type
- Promise.<Array.<TrendingLink>>
(async) fetchTrendingStatuses() → {Promise.<Array.<Toot>>}
Fetch
Toot
s that are trending on this server.
Note: Returned Toot
s have not had Toot.completeProperties
called yet.
Returns:
Array of trending Toot objects.
- Type
- Promise.<Array.<Toot>>
(async) fetchTrendingTags() → {Promise.<Array.<TagWithUsageCounts>>}
Get the tags that are trending on this server.
Returns:
Array of trending tags with usage counts.
- Type
- Promise.<Array.<TagWithUsageCounts>>
(async, static) fediverseTrendingLinks() → {Promise.<Array.<TrendingLink>>}
Get the top trending links from all servers in the fediverse.
Returns:
Array of trending links across all servers.
- Type
- Promise.<Array.<TrendingLink>>
(async, static) fediverseTrendingTags() → {Promise.<TagList>}
Get the top trending tags from all servers, minus any invalid or muted tags.
Returns:
TagList
of trending tags across all servers.
- Type
- Promise.<TagList>
(async, static) fediverseTrendingToots() → {Promise.<Array.<Toot>>}
Pull public top trending
Toot
s on popular mastodon servers including
from accounts user doesn't follow.
Returns:
Array of trending Toots across all servers.
- Type
- Promise.<Array.<Toot>>
(async, static) getMastodonInstances() → {Promise.<MastodonInstances>}
Get the server names that are most relevant to the user, meaning servers that a lot of the
accounts the user follows live on.
Returns:
Dictionary of MastodonInstances keyed by domain.
- Type
- Promise.<MastodonInstances>
(async, static) getTrendingData() → {Promise.<TrendingData>}
Collect all three kinds of trending data (links, tags,
Toot
s) in one call.
Returns:
Object containing trending links, tags, toots, and servers.
- Type
- Promise.<TrendingData>