Endpoint
open class Endpoint
Class for reifying a target of the Target enum unto a concrete Endpoint.
Note
As of Moya 11.0.0 Endpoint is no longer generic. Existing code should work as is after removing the generic. See #1529 and #1524 for the discussion.-
Undocumented
Declaration
Swift
public typealias SampleResponseClosure = () -> EndpointSampleResponse -
A string representation of the URL for the request.
Declaration
Swift
public let url: String -
A closure responsible for returning an
EndpointSampleResponse.Declaration
Swift
public let sampleResponseClosure: SampleResponseClosure -
The HTTP method for the request.
Declaration
Swift
public let method: Moya.Method -
The HTTP header fields for the request.
Declaration
Swift
public let httpHeaderFields: [String : String]? -
Undocumented
Declaration
Swift
public init(url: String, sampleResponseClosure: @escaping SampleResponseClosure, method: Moya.Method, task: Task, httpHeaderFields: [String: String]?) -
Convenience method for creating a new
Endpointwith the same properties as the receiver, but with added HTTP header fields.Declaration
Swift
open func adding(newHTTPHeaderFields: [String : String]) -> Endpoint
-
Returns the
Endpointconverted to aURLRequestif valid. Throws an error otherwise.Declaration
Swift
func urlRequest() throws -> URLRequest
-
Declaration
Swift
public func hash(into hasher: inout Hasher) -
Note: If both Endpoints fail to produce a URLRequest the comparison will fall back to comparing each Endpoint’s hashValue.
Declaration
Swift
public static func == (lhs: Endpoint, rhs: Endpoint) -> Bool
Endpoint Class Reference