Protocol
RestQuery
@dynamicMemberLookup public protocol RestQuery: AnyObject where QueryParent: Codable, QueryValue: Codable
The protocol all rest query implementations should conform to.
Relationships
Conforms To
AnyObject
Types Conforming to RestQuery
RestQueryImplAn implementation of RestQuery protocol.
Default Implementations
subscript(dynamicMember:)
subscript<Subject>(dynamicMember keyPath: KeyPath<QueryValue, Subject>) -> Binding<Subject>
Lazily creates and stores bindings for the properties of the request return type as part of the query metadata.
Parameters
| Name | Type | Description |
|---|---|---|
| dynamicMember | KeyPath<QueryValue, Subject> |
The read-only property key path. |
subscript(dynamicMember:)
subscript<Subject>(dynamicMember keyPath: WritableKeyPath<QueryValue, Subject>) -> Binding<Subject>
Lazily creates and stores bindings for the properties of the request return type as part of the query metadata.
Parameters
| Name | Type | Description |
|---|---|---|
| dynamicMember | WritableKeyPath<QueryValue, Subject> |
The writable property key path. |
Requirements
QueryParent
associatedtype QueryParent
The parent type.
QueryValue
associatedtype QueryValue
The value type.
metadata
var metadata: RestQueryMetadata<QueryParent, QueryValue>
The metadata associated with this query.
wrappedValue
var wrappedValue: QueryValue
The value wrapped by the property attached to this query.
projectedValue
var projectedValue: Binding<QueryValue>
A binding for the wrapped value.
cancellable
var cancellable: Set<AnyCancellable>
init(current:params:)
init(current: Self, params: [String: String])
Creates a copy of the provided current query with a different params component.
Parameters
| Name | Type | Description |
|---|---|---|
| current | Self |
The current query. |
| params | [String: String] |
The new params for the query copy. |
get(prop:)
func get(prop: Bool) -> Future<QueryValue, RestQueryError>
Sends a get request based on the metadata associated with this query.
Parameters
| Name | Type | Description |
|---|---|---|
| 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:newValue:)
func post(prop: Bool, newValue: QueryValue) -> Future<QueryValue, RestQueryError>
Sends a post request based on the metadata associated with this query.
Parameters
| Name | Type | Description |
|---|---|---|
| prop | Bool |
True if the property key should be used on the parent request result to unwrap the value. |
| newValue | QueryValue |
The value that should be sent as the body part of the |
Returns
A future that will resolve to the new value or an error.