Newer Version Available

This content describes an older version of this product. View Latest

ChatterFavorites Methods

The following are methods for ChatterFavorites. All methods are static.

addFavorite(String, String, String)

Adds a feed search favorite for the specified user in the specified community.

API Version

28.0

Signature

public static ConnectApi.FeedFavorite addFavorite(String communityId, String subjectId, String searchText)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
searchText
Type: String
Specify the text of the search to be saved as a favorite. This method can only create a feed search favorite, not a list view favorite or a topic.

Return Value

Type: ConnectApi.FeedFavorite

addRecordFavorite(String, String, String)

Adds a topic as a favorite.

API Version

28.0

Signature

public static ConnectApi.FeedFavorite addRecordFavorite(String communityId, String subjectId, String targetId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
targetId
Type: String
The ID of the topic to add as a favorite.

Return Value

Type: ConnectApi.FeedFavorite

deleteFavorite(String, String, String)

Deletes the specified favorite.

API Version

28.0

Signature

public static Void deleteFavorite(String communityId, String subjectId, String favoriteId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.

Return Value

Type: Void

getFavorite(String, String, String)

Returns a description of the favorite.

API Version

28.0

Signature

public static ConnectApi.FeedFavorite getFavorite(String communityId, String subjectId, String favoriteId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.

Return Value

Type: ConnectApi.FeedFavorite

getFavorites(String, String)

Returns a list of all favorites for the specified user in the specified community.

API Version

28.0

Signature

public static ConnectApi.FeedFavorites getFavorites(String communityId, String subjectId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.

Return Value

Type: ConnectApi.FeedFavorites

getFeedItems(String, String, String)

Returns the first page of feed items for the specific favorite in the specified community. The page contains the default number of items.

API Version

28.0

Signature

public static ConnectApi.FeedItemPage getFeedItems(String communityId, String subjectId, String favoriteId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
The ID of the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.

Return Value

Type: ConnectApi.FeedItemPage

Usage

To test code that uses this method, use the matching set test method (prefix the method name with setTest). You must use the set test method with the same parameters or the code throws an exception.

getFeedItems(String, String, String, String, Integer, ConnectApi.FeedSortOrder)

Returns the specified page of feed items for the specified favorite, in the specified community in the specified order.

API Version

28.0

Signature

public static ConnectApi.FeedItemPage getFeedItems(String communityId, String subjectId, String favoriteId, String pageParam, Integer pageSize, ConnectApi.FeedSortOrder sortParam)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
The ID of the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.
pageParam
Type: String
The page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.
sortParam
Type: ConnectApi.FeedSortOrder
Values are:
  • CreatedDateDesc—Sorts the feed items by most recent post date.
  • LastModifiedDateDesc—Sorts the feed items by most recent activity, which includes new feed items and comments.
Sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. If you pass in null, the default value CreatedDateDesc is used.

Return Value

Type: ConnectApi.FeedItemPage

Usage

To test code that uses this method, use the matching set test method (prefix the method name with setTest). You must use the set test method with the same parameters or the code throws an exception.

getFeedItems(String, String, String, Integer, String, Integer, FeedSortOrder)

Returns the specified page of feed items for the specified favorite, in the specified community in the specified order and includes no more than the specified number of comments per feed item.

API Version

29.0

Signature

public static ConnectApi.FeedItemPage getFeedItems(String communityId, String subjectId, String favoriteId, Integer recentCommentCount, String pageParam, Integer pageSize, FeedSortOrder sortParam)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
The ID of the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.
recentCommentCount
Type: Integer
The maximum number of comments to return with each feed item. The default value is 3.
pageParam
Type: String
The page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.
sortParam
Type: FeedSortOrder
Values are:
  • CreatedDateDesc—Sorts the feed items by most recent post date.
  • LastModifiedDateDesc—Sorts the feed items by most recent activity, which includes new feed items and comments.
Sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. If you pass in null, the default value CreatedDateDesc is used.

Return Value

Type: ConnectApi.FeedItemPage

Usage

To test code that uses this method, use the matching set test method (prefix the method name with setTest). You must use the set test method with the same parameters or the code throws an exception.

setTestGetFeedItems(String, String, String, ConnectApi.FeedItemPage)

Registers a ConnectApi.FeedItemPage object to be returned when getFeedItems​ is called with matching parameters in a test context. You must use the method with the same parameters or the code throws an exception.

API Version

28.0

Signature

public static Void setTestGetFeedItems(String communityId, String subjectId, String favoriteId, ConnectApi.FeedItemPage result)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.
result
Type: ConnectApi.FeedItem​Page Class
The object containing test data.

Return Value

Type: Void

setTestGetFeedItems(String, String, String, String, Integer, FeedSortOrder, ConnectApi.FeedItemPage)

Registers a ConnectApi.FeedItemPage object to be returned when getFeedItems​ is called with matching parameters in a test context. You must use the method with the same parameters or the code throws an exception.

API Version

28.0

Signature

public static Void setTestGetFeedItems(String communityId, String subjectId, String favoriteId, String pageParam, Integer pageSize, FeedSortOrder sortParam, ConnectApi.FeedItemPage result)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.
pageParam
Type: String
The page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.
sortParam
Type: FeedSortOrder
Values are:
  • CreatedDateDesc—Sorts the feed items by most recent post date.
  • LastModifiedDateDesc—Sorts the feed items by most recent activity, which includes new feed items and comments.
Sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. If you pass in null, the default value CreatedDateDesc is used.
result
Type: ConnectApi.FeedItem​Page Class
The object containing test data.

Return Value

Type: Void

setTestGetFeedItems(String, String, String, Integer, String, Integer, FeedSortOrder, ConnectApi.FeedItemPage)

Registers a ConnectApi.FeedItemPage object to be returned when getFeedItems​ is called with matching parameters in a test context. You must use the method with the same parameters or the code throws an exception.

API Version

29.0

Signature

public static Void setTestGetFeedItems(String communityId, String subjectId, String favoriteId, Integer recentCommentCount, String pageParam, Integer pageSize, FeedSortOrder sortParam, ConnectApi.FeedItemPage result)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.
recentCommentCount
Type: Integer
The maximum number of comments to return with each feed item. The default value is 3.
pageParam
Type: String
The page token to use to view the page. Page tokens are returned as part of the response class, for example, currentPageToken or nextPageToken. If you pass in null the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.
sortParam
Type: FeedSortOrder
Values are:
  • CreatedDateDesc—Sorts the feed items by most recent post date.
  • LastModifiedDateDesc—Sorts the feed items by most recent activity, which includes new feed items and comments.
Sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. If you pass in null, the default value CreatedDateDesc is used.
result
Type: ConnectApi.FeedItem​Page Class
The object containing test data.

Return Value

Type: Void

updateFavorite(String, String, String, Boolean)

Updates the last view date of the saved search or list view feed to the current system time if you specify true for updateLastViewDate.

API Version

28.0

Signature

public static ConnectApi.FeedFavorite updateFavorite(String communityId, String subjectId, String favoriteId, Boolean updateLastViewDate)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
subjectId
Type: String
Specify the ID for the context user or the alias me.
favoriteId
Type: String
The ID of a favorite.
updateLastViewDate
Type: Boolean
Specify whether to update the last view date of the specified favorite to the current system time (true) or not (false).

Return Value

Type: ConnectApi.FeedFavorite