A single post.

Hierarchy (view full)

Implements

Properties

approved?: boolean

Whether or not this item was approved.

approvedAtUtc: Maybe<number>

The unix timestamp of when this was approved.

This can be undefined if the item either hasn't been approved or you don't have permission to know (i.e. you're not a mod on that subreddit).

approvedBy: Maybe<string>

The username of the mod who approved this post.

This can be undefined if the item either hasn't been approved or you don't have permission to know (i.e. you're not a mod on that subreddit).

archived: boolean

Whether or not this post is archived.

author: string

The username of the user who created this item.

authorPatreonFlair: boolean

Whether or not the author has a Patreon flair.

authorPremium: boolean

Whether or not the author has Reddit Premium.

banNote?: string

The note of why this item was banned (removed).

bannedAtUtc: Maybe<number>

The unix timestamp of when this item was banned (removed).

This can be undefined if the item either hasn't been banned or you don't have permission to know (i.e. you're not a mod on that subreddit).

bannedBy: Maybe<string>

The username of the mod who banned (removed) this item.

This can be undefined if the item either hasn't been banned or you don't have permission to know (i.e. you're not a mod on that subreddit).

body: string

The text body of the post.

Note

The Reddit API calls this parameter selftext.

bodyHtml: Maybe<string>

The HTML body of the post, or undefined if the body is empty.

Note

The Reddit API calls this parameter selftextHtml.

canGild: boolean

Whether or not this you can guild this item.

canModPost: boolean

Whether or not you can moderate this item.

comments: Listing<Comment>

A Listing of comments on this post.

contestMode: boolean

Whether or not this post is in contest mode.

createdUtc: number

The unix timestamp when this object was created.

dismissedUserReports?: string[]

The old reports on this item.

distinguished: Maybe<"admin" | "moderator">

Whether or not this item was distinguished, and by whom.

domain: string

The domain of the link for this post.

edited: number | false

The unix timestamp when this item was edited, or false if it wasn't.

gilded: number

How many times this item has been gilded.

gildings: Gildings

The gildings that this item has received.

hidden: boolean

Whether or not this post is hidden.

hideScore: boolean

Whether or not the score of this post is hidden.

id: string

The ID of this object.

ignoreReports: boolean

Whether or not future reports of this item will be ignored.

isCrosspostable: boolean

Whether or not you are allowed to crosspost this post.

isMeta: boolean

Whether or not this is a meta post.

isOriginalContent: boolean

Whether or not this post is marked as OC.

isRedditMediaDomain: boolean

Whether the domain is reddit-controlled (true) or 3rd party (false).

isRobotIndexable: boolean

Whether or not robots are allowed to index this post.

isSelf: boolean

Whether or not this is a self (text) post.

isVideo: boolean

Whether or not this is a video post.

likes: Maybe<boolean>

Whether and how you voted on this item.

Value Meaning
true You upvoted this item.
false You downvoted this item.
undefined You have not voted on this item.
linkFlairTemplateId: Maybe<string>

The ID of the link flair template, or undefined if there is no flair.

locked: boolean

Whether or not this item is locked.

modNote: Maybe<string>

A note about why this item was removed that only the moderators can see, or undefined if no note was added or this item hasn't been removed.

modReasonBy: Maybe<string>

The username of the mod who added a removal reason to this item, or undefined if no reason was given or this item hasn't been removed.

modReasonTitle: Maybe<string>

The reason this item was removed, or undefined if no reason was given or this item hasn't been removed.

modReports: [string, string][]

The current reports on this item that were made by mods.

Each entry is of the form [report, username].

modReportsDismissed?: [string, string][]

The old reports on this item that were made by mods.

Each entry is of the form [report, username].

numComments: number

The number of comments on this post.

numCrossposts: number

The number of times this has been crossposted.

numReports: number

The number of reports this item has.

This seems to be calculated as follows:

max(
modReports.length - modReportsDismissed.length,
userReports.length - userReportsDismissed.length
)

This means that it will be negative if there were reports that have been dismissed.

over18: boolean

Whether or not this post is marked as 18+/nsfw.

permalink: string

The permalink to this item, relative to reddit.com.

pinned: boolean

Whether or not this post has been pinned.

removed: boolean

Whether or not this item has been removed.

saved: boolean

Whether or not you have saved this item.

score: number

The score that this item has received.

sendReplies: boolean

Whether or not replies to this item will notify the author.

spam?: boolean

Whether or not this item has been marked as spam.

spoiler: boolean

Whether or not this post was marked as being a spoiler.

stickied: boolean

Whether or not this item has been sticked.

subreddit: string

The name of the subreddit this item was posted in.

subredditSubscribers: number

The number of subscribers the subreddit this was posted to has.

subredditType: SubredditType

The type of the subreddit this item was posted in.

suggestedSort: Maybe<SuggestedSort>

The suggested way to sort the comments of this post, or undefined if no such suggestion has been given.

title: string

The title of this post.

upvoteRatio: number

The ratio of upvotes to downvotes on this post.

This will be in the range [0, 1], where 1 is 100% upvoted.

url: string

The URL of this post.

If this is a link post url will be that link. Otherwise it will be the fully-qualified URL of this post.

userReports: [string, number][]

The current reports on this item that were made by users.

Each entry is of the form [report, count].

userReportsDismissed?: [string, number][]

The old reports on this item that were made by users.

Each entry is of the form [report, count].

Methods

  • Approve this item.

    Returns Promise<void>

    A promise that resolves when the item has been approved.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Block the author of this item.

    Returns Promise<void>

    A promise that resolves when the request is complete.

    Note

    Apparently this only works if this item is in modmail or the user's inbox, and if it's not the request silently succeeds anyway.

  • Crosspost this post.

    Parameters

    • subreddit: string

      The name of the subreddit to crosspost to.

    • title: string

      The title of the crosspost.

    • options: LinkPostOptions = {}

      Any extra options.

    Returns Promise<string>

    A promise that resolves to the ID of the newly created post.

  • Distinguish this post.

    Returns Promise<void>

    A promise that resolves when this post has been distinguished.

  • Edit this item.

    Parameters

    • newText: string

      The new text to use.

    Returns Promise<void>

    A promise that resolves when the edit is complete.

  • Get the duplicates of this post.

    This is the mechanism that drives the "View discussions in X other communities" button on Reddit.

    Returns Promise<Listing<Post>>

    A promise that resolves to a listing of posts.

  • Give Reddit gold to the author of this item.

    Returns Promise<void>

    A promise that resolves when this item has been gilded.

  • Hide this post, preventing it from appearing on most listings.

    Returns Promise<void>

    A promise that resolves when the post has been hidden.

  • Ignore any future reports on this item.

    Returns Promise<void>

    A promise that resolves when the setting has been changed.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Lock this item, preventing non-moderators from being able to post replies.

    Returns Promise<void>

    A promise that resolves when this item has been locked.

  • Mark this post as NSFW.

    Returns Promise<void>

    A promise that resolves when the post has been marked as NSFW.

  • Mark this post is a spoiler.

    Returns Promise<void>

    A promise that resolves when the post has been marked as a spoiler.

  • Re-fetch this post.

    Note: This returns a new object, it is not mutating.

    Returns Promise<Post>

    A promise that resolves to the newly fetched post.

  • Remove this item, optionally marking it as spam.

    Parameters

    • spam: boolean = false

      Whether or not to mark this item as spam. Defaults to false.

    Returns Promise<void>

    A promise that resolves when this item has been removed.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Report this item to the mods.

    The report will be anonymous if you are not a mod of the subreddit. If you are a mod the report will be tied to your username.

    Parameters

    • Optional reason: string

      The reason you are reporting this item.

    Returns Promise<void>

    A promise that resolves when this item has been reported.

  • Save this item.

    This will make this item show up at reddit.com/saved.

    Returns Promise<void>

    A promise that resolves when this item has been saved.

  • Turn contest mode on/off.

    Parameters

    • enabled: boolean

      Whether to turn contest mode on or off.

    Returns Promise<void>

    A promise that resolves when this post's contest mode has been updated.

  • Set the suggested sort for this post.

    Parameters

    • sort: Maybe<SuggestedSort>

      The new suggested sort. If this is undefined the sort will be cleared.

    Returns Promise<void>

    A promise that resolves when this post's suggested sort has been updated.

  • Sticky this post.

    Parameters

    • slot: 1 | 2

      The slot to sticky this post to.

    Returns Promise<void>

    A promise that resolves when the post has been stickied.

  • Undistinguish this post.

    Returns Promise<void>

    A promise that resolves when this post has been undistinguished.

  • Unhide this post, allowing it to appear on most listings.

    Returns Promise<void>

    A promise that resolves when the post has been hidden.

  • Unignore any future reports on this item.

    Returns Promise<void>

    A promise that resolves when the setting has been changed.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Unlock this item, allowing non-moderators to post replies.

    Returns Promise<void>

    A promise that resolves when this item has been unlocked.

  • Mark this post as not NSFW.

    Returns Promise<void>

    A promise that resolves when the post has been unmarked.

  • Mark this post is not a spoiler.

    Returns Promise<void>

    A promise that resolves when the post has been unmarked.

  • Unsave this item.

    This will make this item no longer show up at reddit.com/saved.

    Returns Promise<void>

    A promise that resolves when this item has been unsaved.

  • Unsticky this post.

    Returns Promise<void>

    A promise that resolves when the post has been unstickied.