User
NodeBB provider module User class
Author: Accalia
License: MIT
- User
- static
- .bindUser(forum) ⇒
User
- .bindUser(forum) ⇒
- inner
- ~User
- new User(payload)
- instance
- .id :
number - .name :
string - .username :
string - .email :
string - .avatar :
string - .postCount :
number - .topicCount :
number - .reputation :
number - .lastPosted :
Date - .lastSeen :
Date - .url() ⇒
Promise.<string> - .follow() ⇒
Promise.<User> - .unfollow() ⇒
Promise.<user> - .whisper(message, [title]) ⇒
Promise - .uploadAvatar(imageData, mimeType) ⇒
Promise.<string>
- .id :
- static
- .get(userId) ⇒
Promise.<User> - .getByName(username) ⇒
Promise.<User> - .parse(payload) ⇒
Promise.<User>
- .get(userId) ⇒
- ~User
- static
User.bindUser(forum) ⇒ User
Create a User class and bind it to a forum instance
Kind: static method of User
Returns: User - A User class bound to the provided forum instance
| Param | Type | Description |
|---|---|---|
| forum | Provider |
A forum instance to bind to constructed User class |
User~User
User Class
Represents a forum user
Kind: inner class of User
Access: public
- ~User
- new User(payload)
- instance
- .id :
number - .name :
string - .username :
string - .email :
string - .avatar :
string - .postCount :
number - .topicCount :
number - .reputation :
number - .lastPosted :
Date - .lastSeen :
Date - .url() ⇒
Promise.<string> - .follow() ⇒
Promise.<User> - .unfollow() ⇒
Promise.<user> - .whisper(message, [title]) ⇒
Promise - .uploadAvatar(imageData, mimeType) ⇒
Promise.<string>
- .id :
- static
- .get(userId) ⇒
Promise.<User> - .getByName(username) ⇒
Promise.<User> - .parse(payload) ⇒
Promise.<User>
- .get(userId) ⇒
new User(payload)
Construct a User object from payload
This constructor is intended to be private use only, if you need to construct a user from payload data use
User.parse() instead
| Param | Type | Description |
|---|---|---|
| payload | * |
Payload to construct the User object out of |
user.id : number
Forum Specific User Id
Kind: instance property of User
Access: public
user.name : string
Descriptive name of the User
Kind: instance property of User
Access: public
user.username : string
Username of the User
Kind: instance property of User
Access: public
user.email : string
Email address of the User
May be blank if active login does not have sufficient rights to read email address
Kind: instance property of User
Access: public
user.avatar : string
Link to avatar image for user
Kind: instance property of User
Access: public
user.postCount : number
Number of posts User has made at time of retrieval
Kind: instance property of User
Access: public
user.topicCount : number
Number of topics User has created at time of retrieval
Kind: instance property of User
Access: public
user.reputation : number
User reputation at time of retrieval
Kind: instance property of User
Access: public
user.lastPosted : Date
Datetime User last made a publically visible post
Kind: instance property of User
Access: public
user.lastSeen : Date
Datetime User was last seen online
Kind: instance property of User
Access: public
user.url() ⇒ Promise.<string>
Url to User profile
Kind: instance method of User
Returns: Promise.<string> - A promise that resolves to the desired URL
Access: public
Promise:
Fulfill: string The desired Url
Reject: Error An Error that occured while determining URL
user.follow() ⇒ Promise.<User>
Follow the User
Kind: instance method of User
Returns: Promise.<User> - Resolves on completion to followed User
Access: public
Promise:
Fulfill: User The followed User
Reject: Error An Error that occured while processing
user.unfollow() ⇒ Promise.<user>
Unfollow the User
Kind: instance method of User
Returns: Promise.<user> - Resolves to the unfollowed User
Access: public
Promise:
Fulfill: User The unfollowed User
Reject: Error An Error that occured while processing
user.whisper(message, [title]) ⇒ Promise
Communicate privately with the user
Kind: instance method of User
Returns: Promise - Resolve when communication has occured, rejects if attempt fails or is unsupported
Access: public
| Param | Type | Description |
|---|---|---|
| message | string |
Message to communicate with the user |
| [title] | string |
Optional: Title of the message to communicate |
user.uploadAvatar(imageData, mimeType) ⇒ Promise.<string>
Upload avatar and set as current avatar
Kind: instance method of User
Returns: Promise.<string> - Resolves to the url of the avatar that is uploaded
Access: public
Promise:
Fulfill: string The url of the uploaded image
Reject: Error An Error that occured while processing
| Param | Type | Description |
|---|---|---|
| imageData | Buffer |
Image File Data to be uploaded |
| mimeType | string |
Mime type of the image data. E.g. 'image/jpeg' |
User.get(userId) ⇒ Promise.<User>
Get User by Id
Kind: static method of User
Returns: Promise.<User> - Resolves to the retrieved User
Access: public
Promise:
Fulfill: User The retrieved User
Reject: Error An Error that occured while processing
| Param | Type | Description |
|---|---|---|
| userId | number |
ID of the user to retrieve |
User.getByName(username) ⇒ Promise.<User>
Get User by username
Kind: static method of User
Returns: Promise.<User> - Resolves to the retrieved User
Access: public
Promise:
Fulfill: User The retrieved User
Reject: Error An Error that occured while processing
| Param | Type | Description |
|---|---|---|
| username | string |
Username of the user to retrieve |
User.parse(payload) ⇒ Promise.<User>
Parse user from retrieved payload
Kind: static method of User
Returns: Promise.<User> - Resolves to the parsed User
Access: public
Promise:
Fulfill: User The parsed User
Reject: Error An Error that occured while processing
| Param | Type | Description |
|---|---|---|
| payload | * |
Data to parse as a User object |