Class Usernotes

A class that interfaces with the raw contents of a subreddit's usernotes wiki page, automatically upgrading old storage schemas to the current version and providing methods to manipulate and reserialize the notes back for writing back to the wiki.

Hierarchy

  • Usernotes

Constructors

Properties

Methods

Constructors

Properties

users: Map<string, Usernote[]> = ...

A mapping of usernames to notes on the given user.

Methods

  • Adds a new usernote to the collection.

    Parameters

    • note: Usernote

      Details about the usernote to create

    Returns void

  • Returns all usernotes for a given user.

    Parameters

    • username: string

      The user to fetch the notes of

    Returns Usernote[]

    The list of usernotes

  • Serializes the usernotes data for writing back to the wiki. This method returns an object; you probably want toString instead.

    Returns RawUsernotes

    Object which can be serialized to JSON and written as the contents of the usernotes wiki page

  • Stringifies the usernotes data for writing back to the wiki.

    Parameters

    • Optional indent: string | number

      Passed as the third argument of JSON.stringify. Useful for debugging; however, because wiki space is limited, never provide this parameter when actually saving notes to the wiki.

    Returns string

    JSON string which can be saved as the contents of the usernotes wiki page

Generated using TypeDoc