File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Modules/Sources/APIClient Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ public struct APIClient: Sendable {
6363 public var editPost : @Sendable ( _ request: PostEditRequest ) async throws -> PostSendResponse
6464 public var deletePosts : @Sendable ( _ postIds: [ Int ] ) async throws -> Bool
6565 public var postKarma : @Sendable ( _ postId: Int , _ isUp: Bool ) async throws -> Bool
66+ public var voteInTopicPoll : @Sendable ( _ topicId: Int , _ selections: [ [ Int ] ] ) async throws -> Bool
6667
6768 // Favorites
6869 public var getFavorites : @Sendable ( _ request: FavoritesRequest , _ policy: CachePolicy ) async throws -> AsyncThrowingStream < Favorite , any Error >
@@ -357,6 +358,13 @@ extension APIClient: DependencyKey {
357358 return status == 0
358359 } ,
359360
361+ voteInTopicPoll: { topicId, selections in
362+ let command = ForumCommand . Topic. Poll. vote ( topicId: topicId, selections: selections)
363+ let response = try await api. send ( command)
364+ let status = Int ( response. getResponseStatus ( ) ) !
365+ return status == 0
366+ } ,
367+
360368 // MARK: - Favorites
361369
362370 getFavorites: { request, policy in
@@ -570,6 +578,9 @@ extension APIClient: DependencyKey {
570578 postKarma: { _, _ in
571579 return true
572580 } ,
581+ voteInTopicPoll: { _, _ in
582+ return true
583+ } ,
573584 getFavorites: { _, _ in
574585 let ( stream, continuation) = AsyncThrowingStream . makeStream ( of: Favorite . self)
575586 continuation. yield ( with: . success( . mock) )
You can’t perform that action at this time.
0 commit comments