EntryQuery
public protocol EntryQuery : AbstractResourceQuery
The base abstract type for querying Contentful entries. The contained operations in the default implementation of this protocol can only be used when querying against the `/entries/ endpoint of the Content Delivery and Content Preview APIs. See: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
-
where(contentTypeId:Extension method) Initializes a new query specifying the
content_typeparameter to narrow the results to entries that have that content type identifier.Declaration
Swift
static func `where`(contentTypeId: ContentTypeId) -> SelfParameters
contentTypeIdThe identifier of the content type which the query will be performed on.
Return Value
A new initialized Query narrowing the results to a specific content type.
-
where(contentTypeId:Extension method) Appends the
content_typeparameter to narrow the results to entries that have that content type identifier.Declaration
Swift
@discardableResult func `where`(contentTypeId: ContentTypeId) -> SelfParameters
contentTypeIdThe identifier of the content type which the query will be performed on.
Return Value
A reference to the receiving query to enable chaining.
-
where(linkAtFieldNamed:Extension methodonSourceContentTypeWithId: hasValueAtKeyPath: withTargetContentTypeId: that: ) Initialize a query to do a “Search on References” which enables searching for entries based on value’s for members of referenced entries.
Example usage:
let query = Query.where(linkAtFieldNamed: "bestFriend", onSourceContentTypeWithId: "cat", hasValueAtKeyPath: "fields.name", withTargetContentTypeId: "cat", that: .matches("Happy Cat"))Declaration
Swift
static func `where`(linkAtFieldNamed linkingFieldName: String, onSourceContentTypeWithId sourceContentTypeId: ContentTypeId, hasValueAtKeyPath targetKeyPath: String, withTargetContentTypeId targetContentTypeId: ContentTypeId, that operation: Query.Operation) -> SelfParameters
linkingFieldNameThe field name which holds a reference to a link.
sourceContentTypeIdThe content type identifier of the link source.
targetKeyPathThe member path for the value you would like to search on for the link destination resource.
targetContentTypeIdThe content type idenifier of the item(s) being linked to at the specified linking field name.
operationThe
Query.Operationused to match the value of at the target key path.Return Value
A newly initialized query for searching on references.
-
where(linkAtFieldNamed:Extension methodonSourceContentTypeWithId: hasValueAtKeyPath: withTargetContentTypeId: that: ) Use this method to do a “Search on References” which enables searching for entries based on value’s for members of referenced entries.
Example usage:
Declaration
Swift
@discardableResult func `where`(linkAtFieldNamed linkingFieldName: String, onSourceContentTypeWithId sourceContentTypeId: ContentTypeId, hasValueAtKeyPath targetKeyPath: String, withTargetContentTypeId targetContentTypeId: ContentTypeId, that operation: Query.Operation) -> SelfParameters
linkingFieldNameThe field name which holds a reference to a link.
sourceContentTypeIdThe content type identifier of the link source.
targetKeyPathThe member path for the value you would like to search on for the link destination resource.
targetContentTypeIdThe content type idenifier of the item(s) being linked to at the specified linking field name.
operationThe
Query.Operationused to match the value of at the target key path.Return Value
A reference to the receiving query to enable chaining.
-
where(linkAtFieldNamed:Extension methodonSourceContentTypeWithId: hasTargetId: ) Static method creating a query that requires that an specific field of an entry holds a reference to another specific entry.
Example usage:
let query = Query.where(linkAtFieldNamed: "bestFriend", onSourceContentTypeWithId: "cat", hasValueAtKeyPath: "fields.name", withTargetContentTypeId: "cat", that: .matches("Happy Cat"))Declaration
Swift
static func `where`(linkAtFieldNamed linkingFieldName: String, onSourceContentTypeWithId sourceContentTypeId: ContentTypeId, hasTargetId targetId: String) -> SelfParameters
linkingFieldNameThe field name which holds a reference to a link.
sourceContentTypeIdThe content type identifier of the link source.
targetIdThe identifier of the entry or asset being linked to at the specified linking field.
Return Value
A newly initialized query for searching on references.
-
where(linkAtFieldNamed:Extension methodonSourceContentTypeWithId: hasTargetId: ) Instance method creating a query that requires that an specific field of an entry holds a reference to another specific entry.
Example usage:
Declaration
Swift
@discardableResult func `where`(linkAtFieldNamed linkingFieldName: String, onSourceContentTypeWithId sourceContentTypeId: ContentTypeId, hasTargetId targetId: String) -> SelfParameters
linkingFieldNameThe field name which holds a reference to a link.
sourceContentTypeIdThe content type identifier of the link source.
targetIdThe identifier of the entry or asset being linked to at the specified linking field.
Return Value
A reference to the receiving query to enable chaining.
-
where(linksToEntryWithId:Extension method) Static method for creating a query that will search for entries that have a field linking to another entry with a specific id.
Declaration
Swift
static func `where`(linksToEntryWithId entryId: String) -> SelfParameters
entryIdThe identifier of the entry which you want to find incoming links for.
Return Value
A newly initialized query which will search for incoming links on a specific entry.
-
where(linksToEntryWithId:Extension method) Instance method for creating a query that will search for entries that have a field linking to another entry with a specific id.
Declaration
Swift
@discardableResult func `where`(linksToEntryWithId entryId: String) -> SelfParameters
entryIdThe identifier of the entry which you want to find incoming links for.
Return Value
A reference to the receiving query to enable chaining.
-
where(linksToAssetWithId:Extension method) Static method for creating a query that will search for entries that have a field linking to an asset with a specific id.
Declaration
Swift
static func `where`(linksToAssetWithId assetId: String) -> SelfParameters
assetIdThe identifier of the asset which you want to find incoming links for
Return Value
A newly initialized query which will search for incoming links on a specific asset.
-
where(linksToAssetWithId:Extension method) Static method for creating a query that will search for entries that have a field linking to an asset with a specific id.
Declaration
Swift
@discardableResult func `where`(linksToAssetWithId assetId: String) -> SelfParameters
assetIdThe identifier of the asset which you want to find incoming links for.
Return Value
A reference to the receiving query to enable chaining.
View on GitHub
EntryQuery Protocol Reference