The manager of docs that belong to a doc channel.

Example

new DocManager(channel);

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

cache: CacheCollection<number, Doc>

This cache of the manager.

channel: DocChannel
client: Client

Methods

  • Create a doc in the channel.

    Returns

    The created doc.

    Example

    docs.create('Title', 'Content');
    

    Parameters

    • title: string

      The title of the doc.

    • content: string

      The content of the doc.

    Returns Promise<Doc>

  • Delete a doc from the channel.

    Example

    docs.delete(doc);
    

    Parameters

    • doc: number | Doc

      The doc to delete.

    Returns Promise<void>

  • Edit a doc in the channel.

    Returns

    The edited doc.

    Example

    docs.edit(doc, 'Title', 'Content');
    

    Parameters

    • doc: number | Doc

      The doc to edit.

    • title: string

      The title of the doc.

    • content: string

      The content of the doc.

    Returns Promise<Doc>

  • Fetch a doc from the channel, or cache.

    Returns

    The fetched doc.

    Example

    docs.fetch(doc);
    

    Parameters

    • doc: number | Doc

      The doc to fetch.

    • Optional options: FetchOptions

      The options to fetch the doc with.

    Returns Promise<Doc>

  • Fetch docs from the channel.

    Returns

    The fetched docs.

    Example

    docs.fetch();
    

    Parameters

    Returns Promise<Collection<number, Doc>>

  • Set the maximum cache size of the manager.

    Returns

    The manager.

    Example

    manager.setMaxCache(100);
    

    Parameters

    • maxSize: number

      The maximum size of the cache.

    Returns DocManager