this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

get actor feed and likes

+25 -5
+11 -3
Sources/bskyKit/BskyAPI.swift
··· 19 19 // Feed endpoints 20 20 case getFeedGenerators(feeds: [String]) 21 21 case getTimeline(limit: Int, cursor: String?) 22 - case getAuthorFeed(did: String, limit: Int, cursor: String?) 22 + case getAuthorFeed(did: String, limit: Int, cursor: String?, filter: String?) 23 23 case getPostThread(uri: String, depth: Int) 24 24 case getPosts(uris: [String]) 25 + case getActorLikes(did: String, limit: Int, cursor: String?) 25 26 case getLikes(uri: String, limit: Int, cursor: String?) 26 27 case getRepostedBy(uri: String, limit: Int, cursor: String?) 27 28 ··· 60 61 case .getAuthorFeed: "/xrpc/app.bsky.feed.getAuthorFeed" 61 62 case .getPostThread: "/xrpc/app.bsky.feed.getPostThread" 62 63 case .getPosts: "/xrpc/app.bsky.feed.getPosts" 64 + case .getActorLikes: "/xrpc/app.bsky.feed.getActorLikes" 63 65 case .getLikes: "/xrpc/app.bsky.feed.getLikes" 64 66 case .getRepostedBy: "/xrpc/app.bsky.feed.getRepostedBy" 65 67 // Graph ··· 77 79 var httpMethod: HTTPMethod { 78 80 switch self { 79 81 case .getPreferences, .getProfile, .getProfiles, .searchActors, .searchActorsTypeahead, 80 - .getFeedGenerators, .getTimeline, .getAuthorFeed, .getPostThread, .getPosts, .getLikes, .getRepostedBy, 82 + .getFeedGenerators, .getTimeline, .getAuthorFeed, .getPostThread, .getPosts, .getActorLikes, .getLikes, .getRepostedBy, 81 83 .getFollows, .getFollowers, .getBlocks, .getMutes, 82 84 .listNotifications, .getUnreadCount: 83 85 return .get ··· 119 121 if let cursor { params["cursor"] = cursor } 120 122 return .requestParameters(encoding: .urlEncoding(parameters: params)) 121 123 122 - case .getAuthorFeed(let did, let limit, let cursor): 124 + case .getAuthorFeed(let did, let limit, let cursor, let filter): 123 125 var params: Parameters = ["actor": did, "limit": limit] 124 126 if let cursor { params["cursor"] = cursor } 127 + if let filter { params["filter"] = filter } 125 128 return .requestParameters(encoding: .urlEncoding(parameters: params)) 126 129 127 130 case .getPostThread(let uri, let depth): ··· 132 135 133 136 case .getPosts(let uris): 134 137 return .requestParameters(encoding: .urlEncoding(parameters: ["uris": uris])) 138 + 139 + case .getActorLikes(let did, let limit, let cursor): 140 + var params: Parameters = ["actor": did, "limit": limit] 141 + if let cursor { params["cursor"] = cursor } 142 + return .requestParameters(encoding: .urlEncoding(parameters: params)) 135 143 136 144 case .getLikes(let uri, let limit, let cursor): 137 145 var params: Parameters = ["uri": uri, "limit": limit]
+14 -2
Sources/bskyKit/BskyService.swift
··· 142 142 /// - did: The user's DID or handle. 143 143 /// - limit: Maximum number of posts to return (default: 50). 144 144 /// - cursor: Pagination cursor from a previous response. 145 + /// - filter: Feed filter (e.g., "posts_and_author_threads", "posts_with_replies", "posts_no_replies", "posts_with_media"). 145 146 /// - Returns: The user's posts with cursor for pagination. 146 147 /// - Throws: An error if the request fails. 147 - public func getAuthorFeed(for did: String, limit: Int = 50, cursor: String? = nil) async throws -> AuthorFeed { 148 - try await router.execute(.getAuthorFeed(did: did, limit: limit, cursor: cursor)) 148 + public func getAuthorFeed(for did: String, limit: Int = 50, cursor: String? = nil, filter: String? = nil) async throws -> AuthorFeed { 149 + try await router.execute(.getAuthorFeed(did: did, limit: limit, cursor: cursor, filter: filter)) 149 150 } 150 151 151 152 /// Fetches a post and its reply thread. ··· 164 165 /// - Throws: An error if the request fails. 165 166 public func getPosts(uris: [String]) async throws -> Posts { 166 167 try await router.execute(.getPosts(uris: uris)) 168 + } 169 + 170 + /// Fetches posts liked by a specific user. 171 + /// - Parameters: 172 + /// - did: The user's DID or handle. 173 + /// - limit: Maximum number of posts to return (default: 50). 174 + /// - cursor: Pagination cursor from a previous response. 175 + /// - Returns: The user's liked posts with cursor for pagination. 176 + /// - Throws: An error if the request fails. 177 + public func getActorLikes(for did: String, limit: Int = 50, cursor: String? = nil) async throws -> AuthorFeed { 178 + try await router.execute(.getActorLikes(did: did, limit: limit, cursor: cursor)) 167 179 } 168 180 169 181 /// Fetches users who liked a specific post.