The FMPWeb.Builder class is a builder for the FMPWeb class.
class Builder
Method | Description |
httpMethod(_:) | Save HTTP method to variable. func httpMethod(_ method: FMPWeb.HTTPMethod) -> Builder Parameters:
|
headers(_:) | Save request headers to variable. func headers(_ headers: [AnyHashable : Any]) -> Builder Parameters:
|
resource(_:) | Save web resource, to which request is created, to variable. func resource(_ resource: FMPResource) -> Builder Parameters:
|
queryParams(_:) | Save request string parameters to variable. func queryParams(_ params: [AnyHashable : Any]) -> Builder Parameters:
|
build() | Build an instance of the FMPWeb class. It returns the object of the FMPWeb type. func build() -> FMPWeb |
Build an instance of the FMPWeb class:
// Build an instance of the FMPResource class. For details see examples for FMPResource.Builder.
let resource: FMPResource = fmp.resource.build()
// Build an instance of the FMPWeb class with various settings
let web: FMPWeb = fmp.web
.httpMethod(.post) // By default FMPWeb.HTTPMethod.get
.headers(["Content-Type" : "application/json"]) // By default [:]
.resource(resource) // By default nil
.queryParams(["key" : "value"]) // By default [:]
.build()
See also: