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
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 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
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 to
See moreString
.Declaration
Swift
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
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<S> : Request where S : HttpService
-
This entity may be used to provide retriers independent of the request that has been scheduled. In most cases, this will be the only retrier factory that you are using.
See moreDeclaration
Swift
public struct AnyRetrierFactory : RetrierFactory
-
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 “utility” structures that need to be accessible publicly.
See moreDeclaration
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<ServiceType> : StreamRequest where ServiceType : HttpService