You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/ComposableArchitecturePattern/Server.swift
+56Lines changed: 56 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -139,6 +139,20 @@ public extension Server {
139
139
return decoded
140
140
}
141
141
142
+
/// Sends a GET request and returns the specified value type based on the specified path.
143
+
///
144
+
/// The default implementation attempts to find and unwrap the first api that supports `path`, `GET` http method, `currentEnvironment` (if the API's environment is specified), and supports the return type. If none are found, it throws a `ServerAPIError.badRequest`. If an api is found, it gets unwrapped and then this calls `-get(using:, to:, additionalHeaders:, queries:, httpBodyOverride:, timeoutInterval:, dataDecodingStrategry:, keyDecodingStrategy:)`.
145
+
///
146
+
/// - Note: `additionalHeaders` will override a key-value in `additionalHTTPHeaders`.
147
+
/// - Note: The server automatically checks against these values to check whether they're supported by the API or not. For instance, if the specified return type is not supported, a `ServerAPIError.badRequest` error is thrown. If the specified API doesn't support this function, a `ServerAPIError.badRequest` error is thrown.
/// Sends a POST request and returns the specified value type based on the specified path.
220
+
///
221
+
/// The default implementation attempts to find and unwrap the first api that supports `path`, `POST` http method, `currentEnvironment` (if the API's environment is specified), and supports the return type. If none are found, it throws a `ServerAPIError.badRequest`. If an api is found, it gets unwrapped and then this calls `-post(using:, to:, additionalHeaders:, queries:, httpBodyOverride:, timeoutInterval:, dataDecodingStrategry:, keyDecodingStrategy:)`.
222
+
///
223
+
/// - Note: `additionalHeaders` will override a key-value in `additionalHTTPHeaders`.
224
+
/// - Note: The server automatically checks against these values to check whether they're supported by the API or not. For instance, if the specified return type is not supported, a `ServerAPIError.badRequest` error is thrown. If the specified API doesn't support this function, a `ServerAPIError.badRequest` error is thrown.
/// Sends a PUT request and returns the specified value type based on the specified path.
299
+
///
300
+
/// The default implementation attempts to find and unwrap the first api that supports `path`, `PUT` http method, `currentEnvironment` (if the API's environment is specified), and supports the return type. If none are found, it throws a `ServerAPIError.badRequest`. If an api is found, it gets unwrapped and then this calls `-put(using:, to:, additionalHeaders:, queries:, httpBodyOverride:, timeoutInterval:, dataDecodingStrategry:, keyDecodingStrategy:)`.
301
+
///
302
+
/// - Note: `additionalHeaders` will override a key-value in `additionalHTTPHeaders`.
303
+
/// - Note: The server automatically checks against these values to check whether they're supported by the API or not. For instance, if the specified return type is not supported, a `ServerAPIError.badRequest` error is thrown. If the specified API doesn't support this function, a `ServerAPIError.badRequest` error is thrown.
/// Sends a DELETE request and returns the specified value type based on the specified path.
376
+
///
377
+
/// The default implementation attempts to find and unwrap the first api that supports `path`, `DELETE` http method, `currentEnvironment` (if the API's environment is specified), and supports the return type. If none are found, it throws a `ServerAPIError.badRequest`. If an api is found, it gets unwrapped and then this calls `-delete(using:, to:, additionalHeaders:, queries:, httpBodyOverride:, timeoutInterval:, dataDecodingStrategry:, keyDecodingStrategy:)`.
378
+
///
379
+
/// - Note: `additionalHeaders` will override a key-value in `additionalHTTPHeaders`.
380
+
/// - Note: The server automatically checks against these values to check whether they're supported by the API or not. For instance, if the specified return type is not supported, a `ServerAPIError.badRequest` error is thrown. If the specified API doesn't support this function, a `ServerAPIError.badRequest` error is thrown.
0 commit comments