LinkQuery
public final class LinkQuery<EntryType> : AbstractQuery where EntryType : EntryDecodable, EntryType : FieldKeysQueryable
An additional query to filter by the properties of linked objects when searching on references.
See: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/search-on-references
and see the init
-
The parameters dictionary that are converted to
URLComponents
(HTTP parameters/arguments) on the HTTP URL. Useful for debugging.Declaration
Swift
public var parameters: [String : String]
-
Static method for creating a new LinkQuery with an operation. This variation for initializing guarantees correct query contruction by utilizing the associated Fields CodingKeys type required by ResourceQueryable on the type you are linking to.
Example usage:
let linkQuery = LinkQuery<Cat>.where(field: .name, .matches("Happy Cat")) let query = QueryOn<Cat>(whereLinkAtField: .bestFriend, matches: linkQuery) client.fetchArray(of: Cat.self, matching: query) { (result: Result<ArrayResponse<Cat>>) in switch result { case .success(let arrayResponse): let cats = arrayResponse.items // Do stuff with cats. case .failure(let error): print(error) } }
Declaration
Swift
public static func `where`(field: EntryType.FieldKeys, _ operation: Query.Operation) -> LinkQuery<EntryType>
Parameters
field
The member of the
FieldKeys
type associated with your type conforming toEntryDecodable & ResourceQueryable
that you are performing your search on reference against.operation
The query operation used in the query.
Return Value
A newly initialized
QueryOn
query. -
Static method for creating a new LinkQuery with an operation. This variation for initializing guarantees correct query contruction by utilizing the associated Sys CodingKeys type required by ResourceQueryable on the type you are linking to.
Example usage:
let linkQuery = LinkQuery<Cat>.where(sys: .id, .matches("happycat")) let query = QueryOn<Cat>(whereLinkAtField: .bestFriend, matches: linkQuery) client.fetchArray(of: Cat.self, matching: query) { (result: Result<ArrayResponse<Cat>>) in switch result { case .success(let arrayResponse): let cats = arrayResponse.items // Do stuff with cats. case .failure(let error): print(error) } }
See: Search on references
Declaration
Parameters
sys
The member of the
Sys.CodingKeys
type associated with your type conforming toEntryDecodable & ResourceQueryable
that you are performing your search on reference against.operation
The query operation used in the query.
Return Value
A newly initialized
QueryOn
query. -
Designated initializer for FilterQuery.
Declaration
Swift
public init()