FMPWeb.Builder

Description

The FMPWeb.Builder class is a builder for the FMPWeb class.

class Builder

Methods

Method Description
httpMethod(_:) Save HTTP method to variable.
func httpMethod(_ method: FMPWeb.HTTPMethod) -> Builder

Parameters:

  • method . HTTP method.

headers(_:) Save request headers to variable.
func headers(_ headers: [AnyHashable : Any]) -> Builder

Parameters:

  • headers. Request headers.

resource(_:) Save web resource, to which request is created, to variable.
func resource(_ resource: FMPResource) -> Builder

Parameters:

  • resource. Web resource, to which request is created.

queryParams(_:) Save request string parameters to variable.
func queryParams(_ params: [AnyHashable : Any]) -> Builder

Parameters:

  • params. Request string parameters.

build() Build an instance of the FMPWeb class. It returns the object of the FMPWeb type.
func build() -> FMPWeb

Example

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:

FMPWrapper Framework | Classes