The FMPWeb class is used to describe request to web resource.
class FMPWeb
Property | Description |
httpMethod |
HTTP method. var httpMethod: FMPWeb.HTTPMethod { get } |
headers | Request headers. var headers: [AnyHashable : Any] { get } |
resource | Web resource, for which request is created. var resource: FMPResource? { get } |
queryParams |
Request string parameters. var queryParams: [AnyHashable : Any] { get } |
Method | Description |
request(completion:) |
Send request to web resource. func request(completion: @escaping FMPRequestResponseHandler) Parameters:
|
Send request to web resource:
// Build an instance of the FMPWeb class. For details see examples for FMPWeb.Builder.
let web: FMPWeb = fmp.web.build()
// Send request to web resource
web.request() { (response) in
if response.success {
// Display server response
print(response.result)
} else {
// Display error code and description
print(response.error?.code, response.error?.description)
}
}
See also: