@@ -13,14 +13,15 @@ module.exports = runExample({
13
13
debug ( 'pulse history response' )
14
14
debugTable ( {
15
15
headers : [
16
- 'PID' , 'MTS' , 'PUID' , 'TITLE' , 'CONTENT'
16
+ 'PID' , 'MTS' , 'PUID' , 'TITLE' , 'CONTENT' , 'COMMENTS'
17
17
] ,
18
- rows : pulseHistRes . map ( ( { id, mts, userID, title, content } ) => [
18
+ rows : pulseHistRes . map ( ( { id, mts, userID, title, content, comments } ) => [
19
19
id ,
20
20
new Date ( mts ) . toLocaleString ( ) ,
21
21
userID ,
22
- ( title && title . substring ( 0 , 10 ) ) || '-' ,
23
- content . substring ( 0 , 10 )
22
+ ( title && title . substring ( 0 , 15 ) ) || '-' ,
23
+ content . substring ( 0 , 15 ) ,
24
+ comments // number of comments
24
25
] )
25
26
} )
26
27
const pulseMsg = new PulseMessage ( {
@@ -48,14 +49,14 @@ module.exports = runExample({
48
49
pulse . id ,
49
50
new Date ( pulse . mts ) . toLocaleString ( ) ,
50
51
pulse . userID ,
51
- ( pulse . title && pulse . title . substring ( 0 , 10 ) ) || '-' ,
52
- pulse . content . substring ( 0 , 10 )
52
+ ( pulse . title && pulse . title . substring ( 0 , 15 ) ) || '-' ,
53
+ pulse . content . substring ( 0 , 15 )
53
54
] ]
54
55
} )
56
+
55
57
const pulseComment = new PulseMessage ( {
56
58
parent : pulse . id ,
57
- title : '1234 5678 Foo Bar Baz Qux TITLE' ,
58
- content : '1234 5678 Foo Bar Baz Qux Content' ,
59
+ content : 'No more seven warlords of the sea' ,
59
60
isPublic : 0 ,
60
61
isPin : 1
61
62
} )
@@ -71,15 +72,35 @@ module.exports = runExample({
71
72
debug ( 'pulse comment submission response' )
72
73
debugTable ( {
73
74
headers : [
74
- 'PID' , 'MTS' , 'PARENT' , 'PUID' , 'TITLE' , 'CONTENT '
75
+ 'PID' , 'MTS' , 'PARENT' , 'PUID' , 'COMMENT '
75
76
] ,
76
77
rows : [ [
77
78
comment . id ,
78
79
new Date ( comment . mts ) . toLocaleString ( ) ,
79
80
comment . parent ,
80
81
comment . userID ,
81
- ( comment . title && comment . title . substring ( 0 , 10 ) ) || '-' ,
82
- comment . content . substring ( 0 , 10 )
82
+ comment . content . substring ( 0 , 15 )
83
83
] ]
84
84
} )
85
+
86
+ debug ( 'gettting pulse comments..' )
87
+ const pulseComments = await rest . fetchPulseComments ( {
88
+ parent : pulse . id ,
89
+ isPublic : 0 , // 0 for comments made by you; 1 for all comments of the pulse
90
+ limit : 3 , // fetch given number of comments for this pulse
91
+ end : 0 // fetch comments from a given starttime in milliseconds
92
+ } )
93
+
94
+ debug ( 'pulse comments response: %O' , pulseComments )
95
+ debugTable ( {
96
+ headers : [
97
+ 'PID' , 'MTS' , 'PUID' , 'COMMENT'
98
+ ] ,
99
+ rows : pulseComments . map ( ( { id, mts, userID, content } ) => [
100
+ id ,
101
+ new Date ( mts ) . toLocaleString ( ) ,
102
+ userID ,
103
+ content . substring ( 0 , 15 )
104
+ ] )
105
+ } )
85
106
} )
0 commit comments