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 typeSee more
HttpHeader.Field. The value always needs to be of type
public struct HttpHeader
extension HttpHeader: Equatable
extension HttpHeader: Hashable
extension HttpHeader: ExpressibleByDictionaryLiteral
This entity represents a set of HTTP query parameters. Basically, it abstracts a simple mapping from keys (See more
String) 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 calling
public struct HttpQuery
extension HttpQuery: ExpressibleByDictionaryLiteral
extension HttpQuery: Equatable
extension HttpQuery: Hashable
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 toSee more
public struct HttpRoute
extension HttpRoute: ExpressibleByArrayLiteral
extension HttpRoute: Equatable
extension HttpRoute: Hashable
This struct can be used to construct requests easily without having to define a custom entity conforming to the
Requestprotocol and defining some
HttpService. 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
Datasuch that the user can decode to the desired type via calling the
decode(type:decoder:)function on the returned
Responsepublisher when scheduling the request.
As this request struct abstracts away the
HttpServicein 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 more
This entity provides a way to initialize an HTTP service without implementing theSee more
HttpServiceprotocol in a custom entity. Note that you should usually implement the
HttpServiceprotocol instead of simply using an instance of
AnyHttpService. This class is mainly used internally.
public struct AnyHttpService : HttpService
This struct simply provides a scope for global “utility” structures that need to be accessible publicly.See more
public struct Squid
This struct can be used to construct stream requests easily without having to define a custom entity conforming to theSee more
StreamRequestprotocol and defining some
HttpService. The specifics of this entity are very similar to the specifics of
AnyRequest. Note, however, that this entity restricts messages being sent and received to be of type