Structures
The following structures are available globally.
-
This struct is used to represent a header of HTTP requests. It can contain arbitrarily many fields which are each defined by a key and a value. The key is of the type
See moreHttpHeader.Field
. The value always needs to be of typeString
.Declaration
Swift
public struct HttpHeader
-
This entity represents a set of HTTP query parameters. Basically, it abstracts a simple mapping from keys (
See moreString
) to values (String
). As a result, an instance of this struct can also be created directly from a[String: Any]
dictionary literal where all values are represented in the query parameters by callingString.init(describing:)
.Declaration
Swift
public struct HttpQuery
-
An HTTP route represents a set of URL routing paths. Essentially, a set of routing paths can simply be represented by an array of strings. However, this entity enables initializing HTTP routes without having to explicitly convert all path components to
See moreString
.Declaration
Swift
public struct HttpRoute
-
This struct can be used to construct requests easily without having to define a custom entity conforming to the
Request
protocol and defining someHttpService
. In a larger application, you should refrain from using this struct, however, it might be useful in small projects and when writing tests.This request fixes the result type to
Data
such that the user can decode to the desired type via calling thedecode(type:decoder:)
function on the returnedResponse
publisher when scheduling the request.As this request struct abstracts away the
HttpService
in favor for a simpler interface, scheduling can be performed even easier.Note that this entity does not allow to make insecure requests over HTTP (only HTTPS).
See moreDeclaration
Swift
public struct AnyRequest : Request
-
The backoff retrier is a more complex, stateful retrier that retries a request upon certain failures by waiting a specified period of time defined by its strategy (see
See moreBackoffRetrier.Strategy
). It also defines a maximum duration after which a failed request is deemed unsuccessful.Declaration
Swift
public struct BackoffRetrier : Retrier
-
This retrier is used to indicate that the request is not retried under any circumstances. Upon calling the
See moreretry
method, the returned Future immediately delivers a message that the request does not need to be retried.Declaration
Swift
public struct NilRetrier : StatelessRetrier
-
This entity provides a way to initialize an HTTP service without implementing the
See moreHttpService
protocol in a custom entity. Note that you should usually implement theHttpService
protocol instead of simply using an instance ofAnyHttpService
. This class is mainly used internally.Declaration
Swift
public struct AnyHttpService : HttpService
-
This struct simply provides a scope for global
See moreutility
structures that need to be accessible publicly.Declaration
Swift
public struct Squid
-
This struct can be used to construct stream requests easily without having to define a custom entity conforming to the
See moreStreamRequest
protocol and defining someHttpService
. The specifics of this entity are very similar to the specifics ofAnyRequest
. Note, however, that this entity restricts messages being sent and received to be of typeString
.Declaration
Swift
public struct AnyStreamRequest : StreamRequest