masto
Version:
Mastodon API client for JavaScript, TypeScript, Node.js, browsers
1,307 lines (1,251 loc) • 212 kB
TypeScript
import { CustomError } from 'ts-custom-error';
declare class MastoUnexpectedError extends CustomError {
}
declare class MastoDeserializeError extends CustomError {
readonly contentType: string;
readonly data: unknown;
constructor(message: string, contentType: string, data: unknown, options?: ErrorOptions);
}
type MastoErrorType = "ERR_BLOCKED" | "ERR_UNREACHABLE" | "ERR_TAKEN" | "ERR_RESERVED" | "ERR_ACCEPTED" | "ERR_BLANK" | "ERR_INVALID" | "ERR_TOO_LONG" | "ERR_TOO_SHORT" | "ERR_INCLUSION";
interface MastoHttpErrorDetail {
readonly error: MastoErrorType;
readonly description: string;
}
type MastoHttpErrorDetails = Record<string, readonly MastoHttpErrorDetail[]>;
interface MastoHttpErrorProps {
readonly statusCode: number;
readonly message: string;
readonly description?: string;
readonly details?: MastoHttpErrorDetails;
readonly additionalProperties?: Record<string, unknown>;
}
declare class MastoHttpError extends CustomError {
readonly statusCode: number;
readonly description?: string;
readonly details?: MastoHttpErrorDetails;
readonly additionalProperties?: Record<string, unknown>;
constructor(props: MastoHttpErrorProps, errorOptions?: ErrorOptions);
}
declare class MastoInvalidArgumentError extends CustomError {
}
declare class MastoTimeoutError extends CustomError {
}
declare class MastoWebSocketError extends CustomError {
constructor(message: string, options?: ErrorOptions);
}
type Encoding = "none" | "json" | "multipart-form" | "querystring";
interface HttpMetaParams<T extends Encoding = "none"> {
readonly encoding?: T;
readonly requestInit?: Omit<RequestInit, "body" | "method">;
}
type LogType = "debug" | "info" | "warn" | "error";
/**
* Represents a custom emoji.
* @see https://docs.joinmastodon.org/entities/CustomEmoji/
*/
interface CustomEmoji {
/** The name of the custom emoji. */
shortcode: string;
/** A link to the custom emoji. */
url: string;
/** A link to a static copy of the custom emoji. */
staticUrl: string;
/** Whether this Emoji should be visible in the picker or unlisted. */
visibleInPicker: boolean;
/** Used for sorting custom emoji in the picker. */
category?: string | null;
}
/**
* Represents a custom user role that grants permissions.
* @see https://docs.joinmastodon.org/entities/Role/
*/
interface Role {
/** The ID of the Role in the database. */
id: number;
/** The name of the role. */
name: string;
/** The hex code assigned to this role. If no hex code is assigned, the string will be empty */
color: string;
/** An index for the role’s position. The higher the position, the more priority the role has over other roles. */
position: number;
/** A bitmask that represents the sum of all permissions granted to the role. */
permissions: number;
/** Whether the role is publicly visible as a badge on user profiles. */
highlighted: boolean;
/** The date that the role was created. */
createdAt: string;
/** The date that the role was updated. */
updatedAt: string;
}
/**
* Represents an application that interfaces with the REST API to access accounts or post statuses.
* @see https://docs.joinmastodon.org/entities/application/
*/
interface Application {
/** The name of your application. */
name: string;
/** The website associated with your application. */
website?: string | null;
/** Used for Push Streaming API. Returned with POST /api/v1/apps. Equivalent to PushSubscription#server_key */
vapidKey?: string | null;
}
interface Client$3 extends Application {
/** Client ID key, to be used for obtaining OAuth tokens */
clientId?: string | null;
/** Client secret key, to be used for obtaining OAuth tokens */
clientSecret?: string | null;
}
/**
* Represents a keyword that, if matched, should cause the filter action to be taken.
* @see https://docs.joinmastodon.org/entities/FilterKeyword/
*/
interface FilterKeyword {
/** The ID of the FilterKeyword in the database. */
id: string;
/** The phrase to be matched against. */
keyword: string;
/** Should the filter consider word boundaries? See [implementation guidelines](https://docs.joinmastodon.org/api/guidelines/#filters) for filters. */
wholeWord: boolean;
}
/**
* Represents a status ID that, if matched, should cause the filter action to be taken.
* @see https://docs.joinmastodon.org/entities/FilterStatus/
*/
interface FilterStatus {
/** The ID of the FilterStatus in the database. */
id: string;
/** The ID of the filtered Status in the database. */
statusId: string;
}
type FilterContext$1 = "home" | "notifications" | "public" | "thread" | "account";
type FilterAction = "warn" | "hide";
/**
* Represents a user-defined filter for determining which statuses should not be shown to the user.
* @see https://docs.joinmastodon.org/entities/filter/
*/
interface Filter$1 {
/** The ID of the filter in the database. */
id: string;
/** A title given by the user to name the filter. */
title: string;
/** The contexts in which the filter should be applied. */
context: FilterContext$1[];
/** When the filter should no longer be applied */
expiresAt?: string | null;
/**
* The action to be taken when a status matches this filter.
*
* `warn` = show a warning that identifies the matching filter by title, and allow the user to expand the filtered status. This is the default (and unknown values should be treated as equivalent to warn).
*
* `hide` = do not show this status if it is received
*/
filterAction: FilterAction;
/** The keywords grouped under this filter. */
keywords: FilterKeyword[];
/** The statuses grouped under this filter. */
statuses: FilterStatus[];
}
/**
* Represents a filter whose keywords matched a given status.
* @see https://docs.joinmastodon.org/entities/FilterResult/
*/
interface FilterResult {
/** The filter that was matched. */
filter: Filter$1;
/** The keyword within the filter that was matched. */
keywordMatches: string[] | null;
/** The status ID within the filter that was matched. */
statusMatches: string[] | null;
}
type MediaAttachmentType = "image" | "video" | "gifv" | "audio" | "unknown";
interface MediaAttachmentMetaImage {
width: number;
height: number;
size: string;
aspect: number;
}
interface MediaAttachmentMetaVideo {
width: number;
height: number;
frameRate: string;
duration: number;
bitrate: number;
aspect: number;
}
interface MediaAttachmentMetaFocus {
x: number;
y: number;
}
interface MediaAttachmentMetaColors {
background: string;
foreground: string;
accent: string;
}
interface MediaAttachmentMeta {
small?: MediaAttachmentMetaImage | MediaAttachmentMetaVideo | null;
original?: MediaAttachmentMetaImage | MediaAttachmentMetaVideo | null;
focus?: MediaAttachmentMetaFocus | null;
colors?: MediaAttachmentMetaColors | null;
}
/**
* Represents a file or media MediaAttachment that can be added to a status.
* @see https://docs.joinmastodon.org/entities/MediaAttachment/
*/
interface MediaAttachment {
/** The ID of the MediaAttachment in the database. */
id: string;
/** The type of the MediaAttachment. */
type: MediaAttachmentType;
/** The location of the original full-size MediaAttachment. */
url?: string | null;
/** The location of a scaled-down preview of the MediaAttachment. */
previewUrl: string;
/** The location of the full-size original MediaAttachment on the remote website. */
remoteUrl?: string | null;
/** Remote version of previewUrl */
previewRemoteUrl?: string | null;
/** A shorter URL for the MediaAttachment. */
textUrl?: string | null;
/** Metadata returned by Paperclip. */
meta?: MediaAttachmentMeta | null;
/**
* Alternate text that describes what is in the media MediaAttachment,
* to be used for the visually impaired or when media MediaAttachments do not load.
*/
description?: string | null;
/**
* A hash computed by the BlurHash algorithm,
* for generating colorful preview thumbnails when media has not been downloaded yet.
*/
blurhash?: string | null;
}
interface PollOption {
/** The text value of the poll option. String. */
title: string;
/** The number of received votes for this option. Number, or null if results are not published yet. */
votesCount?: number;
/** Custom emoji to be used for rendering poll options. */
emojis: CustomEmoji[];
}
/**
* Represents a poll attached to a status.
* @see https://docs.joinmastodon.org/entities/poll/
*/
interface Poll {
/** The ID of the poll in the database. */
id: string;
/** When the poll ends. */
expiresAt?: string | null;
/** Is the poll currently expired? */
expired: boolean;
/** Does the poll allow multiple-choice answers? */
multiple: boolean;
/** How many votes have been received. */
votesCount: number;
/** How many unique accounts have voted on a multiple-choice poll. */
votersCount?: number | null;
/** When called with a user token, has the authorized user voted? */
voted?: boolean;
/**
* When called with a user token, which options has the authorized user chosen?
* Contains an array of index values for options.
*/
ownVotes?: number[] | null;
/** Possible answers for the poll. */
options: PollOption[];
}
/**
* Represents daily usage history of a hashtag.
*/
interface TagHistory$1 {
/** UNIX timestamp on midnight of the given day. */
day: string;
/** the counted usage of the tag within that day. */
uses: string;
/** the total of accounts using the tag within that day. */
accounts: string;
}
/**
* Represents a hashtag used within the content of a status.
* @see https://docs.joinmastodon.org/entities/tag/
*/
interface Tag$1 {
/** The value of the hashtag after the # sign. */
name: string;
/** A link to the hashtag on the instance. */
url: string;
/** Usage statistics for given days. */
history?: TagHistory$1[] | null;
/** Whether the current token’s authorized user is following this tag. */
following?: boolean | null;
}
type PreviewCardType = "link" | "photo" | "video" | "rich";
/**
* Represents an author in a rich preview card.
* @see https://docs.joinmastodon.org/entities/PreviewCardAuthor/
*/
interface PreviewCardAuthor {
/** The original resource author’s name. Replaces the deprecated author_name attribute of the preview card. */
name: string;
/** A link to the author of the original resource. Replaces the deprecated author_url attribute of the preview card. */
url: string;
/** The fediverse account of the author. */
account: Account$1 | null;
}
/**
* Represents a rich preview card that is generated using OpenGraph tags from a URL.
* @see https://docs.joinmastodon.org/entities/PreviewCard
*/
interface PreviewCard {
/** Location of linked resource. */
url: string;
/** Title of linked resource. */
title: string;
/** Description of preview. */
description: string;
/** The type of the preview card. */
type: PreviewCardType;
/** Blurhash */
blurhash: string;
/** Fediverse account of the authors of the original resource. */
authors: PreviewCardAuthor[];
/**
* The author of the original resource.
* @deprecated Use `authors` instead
*/
authorName?: string | null;
/**
* A link to the author of the original resource.
* @deprecated Use `authors` instead
*/
authorUrl?: string | null;
/** The provider of the original resource. */
providerName?: string | null;
/** A link to the provider of the original resource. */
providerUrl?: string | null;
/** HTML to be used for generating the preview card. */
html?: string | null;
/** Width of preview, in pixels. */
width?: number | null;
/** Height of preview, in pixels. */
height?: number | null;
/** Preview thumbnail. */
image?: string | null;
/** Used for photo embeds, instead of custom `html`. */
embedUrl: string;
/** @see https://github.com/mastodon/mastodon/pull/27503 */
language?: string;
}
interface TrendLink extends PreviewCard {
history: TagHistory$1[];
}
/**
* Represents a mention of a user within the content of a status.
* @see https://docs.joinmastodon.org/entities/mention/
*/
interface StatusMention {
/** The account id of the mentioned user. */
id: string;
/** The username of the mentioned user. */
username: string;
/** The location of the mentioned user's profile. */
url: string;
/**
* The WebFinger acct: URI of the mentioned user.
* Equivalent to username for local users, or `username@domain` for remote users.
*/
acct: string;
}
type StatusVisibility = "public" | "unlisted" | "private" | "direct";
/**
* Represents a status posted by an account.
* @see https://docs.joinmastodon.org/entities/status/
*/
interface Status {
/** ID of the status in the database. */
id: string;
/** URI of the status used for federation. */
uri: string;
/** The date when this status was created. */
createdAt: string;
/** Timestamp of when the status was last edited. */
editedAt: string | null;
/** The account that authored this status. */
account: Account$1;
/** HTML-encoded status content. */
content: string;
/** Visibility of this status. */
visibility: StatusVisibility;
/** Is this status marked as sensitive content? */
sensitive: boolean;
/** Subject or summary line, below which status content is collapsed until expanded. */
spoilerText: string;
/** Media that is attached to this status. */
mediaAttachments: MediaAttachment[];
/** The application used to post this status. */
application: Application;
/** Mentions of users within the status content. */
mentions: StatusMention[];
/** Hashtags used within the status content. */
tags: Tag$1[];
/** Custom emoji to be used when rendering status content. */
emojis: CustomEmoji[];
/** How many boosts this status has received. */
reblogsCount: number;
/** How many favourites this status has received. */
favouritesCount: number;
/** If the current token has an authorized user: The filter and keywords that matched this status. */
filtered?: FilterResult[];
/** How many replies this status has received. */
repliesCount: number;
/** A link to the status's HTML representation. */
url?: string | null;
/** ID of the status being replied. */
inReplyToId?: string | null;
/** ID of the account being replied to. */
inReplyToAccountId?: string | null;
/** The status being reblogged. */
reblog?: Status | null;
/** The poll attached to the status. */
poll?: Poll | null;
/** Preview card for links included within status content. */
card?: PreviewCard | null;
/** Primary language of this status. */
language?: string | null;
/**
* Plain-text source of a status. Returned instead of `content` when status is deleted,
* so the user may redraft from the source text without the client having
* to reverse-engineer the original text from the HTML content.
*/
text?: string | null;
/** Have you favourited this status? */
favourited?: boolean | null;
/** Have you boosted this status? */
reblogged?: boolean | null;
/** Have you muted notifications for this status's conversation? */
muted?: boolean | null;
/** Have you bookmarked this status? */
bookmarked?: boolean | null;
/** Have you pinned this status? Only appears if the status is pin-able. */
pinned?: boolean | null;
}
/**
* Represents display or publishing preferences of user's own account.
* Returned as an additional entity when verifying and updated credentials, as an attribute of Account.
* @see https://docs.joinmastodon.org/entities/source/
*/
interface AccountSource {
/** Profile bio. */
note: string;
/** Metadata about the account. */
fields: AccountField[];
/** The default post privacy to be used for new statuses. */
privacy?: StatusVisibility | null;
/** Whether new statuses should be marked sensitive by default. */
sensitive?: boolean | null;
/** The default posting language for new statuses. */
language: string | null;
/** The number of pending follow requests. */
followRequestsCount?: number | null;
}
/**
* Represents a profile field as a name-value pair with optional verification.
*/
interface AccountField {
/** The key of a given field's key-value pair. */
name: string;
/** The value associated with the `name` key. */
value: string;
/** Timestamp of when the server verified a URL value for a rel="me” link. */
verifiedAt?: string | null;
}
/**
* Represents a user of Mastodon and their associated profile.
* @see https://docs.joinmastodon.org/entities/account/
*/
interface Account$1 {
/** The account id */
id: string;
/** The username of the account, not including domain */
username: string;
/** The WebFinger account URI. Equal to `username` for local users, or `username@domain` for remote users. */
acct: string;
/** The location of the user's profile page. */
url: string;
/** The profile's display name. */
displayName: string;
/** The profile's bio / description. */
note: string;
/** An image icon that is shown next to statuses and in the profile. */
avatar: string;
/** A static version of the `avatar`. Equal to avatar if its value is a static image; different if `avatar` is an animated GIF. */
avatarStatic: string;
/** An image banner that is shown above the profile and in profile cards. */
header: string;
/** A static version of the header. Equal to `header` if its value is a static image; different if `header` is an animated GIF. */
headerStatic: string;
/** Whether the account manually approves follow requests. */
locked: boolean;
/** Additional metadata attached to a profile as name-value pairs. */
fields: AccountField[];
/** Custom emoji entities to be used when rendering the profile. If none, an empty array will be returned. */
emojis: CustomEmoji[];
/** Boolean to indicate that the account performs automated actions */
bot: boolean;
/** Indicates that the account represents a Group actor. */
group: boolean;
/** Whether the account has opted into discovery features such as the profile directory. */
discoverable?: boolean | null;
/** Whether the local user has opted out of being indexed by search engines. */
noindex?: boolean | null;
/** Indicates that the profile is currently inactive and that its user has moved to a new account. */
moved?: Account$1 | null;
/** An extra entity returned when an account is suspended. **/
suspended?: boolean | null;
/** An extra attribute returned only when an account is silenced. If true, indicates that the account should be hidden behind a warning screen. */
limited?: boolean | null;
/** When the account was created. */
createdAt: string;
/** Time of the last status posted */
lastStatusAt: string;
/** How many statuses are attached to this account. */
statusesCount: number;
/** The reported followers of this profile. */
followersCount: number;
/** The reported follows of this profile. */
followingCount: number;
/** Roles that have been granted to this account. */
roles: Pick<Role, "id" | "name" | "color">[];
/** https://github.com/mastodon/mastodon/pull/23591 */
memorial?: boolean | null;
}
/**
* @see https://docs.joinmastodon.org/entities/Account/#CredentialAccount
*/
interface AccountCredentials extends Account$1 {
/**
* Note the extra `source` property, which is not visible on accounts other than your own.
* Also note that plain-text is used within `source` and HTML is used for their
* corresponding properties such as `note` and `fields`.
*/
source: AccountSource;
/** The role assigned to the currently authorized user. */
role: Role;
}
/**
* Represents an IP address associated with a user.
* @see https://docs.joinmastodon.org/entities/Admin_Ip/
*/
interface Ip {
/** The IP address. */
ip: string;
/** The timestamp of when the IP address was last used for this account. */
usedAt: string;
}
/**
* Admin-level information about a given account.
* @see https://docs.joinmastodon.org/entities/admin-account/
*/
interface Account {
/** The ID of the account in the database. */
id: string;
/** The username of the account. */
username: string;
/** The domain of the account. */
domain?: string | null;
/** When the account was first discovered. */
createdAt: string;
/** The email address associated with the account. */
email: string;
/** The IP address last used to login to this account. */
ip?: string | null;
/** All known IP addresses associated with this account. */
ips: Ip[];
/** The locale of the account. */
locale: string;
/** The reason given when requesting an invite (for instances that require manual approval of registrations) */
inviteRequest?: string | null;
/** The current role of the account. */
role: Role;
/** Whether the account has confirmed their email address. */
confirmed: boolean;
/** Whether the account is currently approved. */
approved: boolean;
/** Whether the account is currently disabled. */
disabled: boolean;
/** Whether the account is currently silenced. */
silenced: boolean;
/** Whether the account is currently suspended. */
suspended: boolean;
/** Boolean. Filter for accounts force-marked as sensitive? */
sensitized: boolean;
/** User-level information about the account. */
account: Account$1;
/** The ID of the application that created this account. */
createdByApplicationId?: string | null;
/** The ID of the account that invited this user */
invitedByAccountId?: string | null;
}
interface CanonicalEmailBlock {
/** The ID of email block in the database. */
id: string;
/** The hash to test against. */
canonicalEmailHash: string;
}
type CohortFrequency = "day" | "month";
interface CohortData {
/** The timestamp for the start of the bucket, at midnight. */
date: string;
/** The percentage rate of users who registered in the specified `period` and were active for the given `date` bucket. */
rate: number;
/** How many users registered in the specified `period` and were active for the given `date` bucket. */
value: number;
}
/**
* Represents a retention metric.
*/
interface Cohort {
/** The timestamp for the start of the period, at midnight. */
period: string;
/** The size of the bucket for the returned data. */
frequency: CohortFrequency;
/** Retention data for users who registered during the given period. */
data: CohortData[];
}
interface DimensionData {
/** The unique keystring for this data item. */
key: string;
/** A human-readable key for this data item. */
humanKey: string;
/** The value for this data item. */
value: string;
/** The units associated with this data item’s value, if applicable. */
unit?: string | null;
/** A human-readable formatted value for this data item. */
humanValue?: string | null;
}
type DimensionKey = "languages" | "sources" | "servers" | "space_usage" | "software_versions" | "tag_servers" | "tag_languages" | "instance_accounts" | "instance_languages";
/**
* Represents qualitative data about the server.
* @see https://docs.joinmastodon.org/entities/Admin_Dimension/
*/
interface Dimension {
/** The unique keystring for the requested dimension. */
key: DimensionKey;
/** The data available for the requested dimension. */
data: DimensionData[];
}
interface DomainAllow {
/** The ID of the domain allow in the database. */
id: string;
/** The domain of the domain allow in the database. */
domain: string;
/** The create date of the domain allow in the database. */
createdAt: string;
}
type DomainBlockSeverity$1 = "silence" | "suspend" | "noop";
interface DomainBlock$1 {
/** The ID of the domain block in the database. */
id: string;
/** The domain of the domain block in the database. */
domain: string;
/** The create date of the domain block in the database. */
createdAt: string;
/** The date of the application that created this account. */
severity: DomainBlockSeverity$1;
/** The reject media of the domain. */
rejectMedia: boolean;
/** The reject report of the domain. */
rejectReposts: boolean;
/** The private comment of the domain. */
privateComment?: string | null;
/** The public comment of the domain. */
publicComment?: string | null;
/** The obfuscate of the domain block. */
obfuscate: boolean;
/** SHA256 of the domain. https://github.com/mastodon/mastodon/pull/29092 */
digest: string;
}
interface EmailDomainBlockHistory {
/** UNIX timestamp on midnight of the given day. */
day: string;
/** The counted accounts signup attempts using that email domain within that day. */
accounts: string;
/** The counted IP signup attempts of that email domain within that day. */
uses: string;
}
interface EmailDomainBlock {
/** The ID of the email domain block in the database. */
id: string;
/** The domain of the email domain block in the database. */
domain: string;
/** The create date of the email domain block in the database. */
createdAt: string;
/** The history of the email domain block in the database. */
history: EmailDomainBlockHistory[];
}
type IpBlockSeverity = "sign_up_requires_approval" | "sign_up_block" | "no_access";
interface IpBlock {
/** The ID of the domain allow in the database. */
id: string;
/** The IP address and prefix to block. */
ip: string;
/** The policy to apply to this IP range. */
severity: IpBlockSeverity;
/** The reason for this IP block. */
comment: string;
/** The create date of the ip block. */
createdAt: string;
/** The number of seconds in which this IP block will expire. */
expiresAt: number | null;
}
interface MeasureData {
/** Midnight on the requested day in the time period. */
date: string;
/** The numeric value for the requested measure. */
value: string;
}
/** @see https://docs.joinmastodon.org/entities/Admin_Measure/#key */
type MeasureKey = "active_users" | "new_users" | "interactions" | "opened_reports" | "resolved_reports" | "tag_accounts" | "tag_uses" | "tag_servers" | "instance_accounts" | "instance_media_attachments" | "instance_reports" | "instance_statuses" | "instance_follows" | "instance_followers";
/**
* Represents quantitative data about the server.
* @see https://docs.joinmastodon.org/entities/Admin_Measure
*/
interface Measure {
/** The unique keystring for the requested measure. */
key: MeasureKey;
/** The units associated with this data item’s value, if applicable. */
unit?: string | null;
/** The numeric total associated with the requested measure. */
total: string;
/** A human-readable formatted value for this data item. */
humanValue?: string;
/** The numeric total associated with the requested measure, in the previous period. Previous period is calculated by subtracting the start_at and end_at dates, then offsetting both start and end dates backwards by the length of the time period. */
previousTotal?: string;
/** The data available for the requested measure, split into daily buckets. */
data: MeasureData[];
}
type ReportCategory = "spam" | "violation" | "legal" | "other";
/**
* Reports filed against users and/or statuses, to be taken action on by moderators.
* @see https://docs.joinmastodon.org/entities/Report/
*/
interface Report$1 {
/** The ID of the report in the database. */
id: string;
/** Whether an action was taken yet. */
actionTaken: boolean;
/** When an action was taken against the report. */
actionTakenAt?: string | null;
/**
* The generic reason for the report.
*
* `spam` = Unwanted or repetitive content
*
* `violation` = A specific rule was violated
*
* `other` = Some other reason
*/
category: ReportCategory;
/** The reason for the report. */
comment: string;
/** Whether the report was forwarded to a remote domain */
forwarded: boolean;
/** When the report was created */
createdAt: string;
/** IDs of statuses that have been attached to this report for additional context. */
statusIds?: string[] | null;
/** IDs of the rules that have been cited as a violation by this report. */
ruleIds?: string[] | null;
/** The account that was reported. */
targetAccount: Account$1;
}
interface Rule {
/** An identifier for the rule. */
id: string;
/** The rule to be followed. */
text: string;
/** Longer-form description of the rule. */
hint: string;
}
/**
* Admin-level information about a filed report.
* @see https://docs.joinmastodon.org/entities/admin-report/
*/
interface Report {
/** The ID of the report in the database. */
id: string;
/** The action taken to resolve this report. */
actionTaken: boolean;
/** When an action was taken, if this report is currently resolved. */
actionTakenAt?: string | null;
/** The category under which the report is classified */
category: ReportCategory;
/** An optional reason for reporting. */
comment: string;
/** Whether a report was forwarded to a remote instance. */
forwarded: boolean;
/** The time the report was filed. */
createdAt: string;
/** The time of last action on this report. */
updatedAt: string;
/** The account which filed the report. */
account: Account$1;
/** The account being reported. */
targetAccount: Account$1;
/** The account of the moderator assigned to this report. */
assignedAccount?: Account$1 | null;
/** The action taken by the moderator who handled the report. */
actionTakenByAccount: Account$1;
/** Statuses attached to the report, for context. */
statuses: Status[];
/** Rules attached to the report, for context. */
rules: Rule[];
}
interface TagHistory {
day: string;
accounts: string;
uses: string;
}
/**
* @see https://docs.joinmastodon.org/entities/Tag/#admin
*/
interface Tag {
/** The ID of the Tag in the database. */
id: string;
name: string;
url: string;
history: TagHistory[];
/** Whether the hashtag has been approved to trend. */
trendable: boolean;
/** Whether the hashtag has not been disabled from auto-linking. */
usable: boolean;
/** Whether the hashtag has not been reviewed yet to approve or deny its trending. */
requiresReview: boolean;
}
type index$7_Account = Account;
type index$7_CanonicalEmailBlock = CanonicalEmailBlock;
type index$7_Cohort = Cohort;
type index$7_CohortData = CohortData;
type index$7_CohortFrequency = CohortFrequency;
type index$7_Dimension = Dimension;
type index$7_DimensionData = DimensionData;
type index$7_DimensionKey = DimensionKey;
type index$7_DomainAllow = DomainAllow;
type index$7_EmailDomainBlock = EmailDomainBlock;
type index$7_EmailDomainBlockHistory = EmailDomainBlockHistory;
type index$7_Ip = Ip;
type index$7_IpBlock = IpBlock;
type index$7_IpBlockSeverity = IpBlockSeverity;
type index$7_Measure = Measure;
type index$7_MeasureData = MeasureData;
type index$7_MeasureKey = MeasureKey;
type index$7_Report = Report;
type index$7_Tag = Tag;
type index$7_TagHistory = TagHistory;
declare namespace index$7 {
export type { index$7_Account as Account, index$7_CanonicalEmailBlock as CanonicalEmailBlock, index$7_Cohort as Cohort, index$7_CohortData as CohortData, index$7_CohortFrequency as CohortFrequency, index$7_Dimension as Dimension, index$7_DimensionData as DimensionData, index$7_DimensionKey as DimensionKey, index$7_DomainAllow as DomainAllow, DomainBlock$1 as DomainBlock, DomainBlockSeverity$1 as DomainBlockSeverity, index$7_EmailDomainBlock as EmailDomainBlock, index$7_EmailDomainBlockHistory as EmailDomainBlockHistory, index$7_Ip as Ip, index$7_IpBlock as IpBlock, index$7_IpBlockSeverity as IpBlockSeverity, index$7_Measure as Measure, index$7_MeasureData as MeasureData, index$7_MeasureKey as MeasureKey, index$7_Report as Report, index$7_Tag as Tag, index$7_TagHistory as TagHistory };
}
/**
* Represents a weekly bucket of instance activity.
* @see https://docs.joinmastodon.org/entities/activity/
*/
interface Activity {
/** Midnight at the first day of the week. */
week: string;
/** Statuses created since the week began. */
statuses: string;
/** User logins since the week began. */
logins: string;
/** User registrations since the week began. */
registrations: string;
}
interface Reaction {
name: string;
count: number;
me: boolean;
url: string;
staticUrl: string;
}
interface AnnouncementAccount {
id: string;
username: string;
url: string;
acct: string;
}
interface AnnouncementStatus {
id: string;
url: string;
}
interface Announcement {
id: string;
content: string;
startsAt: string;
endsAt: string;
allDay: boolean;
publishedAt: string;
updatedAt: string;
mentions: AnnouncementAccount[];
statuses: AnnouncementStatus[];
tags: Tag$1[];
emojis: CustomEmoji[];
reactions: Reaction[];
}
/**
* Represents the tree around a given status. Used for reconstructing threads of statuses.
* @see https://docs.joinmastodon.org/entities/context/
*/
interface Context {
/** Parents in the thread. */
ancestors: Status[];
/** Children in the thread. */
descendants: Status[];
}
/**
* Represents a conversation with "direct message" visibility.
* @see https://docs.joinmastodon.org/entities/conversation/
*/
interface Conversation {
/** Local database ID of the conversation. */
id: string;
/** Participants in the conversation. */
accounts: Account$1[];
/** Is the conversation currently marked as unread? */
unread: boolean;
/** The last status in the conversation, to be used for optional display. */
lastStatus?: Status | null;
}
/**
* Represents an extended description for the instance, to be shown on its about page.
*/
interface ExtendedDescription {
/** The rendered HTML content of the extended description. */
content: string;
/** A timestamp of when the extended description was last updated. */
updatedAt?: string | null;
}
/**
* Represents a domain that is blocked by the instance.
*/
interface DomainBlock {
/** The domain which is blocked. This may be obfuscated or partially censored. */
domain: string;
/** The SHA256 hash digest of the domain string. */
digest: string;
/** The level to which the domain is blocked. */
severity: DomainBlockSeverity;
/** An optional reason for the domain block. */
comment?: string | null;
}
type DomainBlockSeverity = "silence" | "suspend";
/**
* Represents a subset of your follows who also follow some other user.
* @see https://docs.joinmastodon.org/entities/FamiliarFollowers/
*/
interface FamiliarFollowers {
/** The ID of the Account in the database. */
id: string;
/** Accounts you follow that also follow this account. */
accounts: Account$1[];
}
/**
* Represents a hashtag that is featured on a profile.
* @see https://docs.joinmastodon.org/entities/featuredtag/
*/
interface FeaturedTag {
/** The internal ID of the featured tag in the database. */
id: string;
/** The name of the hashtag being featured. */
name: string;
/** The number of authored statuses containing this hashtag */
statusesCount: number;
/** The timestamp of the last authored status containing this hashtag. */
lastStatusAt?: string | null;
}
type FilterContext = "home" | "notifications" | "public" | "thread" | "account";
/**
* Represents a user-defined filter for determining which statuses should not be shown to the user.
* @see https://docs.joinmastodon.org/entities/filter/
*/
interface Filter {
/** The ID of the filter in the database. */
id: string;
/** The text to be filtered. */
phrase: string;
/** The contexts in which the filter should be applied. */
context: FilterContext[];
/** When the filter should no longer be applied */
expiresAt?: string | null;
/** Should matching entities in home and notifications be dropped by the server? */
irreversible: boolean;
/** Should the filter consider word boundaries? */
wholeWord: boolean;
}
/**
* Appeal against a moderation action.
*/
interface Appeal {
/** Text of the appeal from the moderated account to the moderators. */
text: string;
/** State of the appeal. */
state: AppealState;
}
type AppealState = "approved" | "rejected" | "pending";
/**
* Moderation warning against a particular account.
*/
interface AccountWarning {
/** The ID of the account warning in the database. */
id: string;
/** Action taken against the account. */
action: AccountWarningAction;
/** Message from the moderator to the target account. */
text: string;
/** List of status IDs that are relevant to the warning. When action is mark_statuses_as_sensitive or delete_statuses, those are the affected statuses. */
statusIds: string[];
/** Account against which a moderation decision has been taken. */
targetAccount: Account$1;
/** Appeal submitted by the target account, if any. */
appeal?: Appeal | null;
/** When the event took place. */
createdAt: string;
}
type AccountWarningAction = "none" | "disable" | "mark_statuses_as_sensitive" | "delete_statuses" | "sensitive" | "silence" | "suspend";
/**
* Summary of a moderation or block event that caused follow relationships to be severed.
*/
interface RelationshipSeveranceEvent {
/** The ID of the relationship severance event in the database. */
id: string;
/** Type of event. */
type: RelationshipSeveranceEventType;
/** Whether the list of severed relationships is unavailable because the underlying issue has been purged. */
purged: boolean;
/** Number of followers that were removed as result of the event. */
followersCount: number;
/** Number of accounts the user stopped following as result of the event. */
followingCount: number;
/** Name of the target of the moderation/block event. This is either a domain name or a user handle, depending on the event type. */
targetName: string;
/** When the event took place. */
createdAt: string;
}
type RelationshipSeveranceEventType = "domain_block" | "user_domain_block" | "account_suspension";
interface GroupedNotificationsResults {
/** Accounts referenced by grouped notifications. */
accounts: Account$1[];
/** Partial accounts referenced by grouped notifications. Those are only returned when requesting grouped notifications with `expand_accounts=partial_avatars`. */
partialAccounts?: PartialAccountWithAvatar[];
/** Statuses referenced by grouped notifications. */
statuses: Status[];
/** The grouped notifications themselves. */
notificationGroups: NotificationGroup[];
}
/** These are stripped-down versions of {@link Account} that only contain what is necessary to display a list of avatars, as well as a few other useful properties. The aim is to cut back on expensive server-side serialization and reduce the network payload size of notification groups. */
type PartialAccountWithAvatar = Pick<Account$1, "id" | "acct" | "url" | "avatar" | "avatarStatic" | "locked" | "bot">;
interface BaseNotificationGroup<T> {
/** Group key identifying the grouped notifications. Should be treated as an opaque value. */
groupKey: string;
/** Total number of individual notifications that are part of this notification group. */
notificationsCount: number;
/** The type of event that resulted in the notifications in this group. */
type: T;
/** ID of the most recent notification in the group. */
mostRecentNotificationId: string;
/** ID of the oldest notification from this group represented within the current page. This is only returned when paginating through notification groups. Useful when polling new notifications. */
pageMinId?: string;
/** ID of the newest notification from this group represented within the current page. This is only returned when paginating through notification groups. Useful when polling new notifications. */
pageMaxId?: string;
/** Date at which the most recent notification from this group within the current page has been created. This is only returned when paginating through notification groups. */
latestPageNotificationAt?: string;
/** IDs of some of the accounts who most recently triggered notifications in this group. */
sampleAccountIds: string;
/** ID of the Status that was the object of the notification. Attached when type of the notification is favourite, reblog, status, mention, poll, or update. */
statusId?: undefined | null;
/** Report that was the object of the notification. Attached when type of the notification is admin.report. */
report?: undefined | null;
/** Summary of the event that caused follow relationships to be severed. Attached when type of the notification is severed_relationships. */
event?: undefined | null;
/** Moderation warning that caused the notification. Attached when type of the notification is moderation_warning. */
moderationWarning?: undefined | null;
}
type NotificationGroupPlain<T> = BaseNotificationGroup<T>;
type NotificationGroupWithStatusId<T> = BaseNotificationGroup<T> & {
/** ID of the Status that was the object of the notification. Attached when type of the notification is favourite, reblog, status, mention, poll, or update. */
statusId: string;
};
type NotificationGroupWithReport<T> = BaseNotificationGroup<T> & {
/** Report that was the object of the notification. Attached when type of the notification is admin.report. */
report: Report$1;
};
type NotificationGroupWithEvent<T> = BaseNotificationGroup<T> & {
/** Summary of the event that caused follow relationships to be severed. Attached when type of the notification is severed_relationships. */
event: RelationshipSeveranceEvent;
};
type NotificationGroupWithModerationWarning<T> = BaseNotificationGroup<T> & {
/** Moderation warning that caused the notification. Attached when type of the notification is moderation_warning. */
moderationWarning: AccountWarning;
};
/** Someone mentioned you in their status */
type MentionNotificationGroup = NotificationGroupWithStatusId<"mention">;
/** Someone you enabled notifications for has posted a status */
type StatusNotificationGroup = NotificationGroupWithStatusId<"status">;
/** Someone boosted one of your statuses */
type ReblogNotificationGroup = NotificationGroupWithStatusId<"reblog">;
/** Someone followed you */
type FollowNotificationGroup = NotificationGroupPlain<"follow">;
/** Someone requested to follow you */
type FollowRequestNotificationGroup = NotificationGroupPlain<"follow_request">;
/** Someone favourited one of your statuses */
type FavouriteNotificationGroup = NotificationGroupWithStatusId<"favourite">;
/** A poll you have voted in or created has ended */
type PollNotificationGroup = NotificationGroupWithStatusId<"poll">;
/** A status you interacted with has been edited */
type UpdateNotificationGroup = NotificationGroupWithStatusId<"update">;
/** Someone signed up (optionally sent to admins) */
type AdminSignUpNotificationGroup = NotificationGroupPlain<"admin.sign_up">;
/** A new report has been filed */
type AdminReportNotificationGroup = NotificationGroupWithReport<"admin.report">;
/** Some of your follow relationships have been severed as a result of a moderation or block event */
type SeveredRelationshipsNotificationGroup = NotificationGroupWithEvent<"severed_relationships">;
/** A moderator has taken action against your account or has sent you a warning */
type ModerationWarningNotificationGroup = NotificationGroupWithModerationWarning<"moderation_warning">;
/** Group key identifying the grouped notifications. Should be treated as an opaque value. */
type NotificationGroup = MentionNotificationGroup | StatusNotificationGroup | ReblogNotificationGroup | FollowNotificationGroup | FollowRequestNotificationGroup | FavouriteNotificationGroup | PollNotificationGroup | UpdateNotificationGroup | AdminSignUpNotificationGroup | AdminReportNotificationGroup | SeveredRelationshipsNotificationGroup | ModerationWarningNotificationGroup;
type NotificationGroupType = NotificationGroup["type"];
/**
* Represents a proof from an external identity provider.
* @see https://docs.joinmastodon.org/entities/identityproof/
*/
interface IdentityProof {
/** The name of the identity provider. */
provider: string;
/** The account owner's username on the identity provider's service. */
providerUsername: string;
/** The account owner's profile URL on the identity provider. */
profileUrl: string;
/** A link to a statement of identity proof, hosted by the identity provider. */
proofUrl: string;
/** The name of the identity provider. */
updatedAt: string;
}
interface InstanceStatusesConfiguration$1 {
maxCharacters: number;
maxMediaAttachments: number;
charactersReservedPerUrl: number;
}
interface InstanceMediaAttachmentsConfiguration$1 {
supportedMimeTypes: string[];
imageSizeLimit: number;
imageMatrixLimit: number;
videoSizeLimit: number;
videoFrameRateLimit: number;
videoMatrixLimit: number;
}
interface InstancePollsConfiguration$1 {
maxOptions: number;
maxCharactersPerOption: number;
minExpiration: number;
maxExpiration: number;
}
interface InstanceAccountsConfiguration$1 {
maxFeaturedTags: number;
}
/**
* @see https://github.com/mastodon/mastodon/pull/16485
*/
interface InstanceConfiguration$1 {
statuses: InstanceStatusesConfiguration$1;
mediaAttachments: InstanceMediaAttachmentsConfiguration$1;
polls: InstancePollsConfiguration$1;
accounts: InstanceAccountsConfiguration$1;
}
/**
* Represents the software instance of Mastodon running on this domain.
* @see https://docs.joinmastodon.org/entities/instance/
*/
interface Instance$1 {
/** The domain name of the instance. */
uri: string;
/** The title of the website. */
title: string;
/** Admin-defined description of the Mastodon site. */
description: string;
/** A shorter description defined by the admin. */
shortDescription: string;
/** An email that may be contacted for any inquiries. */
email: string;
/** The version of Mastodon installed on the instance. */
version: string;
/** Primary languages of the website and its staff. */
languages: string[];
/** Whether registrations are enabled. */
registrations: boolean;
/** Whether registrations require moderator approval. */
approvalRequired: boolean;
/** URLs of interest for clients apps. */
urls: InstanceURLs;
/** Statistics about how much information the instance contains. */
stats: InstanceStats;
/** Whether invitation in enabled */
invitesEnabled: boolean;
/** List various values like file size limits and supported mime types */
configuration: InstanceConfiguration$1;
/** Banner image for the website. */
thumbnail?: string | null;
/** A user that can be contacted, as an alternative to `email`. */
contactAccount?: Account$1 | null;
rules?: Rule[] | null;
}
interface InstanceURLs {
/** WebSockets address for push streaming. String (URL). */
streamingApi: string;
}
interface InstanceStats {
/** Users registered on this instance. Number. */
userCount: number;
/** Statuses authored by users on instance. Number. */
statusCount: number;
/** Domains federated with this instance. Number. */
domainCount: number;
}
type ListRepliesPolicy = "followed" | "list" | "none";
/**
* Represents a list of some users that the authenticated user follows.
* @see https://docs.joinmastodon.org/entities/list/
*/
interface List {
/** The internal database ID of the list. */
id: string;
/** The user-defined title of the list. */
title: string;
/**
* Which replies should be shown in the list.
*
* `followed` = Show replies to any followed user
*
* `list` = Show replies to members of the list
*
* `none` = Show replies to no one
*/
repliesPolicy: ListRepliesPolicy;
/** https://github.com/mastodon/mastodon/pull/22048/files */
exclusive: boolean;
}
interface MarkerItem {
/** The ID of the most recently viewed entity. */
lastReadId: string;
/** The timestamp of when the marker was set. */
updatedAt: string;
/** Used for locking to prevent write conflicts. */
version: number;
}
type MarkerTimeline = "home" | "notifications";
/**
* Represents the last read position within a user's timelines.
* @see https://docs.joinmastodon.org/entities/marker/
*/
type Marker = {
[key in MarkerTimeline]: MarkerItem;
};
interface BaseNotifica