Class: Comment
Table of contents
Constructors
Accessors
- approved
- authorName
- body
- collapsedBecauseCrowdControl
- createdAt
- distinguishedBy
- edited
- id
- locked
- numReports
- parentId
- postId
- removed
- replies
- score
- spam
- stickied
Methods
- approve
- delete
- distinguish
- distinguishAsAdmin
- edit
- isApproved
- isDistinguished
- isEdited
- isLocked
- isRemoved
- isSpam
- isStickied
- lock
- remove
- reply
- toJSON
- undistinguish
- unlock
- approve
- delete
- distinguish
- edit
- getById
- getComments
- getCommentsByUser
- lock
- remove
- submit
- undistinguish
- unlock
Constructors
constructor
• new Comment(data, metadata?)
Parameters
| Name | Type |
|---|---|
data | RedditObject | Comment |
metadata? | Metadata |
Accessors
approved
• get approved(): boolean
Returns
boolean
authorName
• get authorName(): string
Returns
string
body
• get body(): string
Returns
string
collapsedBecauseCrowdControl
• get collapsedBecauseCrowdControl(): boolean
Returns
boolean
createdAt
• get createdAt(): Date
Returns
Date
distinguishedBy
• get distinguishedBy(): undefined | string
Returns
undefined | string
edited
• get edited(): boolean
Returns
boolean
id
• get id(): `t1_${string}`
Returns
`t1_${string}`
locked
• get locked(): boolean
Returns
boolean
numReports
• get numReports(): number
Returns
number
parentId
• get parentId(): `t1_${string}` | `t3_${string}`
Returns
`t1_${string}` | `t3_${string}`
postId
• get postId(): `t3_${string}`
Returns
`t3_${string}`
removed
• get removed(): boolean
Returns
boolean
replies
• get replies(): Listing<Comment>
Returns
score
• get score(): number
Returns
number
spam
• get spam(): boolean
Returns
boolean
stickied
• get stickied(): boolean
Returns
boolean
Methods
approve
▸ approve(): Promise<void>
Returns
Promise<void>
delete
▸ delete(): Promise<void>
Returns
Promise<void>
distinguish
▸ distinguish(makeSticky?): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
makeSticky | boolean | false |
Returns
Promise<void>
distinguishAsAdmin
▸ distinguishAsAdmin(makeSticky?): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
makeSticky | boolean | false |
Returns
Promise<void>
edit
▸ edit(options): Promise<Comment>
Parameters
| Name | Type |
|---|---|
options | CommentSubmissionOptions |
Returns
Promise<Comment>
isApproved
▸ isApproved(): boolean
Returns
boolean
isDistinguished
▸ isDistinguished(): boolean
Returns
boolean
isEdited
▸ isEdited(): boolean
Returns
boolean
isLocked
▸ isLocked(): boolean
Returns
boolean
isRemoved
▸ isRemoved(): boolean
Returns
boolean
isSpam
▸ isSpam(): boolean
Returns
boolean
isStickied
▸ isStickied(): boolean
Returns
boolean
lock
▸ lock(): Promise<void>
Returns
Promise<void>
remove
▸ remove(isSpam?): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
isSpam | boolean | false |
Returns
Promise<void>
reply
▸ reply(options): Promise<Comment>
Parameters
| Name | Type |
|---|---|
options | CommentSubmissionOptions |
Returns
Promise<Comment>
toJSON
▸ toJSON(): Object
Returns
Object
| Name | Type |
|---|---|
approved | boolean |
authorName | string |
body | string |
collapsedBecauseCrowdControl | boolean |
createdAt | Date |
distinguishedBy | undefined | string |
edited | boolean |
id | `t1_${string}` |
locked | boolean |
numReports | number |
parentId | `t1_${string}` | `t3_${string}` |
postId | `t3_${string}` |
removed | boolean |
replies | Listing<Comment> |
score | number |
spam | boolean |
stickied | boolean |
undistinguish
▸ undistinguish(): Promise<void>
Returns
Promise<void>
unlock
▸ unlock(): Promise<void>
Returns
Promise<void>
approve
▸ Static approve(id, metadata?): Promise<void>
Parameters
| Name | Type |
|---|---|
id | `t1_${string}` |
metadata? | Metadata |
Returns
Promise<void>
delete
▸ Static delete(id, metadata?): Promise<void>
Parameters
| Name | Type |
|---|---|
id | `t1_${string}` |
metadata? | Metadata |
Returns
Promise<void>
distinguish
▸ Static distinguish(id, sticky, asAdmin, metadata?): Promise<{ distinguishedBy: undefined | string = comment.distinguished; stickied: boolean }>
Parameters
| Name | Type |
|---|---|
id | `t1_${string}` |
sticky | boolean |
asAdmin | boolean |
metadata? | Metadata |
Returns
Promise<{ distinguishedBy: undefined | string = comment.distinguished; stickied: boolean }>
edit
▸ Static edit(options, metadata?): Promise<Comment>
Parameters
| Name | Type |
|---|---|
options | Object |
metadata? | Metadata |
Returns
Promise<Comment>
getById
▸ Static getById(id, metadata?): Promise<Comment>
Parameters
| Name | Type |
|---|---|
id | `t1_${string}` |
metadata? | Metadata |
Returns
Promise<Comment>
getComments
▸ Static getComments(options, metadata?): Listing<Comment>
Parameters
| Name | Type |
|---|---|
options | GetCommentsOptions |
metadata? | Metadata |
Returns
getCommentsByUser
▸ Static getCommentsByUser(options, metadata?): Listing<Comment>
Parameters
| Name | Type |
|---|---|
options | GetCommentsByUserOptions |
metadata? | Metadata |
Returns
lock
▸ Static lock(id, metadata?): Promise<void>
Parameters
| Name | Type |
|---|---|
id | `t1_${string}` |
metadata? | Metadata |
Returns
Promise<void>
remove
▸ Static remove(id, isSpam?, metadata?): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
id | `t1_${string}` | undefined |
isSpam | boolean | false |
metadata? | Metadata | undefined |
Returns
Promise<void>
submit
▸ Static submit(options, metadata?): Promise<Comment>
Parameters
| Name | Type |
|---|---|
options | Object |
metadata? | Metadata |
Returns
Promise<Comment>
undistinguish
▸ Static undistinguish(id, metadata?): Promise<{ distinguishedBy: undefined | string = comment.distinguished; stickied: boolean }>
Parameters
| Name | Type |
|---|---|
id | `t1_${string}` |
metadata? | Metadata |
Returns
Promise<{ distinguishedBy: undefined | string = comment.distinguished; stickied: boolean }>
unlock
▸ Static unlock(id, metadata?): Promise<void>
Parameters
| Name | Type |
|---|---|
id | `t1_${string}` |
metadata? | Metadata |
Returns
Promise<void>