From 32e9eaeb864ec7b0e87d6c6f58705fed89270390 Mon Sep 17 00:00:00 2001 From: maumar2000 Date: Wed, 27 May 2026 12:36:28 -0300 Subject: [PATCH] Refine public API visibility for APIClient and middleware internals --- Sources/TypedNetwork/APIClient.swift | 6 +++--- Sources/TypedNetwork/Middleware.swift | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/TypedNetwork/APIClient.swift b/Sources/TypedNetwork/APIClient.swift index 7b8819c..e092de1 100644 --- a/Sources/TypedNetwork/APIClient.swift +++ b/Sources/TypedNetwork/APIClient.swift @@ -3,7 +3,7 @@ import Foundation import FoundationNetworking #endif -actor APIClient { +public actor APIClient { private let session: NetworkSession private let builder: RequestBuilder @@ -11,7 +11,7 @@ actor APIClient { private let middlewares: [any Middleware] private let decoder: ResponseDecoder - init( + public init( baseURL: URL, session: NetworkSession = URLSession.shared, mockRegistry: MockRegistry? = nil, @@ -26,7 +26,7 @@ actor APIClient { self.decoder = decoder } - func send(_ endpoint: E) async throws -> E.Response { + public func send(_ endpoint: E) async throws -> E.Response { if let mock = await mockRegistry?.response(for: endpoint) as? E.Response { return mock } diff --git a/Sources/TypedNetwork/Middleware.swift b/Sources/TypedNetwork/Middleware.swift index 585941a..7b73376 100644 --- a/Sources/TypedNetwork/Middleware.swift +++ b/Sources/TypedNetwork/Middleware.swift @@ -10,10 +10,10 @@ public protocol Middleware: Sendable { ) async throws -> (Data, HTTPURLResponse) } -public struct MiddlewareChain: Sendable { +struct MiddlewareChain: Sendable { private let middlewares: [any Middleware] - public init(_ middlewares: [any Middleware]) { + init(_ middlewares: [any Middleware]) { self.middlewares = middlewares }