ExportReply returns a reply as a map for JSON output, without nested replies.
()
| 219 | |
| 220 | // ExportReply returns a reply as a map for JSON output, without nested replies. |
| 221 | func (c DiscussionComment) ExportReply() map[string]interface{} { |
| 222 | reactions := make([]interface{}, len(c.ReactionGroups)) |
| 223 | for i, rg := range c.ReactionGroups { |
| 224 | reactions[i] = rg.Export() |
| 225 | } |
| 226 | return map[string]interface{}{ |
| 227 | "id": c.ID, |
| 228 | "url": c.URL, |
| 229 | "author": c.Author.Export(), |
| 230 | "body": c.Body, |
| 231 | "createdAt": c.CreatedAt, |
| 232 | "isAnswer": c.IsAnswer, |
| 233 | "upvoteCount": c.UpvoteCount, |
| 234 | "reactionGroups": reactions, |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // DiscussionCommentListDirection indicates whether a comment list was fetched |
| 239 | // in forward (oldest first) or backward (newest first) order. |