Type Aliasswift-package-manager 6.0.3Basics
CompletionHandler
LegacyHTTPClient.swift:30typealias CompletionHandler = (Result<HTTPClientResponse, Error>) -> Void
typealias CompletionHandler = (Result<HTTPClientResponse, Error>) -> Void
import Basics
final class LegacyHTTPClient
@frozen enum Result<Success, Failure> where Failure : Error, Success : ~Copyable
A value that represents either a success or a failure, including an associated value in each case.
struct HTTPClientResponse
protocol Error : Sendable
A type representing an error value that can be thrown.
typealias Void = ()
The return type of functions that don’t explicitly specify a return type, that is, an empty tuple ()
.
init(configuration: LegacyHTTPClientConfiguration = .init(), handler: Handler? = nil)
var configuration: LegacyHTTPClientConfiguration
func cancel(deadline: DispatchTime) throws
Cancel any outstanding requests
func delete(_ url: URL, headers: HTTPClientHeaders = .init(), options: Request.Options = .init(), observabilityScope: ObservabilityScope? = .none, completion: @escaping (Result<Response, Error>) -> Void)
func execute(_ request: Request, observabilityScope: ObservabilityScope? = nil, progress: ProgressHandler? = nil, completion: @escaping CompletionHandler)
Execute an HTTP request asynchronously
func get(_ url: URL, headers: HTTPClientHeaders = .init(), options: Request.Options = .init(), observabilityScope: ObservabilityScope? = .none, completion: @escaping (Result<Response, Error>) -> Void)
func head(_ url: URL, headers: HTTPClientHeaders = .init(), options: Request.Options = .init(), observabilityScope: ObservabilityScope? = .none, completion: @escaping (Result<Response, Error>) -> Void)
func post(_ url: URL, body: Data?, headers: HTTPClientHeaders = .init(), options: Request.Options = .init(), observabilityScope: ObservabilityScope? = .none, completion: @escaping (Result<Response, Error>) -> Void)
func put(_ url: URL, body: Data?, headers: HTTPClientHeaders = .init(), options: Request.Options = .init(), observabilityScope: ObservabilityScope? = .none, completion: @escaping (Result<Response, Error>) -> Void)
typealias Configuration = LegacyHTTPClientConfiguration
typealias Handler = (Request, ProgressHandler?, @escaping (Result<Response, Error>) -> Void) -> Void
typealias ProgressHandler = (_ bytesReceived: Int64, _ totalBytes: Int64?) throws -> Void
typealias Request = LegacyHTTPClientRequest
typealias Response = HTTPClientResponse