UNPKG

1.31 kBMarkdownView Raw
1
2# Comment
3
4`Comment` handler class.
5
6## API
7
8### Comment([comment-id], [post-id], site-id, WPCOM);
9
10Create a new `Comment` instance giving `comment-id`, `post-id`, `site-id` and `WPCOM` instance.
11
12```js
13var comment = Comment('<comment-id>', '<post-id>', '<site-id>', WPCOM);
14```
15
16### Comment#get([query], fn)
17
18Return a single Comment
19
20```js
21wpcom
22.site('blog.wordpress.com')
23.comment(32)
24.get(function(err, data){
25 // comment `data` object
26});
27```
28
29### Comment#replies([query], fn)
30
31Return recent comments for a post
32
33```js
34wpcom
35.site('blog.wordpress.com')
36.post(342)
37.comment()
38.replies(function(err, data){
39});
40```
41
42### Comment#add(body, fn)
43
44Create a comment on a post
45
46```js
47wpcom
48.site('blog.wordpress.com')
49.post(342)
50.comment()
51.add('Nice blog post !!!', function(err, data){
52});
53```
54
55### Comment#update(body, fn)
56
57Edit a comment
58
59```js
60wpcom
61.site('blog.wordpress.com')
62.comment(123)
63.update('It is not a blog post !!!', function(err, data){
64});
65```
66
67### Comment#reply(body, fn)
68
69Create a Comment as a reply to another Comment
70
71```js
72wpcom
73.site('blog.wordpress.com')
74.comment(123)
75.reply('Im sorry, I've edited the previous comment', function(err, data){
76});
77```
78
79### Comment#del(body, fn)
80
81Delete a comment
82
83```js
84wpcom
85.site('blog.wordpress.com')
86.comment(123)
87.del(function(err, data){
88});
89```