Topic

NodeBB provider module Topic class

Author: Accalia
License: MIT

Topic.bindTopic(forum) ⇒ User

Create a Topic class and bind it to a forum instance

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

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

Topic~Topic

Topic Class

Represends a forum topic

Kind: inner class of Topic
Access: public

new Topic(payload)

Construct a topic object from a provided payload.

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

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

topic.categoryId : number

Forum specific ID for topic category

Kind: instance property of Topic
Access: public

topic.authorId : number

Forum specific ID for topic author

Kind: instance property of Topic
Access: public

topic.title : string

Topic title

Kind: instance property of Topic
Access: public

topic.posted : Date

DateTime that the topic was created

Kind: instance property of Topic
Access: public

topic.lastPosted : Date

DateTime that the topic was last replied to

Kind: instance property of Topic
Access: public

topic.id : number

Forum Specific Topic Id

Kind: instance property of Topic
Access: public

topic.mainPostId : number

Forum id of the opening post

Kind: instance property of Topic
Access: public

topic.postCount : number

Count of posts in topic

Kind: instance property of Topic
Access: public

topic.url() ⇒ Promise.<string>

Retrieve the web URL for the topic

Kind: instance method of Topic
Returns: Promise.<string> - Resolves to the web URL for this topic
Access: public
Promise:
Fulfill: string The Web URL for this topic
Reject: Error An Error that occured while retrieving the post URL

topic.reply(content) ⇒ Promise.<Post>

Reply to this topic with the given content

Kind: instance method of Topic
Returns: Promise.<Post> - Resolves to the newly created Post
Access: public
Promise:
Fulfill: Post The newly created Post
Reject: Error An Error that occured while posting

Param Type Description
content string Post Content

topic.getAllPosts(eachPost) ⇒ Promise.<Topic>

Retrieve all posts from this topic, passing each off to a provided iterator function.

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

Param Type Description
eachPost PostProcessor A function to process retrieved posts.

topic.getLatestPosts(eachPost) ⇒ Promise.<Topic>

Retrieve most posts from this topic, passing each off to a provided iterator function.

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

Param Type Description
eachPost PostProcessor A function to process retrieved posts.

topic.markRead([postNumber]) ⇒ Promise.<Topic>

Mark the topic read up to a point

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

Param Type Description
[postNumber] number Last read post. Omit to mark the entire topic read

topic.watch() ⇒ Promise.<Topic>

Watch the topic for new replies

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

topic.unwatch() ⇒ Promise.<Topic>

Stop watching the tipic for new replies

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

topic.mute() ⇒ Promise.<Topic>

Mute the topic to suppress notifications

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

topic.unmute() ⇒ Promise.<Topic>

Unmute the topic, allowing notifications to be generated again.

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

topic.lock() ⇒ Promise.<Topic>

Locks the topic. Will reject if you're not a moderator.

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

topic.unlock() ⇒ Promise.<Topic>

Unlocks the topic. Will reject if you're not a moderator.

Kind: instance method of Topic
Returns: Promise.<Topic> - Resolves to self on completion
Access: public
Promise:
Fulfill: Topic Source Topic
Reject: Error An Error that occured while posting

Topic.get(topicId) ⇒ Promise.<Topic>

Retrieve a topic by topic id

Kind: static method of Topic
Returns: Promise.<Topic> - Retrieved topic
Access: public
Promise:
Fulfill: Topic Retrieved Topic
Reject: Error An Error that occured while posting

Param Type Description
topicId number Id of topic to retrieve

Topic.parse(payload) ⇒ Topic

Parse a topic from retrieved data

Kind: static method of Topic
Returns: Topic - Parsed topic
Access: public

Param Type Description
payload * Payload to parse into a topic

Topic.parseExtended(data) ⇒ Promise.<TopicExtended>

Parse a topic with embedded user and category information into respective objects

Kind: static method of Topic
Returns: Promise.<TopicExtended> - Parsed Results
Access: public
Promise:
Fulfill: TopicExtended Parsed topic data

Param Type Description
data * Data to parse into a topic

Topic.getUnreadTopics(eachTopic) ⇒ Promise

Get All Unread Topics

Kind: static method of Topic
Returns: Promise - A promise that resolves when all topics have been processed
Access: public

Param Type Description
eachTopic TopicProcessor A function to process each retrieved topic

Topic.getRecentTopics(eachTopic) ⇒ Promise

Get All Topics in order of most recent activity

Kind: static method of Topic
Returns: Promise - A promise that resolves when all topics have been processed
Access: public

Param Type Description
eachTopic TopicProcessor A function to process each retrieved topic