new Jamments(options)
Create the API object
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | The options object
Properties
|
Methods
(static) escapeHtml(text) → {String}
Escape html to avoid xss
Parameters:
Name | Type | Description |
---|---|---|
text |
String |
Returns:
- Type
- String
(static) parseMd(text) → {String}
Create HTML from Markdown (just a subset: links, *italicized*, **bold**, `code`, ```codeblock``` and paragraph)
Parameters:
Name | Type | Description |
---|---|---|
text |
String |
Returns:
- Type
- String
deleteComment(commentId, secret) → {Promise}
Delete a comment
Parameters:
Name | Type | Description |
---|---|---|
commentId |
String | |
secret |
String |
Returns:
- Type
- Promise
getCommentById(id) → {Object}
Get a comment from cached comments
Parameters:
Name | Type | Description |
---|---|---|
id |
String |
Returns:
- Type
- Object
getComments(slug) → {Promise|Promise.resolve.<Array>|Promise.reject.<Error>}
Return all comments sorted chronogically. Children comments are contained inside their parents (chrono sorted too)
Parameters:
Name | Type | Description |
---|---|---|
slug |
String |
Returns:
-
- Type
- Promise
-
array of comments sorted chronologically
- Type
- Promise.resolve.<Array>
-
- Type
- Promise.reject.<Error>
getSiteInfos() → {Promise}
Get global site info (nbr of comments for each article & md5 of admin user)
Returns:
- Type
- Promise
postComment(slug, comment, name, email, parentId) → {Promise}
Post a new comment
Parameters:
Name | Type | Description |
---|---|---|
slug |
String | |
comment |
String | |
name |
String | |
email |
String | |
parentId |
String |
Returns:
- Type
- Promise
updateComment(commentId, comment, secret) → {Promise}
Update a comment
Parameters:
Name | Type | Description |
---|---|---|
commentId |
String | |
comment |
String | |
secret |
String |
Returns:
- Type
- Promise
updateNewCommentsSubscription(articleId, userId, secret, subscribe) → {Promise}
Update user notification preferences for an article
Parameters:
Name | Type | Description |
---|---|---|
articleId |
String | |
userId |
String | |
secret |
String | |
subscribe |
Bool |
Returns:
- Type
- Promise
validateComment(commentId, secret) → {Promise}
Validate comment by sending validation data to API and refresh commentlist after that
Parameters:
Name | Type | Description |
---|---|---|
commentId |
String | |
secret |
String |
Returns:
- Type
- Promise