Structure
Catch
public struct Catch<Parent: Endpoint, Child: SingleEndpoint> where Child.Output == Parent.Output
A struct
defining a custom endpoint
implementation handling a request generated
by an error in the previous one.
This is only available for SingleEndpoint
Child
s cause we want to be sure to
guarantee a deterministic ordering for outputs
which is choerent with user expectations (i.e.
work like Combine), and it wouldn't
otherwise be possible by extending it to
LoopEndpoint
s.
Relationships
Conforms To
Endpoint
LoopEndpoint
Nested Type Aliases
Initializers
init(_:to:)
public init(
@EndpointBuilder _ parent: () -> Parent,
@EndpointBuilder to child: @escaping (any Error) -> Child
)
Init.
Parameters
Name | Type | Description |
---|---|---|
parent | () -> Parent |
A valid |
child | @escaping (any Error) -> Child |
A valid |
Methods
_resolve(with:)
@_spi(Private)
public func _resolve<R: EndpointResolver>(with session: R) -> AsyncThrowingStream<Output, any Error>
Fetch responses, from a given
Input
and URLSession
.
Parameters
Name | Type | Description |
---|---|---|
session | R |
The |
Returns
Some AsyncStream
.
_resolve(with:)
@_spi(Private)
public func _resolve<R: EndpointResolver>(with session: R) -> AnyPublisher<Output, any Error>
Fetch responses, from a given
Input
and URLSession
.
Parameters
Name | Type | Description |
---|---|---|
session | R |
The |
Returns
Some AsyncStream
.