Extensions on
Endpoint
Methods
`catch`(_:)
func `catch`<S: SingleEndpoint>(
@EndpointBuilder _ content: @escaping (any Error) -> S
) -> Catch<Self, S>
Catch the error and compose a new endpoint.
Parameters
Name | Type | Description |
---|---|---|
content | @escaping (any Error) -> S |
A valid content factory. |
Returns
Some Endpoint
.
handleEvents(_:)
func handleEvents(_ result: @escaping (Result<Output, any Error>) -> Void) -> HandleEvents<Self>
Handle success and failures.
Parameters
Name | Type | Description |
---|---|---|
handler | A valid event handler. |
Returns
Some Endpoint
.
map(_:)
func map<O>(_ content: @escaping (Output) throws -> O) -> Map<Self, O>
Map the output to some convenience value.
Parameters
Name | Type | Description |
---|---|---|
content | @escaping (Output) throws -> O |
A valid content factory. |
Returns
Some Endpoint
.
store(in:)
func store<S: Storage>(in storage: S) -> Map<Self, Output> where S.Item == Output
Store an item into the appropriate storage.
Parameters
Name | Type | Description |
---|---|---|
storage | S |
Some |
Returns
Some Endpoint
.