RestfulPropertyKit Documentation Beta

Class Rest​Query​Impl

public final class RestQueryImpl<Parent, Value>: RestQuery where Parent: Codable, Value: Codable 

An implementation of RestQuery protocol.

RestQueryImpl RestQueryImpl RestQuery RestQuery RestQueryImpl->RestQuery

Conforms To

RestQuery

The protocol all rest query implementations should conform to.

Initializers

init(current:​params:​)

required convenience public init(current: RestQueryImpl<Parent, Value>, params: [String: String]) 

Creates a copy of the provided current query with a different params component.

Parameters

current Rest​Query​Impl<Parent, Value>

The current query.

params [String:​ String]

The new params for the query copy.

Returns

The created copy RestQueryImpl instance.

Properties

projected​Value

public var projectedValue: Binding<Value>

A binding for the wrapped value.

metadata

public var metadata: RestQueryMetadata<Parent, Value>

The metadata associated with this query.

cancellable

public var cancellable: Set<AnyCancellable> 

The Set of cancellable query requests.

wrapped​Value

public var wrappedValue: Value 

The value wrapped by the property attached to this query.

Methods

get(prop:​)

public func get(prop: Bool) -> Future<Value, RestQueryError> 

Sends a get request based on the metadata associated with this query.

Parameters

prop Bool

True if the property key should be used on the parent request result to unwrap the value.

Returns

A future that will resolve to the request result or an error.

post(prop:​new​Value:​)

public func post(prop: Bool, newValue: Value) -> Future<Value, RestQueryError> 

Sends a post request based on the metadata associated with this query.

Parameters

prop Bool

True if the property key should be used on the parent request result to unwrap the value.

new​Value Value

The value that should be send as the body part of the HTTPS request.

Returns

A future that will resolve to the new value or an error.