Package com.restfb.types
Class Post
java.lang.Object
com.restfb.types.AbstractFacebookType
com.restfb.types.FacebookType
com.restfb.types.Post
- All Implemented Interfaces:
HasComments
,HasCreatedTime
,HasMessage
,Serializable
public class Post extends FacebookType implements HasComments, HasCreatedTime, HasMessage
Represents the Post Graph API type.
- Since:
- 1.5
- Author:
- Mark Allen
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Post.Action
Represents the Action Graph API type.static class
Post.Attachments
Represents the attachments included inGraph API Post type.static class
Post.FeedTargeting
Object that controls news feed targeting for this post.static class
Post.KeyedType
static class
Post.Property
Represents the undocumentedProperty
type.static class
Post.Shares
Represents the Shares included the Post response.static class
Post.Targeting
Nested classes/interfaces inherited from class com.restfb.types.FacebookType
FacebookType.Metadata
-
Constructor Summary
Constructors Constructor Description Post()
-
Method Summary
Modifier and Type Method Description boolean
addAction(Post.Action action)
void
addChildAttachment(Post childAttachment)
void
addMessageTag(MessageTag messageTag)
boolean
addProperty(Post.Property property)
boolean
addSponsorTag(NamedFacebookType sponsorTag)
void
addStoryTag(MessageTag messageTag)
boolean
addTo(NamedFacebookType profile)
boolean
addWithTag(NamedFacebookType withTag)
Deprecated.List<Post.Action>
getActions()
A list of available action names and links (including commenting, liking, and an optional app-specified action).NamedFacebookType
getAdminCreator()
ID of admin who created the post.List<String>
getAllowedAdvertisingObjectives()
Objectives under which this post can be advertisedString
getAllowedAdvertisingObjects()
Objectives under which this post can be advertisedNamedFacebookType
getApplication()
The application used to create this post.Post.Attachments
getAttachments()
Attachments added to a post.PostCallToAction
getCallToAction()
The call to action type used in any Page posts for mobile app engagement adsBoolean
getCanReplyPrivately()
Whether the viewer can send a private reply to this post (Page viewers only)String
getCaption()
The caption of the link (appears beneath the link name).List<Post>
getChildAttachments()
Sub-shares of a multi-link share postComments
getComments()
The comments for this post.Long
getCommentsCount()
The number of comments of this post.String
getCommentsMirroringDomain()
If comments are being mirrored to an external site, this function returns the domain of that external site.Date
getCreatedTime()
The time the post was initially published.String
getDescription()
A description of the link (appears beneath the link caption).Post.FeedTargeting
getFeedTargeting()
Object that controls news feed targeting for this post.CategorizedFacebookType
getFrom()
An object containing the ID and name of the user who posted the message.String
getFullPicture()
Full picture URL.String
getIcon()
A link to an icon representing the type of this post.String
getInstagramEligibility()
Whether the post can be promoted on Instagram.Boolean
getIsAppShare()
Whether or not the post references an app.Boolean
getIsEligibleForPromotion()
Boolean
getIsExpired()
Whether the post has expiration time that has passedBoolean
getIsHidden()
If this post is marked as hidden (applies to Pages only).Boolean
getIsInstagramEligible()
Whether this post can be promoted in Instagram.Boolean
getIsPopular()
Whether the post is currently popular.Boolean
getIsPublished()
Indicates whether a scheduled post was published.Boolean
getIsSpherical()
Whether the post is a spherical video post.Likes
getLikes()
Duplicate mapping for "likes" since FB can return it differently in different situations. -- GETTER -- The likes on this post.Long
getLikesCount()
The number of likes on this post.String
getLink()
The link attached to this post.String
getMessage()
The message.List<MessageTag>
getMessageTags()
Objects tagged in the message (Users, Pages, etc).Boolean
getMultiShareEndCard()
Whether display the end card for a multi-link share postBoolean
getMultiShareOptimized()
Whether automatically select the order of the links in multi-link share post when used in an adString
getName()
The name of the link.String
getObjectId()
The Facebook object id for an uploaded photo or video.String
getParentId()
ID of the parent postString
getPermalinkUrl()
The permanent static URL to the post on www.facebook.com.String
getPicture()
If available, a link to the picture included with this post.Place
getPlace()
The place where this post occurred.Privacy
getPrivacy()
The privacy settings for this post.String
getPromotionStatus()
Status of the promotion, if the post was promoted.List<Post.Property>
getProperties()
A list of properties for this post.Reactions
getReactions()
The reactions for this post.Long
getReactionsCount()
The number of reactions on this post.Date
getScheduledPublishTime()
UNIX timestamp of the scheduled publish time for the post.Post.Shares
getShares()
Number of times the post has been shared.Long
getSharesCount()
The number of shares of this post.String
getSource()
If available, the source link attached to this post (for example, a flash or video file).List<NamedFacebookType>
getSponsorTags()
A sponsor tag points to a Facebook Page.String
getStatusType()
Thestatus_type
of post this is, for example"approved_friend"
.String
getStory()
Text from stories not intentionally generated by usersList<MessageTag>
getStoryTags()
Objects tagged in the story (Users, Pages, etc).NamedFacebookType
getTarget()
The profile this was posted on if different from the author.Post.Targeting
getTargeting()
Ads targeting information of the post.String
getTimelineVisibility()
Timeline visibility information of the post.List<NamedFacebookType>
getTo()
A list of the profiles mentioned or targeted in this post.String
getType()
A string indicating the object type of this post.Date
getUpdatedTime()
The time of the last comment on this post.String
getVia()
ID of the user or Page the post was shared fromList<NamedFacebookType>
getWithTags()
Deprecated.protected void
jsonMappingCompleted(JsonMapper jsonMapper)
Post-JSON-mapping operation that populates themessageTags
field "by hand".boolean
removeAction(Post.Action action)
void
removeChildAttachment(Post childAttachment)
void
removeMessageTag(MessageTag messageTag)
boolean
removeProperty(Post.Property property)
boolean
removeSponsorTag(NamedFacebookType sponsorTag)
void
removeStoryTag(MessageTag messageTag)
boolean
removeTo(NamedFacebookType profile)
boolean
removeWithTag(NamedFacebookType withTag)
Deprecated.void
setAdminCreator(NamedFacebookType adminCreator)
ID of admin who created the post.void
setAllowedAdvertisingObjectives(List<String> allowedAdvertisingObjectives)
Objectives under which this post can be advertisedvoid
setAllowedAdvertisingObjects(String allowedAdvertisingObjects)
Objectives under which this post can be advertisedvoid
setApplication(NamedFacebookType application)
The application used to create this post.void
setAttachments(Post.Attachments attachments)
Attachments added to a post.void
setCallToAction(PostCallToAction callToAction)
The call to action type used in any Page posts for mobile app engagement adsvoid
setCanReplyPrivately(Boolean canReplyPrivately)
Whether the viewer can send a private reply to this post (Page viewers only)void
setCaption(String caption)
The caption of the link (appears beneath the link name).void
setComments(Comments comments)
The comments for this post.void
setCommentsMirroringDomain(String commentsMirroringDomain)
If comments are being mirrored to an external site, this function returns the domain of that external site.void
setCreatedTime(Date createdTime)
The time the post was initially published.void
setDescription(String description)
A description of the link (appears beneath the link caption).void
setFeedTargeting(Post.FeedTargeting feedTargeting)
Object that controls news feed targeting for this post.void
setFrom(CategorizedFacebookType from)
An object containing the ID and name of the user who posted the message.void
setFullPicture(String fullPicture)
Full picture URL.void
setIcon(String icon)
A link to an icon representing the type of this post.void
setInstagramEligibility(String instagramEligibility)
Whether the post can be promoted on Instagram.void
setIsAppShare(Boolean isAppShare)
Whether or not the post references an app.void
setIsEligibleForPromotion(Boolean isEligibleForPromotion)
void
setIsExpired(Boolean isExpired)
Whether the post has expiration time that has passedvoid
setIsHidden(Boolean isHidden)
If this post is marked as hidden (applies to Pages only).void
setIsInstagramEligible(Boolean isInstagramEligible)
Whether this post can be promoted in Instagram.void
setIsPopular(Boolean isPopular)
Whether the post is currently popular.void
setIsPublished(Boolean isPublished)
Indicates whether a scheduled post was published.void
setIsSpherical(Boolean isSpherical)
Whether the post is a spherical video post.void
setLikes(Likes likes)
Duplicate mapping for "likes" since FB can return it differently in different situations. -- GETTER -- The likes on this post.void
setLink(String link)
The link attached to this post.void
setMessage(String message)
The message.void
setMultiShareEndCard(Boolean multiShareEndCard)
Whether display the end card for a multi-link share postvoid
setMultiShareOptimized(Boolean multiShareOptimized)
Whether automatically select the order of the links in multi-link share post when used in an advoid
setName(String name)
The name of the link.void
setObjectId(String objectId)
The Facebook object id for an uploaded photo or video.void
setParentId(String parentId)
ID of the parent postvoid
setPermalinkUrl(String permalinkUrl)
The permanent static URL to the post on www.facebook.com.void
setPicture(String picture)
If available, a link to the picture included with this post.void
setPlace(Place place)
The place where this post occurred.void
setPrivacy(Privacy privacy)
The privacy settings for this post.void
setPromotionStatus(String promotionStatus)
Status of the promotion, if the post was promoted.void
setReactions(Reactions reactions)
The reactions for this post.void
setScheduledPublishTime(Date scheduledPublishTime)
UNIX timestamp of the scheduled publish time for the post.void
setShares(Post.Shares shares)
Number of times the post has been shared.void
setSource(String source)
If available, the source link attached to this post (for example, a flash or video file).void
setStatusType(String statusType)
Thestatus_type
of post this is, for example"approved_friend"
.void
setStory(String story)
Text from stories not intentionally generated by usersvoid
setTarget(NamedFacebookType target)
The profile this was posted on if different from the author.void
setTargeting(Post.Targeting targeting)
Ads targeting information of the post.void
setTimelineVisibility(String timelineVisibility)
Timeline visibility information of the post.void
setUpdatedTime(Date updatedTime)
The time of the last comment on this post.void
setVia(String via)
ID of the user or Page the post was shared fromMethods inherited from class com.restfb.types.FacebookType
getId, getMetadata, setId, setMetadata, setType
Methods inherited from class com.restfb.types.AbstractFacebookType
equals, hashCode, toString
-
Constructor Details
-
Post
public Post()
-
-
Method Details
-
getType
A string indicating the object type of this post. Hint for Graph API 3.3:attachment/media_type
If there is noattachment
ormedia_type=link
, the value is the same astype=status
.- Overrides:
getType
in classFacebookType
- Returns:
- A string indicating the object type of this post.
-
jsonMappingCompleted
Post-JSON-mapping operation that populates themessageTags
field "by hand".This is a temporary hack until we have formal public support for it/improved
JsonMapper
capabilities so it can handle arbitrary Map types.- Parameters:
jsonMapper
- TheJsonMapper
that was used to map to this type.- Since:
- 1.6.11
-
getLikesCount
The number of likes on this post.- Returns:
- The number of likes on this post.
-
getReactionsCount
The number of reactions on this post.- Returns:
- The number of reactions on this post.
-
getCommentsCount
The number of comments of this post.- Returns:
- The number of comments of this post.
-
getTo
A list of the profiles mentioned or targeted in this post.- Returns:
- A list of the profiles mentioned or targeted in this post.
-
addTo
-
removeTo
-
getActions
A list of available action names and links (including commenting, liking, and an optional app-specified action).- Returns:
- A list of available action names and links (including commenting, liking, and an optional app-specified action).
-
addAction
-
removeAction
-
getProperties
A list of properties for this post.This field is undocumented.
- Returns:
- A list of properties for this post.
-
addProperty
-
removeProperty
-
getWithTags
Deprecated.Objects (Users, Pages, etc) tagged as being with the publisher of the post ("Who are you with?" on Facebook).- Returns:
- Objects (Users, Pages, etc) tagged as being with the publisher of the post ("Who are you with?" on Facebook).
- Since:
- 1.6.10
-
addWithTag
Deprecated. -
removeWithTag
Deprecated. -
getMessageTags
Objects tagged in the message (Users, Pages, etc).- Returns:
- Objects tagged in the message (Users, Pages, etc).
- Since:
- 1.6.10
-
addMessageTag
-
removeMessageTag
-
getStoryTags
Objects tagged in the story (Users, Pages, etc).- Returns:
- Objects tagged in the story (Users, Pages, etc).
-
addStoryTag
-
removeStoryTag
-
getChildAttachments
Sub-shares of a multi-link share post- Returns:
- Sub-shares of a multi-link share post
-
addChildAttachment
-
removeChildAttachment
-
getSponsorTags
A sponsor tag points to a Facebook Page. (Page owners can allow their business partners to directly boost their posts.) -
addSponsorTag
-
removeSponsorTag
-
getFrom
An object containing the ID and name of the user who posted the message.- Returns:
- An object containing the ID and name of the user who posted the message.
-
setFrom
An object containing the ID and name of the user who posted the message. -
getAllowedAdvertisingObjects
Objectives under which this post can be advertised- Returns:
- Objectives under which this post can be advertised
-
setAllowedAdvertisingObjects
Objectives under which this post can be advertised -
getAllowedAdvertisingObjectives
Objectives under which this post can be advertised- Returns:
- Objectives under which this post can be advertised
-
setAllowedAdvertisingObjectives
Objectives under which this post can be advertised -
getCallToAction
The call to action type used in any Page posts for mobile app engagement ads -
setCallToAction
The call to action type used in any Page posts for mobile app engagement ads -
getCommentsMirroringDomain
If comments are being mirrored to an external site, this function returns the domain of that external site.- Returns:
- If comments are being mirrored to an external site, this function returns the domain of that external site.
-
setCommentsMirroringDomain
If comments are being mirrored to an external site, this function returns the domain of that external site. -
getMessage
The message.- Specified by:
getMessage
in interfaceHasMessage
- Returns:
- The message.
-
setMessage
The message. -
getParentId
ID of the parent post- Returns:
- ID of the parent post
-
setParentId
ID of the parent post -
getPermalinkUrl
The permanent static URL to the post on www.facebook.com.Example: https://www.facebook.com/FacebookforDevelopers/posts/10153449196353553
- Returns:
- The permanent static URL to the post on www.facebook.com.
-
setPermalinkUrl
The permanent static URL to the post on www.facebook.com.Example: https://www.facebook.com/FacebookforDevelopers/posts/10153449196353553
-
getPicture
If available, a link to the picture included with this post.- Returns:
- If available, a link to the picture included with this post.
-
setPicture
If available, a link to the picture included with this post. -
getLink
The link attached to this post. Hint for Graph API 3.3: Useattachment/url_unshimmed
instead- Returns:
- The link attached to this post.
-
setLink
The link attached to this post. Hint for Graph API 3.3: Useattachment/url_unshimmed
instead -
getName
The name of the link. Hint for Graph API 3.3: Useattachment/title
instead- Returns:
- The name of the link.
-
setName
The name of the link. Hint for Graph API 3.3: Useattachment/title
instead -
getCaption
The caption of the link (appears beneath the link name). Hint for Graph API 3.3: Useattachment/title
instead- Returns:
- The caption of the link (appears beneath the link name).
-
setCaption
The caption of the link (appears beneath the link name). Hint for Graph API 3.3: Useattachment/title
instead -
getDescription
A description of the link (appears beneath the link caption). Hint for Graph API 3.3: Useattachment/description
instead- Returns:
- A description of the link (appears beneath the link caption).
-
setDescription
A description of the link (appears beneath the link caption). Hint for Graph API 3.3: Useattachment/description
instead -
getSource
If available, the source link attached to this post (for example, a flash or video file). Hint for Graph API 3.3: Useattachment/media/source
instead- Returns:
- If available, the source link attached to this post (for example, a flash or video file).
-
setSource
If available, the source link attached to this post (for example, a flash or video file). Hint for Graph API 3.3: Useattachment/media/source
instead -
getApplication
The application used to create this post.- Returns:
- The application used to create this post.
-
setApplication
The application used to create this post. -
getIcon
A link to an icon representing the type of this post.- Returns:
- A link to an icon representing the type of this post.
-
setIcon
A link to an icon representing the type of this post. -
getPrivacy
The privacy settings for this post.- Returns:
- The privacy settings for this post.
-
setPrivacy
The privacy settings for this post. -
getPromotionStatus
Status of the promotion, if the post was promoted.- Returns:
- Status of the promotion, if the post was promoted
-
setPromotionStatus
Status of the promotion, if the post was promoted. -
getFeedTargeting
Object that controls news feed targeting for this post. To force Facebook to fill thefeed_targeting
field you have to fetch the post with thefields=feed_targeting
parameter, otherwise the feedTargeting isnull
.- Since:
- 1.11.0
-
setFeedTargeting
Object that controls news feed targeting for this post. To force Facebook to fill thefeed_targeting
field you have to fetch the post with thefields=feed_targeting
parameter, otherwise the feedTargeting isnull
.- Since:
- 1.11.0
-
getCanReplyPrivately
Whether the viewer can send a private reply to this post (Page viewers only)- Returns:
- Whether the viewer can send a private reply to this post
-
setCanReplyPrivately
Whether the viewer can send a private reply to this post (Page viewers only) -
getTarget
The profile this was posted on if different from the author.- Returns:
- The profile this was posted on if different from the author
-
setTarget
The profile this was posted on if different from the author. -
getTargeting
Ads targeting information of the post.- Returns:
- Ads targeting information of the post
-
setTargeting
Ads targeting information of the post. -
getTimelineVisibility
Timeline visibility information of the post.- Returns:
- imeline visibility information of the post
-
setTimelineVisibility
Timeline visibility information of the post. -
getLikes
Duplicate mapping for "likes" since FB can return it differently in different situations. -- GETTER -- The likes on this post.Sometimes this can be
null
- checkgetLikesCount()
instead in that case.- Returns:
- The likes on this post.
-
setLikes
Duplicate mapping for "likes" since FB can return it differently in different situations. -- GETTER -- The likes on this post.Sometimes this can be
null
- checkgetLikesCount()
instead in that case. -
getCreatedTime
The time the post was initially published.- Specified by:
getCreatedTime
in interfaceHasCreatedTime
- Returns:
- The time the post was initially published.
-
setCreatedTime
The time the post was initially published. -
getUpdatedTime
The time of the last comment on this post.- Returns:
- The time of the last comment on this post.
-
setUpdatedTime
The time of the last comment on this post. -
getObjectId
The Facebook object id for an uploaded photo or video. Hint for Graph API 3.3: Useattachment/target/id
instead- Returns:
- The Facebook object id for an uploaded photo or video.
- Since:
- 1.6.5
-
setObjectId
The Facebook object id for an uploaded photo or video. Hint for Graph API 3.3: Useattachment/target/id
instead- Since:
- 1.6.5
-
getStatusType
Thestatus_type
of post this is, for example"approved_friend"
.- Returns:
- The
status_type
of post this is, for example"approved_friend"
. - Since:
- 1.6.12
-
setStatusType
Thestatus_type
of post this is, for example"approved_friend"
.- Since:
- 1.6.12
-
getStory
Text from stories not intentionally generated by users- Returns:
- Text from stories not intentionally generated by users
- Since:
- 1.6.16
-
setStory
Text from stories not intentionally generated by users- Since:
- 1.6.16
-
getComments
The comments for this post.- Specified by:
getComments
in interfaceHasComments
- Returns:
- The comments for this post.
-
setComments
The comments for this post. -
getReactions
The reactions for this post.- Returns:
- The reactions for this post.
-
setReactions
The reactions for this post. -
getPlace
The place where this post occurred.- Returns:
- The place where this post occurred.
- Since:
- 1.6.8
-
setPlace
The place where this post occurred.- Since:
- 1.6.8
-
getScheduledPublishTime
UNIX timestamp of the scheduled publish time for the post.- Returns:
- UNIX timestamp of the scheduled publish time for the post
-
setScheduledPublishTime
UNIX timestamp of the scheduled publish time for the post. -
getAdminCreator
ID of admin who created the post. Applies to pages only- Returns:
- ID of admin who created the post.
- Since:
- 1.10.0
-
setAdminCreator
ID of admin who created the post. Applies to pages only- Since:
- 1.10.0
-
getInstagramEligibility
Whether the post can be promoted on Instagram.It returns the enum
eligible
if it can be promoted. Otherwise it returns an enum for why it cannot be promoted- Returns:
- Whether the post can be promoted on Instagram
-
setInstagramEligibility
Whether the post can be promoted on Instagram.It returns the enum
eligible
if it can be promoted. Otherwise it returns an enum for why it cannot be promoted -
getIsEligibleForPromotion
-
setIsEligibleForPromotion
-
getIsExpired
Whether the post has expiration time that has passed- Returns:
- Whether the post has expiration time that has passed
-
setIsExpired
Whether the post has expiration time that has passed -
getIsHidden
If this post is marked as hidden (applies to Pages only).- Returns:
- if this post is marked as hidden
- Since:
- 1.10.0
-
setIsHidden
If this post is marked as hidden (applies to Pages only).- Since:
- 1.10.0
-
getIsInstagramEligible
Whether this post can be promoted in Instagram.- Returns:
- Whether this post can be promoted in Instagram
-
setIsInstagramEligible
Whether this post can be promoted in Instagram. -
getIsPopular
Whether the post is currently popular. Based on whether the total actions as a percentage of reach exceeds a certain threshold- Returns:
- Whether the post is currently popular
-
setIsPopular
Whether the post is currently popular. Based on whether the total actions as a percentage of reach exceeds a certain threshold -
getIsPublished
Indicates whether a scheduled post was published. (applies to scheduled Page Post only, for users post and instantly published posts this value is alwaystrue
)- Returns:
- indicates whether a scheduled post was published
- Since:
- 1.10.0
-
setIsPublished
Indicates whether a scheduled post was published. (applies to scheduled Page Post only, for users post and instantly published posts this value is alwaystrue
)- Since:
- 1.10.0
-
getIsSpherical
Whether the post is a spherical video post.- Returns:
- Whether the post is a spherical video post
-
setIsSpherical
Whether the post is a spherical video post. -
getAttachments
Attachments added to a post. To force Facebook to fill theattachments
field you have to fetch the post with thefields=attachments
parameter, otherwise the attachments arenull
.- Returns:
- Attachment on the post
-
setAttachments
Attachments added to a post. To force Facebook to fill theattachments
field you have to fetch the post with thefields=attachments
parameter, otherwise the attachments arenull
. -
getFullPicture
Full picture URL. you get the url to this posts full picture. To force Facebook to fill thefull_picture
field you have to fetch the post with thefields=full_picture
parameter, otherwise the full_picture isnull
.- Returns:
- String representing the url to the post's full picture
-
setFullPicture
Full picture URL. you get the url to this posts full picture. To force Facebook to fill thefull_picture
field you have to fetch the post with thefields=full_picture
parameter, otherwise the full_picture isnull
. -
getVia
ID of the user or Page the post was shared from -
setVia
ID of the user or Page the post was shared from
-