Requests Documentation

Structure Handle​Events

public struct HandleEvents<Parent: Endpoint>  

A struct defining a custom endpoint implementation handling success and failures of an existing one, without modifying them.

%141 HandleEvents HandleEvents LoopEndpoint LoopEndpoint HandleEvents->LoopEndpoint Endpoint Endpoint HandleEvents->Endpoint

Conforms To

Endpoint
LoopEndpoint

Initializers

init(_:​with:​)

public init(
        @EndpointBuilder _ parent: () -> Parent,
        with handler: @escaping (Result<Parent.Output, any Error>) -> Void
    )  

Init.

Parameters

parent () -> Parent

A valid Parent factory.

handler @escaping (Result<Parent.​Output, any Error>) -> Void

The event handler.

Methods

_resolve(with:​)

@_spi(Private)
    public func _resolve<R: EndpointResolver>(with session: R) -> AsyncThrowingStream<Parent.Output, any Error>  

Fetch responses, from a given Input and URLSession.

Parameters

session R

The EndpointResolver used to fetch the response.

Returns

Some AsyncStream.

_resolve(with:​)

@_spi(Private)
    public func _resolve<R: EndpointResolver>(with session: R) -> AnyPublisher<Parent.Output, any Error>  

Fetch responses, from a given Input and URLSession.

Parameters

session R

The EndpointResolver used to fetch the response.

Returns

Some AsyncStream.