Structure
Query
public struct Query: Component
A struct
defining the query
items for a given endpoint.
Defaults to empty.
Relationships
Conforms To
Component
A
protocol
defining a unique identifier for a specific request component.
Initializers
init(_:)
public init<C: Sequence>(_ items: C) where C.Element == URLQueryItem
Init.
Parameters
Name | Type | Description |
---|---|---|
items | C |
The query items for a given endpoint. |
init(withFlags:)
public init(withFlags query: [String: String?])
Init.
Parameters
Name | Type | Description |
---|---|---|
query | [String: String?] |
The query items for a given endpoint. |
init(_:)
public init(_ query: [String: String?])
Init.
Parameters
Name | Type | Description |
---|---|---|
query | [String: String?] |
The query items for a given endpoint. |
init(_:)
public init(_ query: [String: String])
Init.
Parameters
Name | Type | Description |
---|---|---|
query | [String: String] |
The query items for a given endpoint. |
init(_:forKey:)
public init(_ value: String, forKey key: String)
Init.
Parameters
Name | Type | Description |
---|---|---|
value | String |
A |
key | String |
A |
init(_:forKey:)
public init(_ value: String?, forKey key: String)
Init.
Parameters
Name | Type | Description |
---|---|---|
value | String? |
An optional |
key | String |
A |
Properties
defaultValue
public static var defaultValue: Query
The default value when no cached component can be found.
Methods
inherit(from:_:)
public mutating func inherit(from original: any Component)
Inherit some previously cached value.
Query("value1", forKey: "key1")
Query("value2", forKey: "key2")
would be resolved to ["key1": "value1", "key2": "value2"]
.
Parameters
Name | Type | Description |
---|---|---|
original | any |
The original value for the cached component. |
update(_:)
public func update(_ request: inout URLRequest)
Update a given URLRequest
.
Parameters
Name | Type | Description |
---|---|---|
request | inout URLRequest |
A mutable |