CreateReplyFilters api #
Declarations #
Mastodon components and helpers for Svelte, SvelteKit, and Fuz
29 declarations
CreateReplyFilters #
CustomReplyFilter #
CustomReplyFilter type
'custom'should_include
(
status: MastodonStatus,
root_status: MastodonStatus,
status_context: MastodonStatusContext,
) => booleanFavouritedByReplyFilter #
FavouritedByReplyFilter type
'favourited_by'favourited_by
Array<string>fetch_mastodon_favourites #
(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
stringstatus_id
stringcache?
Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefinedlog?
Logger | undefinedrequest?
RequestInit | undefinedtoken?
string | undefinedfetch?
((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>) | undefinedreturns
Promise<MastodonFavourite[] | null> fetch_mastodon_status #
(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
stringid
stringcache?
Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefinedlog?
Logger | undefinedrequest?
RequestInit | undefinedtoken?
string | undefinedfetch?
((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>) | undefinedreturns
Promise<MastodonStatus | null> fetch_mastodon_status_context #
(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
stringid
stringcache?
Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefinedlog?
Logger | undefinedrequest?
RequestInit | undefinedtoken?
string | undefinedfetch?
((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>) | undefinedreturns
Promise<MastodonStatusContext | null> filter_valid_replies #
(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
ReplyFilter | ReplyFilter[] | nullcache
Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | null | undefinedlog
Logger | undefinedreturns
Promise<MastodonStatus[]> load_from_storage #
<T>(key: string, to_default_value: () => T, validate?: ((value: any) => asserts value is T) | undefined): T Loads key and falls back to defaultValue.
If validate is provided and throws, it removes the key and returns undefined.
key
stringto_default_value
() => Tvalidate?
((value: any) => asserts value is T) | undefinedreturns
T mastodon_cache_context #
mastodon_cache.svelte.ts view source
{ get: (error_message?: string | undefined) => MastodonCache; get_maybe: () => MastodonCache | undefined; set: (value: MastodonCache) => MastodonCache; } MastodonCache #
mastodon_cache.svelte.ts view source
load_data
type () => Promise<Array<[Url, FetchValueCacheItem]> | null>
data
If undefined, it's still loading. null means no data.
type FetchValueCache | undefined | null
constructor
type new (load_data: () => Promise<[Url, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }][] | null>, load_on_mount?: boolean): MastodonCache
load_data
() => Promise<[Url, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }][] | null>load_on_mount
booleantrueload
MastodonFavourite #
MastodonFavourite id
stringusername
stringacct
stringdisplay_name
stringlocked
booleanbot
booleandiscoverable
booleangroup
booleancreated_at
stringnote
stringurl
stringavatar
stringavatar_static
stringheader
stringheader_static
stringfollowers_count
numberfollowing_count
numberstatuses_count
numberlast_status_at
stringemojis
Array<unknown>fields
Array<{
name: string;
value: string;
verified_at: string; // Datetime
}>MastodonStatus #
MastodonStatus id
stringcreated_at
stringin_reply_to_id
stringin_reply_to_account_id
stringsensitive
booleanspoiler_text
stringvisibility
stringlanguage
stringuri
stringurl
stringreplies_count
numberreblogs_count
numberfavourites_count
numberedited_at
null | stringfavourited
booleanreblogged
booleanmuted
booleanbookmarked
booleancontent
stringfiltered
Array<unknown>reblog
unknownaccount
{
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
Array<unknown>mentions
[
{
id: string;
username: string;
url: string;
acct: string;
},
]tags
[
{
name: string;
url: string;
},
]emojis
Array<unknown>card
unknownpoll
unknownMastodonStatusContext #
MastodonStatusContext Result from https://:host/api/v1/statuses/:id/context.
see also
ancestors
Array<MastodonStatus>descendants
Array<MastodonStatus>MastodonStatusItem #
MastodonStatusItem.svelte view source
item
MastodonStatusTree #
MastodonStatusTree.svelte view source
item
items
Array<MastodonStatus>MastodonStatusUrl #
MastodonStatusUrl href
stringhost
stringstatus_id
stringauthor
stringMinimumFavouritesReplyFilter #
MinimumFavouritesReplyFilter type
'minimum_favourites'minimum_favourites
numberparse_mastodon_status_url #
(url: string): MastodonStatusUrl | null Parses a url to a post or API endpoint for a post, aka Mastodon status context.
url
stringreturns
MastodonStatusUrl | null the parsed host and id params, if any
ReplyFilter #
ReplyFilter When filtering replies, at least one rule must pass for a reply to be included.
set_in_storage #
(key: string, value: any): void Sets value at key.
Importantly, if value is undefined the key is removed,
but a value of null is stored.
key
stringvalue
anyreturns
void to_mastodon_api_favourites_url #
(host: string, id: string): string host
stringid
stringreturns
string to_mastodon_api_status_context_url #
(host: string, id: string): string host
stringid
stringreturns
string to_mastodon_api_status_url #
(host: string, id: string): string host
stringid
stringreturns
string to_mastodon_status_url #
(host: string, id: string): string host
stringid
stringreturns
string to_mastodon_status_url_with_author #
(host: string, id: string, author: string): string host
stringid
stringauthor
stringreturns
string to_mastodon_status_url_with_users_author #
(host: string, id: string, author: string): string longhand for to_mastodon_status_url_with_author, apperas
host
stringid
stringauthor
stringreturns
string Toot #
url
stringupdated_url?
Defaults to the url, but can be updated by user input.
stringinclude_ancestors?
Whether to fetch and display the ancestors in the status context.
booleaninclude_replies?
Whether to fetch and display replies aka descendants in the status context.
booleanreply_filter?
Get a list of rules that controls whether replies are shown or not.
ReplyFilter | Array<ReplyFilter> | CreateReplyFilters | nullcache?
Optional API result cache.
See MastodonCache and get_mastodon_cache/set_mastodon_cache.
FetchValueCache | null | undefinedlog?
Optional logger for network calls.
Logger | undefinedloading?
boolean | undefinedload_time?
number | undefinedsettings_storage_key?
string | undefinedinitial_show_settings?
booleanshow_settings?
booleanautoload_storage_key?
string | undefinedinitial_autoload?
booleanautoload?
booleanonreset?
() => voidsettings?
SnippetTootInput #
url
stringattrs?
SvelteHTMLElements['input'] | undefinedTootLoader #
host
The host part of the url, like 'mastodon.ryanatkn.com'.
string | nullid
The status id to fetch, like '110702983310017651'.
string | nullinclude_ancestors?
Whether to fetch and display the ancestors in the status context.
booleaninclude_replies?
Whether to fetch and display replies aka descendants in the status context.
booleancache?
Optional API result cache.
FetchValueCache | null | undefinedlog?
Optional logger for network calls.
Logger | undefinedloading?
boolean | undefineditem?
MastodonStatus | null | undefinedstatus_context?
MastodonStatusContext | null | undefinedreplies?
Array<MastodonStatus> | null | undefinedreply_filter?
Get a list of rules that controls whether replies are shown or not. If omitted, all replies are included.
ReplyFilter | Array<ReplyFilter> | CreateReplyFilters | nullload_time?
number | undefinedchildren
Snippet<
[
{
/**
* `null` here is a failed loading condition.
*/
item: MastodonStatus | null | undefined;
/**
* `null` here is a failed loading condition.
*/
status_context: MastodonStatusContext | null | undefined;
/**
* `null` here is a failed loading condition for `item` or `status_context`.
*/
replies: Array<MastodonStatus> | null | undefined;
load: () => Promise<void>;
loading: boolean | undefined;
load_time: number | undefined;
},
]
>