NewsFeedAPI

public enum NewsFeedAPI

Caseless enumeration with static methods to send News Feed Requests

Posts

  • Sends a request to get flags from the API.

    Declaration

    Swift

    public static func getFlags(completion: ResponseCompletion<[Post.Flag]> = nil)

    Parameters

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get posts from the API.

    Declaration

    Swift

    public static func getPosts(with parameters: Parameters?,
                                completion: ResponseCompletion<NewsFeed> = nil)

    Parameters

    parameters

    The Parameters to apply. Commonly used parameter keys for posts list is:

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get a specific post with ID.

    Declaration

    Swift

    public static func getPost(id: String, completion: ResponseCompletion<Post> = nil)

    Parameters

    id

    ID of the post that will be fetched.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to create a new post in a specific feed.

    Declaration

    Swift

    public static func addNewPost(body: String,
                                  assets: [URL],
                                  feedName: String?,
                                  completion: ResponseCompletion<Post> = nil)

    Parameters

    body

    The content of the post.

    assets

    The attachments of the post.

    feedName

    The name of the feed in which the new post will be created.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to delete a specific post with ID.

    Declaration

    Swift

    public static func deletePost(id: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the post that will be deleted.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to like a specific post with ID.

    Declaration

    Swift

    public static func likePost(id: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the post that will be liked.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to unlike a specific post with ID.

    Declaration

    Swift

    public static func unlikePost(id: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the post that will be unliked.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to flag a specific post with ID.

    Declaration

    Swift

    public static func flagPost(flag: String, id: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    flag

    Key of Post.Flag object.

    id

    ID of the post that will be flagged.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to unflag a specific post with ID.

    Declaration

    Swift

    public static func unflagPost(id: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the post that will be unflagged.

    completion

    The closure to be executed once the request has finished.

Comments

  • Sends a request to get comments in a specific comment for a page.

    Declaration

    Swift

    public static func getComments(postId: String,
                                   with parameters: Parameters? = nil,
                                   completion: ResponseCompletion<[Comment]> = nil)

    Parameters

    postId

    ID of the post.

    parameters

    The Parameters to apply. Commonly used parameter keys for posts list is:

    completion

    The closure to be executed once the request has finished.

  • Sends a request to create a new comment in a specific post.

    Declaration

    Swift

    public static func addNewComment(body: String,
                                     postId: String,
                                     completion: ResponseCompletion<Bool> = nil)

    Parameters

    body

    The content of the comment.

    postId

    ID of the post in which the new comment will be created.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to delete a specific comment with ID.

    Declaration

    Swift

    public static func deleteComment(withId id: String,
                                     postId: String,
                                     completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the comment that will be deleted.

    postId

    ID of the post in which the comment will be deleted.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to like a specific comment with ID.

    Declaration

    Swift

    public static func likeComment(id: String,
                                   postId: String,
                                   completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the comment that will be liked.

    postId

    ID of the post in which the comment will be liked.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to unlike a specific comment with ID.

    Declaration

    Swift

    public static func unlikeComment(id: String,
                                     postId: String,
                                     completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the comment that will be unliked.

    postId

    ID of the post in which the comment will be unliked.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to flag a specific comment with ID.

    Declaration

    Swift

    public static func flagComment(id: String,
                                   postId: String,
                                   flag: String,
                                   completion: ResponseCompletion<Bool> = nil)

    Parameters

    flag

    Key of Post.Flag object.

    id

    ID of the comment that will be flagged.

    postId

    ID of the post in which the comment will be flagged.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to unflag a specific comment with ID.

    Declaration

    Swift

    public static func unflagComment(id: String,
                                     postId: String,
                                     completion: ResponseCompletion<Bool> = nil)

    Parameters

    id

    ID of the comment that will be unflagged.

    postId

    ID of the post in which the comment will be unflagged.

    completion

    The closure to be executed once the request has finished.