Feed
public class Feed : CustomStringConvertible
A superclass for feeds: FlatFeed
, AggregatedFeed
and NotificationFeed
.
-
A feed id.
Declaration
Swift
public let feedId: FeedId
-
A separated callback queue from
client.callbackQueue
for completion requests.Declaration
Swift
public var callbackQueue: DispatchQueue
-
Returns a feedId description of the feed.
Declaration
Swift
public var description: String { get }
-
Add a new activity.
Declaration
Swift
@discardableResult public func add<T>(_ activity: T, completion: @escaping ActivityCompletion<T>) -> Cancellable where T : ActivityProtocol
Parameters
activity
an activity to add.
completion
a completion block with the activity that was added.
Return Value
an object to cancel the request.
-
Remove an activity by the activityId.
Declaration
Swift
@discardableResult public func remove(activityId: String, completion: @escaping RemovedCompletion) -> Cancellable
Parameters
activityId
an activityId to remove.
completion
a completion block with removed activityId.
Return Value
an object to cancel the request.
-
Remove an activity by the foreignId.
Declaration
Swift
@discardableResult public func remove(foreignId: String, completion: @escaping RemovedCompletion) -> Cancellable
Parameters
foreignId
an foreignId to remove.
completion
a completion block with removed activityId.
Return Value
an object to cancel the request.
-
Follow a target feed.
Declaration
Swift
@discardableResult public func follow(toTarget target: FeedId, activityCopyLimit: Int = 100, completion: @escaping StatusCodeCompletion) -> Cancellable
Parameters
target
the target feed this feed should follow, e.g. user:44.
activityCopyLimit
how many activities should be copied from the target feed, max 1000, default 100.
Return Value
an object to cancel the request.
-
Unfollow a target feed.
Note
Unfollow target’s activities are purged from the feed unless thekeepHistory
parameter is provided.Declaration
Swift
@discardableResult public func unfollow(fromTarget target: FeedId, keepHistory: Bool = false, completion: @escaping StatusCodeCompletion) -> Cancellable
Parameters
target
the target feed, e.g. user:44.
keepHistory
when provided the activities from target feed will not be kept in the feed.
Return Value
an object to cancel the request.
-
Returns a paginated list of followers.
Note
the number of followers that can be retrieved is limited to 1000.Declaration
Swift
@discardableResult public func followers(offset: Int = 0, limit: Int = 25, completion: @escaping FollowersCompletion) -> Cancellable
Parameters
offset
number of followers to skip before returning results, max 400.
limit
amount of results per request, max 500, default 25.
completion
a result with
Follower
‘s or an error.Return Value
an object to cancel the request.
-
Returns a paginated list of the feeds which are followed by the feed.
Note
the number of followers that can be retrieved is limited to 1000.Declaration
Swift
@discardableResult public func following(filter: FeedIds = [], offset: Int = 0, limit: Int = 25, completion: @escaping FollowersCompletion) -> Cancellable
Parameters
filter
list of feeds to filter results on.
offset
number of followers to skip before returning results, max 400.
limit
amount of results per request, max 500, default 25.
completion
a result with
Follower
‘s or an error.Return Value
an object to cancel the request.
-
Subscribe for the updates of the given activity type of
ActivityProtocol
.Declaration
Swift
public func subscribe<T: ActivityProtocol>(typeOf type: T.Type, decoder: JSONDecoder = .default, subscription: @escaping Subscription<T>) -> SubscribedChannel
Parameters
type
an
ActivityProtocol
of activities.decoder
a custom decoder for the given activity type.
subscription
a subscription block with changes. It will retrun a
Result
withSubscriptionResponse
orDecodingError
.Return Value
a
SubscribedChannel
keep the subscription util it will be deinit. Store the object in a variable for the getting updates and then set it to nil to unsubscribe.