Skip to content

Commit ed1ea20

Browse files
committed
Add documentation
1 parent b64d8cb commit ed1ea20

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Sources/ComposableArchitecturePattern/Server+API.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,35 @@
77

88
import Foundation
99

10+
/// An object that specifies a specific server API.
11+
///
12+
/// - Note: It is highly encouraged to define your `supportedReturnObjects` to ensure `-supports<T: Codable>(_:)` is able to automatically verify against this.
1013
public protocol ServerAPI: Identifiable, Equatable {
14+
/// The environment this API should be used against. Default is `nil`.
15+
/// - Note: If it can be used against any environment, leave it `nil`.
1116
var environment: ServerEnvironment? { get set }
17+
18+
/// The path this API corresponds to.
1219
var path: String { get set }
20+
21+
/// The headers required for this API. Default is `nil`.
1322
var headers: [String: String]? { get set }
23+
24+
/// The queries required for this API. Default is `nil`.
1425
var queries: [URLQueryItem]? { get set }
26+
27+
/// Data to send in the request's body.
1528
var body: Data? { get set }
29+
30+
/// All HTTP methods this API supports.
1631
var supportedHTTPMethods: [HTTPMethod] { get set }
32+
33+
/// All the return objects this API supports. Default is `nil`.
34+
///
35+
/// This helps ensure a non-supported object isn't attempted to be used with the API.
1736
var supportedReturnObjects: [Codable.Type]? { get set }
37+
38+
/// The timeout length for the request. Default is `60`.
1839
var timeoutInterval: TimeInterval { get set }
1940
/// Whether to block this API if the server is attempting to use a different environment.
2041
///

0 commit comments

Comments
 (0)