-
public func send<T: Decodable>(rpc: RPC<T>, withBaseURL baseURL: URL, completion: @escaping ((Result<T, ErrorResponse>) -> Void))
+
public func send<T: Decodable>(rpc: RPC<T>, withBaseURL baseURL: URL, completion: @escaping ((Result<T, KukaiError>) -> Void))
A generic send function that takes an RPC, with a generic type conforming to Decodable
, executes the request and returns the result.
@@ -155,7 +155,7 @@
Parameters
completion |
- @escaping ((Result<T, ErrorResponse>) -> Void) |
+ @escaping ((Result<T, KukaiError>) -> Void) |
A completion callback that will be executed on the main thread.
|
@@ -170,10 +170,10 @@
-
public func request<T: Decodable>(url: URL, isPOST: Bool, withBody body: Data?, forReturnType: T.Type, completion: @escaping ((Result<T, ErrorResponse>) -> Void))
+
public func request<T: Decodable>(url: URL, isPOST: Bool, withBody body: Data?, forReturnType: T.Type, completion: @escaping ((Result<T, KukaiError>) -> Void))
-
A generic network request function that takes a URL, optional payload and a Decodable
response type. Function will execute teh request and attempt to parse the response.
+
A generic network request function that takes a URL, optional payload and a Decodable
response type. Function will execute the request and attempt to parse the response.
Using the Logging config, will auto log (or not) urls, response outputs, or fails to the console
@@ -214,14 +214,64 @@
Parameters
completion |
- @escaping ((Result<T, ErrorResponse>) -> Void) |
+ @escaping ((Result<T, KukaiError>) -> Void) |
A completion block with a Result<T, Error> T being the supplied decoable type
|
+
+
+
+
+
+
+
+
public func request<T: Decodable>(url: URL, isPOST: Bool, withBody body: Data?, forReturnType: T.Type) -> AnyPublisher<T, KukaiError>
+
+
+
A generic network request function that takes a URL, optional payload and a Decodable
response type. Function will execute the request and attempt to parse the response, returning it as a combine publisher.
+Using the Logging config, will auto log (or not) urls, response outputs, or fails to the console
+
+
+
Parameters
+
+
+
+
+ Name |
+ Type |
+ Description |
+
+
+
+
+ url |
+ URL |
+ The full url, including query parameters to execute.
+ |
+
+
+ isPOST |
+ Bool |
+ Bool indicating if its a POST or GET request.
+ |
+
+
+ withBody |
+ Data? |
+ Optional Data to be passed as the body.
+ |
+
+
+ forReturnType |
+ T.Type |
+ The Type to parse the response as.
+ |
Returns
-
Void
+
A publisher of the supplied return type, or error response