mastodon.ts

Declarations
#

20 declarations

view source

CreateReplyFilters
#

CustomReplyFilter
#

mastodon.ts view source

CustomReplyFilter

type

type 'custom'

should_include

type ( status: MastodonStatus, root_status: MastodonStatus, status_context: MastodonStatusContext, ) => boolean

FavouritedByReplyFilter
#

fetch_mastodon_favourites
#

mastodon.ts view source

(host: string, status_id: string, cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefined, log?: Logger | undefined, request?: RequestInit | undefined, token?: string | undefined, fetch?: ((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<...>) | undefined): Promise<...>

host

type string

status_id

type string

cache?

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefined
optional

log?

type Logger | undefined
optional

request?

type RequestInit | undefined
optional

token?

type string | undefined
optional

fetch?

type ((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>) | undefined
optional

returns

Promise<MastodonFavourite[] | null>

fetch_mastodon_status
#

mastodon.ts view source

(host: string, id: string, cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefined, log?: Logger | undefined, request?: RequestInit | undefined, token?: string | undefined, fetch?: ((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<...>) | undefined): Promise<...>

host

type string

id

type string

cache?

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefined
optional

log?

type Logger | undefined
optional

request?

type RequestInit | undefined
optional

token?

type string | undefined
optional

fetch?

type ((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>) | undefined
optional

returns

Promise<MastodonStatus | null>

fetch_mastodon_status_context
#

mastodon.ts view source

(host: string, id: string, cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefined, log?: Logger | undefined, request?: RequestInit | undefined, token?: string | undefined, fetch?: ((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<...>) | undefined): Promise<...>

host

type string

id

type string

cache?

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefined
optional

log?

type Logger | undefined
optional

request?

type RequestInit | undefined
optional

token?

type string | undefined
optional

fetch?

type ((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>) | undefined
optional

returns

Promise<MastodonStatusContext | null>

filter_valid_replies
#

mastodon.ts view source

(root_status: MastodonStatus, status_context: MastodonStatusContext, reply_filter: ReplyFilter | ReplyFilter[] | null, cache: Map<...> | ... 1 more ... | undefined, log: Logger | undefined): Promise<...>

root_status

status_context

reply_filter

type ReplyFilter | ReplyFilter[] | null

cache

type Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefined

log

type Logger | undefined

returns

Promise<MastodonStatus[]>

MastodonFavourite
#

mastodon.ts view source

MastodonFavourite

id

type string

username

type string

acct

type string

display_name

type string

locked

type boolean

bot

type boolean

discoverable

type boolean

group

type boolean

created_at

type string

note

type string

url

type string

avatar

type string

avatar_static

type string

header

type string

header_static

type string

followers_count

type number

following_count

type number

statuses_count

type number

last_status_at

type string

emojis

type Array<unknown>

fields

type Array<{ name: string; value: string; verified_at: string; // Datetime }>

MastodonStatus
#

mastodon.ts view source

MastodonStatus

id

type string

created_at

type string

in_reply_to_id

type string

in_reply_to_account_id

type string

sensitive

type boolean

spoiler_text

type string

visibility

type string

language

type string

uri

type string

url

type string

replies_count

type number

reblogs_count

type number

favourites_count

type number

edited_at

type null | string

favourited

type boolean

reblogged

type boolean

muted

type boolean

bookmarked

type boolean

content

type string

filtered

type Array<unknown>

reblog

type unknown

account

type { id: string; username: string; acct: string; display_name: string; locked: boolean; bot: boolean; discoverable: boolean; group: boolean; created_at: string; note: string; url: string; avatar: string; avatar_static: string; header: string; header_static: string; followers_count: number; following_count: number; statuses_count: number; last_status_at: string; emojis: Array<unknown>; fields: Array<unknown>; }

media_attachments

type Array<unknown>

mentions

type [ { id: string; username: string; url: string; acct: string; }, ]

tags

type [ { name: string; url: string; }, ]

emojis

type Array<unknown>

card

type unknown

poll

type unknown

MastodonStatusContext
#

MastodonStatusUrl
#

mastodon.ts view source

MastodonStatusUrl

href

type string

host

type string

status_id

type string

author

type string

MinimumFavouritesReplyFilter
#

mastodon.ts view source

MinimumFavouritesReplyFilter

type

type 'minimum_favourites'

minimum_favourites

type number

parse_mastodon_status_url
#

mastodon.ts view source

(url: string): MastodonStatusUrl | null

Parses a url to a post or API endpoint for a post, aka Mastodon status context.

url

type string

returns

MastodonStatusUrl | null

the parsed host and id params, if any

ReplyFilter
#

mastodon.ts view source

ReplyFilter

When filtering replies, at least one rule must pass for a reply to be included.

to_mastodon_api_favourites_url
#

to_mastodon_api_status_context_url
#

to_mastodon_api_status_url
#

to_mastodon_status_url
#

to_mastodon_status_url_with_author
#

mastodon.ts view source

(host: string, id: string, author: string): string

host

type string

id

type string

author

type string

returns

string

to_mastodon_status_url_with_users_author
#

Imported by
#