Category

NodeBB provider module Category class

Author: Accalia
License: MIT

Category.bindCategory(forum) ⇒ Category

Create a Category class and bind it to a forum instance

Kind: static method of Category
Returns: Category - A Category class bound to the provided forum instance

Param Type Description
forum Provider A forum instance to bind to constructed Category class

Category~Category

Category Class

Represents a forum category.

Kind: inner class of Category
Access: public

new Category(payload)

Construct a category object from a provided payload.

This constructor is intended for private use only, if you need top construct a category from payload data use Category.parse() instead.

Param Type Description
payload * Payload to construct the Category object out of

category.id : number

Category Id

Kind: instance property of Category
Access: public

category.name : string

Category Name

Kind: instance property of Category
Access: public

category.description : string

Category description

Kind: instance property of Category
Access: public

category.parentId : number

Parent Category Id

Kind: instance property of Category
Access: public

category.topicCount : number

Number of topics in this category

Kind: instance property of Category
Access: public

category.postCount : number

Number of posts in this category

Kind: instance property of Category
Access: public

category.recentPosts : number

Number of "recent" posts in this category

Kind: instance property of Category
Access: public

category.url() ⇒ Promise.<string>

The web URL of the category

Kind: instance method of Category
Returns: Promise.<string> - Resolves to the web URL *
Access: public

category.getAllTopics(eachTopic) ⇒ Promise

Get all Topics in the category

Kind: instance method of Category
Returns: Promise - Resolves when all topics have been processed
Access: public

Param Type Description
eachTopic TopicProcessor A function to process each topic

category.getRecentTopics(eachTopic) ⇒ Promise

Get all recently active Topics in the category

Kind: instance method of Category
Returns: Promise - Resolves when all topics have been processed
Access: public

Param Type Description
eachTopic TopicProcessor A function to process each topic

category.addTopic(title, body) ⇒ Promise.<Topic>

Add a topic to this category

Kind: instance method of Category
Returns: Promise.<Topic> - Resolves to the newly created topic
Access: public

Param Type Description
title string The title of the topic
body string The body of the first post of the topic

category.watch() ⇒ Promise.<Category>

Watch this category for new activity

Kind: instance method of Category
Returns: Promise.<Category> - Resolves to self on completion
Access: public

category.unwatch() ⇒ Promise.<Category>

Stop watching this category for new activity

Kind: instance method of Category
Returns: Promise.<Category> - Resolves to self on completion
Access: public

category.mute() ⇒ Promise.<Category>

Prevent this category from generating any notifications

This is not currently supported by NodeBB and is a noop

Kind: instance method of Category
Returns: Promise.<Category> - Resolves to self on completion
Access: public

category.unmute() ⇒ Promise.<Category>

Allow this category to generate notifications

This is not currently supported by NodeBB and is a noop

Kind: instance method of Category
Returns: Promise.<Category> - Resolves to self on completion
Access: public

Category.get(categoryId) ⇒ Promise.<Category>

retrieve a category by Id

Kind: static method of Category
Returns: Promise.<Category> - Resolves to retrieved category
Access: public

Param Type Description
categoryId number Id of the category to retrieve

Category.parse(payload) ⇒ Category

Parse a category from payload data

Kind: static method of Category
Returns: Category - Parsed category
Access: public

Param Type Description
payload * Data to parse as category