1 |
|
2 | # Comment
|
3 |
|
4 | `Comment` handler class.
|
5 |
|
6 | ## API
|
7 |
|
8 | ### Comment([comment-id], [post-id], site-id, WPCOM);
|
9 |
|
10 | Create a new `Comment` instance giving `comment-id`, `post-id`, `site-id` and `WPCOM` instance.
|
11 |
|
12 | ```js
|
13 | var comment = Comment('<comment-id>', '<post-id>', '<site-id>', WPCOM);
|
14 | ```
|
15 |
|
16 | ### Comment#get([query], fn)
|
17 |
|
18 | Return a single Comment
|
19 |
|
20 | ```js
|
21 | wpcom
|
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 |
|
31 | Return recent comments for a post
|
32 |
|
33 | ```js
|
34 | wpcom
|
35 | .site('blog.wordpress.com')
|
36 | .post(342)
|
37 | .comment()
|
38 | .replies(function(err, data){
|
39 | });
|
40 | ```
|
41 |
|
42 | ### Comment#add(body, fn)
|
43 |
|
44 | Create a comment on a post
|
45 |
|
46 | ```js
|
47 | wpcom
|
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 |
|
57 | Edit a comment
|
58 |
|
59 | ```js
|
60 | wpcom
|
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 |
|
69 | Create a Comment as a reply to another Comment
|
70 |
|
71 | ```js
|
72 | wpcom
|
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 |
|
81 | Delete a comment
|
82 |
|
83 | ```js
|
84 | wpcom
|
85 | .site('blog.wordpress.com')
|
86 | .comment(123)
|
87 | .del(function(err, data){
|
88 | });
|
89 | ```
|