Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Rainmaker/Requests/Requesting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Foundation
///
/// Features of `URLSession` defined as a mockable protocol for tests.
///
protocol Requesting: Sendable {
public protocol Requesting: Sendable {
func data(for request: URLRequest) async throws -> (Data, URLResponse)
func download(for request: URLRequest, delegate: (any URLSessionTaskDelegate)?) async throws -> (URL, URLResponse)
}
8 changes: 2 additions & 6 deletions Sources/Rainmaker/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,10 @@ public final class Server {
/// - address: HTTP address of the Nextcloud host.
/// - password: In most cases, this is the app password and not the account password.
/// - user: The Nextcloud user name used to identify as.
/// - session: A ``Requesting`` object (e.g. a `URLSession`) to use for network requests. Defaults to a new ephemeral `URLSession`.
/// - userAgent: The user agent to report as in HTTP request headers.
///
public convenience init(address: URL, password: String? = nil, user: String? = nil, userAgent: String = "Rainmaker") {
let session = URLSession(configuration: .ephemeral)
self.init(address: address, password: password, user: user, session: session, userAgent: userAgent)
}

init(address: URL, password: String? = nil, user: String? = nil, session: any Requesting, userAgent: String) {
public init(address: URL, password: String? = nil, user: String? = nil, session: any Requesting = URLSession(configuration: .ephemeral), userAgent: String = "Rainmaker") {
self.address = address
jsonDecoder = JSONDecoder()
self.password = password
Expand Down
Loading