Entry
public class Entry : EntryQueryable, CachePolicyAccessible
extension Entry: ResourceQueryable
An Entry
is the actual piece of content created using one of the defined content types.
-
Undocumented
Declaration
Swift
public typealias ResourceType = EntryModel
-
Declaration
Swift
public var cachePolicy: CachePolicy
-
Stack instance for Entry to be fetched
Declaration
Swift
public var stack: Stack
-
URI Parameters
Declaration
Swift
public var parameters: [String : Any]
-
Query Parameters
Declaration
Swift
public var queryParameter: [String : Any]
-
To fetch all or find Entries
query
method is used.Example usage:
let stack = Contentstack.stack(apiKey: apiKey, deliveryToken: deliveryToken, environment: environment) stack.contentType(uid: contentTypeUid).entry().query() .find { (result: Result<ContentstackResponse<EntryModel>, Error>, response: ResponseType) in switch result { case .success(let contentstackResponse): // Contentstack response with EntryModel array in items. case .failure(let error): //Error Message } }
Declaration
Swift
public func query() -> Query
Return Value
A
Query
to enable chaining. -
To fetch all or find Entries to specific model
query
method is used.Example usage:
let stack = Contentstack.stack(apiKey: apiKey, deliveryToken: deliveryToken, environment: environment) stack.contentType(uid: contentTypeUid).entry().query(Product.self) .find { (result: Result<ContentstackResponse<Product>, Error>, response: ResponseType) in switch result { case .success(let contentstackResponse): // Contentstack response with Product array in items. case .failure(let error): //Error Message } }
Declaration
Swift
public func query<EntryType>(_ entry: EntryType.Type) -> QueryOn<EntryType> where EntryType: EntryDecodable & FieldKeysQueryable
Return Value
A
QueryOn<EntryType>
to enable chaining. -
This call fetches the latest version of a specific
Entry
of a particular stack.Example usage:
let stack = Contentstack.stack(apiKey: apiKey, deliveryToken: deliveryToken, environment: environment) stack.contentType(uid: contentTypeUID).entry(uid: UID) .fetch { (result: Result<EntryModel, Error>, response: ResponseType) in switch result { case .success(let model): //Model retrive from API case .failure(let error): //Error Message } }
Declaration
Swift
public func fetch<ResourceType>(_ completion: @escaping (Result<ResourceType, Error>, ResponseType) -> Void) where ResourceType: EndpointAccessible, ResourceType: Decodable
Parameters
completion
A handler which will be called on completion of the operation.