lib / com.kirkbushman.araw.models / Comment

Comment

@JsonClass(true) data class Comment : CommentData, Votable, Saveable, Created, Editable, Distinguishable, Gildable, Replyable, Parcelable

This class can represent a comment on a Submission or a reply to another comment.

Instances of this class along with the class MoreComments is organized in a tree structure, that composes a Submission comments section.

Constructors

<init>

This class can represent a comment on a Submission or a reply to another comment.

Comment(id: String, fullname: String, allAwarding: List<Awarding>?, author: String, body: String, bodyHtml: String, canGild: Boolean, created: Long, createdUtc: Long, editedRaw: Any, depth: Int = 0, distinguishedRaw: String?, isArchived: Boolean, isLocked: Boolean, isSaved: Boolean, isScoreHidden: Boolean, isStickied: Boolean, isSubmitter: Boolean, likes: Boolean?, linkTitle: String?, linkAuthor: String?, linkId: String?, linkUrl: String?, linkPermalink: String?, gildings: Gildings, parentId: String, permalink: String, repliesRaw: EnvelopedCommentDataListing?, replies: List<CommentData>? = repliesRaw?.data?.children?.map { it.data }?.toList(), parentFullname: String = parentId, score: Int, subreddit: String, subredditId: String, subredditNamePrefixed: String)

Properties

allAwarding

val allAwarding: List<Awarding>?

author

Name of the comment's author

val author: String

body

The raw text. this is the unformatted text which includes the raw markup characters such as ** for bold. <, >, and & are escaped.

val body: String

bodyHtml

The formatted HTML text as displayed on reddit. For example, text that is emphasised by * will now have tags wrapping it. Additionally, bullets and numbered lists will now be in HTML list format. NOTE: The HTML string will be escaped. You must unescape to get the raw HTML.

val bodyHtml: String

canGild

If the user can give a Gilding to this comment.

val canGild: Boolean

created

The unix-time Long representing the creation date of the comment.

val created: Long

createdUtc

The unix-time Long representing the UTC creation date of the comment.

val createdUtc: Long

depth

An integer representing the nested level of this comment.

val depth: Int

distinguishedRaw

to allow determining whether they have been distinguished by moderators/admins. null = not distinguished. moderator = the green. admin = the red. special = various other special distinguishes. NOTE: use the extensions in Distinguishable to have an enum representation.

val distinguishedRaw: String?

editedRaw

false if not edited, edit date in UTC epoch-seconds otherwise. NOTE: for some old edited comments on reddit.com, this will be set to true instead of edit date. Since this field can be a Boolean or a Long value, it's kept as Any, use the field in the Editable interface to get a nullable Long version, which is more practical to use.

val editedRaw: Any

fullname

Fullname of comment, e.g. "t1_c3v7f8u"

val fullname: String

gildings

the number of times this comment received reddit gold, silver, platinum.

val gildings: Gildings

hasReplies

If the node has children nodes.

val hasReplies: Boolean

id

This item identifier, e.g. "8xwlg"

val id: String

isArchived

whether the comment has been archived or not.

val isArchived: Boolean

isLocked

whether the comment has been locked or not.

val isLocked: Boolean

isSaved

whether the comment has been saved by the current user.

val isSaved: Boolean

isScoreHidden

val isScoreHidden: Boolean

isStickied

whether the comment has been stickied at the top of the subreddit or not.

val isStickied: Boolean

isSubmitter

whether the current user is the submitter of the comment.

val isSubmitter: Boolean

likes

how the logged-in user has voted on the comment, True = upvoted, False = downvoted, null = no vote NOTE: use the extensions to have a practical enum class.

val likes: Boolean?

linkAuthor

author of the Submission related to this comment. Present if the comment is being displayed outside its thread.

val linkAuthor: String?

linkId

id of the Submission related to this comment.

val linkId: String?

linkPermalink

permalink of the Submission related to this comment. Present if the comment is being displayed outside its thread.

val linkPermalink: String?

linkTitle

title of the Submission related to this comment. Present if the comment is being displayed outside its thread.

val linkTitle: String?

linkUrl

url of the Submission related to this comment. Present if the comment is being displayed outside its thread.

val linkUrl: String?

parentFullname

Fullname of the thing this comment is a reply to, either the link or a comment in it.

val parentFullname: String

parentId

ID of the thing this comment is a reply to, either the link or a comment in it.

val parentId: String

permalink

val permalink: String

replies

Clear list of the replies to this comment, without envelope.

var replies: List<CommentData>?

repliesRaw

Enveloped models of replies to this comments.

val repliesRaw: EnvelopedCommentDataListing?

repliesSize

The number of children nodes.

val repliesSize: Int

score

the net-score of the comment.

val score: Int

subreddit

subreddit of the comment excluding the /r/ prefix. e.g. "pics".

val subreddit: String

subredditId

id of the comment excluding the /r/ prefix.

val subredditId: String

subredditNamePrefixed

subreddit of the comment including the /r/ prefix.

val subredditNamePrefixed: String

Extension Properties

createdDate

Useful extension to convert the creation date property, from the Long unixtime, to a more practical Date object.

val Created.createdDate: Date

createdUtcDate

Useful extension to convert the utc creation date property, from the Long unixtime, to a more practical Date object.

val Created.createdUtcDate: Date

distinguished

Useful extension to map to an enum.

val Distinguishable.distinguished: Distinguished

edited

val Editable.edited: Date

hasEdited

val Editable.hasEdited: Boolean

vote

Useful extension to map to an enum.

val Votable.vote: Vote