AnyRequest
public struct AnyRequest : RequestThis struct can be used to construct requests easily without having to define a custom entity
conforming to the Request protocol 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 Data such that the user can decode to the desired type
via calling the decode(type:decoder:) function on the returned Response 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).
- 
                  
                  DeclarationSwift public typealias Result = Data
- 
                  
                  DeclarationSwift public let routes: HttpRoute
- 
                  
                  DeclarationSwift public let method: HttpMethod
- 
                  
                  DeclarationSwift public let query: HttpQuery
- 
                  
                  DeclarationSwift public let header: HttpHeader
- 
                  
                  DeclarationSwift public let body: HttpBody
- 
                  
                  DeclarationSwift public let acceptedStatusCodes: CountableClosedRange<Int>
- 
                  
                  DeclarationSwift public let priority: RequestPriority
- 
                  
                  Initializes a new request for a particular URL. DeclarationSwift public init(_ method: HttpMethod = .get, url: UrlConvertible, query: HttpQuery = [:], header: HttpHeader = [:], body: HttpBody = HttpData.Empty(), acceptedStatusCodes: CountableClosedRange<Int> = 200...299, priority: RequestPriority = .default)ParametersmethodThe HTTP method for the request. Defaults to GET. urlThe URL of the request. queryThe request’s query parameters. Defaults to no parameters. headerThe request’s headers. Defaults to no header fields. bodyThe request’s body. Defaults to an empty body. acceptedStatusCodesAcceptable status codes for a successful response. Defaults to all 2xx status codes. priorityThe priority of the request. Defaults to .default.
- 
                  
                  Initializes a new request based on a predefined HttpService.DeclarationSwift public init(_ method: HttpMethod = .get, routes: HttpRoute, query: HttpQuery = [:], header: HttpHeader = [:], body: HttpBody = HttpData.Empty(), acceptedStatusCodes: CountableClosedRange<Int> = 200...299, priority: RequestPriority = .default, service: HttpService)ParametersmethodThe HTTP method for the request. Defaults to GET. routesThe routing paths for the request. The final URL is constructed by making use of the given service.queryThe request’s query parameters. Defaults to no parameters. headerThe request’s headers. Defaults to no header fields. bodyThe request’s body. Defaults to an empty body. acceptedStatusCodesAcceptable status codes for a successful response. Defaults to all 2xx status codes. priorityThe priority of the request. Defaults to .default.serviceThe service representing an API. 
- 
                  
                  Schedules the request and, as expected, returns a Responsepublisher. As the service is transparently constructed when initializing the request, there is no need to pass a service in this case. This implies that the user should not use theschedule(with:)method.DeclarationSwift public func schedule() -> Response<`Self`>
 View on GitHub
            View on GitHub
           AnyRequest Structure Reference
      AnyRequest Structure Reference