diff --git a/native/swift/Sources/wordpress-api/Protocols/Conformances/PostType.swift b/native/swift/Sources/wordpress-api/Protocols/Conformances/PostType.swift index 48b617bb..b2a3c915 100644 --- a/native/swift/Sources/wordpress-api/Protocols/Conformances/PostType.swift +++ b/native/swift/Sources/wordpress-api/Protocols/Conformances/PostType.swift @@ -1,6 +1,8 @@ import Foundation -import Combine + +#if canImport(WordPressAPIInternal) @preconcurrency import WordPressAPIInternal +#endif public final class PostTypeRequestPerformer { typealias ExecutorType = PostTypesRequestExecutor diff --git a/native/swift/Sources/wordpress-api/Protocols/Conformances/Posts.swift b/native/swift/Sources/wordpress-api/Protocols/Conformances/Posts.swift index e0be43e0..e64f93e8 100644 --- a/native/swift/Sources/wordpress-api/Protocols/Conformances/Posts.swift +++ b/native/swift/Sources/wordpress-api/Protocols/Conformances/Posts.swift @@ -1,6 +1,8 @@ import Foundation -import Combine + +#if canImport(WordPressAPIInternal) @preconcurrency import WordPressAPIInternal +#endif public final class PostsRequestPerformer { typealias ExecutorType = PostsRequestExecutor @@ -93,9 +95,13 @@ extension PostsRequestPerformer: RequestPerformer, NoDeletionParams { extension PostsRequestPerformer: CallbackAwarePerformer {} extension PostsRequestPerformer: PaginationAwarePerformer {} -extension PostsRequestPerformer: PublisherAwarePerformer {} extension PostsRequestPerformer: SequenceAwarePerformer {} +#if canImport(Combine) +import Combine +extension PostsRequestPerformer: PublisherAwarePerformer {} +#endif + // MARK: - PostsRequestExecutorProtocol // Allows the performer to respond to everything the PostsRequestExecutor does diff --git a/native/swift/Sources/wordpress-api/Protocols/Conformances/Users.swift b/native/swift/Sources/wordpress-api/Protocols/Conformances/Users.swift index b2ae4397..d3603397 100644 --- a/native/swift/Sources/wordpress-api/Protocols/Conformances/Users.swift +++ b/native/swift/Sources/wordpress-api/Protocols/Conformances/Users.swift @@ -1,6 +1,8 @@ import Foundation -import Combine + +#if canImport(WordPressAPIInternal) @preconcurrency import WordPressAPIInternal +#endif public final class UsersRequestPerformer { typealias ExecutorType = UsersRequestExecutor @@ -17,8 +19,14 @@ public final class UsersRequestPerformer { } } -extension UsersRequestPerformer: PublisherAwarePerformer {} extension UsersRequestPerformer: CallbackAwarePerformer {} +extension UsersRequestPerformer: PaginationAwarePerformer {} +extension UsersRequestPerformer: SequenceAwarePerformer {} + +#if canImport(Combine) +import Combine +extension UsersRequestPerformer: PublisherAwarePerformer {} +#endif extension UsersRequestPerformer: RequestPerformer, HasDeletionParams { public typealias IdType = UserId diff --git a/native/swift/Sources/wordpress-api/Protocols/PublisherAwarePerformer.swift b/native/swift/Sources/wordpress-api/Protocols/PublisherAwarePerformer.swift index b0a738e3..ca301218 100644 --- a/native/swift/Sources/wordpress-api/Protocols/PublisherAwarePerformer.swift +++ b/native/swift/Sources/wordpress-api/Protocols/PublisherAwarePerformer.swift @@ -1,4 +1,5 @@ import Foundation +#if canImport(Combine) import Combine public protocol PublisherAwarePerformer: RequestPerformer { @@ -121,3 +122,4 @@ extension PublisherAwarePerformer where Self: HasDeletionParams { }.eraseToAnyPublisher() } } +#endif diff --git a/native/swift/Sources/wordpress-api/Protocols/SequenceAwarePerformer.swift b/native/swift/Sources/wordpress-api/Protocols/SequenceAwarePerformer.swift index 2a4a2b85..2b8a000c 100644 --- a/native/swift/Sources/wordpress-api/Protocols/SequenceAwarePerformer.swift +++ b/native/swift/Sources/wordpress-api/Protocols/SequenceAwarePerformer.swift @@ -1,6 +1,6 @@ import Foundation -protocol SequenceAwarePerformer: RequestPerformer { +public protocol SequenceAwarePerformer: RequestPerformer { // MARK: - Pagination func sequenceWithEditContext( params: ListWithEditContextResponseType.ParamsType diff --git a/native/swift/Sources/wordpress-api/WordPressAPI.swift b/native/swift/Sources/wordpress-api/WordPressAPI.swift index a9ee7705..85e5f043 100644 --- a/native/swift/Sources/wordpress-api/WordPressAPI.swift +++ b/native/swift/Sources/wordpress-api/WordPressAPI.swift @@ -45,8 +45,12 @@ public struct WordPressAPI { ) } - public var users: UsersRequestExecutor { - self.internalClient.users() + public var users: UsersRequestPerformer { + UsersRequestPerformer( + executor: self.internalClient.users(), + builder: self.requestBuilder.users(), + session: self.urlSession + ) } public var plugins: PluginsRequestExecutor {