|
1 | 1 | import Foundation |
2 | 2 | import Threading |
3 | 3 |
|
4 | | -#if swift(>=6.0) |
5 | | -public protocol RequestManager: Sendable { |
6 | | - /// A closure that is called when a response is received. |
| 4 | +/// The ``RequestManager`` protocol defines mechanisms for sending requests |
| 5 | +/// and includes functions that handle the transmission of requests to specified addresses |
| 6 | +/// with specified parameters and with support for custom completion handling in specified queues. |
| 7 | +public protocol RequestManager: SmartSendable { |
| 8 | + /// A closure that gets called upon receiving a response. |
7 | 9 | typealias ResponseClosure = (_ result: SmartResponse) -> Void |
8 | 10 |
|
9 | | - /// Sends a request to the specified address with the given parameters. |
10 | | - func request(address: Address, parameters: Parameters, userInfo: UserInfo) async -> SmartResponse |
11 | | - |
12 | | - /// Sends a request to the specified address with the given parameters. |
13 | | - func request(address: Address, parameters: Parameters, userInfo: UserInfo, completionQueue: DelayedQueue, completion: @escaping ResponseClosure) -> SmartTasking |
14 | | -} |
15 | | -#else |
16 | | -public protocol RequestManager { |
17 | | - /// A closure that is called when a response is received. |
18 | | - typealias ResponseClosure = (_ result: SmartResponse) -> Void |
19 | | - |
20 | | - /// Sends a request to the specified address with the given parameters. |
| 11 | + /// Sends a request asynchronously to the specified address with the given parameters. |
| 12 | + /// |
| 13 | + /// - Parameter address: An ``Address`` object specifying the target address. |
| 14 | + /// - Parameter parameters: A ``Parameters`` object containing the request parameters. |
| 15 | + /// - Parameter userInfo: A ``UserInfo`` object with additional user information. |
21 | 16 | func request(address: Address, parameters: Parameters, userInfo: UserInfo) async -> SmartResponse |
22 | 17 |
|
23 | 18 | /// Sends a request to the specified address with the given parameters. |
| 19 | + /// |
| 20 | + /// - Parameter address: An ``Address`` object specifying the target address. |
| 21 | + /// - Parameter parameters: A ``Parameters`` object containing the request parameters. |
| 22 | + /// - Parameter userInfo: A ``UserInfo`` object with additional user information. |
| 23 | + /// - Parameter completionQueue: A ``DelayedQueue`` where the completion handler will be executed. |
| 24 | + /// - Parameter completion: A ``ResponseClosure`` that is executed when a response is received. |
24 | 25 | func request(address: Address, parameters: Parameters, userInfo: UserInfo, completionQueue: DelayedQueue, completion: @escaping ResponseClosure) -> SmartTasking |
25 | 26 | } |
26 | | -#endif |
27 | 27 |
|
28 | 28 | public extension RequestManager { |
29 | 29 | /// Sends a request to the specified address with the given parameters. |
|
0 commit comments