Skip to content

Commit

Permalink
Fix CocoaPods support
Browse files Browse the repository at this point in the history
  • Loading branch information
jkmassel committed Nov 20, 2024
1 parent 8681f54 commit 6d160a1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Foundation
import Combine

#if canImport(WordPressAPIInternal)
@preconcurrency import WordPressAPIInternal
#endif

public final class PostTypeRequestPerformer {
typealias ExecutorType = PostTypesRequestExecutor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Foundation
import Combine

#if canImport(WordPressAPIInternal)
@preconcurrency import WordPressAPIInternal
#endif

public final class PostsRequestPerformer {
typealias ExecutorType = PostsRequestExecutor
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Foundation
import Combine

#if canImport(WordPressAPIInternal)
@preconcurrency import WordPressAPIInternal
#endif

public final class UsersRequestPerformer {
typealias ExecutorType = UsersRequestExecutor
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
#if canImport(Combine)
import Combine

public protocol PublisherAwarePerformer: RequestPerformer {
Expand Down Expand Up @@ -121,3 +122,4 @@ extension PublisherAwarePerformer where Self: HasDeletionParams {
}.eraseToAnyPublisher()
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

protocol SequenceAwarePerformer: RequestPerformer {
public protocol SequenceAwarePerformer: RequestPerformer {
// MARK: - Pagination
func sequenceWithEditContext(
params: ListWithEditContextResponseType.ParamsType
Expand Down
8 changes: 6 additions & 2 deletions native/swift/Sources/wordpress-api/WordPressAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6d160a1

Please sign in to comment.