Skip to content

Commit

Permalink
Make fetching public
Browse files Browse the repository at this point in the history
  • Loading branch information
rocxteady committed Jun 25, 2024
1 parent 6bc5150 commit 7ded7bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/WPSwift/API/WPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import Foundation
import Combine
import Resting

enum NetworkError: LocalizedError {
public enum NetworkError: LocalizedError {
case urlMalformed
case api(Error)
case unknown

var errorDescription: String? {
public var errorDescription: String? {
switch self {
case .urlMalformed:
"URL is malformed."
Expand Down Expand Up @@ -57,7 +57,7 @@ public struct WPClient<RequestModel: Encodable, Response: Decodable> {
}
}

func fetch() async throws -> Response {
public func fetch() async throws -> Response {
do {
return try await restClient.fetch(with: requestConfig)
} catch {
Expand All @@ -67,7 +67,7 @@ public struct WPClient<RequestModel: Encodable, Response: Decodable> {
}

extension WPClient {
func fetchPublisher() -> AnyPublisher<Response, NetworkError> {
public func fetchPublisher() -> AnyPublisher<Response, NetworkError> {
restClient.publisher(with: requestConfig)
.mapError {
NetworkError.api($0)
Expand Down

0 comments on commit 7ded7bd

Please sign in to comment.