InterfaceNotificationRepository

interface NotificationRepository {
    policy: {
        fetch(meta?: HttpMetaParams<"none">): Promise<NotificationPolicy>;
        update(params: UpdateNotificationPolicyParams, meta?: HttpMetaParams<"json">): Promise<NotificationPolicy>;
    };
    unreadCount: {
        fetch(params?: mastodon.rest.v2.FetchUnreadCountParams, meta?: HttpMetaParams<"none">): Promise<{
            count: number;
        }>;
    };
    $select(groupKey: string): {
        accounts: {
            fetch(meta?: HttpMetaParams<"none">): Promise<mastodon.v1.Account[]>;
        };
        dismiss(meta?: HttpMetaParams<"none">): Promise<void>;
        fetch(meta?: HttpMetaParams<"none">): Promise<GroupedNotificationsResults>;
    };
    list(params?: mastodon.rest.v2.ListNotificationsParams, meta?: HttpMetaParams<"none">): Paginator<GroupedNotificationsResults, undefined>;
}

Properties

Methods

Properties

policy: {
    fetch(meta?: HttpMetaParams<"none">): Promise<NotificationPolicy>;
    update(params: UpdateNotificationPolicyParams, meta?: HttpMetaParams<"json">): Promise<NotificationPolicy>;
}

Type declaration

unreadCount: {
    fetch(params?: mastodon.rest.v2.FetchUnreadCountParams, meta?: HttpMetaParams<"none">): Promise<{
        count: number;
    }>;
}

Type declaration

  • fetch:function
    • Get the (capped) number of unread notification groups for the current user. A notification is considered unread if it is more recent than the notifications read marker. Because the count is dependant on the parameters, it is computed every time and is thus a relatively slow operation (although faster than getting the full corresponding notifications), therefore the number of returned notifications is capped.

      Parameters

      Returns Promise<{
          count: number;
      }>

Methods

  • Return grouped notifications concerning the user. This API returns Link headers containing links to the next/previous page. However, the links can also be constructed dynamically using query params and id values.

    Notifications of type favourite, follow or reblog with the same type and the same target made in a similar timeframe are given a same group_key by the server, and querying this endpoint will return aggregated notifications, with only one object per group_key. Other notification types may be grouped in the future. The grouped_types parameter should be used by the client to explicitly list the types it supports showing grouped notifications for.

    Parameters

    Returns Paginator<GroupedNotificationsResults, undefined>