Skip to content
henry-smith edited this page Sep 4, 2011 · 13 revisions

Reference

vote($direction)

Casts a vote on the link. 1 for an upvote, -1 for a downvote, 0 to remove a vote. Requires a valid login.

comment($text)

Posts a comment in reply to the link. Requires a valid login.

save()

Saves the link. Requires a valid login.

unsave()

Unsaves the link (requires login).

hide()

Hides the link (requires login).

unhide()

Unhides the link (requires login).

getComments()

Returns an array of the comments posted in reply to the link Only direct replies to the link itself are in the array. Replies to those comments are stored in the comments themselves.

If the link was fetched without comments, comments are fetched from the API. Avoid this scenario where possible, the API documentation specifically asks for users to pull in information in bulk rather than in lots of different requests.

getThingId()

Returns the link's unique 't3_*' ID

getId()

Returns the link's ID

getUpvotes()

Returns the number of upvotes given to the link

getDownvotes()

Returns the number of downvotes given to the link

getScore()

Returns the link's score Score is a function of upvotes, downvotes, and time since creation

countComments()

Returns the number of replies to the link

getAuthorName()

Returns the username of the user who submitted the link

getTitle()

Returns the title of the link

getUrl()

Returns the URL that the post is a link

getPermaLink($absolute = false)

Returns the permalink to the link on Reddit. If $absolute is true, returns the full absolute URL. If not, returns just the path.

getSelfText()

If the link is a self-post, this method returns the self text

isSelfPost()

Indicates whether the post is a self-post or a link

isAgeRestricted()

Indicates whether the post is restricted to those 18-years-old or over

isClicked()

Indicates whether the logged-in user has clicked on the link.

isHidden()

Indicates whether the logged-in user has hidden the link.

isSaved()

Indicates whether the logged-in user has saved the link.

Clone this wiki locally