User
NodeBB provider module User class
Author: Accalia
License: MIT
- User
- static
- .bindPost(forum) ⇒
User
- .bindPost(forum) ⇒
- inner
- ~Post
- new Post(payload)
- instance
- .authorId :
number
- .content :
string
- .posted :
Date
- .id :
number
- .topicId :
number
- .markup() ⇒
Promise.<string>
- .url() ⇒
Promise.<string>
- .reply(content) ⇒
Promise.<Post>
- .edit(newContent, [reason]) ⇒
Promise.<Post>
- .append(newContent, [reason]) ⇒
Promise.<Post>
- .delete() ⇒
Promise.<Post>
- .undelete() ⇒
Promise.<Post>
- .upvote() ⇒
Promise.<Post>
- .downvote() ⇒
Promise.<Post>
- .unvote() ⇒
Promise.<Post>
- .bookmark() ⇒
Promise.<Post>
- .unbookmark() ⇒
Promise.<Post>
- .authorId :
- static
- .reply(topicId, postId, content) ⇒
Promise.<Post>
- .get(postId) ⇒
Promise.<Post>
- .parse(payload) ⇒
Post
- .preview(content) ⇒
Promise.<String>
- .reply(topicId, postId, content) ⇒
- ~Post
- static
User.bindPost(forum) ⇒ User
Create a Post class and bind it to a forum instance
Kind: static method of User
Returns: User
- A Post class bound to the provided forum
instance
Param | Type | Description |
---|---|---|
forum | Provider |
A forum instance to bind to constructed Post class |
User~Post
Post Class
Represents a forum post
Kind: inner class of User
Access: public
- ~Post
- new Post(payload)
- instance
- .authorId :
number
- .content :
string
- .posted :
Date
- .id :
number
- .topicId :
number
- .markup() ⇒
Promise.<string>
- .url() ⇒
Promise.<string>
- .reply(content) ⇒
Promise.<Post>
- .edit(newContent, [reason]) ⇒
Promise.<Post>
- .append(newContent, [reason]) ⇒
Promise.<Post>
- .delete() ⇒
Promise.<Post>
- .undelete() ⇒
Promise.<Post>
- .upvote() ⇒
Promise.<Post>
- .downvote() ⇒
Promise.<Post>
- .unvote() ⇒
Promise.<Post>
- .bookmark() ⇒
Promise.<Post>
- .unbookmark() ⇒
Promise.<Post>
- .authorId :
- static
- .reply(topicId, postId, content) ⇒
Promise.<Post>
- .get(postId) ⇒
Promise.<Post>
- .parse(payload) ⇒
Post
- .preview(content) ⇒
Promise.<String>
- .reply(topicId, postId, content) ⇒
new Post(payload)
Construct a Post object from payload
This constructor is intended to be private use only, if you need to construct a post from payload data use
Post.parse()
instead
Param | Type | Description |
---|---|---|
payload | * |
Payload to construct the Post object out of |
post.authorId : number
ID of the post author
Kind: instance property of Post
Access: public
post.content : string
Raw content of the post, before any HTML transformation has been applied
Kind: instance property of Post
Access: public
post.posted : Date
DateTime that the post was posted
Kind: instance property of Post
Access: public
post.id : number
ID of the post
Kind: instance property of Post
Access: public
post.topicId : number
ID of the topic that contains this post
Kind: instance property of Post
Access: public
post.markup() ⇒ Promise.<string>
Retrieve the HTML representation of the raw content of the post
Kind: instance method of Post
Returns: Promise.<string>
- Resolves to the HTML markup for the post
Access: public
Promise:
Fulfill: string
The HTML markup for this post
Reject: Error
An Error that occured while deleting
post.url() ⇒ Promise.<string>
Retrieve the direct URL for this post
Kind: instance method of Post
Returns: Promise.<string>
- Resolves to the web URL for this post
Access: public
Promise:
Fulfill: string
The web URL for this post
Reject: Error
An Error that occured while retreiving post URL
post.reply(content) ⇒ Promise.<Post>
Reply to this post with the given content
Kind: instance method of Post
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 |
post.edit(newContent, [reason]) ⇒ Promise.<Post>
Edit this post to contain new content
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the edited Post
Access: public
Promise:
Fulfill: Post
The edited Post
Reject: Error
An Error that occured while editing
Param | Type | Description |
---|---|---|
newContent | string |
New post content |
[reason] | string |
Post edit reason |
post.append(newContent, [reason]) ⇒ Promise.<Post>
Append new content to this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the edited post
Access: public
Promise:
Fulfill: Post
The edited Post
Reject: Error
An Error that occured while editing
Param | Type | Description |
---|---|---|
newContent | string |
New post content |
[reason] | string |
Post edit reason |
post.delete() ⇒ Promise.<Post>
Delete this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the deleted post
Access: public
Promise:
Fulfill: Post
The deleted Post
Reject: Error
An Error that occured while deleting
post.undelete() ⇒ Promise.<Post>
Undelete this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the undeleted post
Access: public
Promise:
Fulfill: Post
The undeleted Post
Reject: Error
An Error that occured while deleting
post.upvote() ⇒ Promise.<Post>
Upvote this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the upvoted post
Access: public
Promise:
Fulfill: Post
The upvoted Post
Reject: Error
An Error that occured while upvoting
post.downvote() ⇒ Promise.<Post>
Downvote this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the downvoted post
Access: public
Promise:
Fulfill: Post
The downvoted Post
Reject: Error
An Error that occured while downvoting
post.unvote() ⇒ Promise.<Post>
Unvote this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the unvoted post
Access: public
Promise:
Fulfill: Post
The unvoted Post
Reject: Error
An Error that occured while downvoting
post.bookmark() ⇒ Promise.<Post>
Bookmark this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the bookmarked post
Access: public
Promise:
Fulfill: Post
The bookmarked post
Reject: Error
An Error that occured while bookmarking
post.unbookmark() ⇒ Promise.<Post>
Remove a bookmark from this post
Kind: instance method of Post
Returns: Promise.<Post>
- Resolves to the unbookmarked post
Access: public
Promise:
Fulfill: Post
The unbookmarked post
Reject: Error
An Error that occured while unbookmarking
Post.reply(topicId, postId, content) ⇒ Promise.<Post>
Post a reply to a post with the given content
Kind: static method of Post
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 |
---|---|---|
topicId | string |
Topic Id to reply to |
postId | string |
Post Id to reply to |
content | string |
Post content |
Post.get(postId) ⇒ Promise.<Post>
Retrieve a post identified by postId
Kind: static method of Post
Returns: Promise.<Post>
- Resolves to the retrieved post
Access: public
Promise:
Fulfill: Post
The retrieved Post
Reject: Error
An Error that occured retrieving the post
Param | Type | Description |
---|---|---|
postId | * |
Forum specific post id to retrieve |
Post.parse(payload) ⇒ Post
Construct a post object from a previously retrieved payload
Kind: static method of Post
Returns: Post
- the deserialized Post object
Access: public
Param | Type | Description |
---|---|---|
payload | * |
Serialized post representation retrieved from forum |
Post.preview(content) ⇒ Promise.<String>
Render the content to HTML as it would be rendered for a post
Kind: static method of Post
Returns: Promise.<String>
- Resolves to the rendered HTML
Access: public
Promise:
Fulfill: string
Rendered HTML for content
Reject: Error
Any error that occurred rendering HTML for content
Param | Type | Description |
---|---|---|
content | string |
Content to render HTML PReview for |