Requests Documentation

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

content @escaping (any Error) -> S

A valid content factory.

Returns

Some Endpoint.

handle​Events(_:​)

func handleEvents(_ result: @escaping (Result<Output, any Error>) -> Void) -> HandleEvents<Self>  

Handle success and failures.

Parameters

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

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

storage S

Some Storage.

Returns

Some Endpoint.