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_type
parameter to narrow the results to entries that have that content type identifier.Declaration
Swift
static func `where`(contentTypeId: ContentTypeId) -> Self
Parameters
contentTypeId
The 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_type
parameter to narrow the results to entries that have that content type identifier.Declaration
Swift
@discardableResult func `where`(contentTypeId: ContentTypeId) -> Self
Parameters
contentTypeId
The 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) -> Self
Parameters
linkingFieldName
The field name which holds a reference to a link.
sourceContentTypeId
The content type identifier of the link source.
targetKeyPath
The member path for the value you would like to search on for the link destination resource.
targetContentTypeId
The content type idenifier of the item(s) being linked to at the specified linking field name.
operation
The
Query.Operation
used 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) -> Self
Parameters
linkingFieldName
The field name which holds a reference to a link.
sourceContentTypeId
The content type identifier of the link source.
targetKeyPath
The member path for the value you would like to search on for the link destination resource.
targetContentTypeId
The content type idenifier of the item(s) being linked to at the specified linking field name.
operation
The
Query.Operation
used 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) -> Self
Parameters
linkingFieldName
The field name which holds a reference to a link.
sourceContentTypeId
The content type identifier of the link source.
targetId
The 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) -> Self
Parameters
linkingFieldName
The field name which holds a reference to a link.
sourceContentTypeId
The content type identifier of the link source.
targetId
The 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) -> Self
Parameters
entryId
The 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) -> Self
Parameters
entryId
The 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) -> Self
Parameters
assetId
The 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) -> Self
Parameters
assetId
The identifier of the asset which you want to find incoming links for.
Return Value
A reference to the receiving query to enable chaining.