ContentType
ContentType
Content type defines the structure or schema of a page or a section of your web or mobile property.
| Name | Type | Description |
|---|---|---|
| cachePolicy | CachePolicy | Set cache policy for the ContentType request. |
entry(uid:)
Get instance of Entry to fetch Entry or fetch specific Entry.
let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>") stack.contentType(uid: "<CONTENT_TYPE_UID>").entry()
let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>") stack.contentType(uid: "<CONTENT_TYPE_UID>").entry(uid: "<ENTRY_UID>")
includeGlobalFields()
To include Global Fields schema in ContentType response.
let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")
stack.contentType(uid: "<CONTENT_TYPE_UID>").includeGlobalFields()
.fetch { (result: Result<ContentTypeModel, Error>, response: ResponseType) in
switch result {
case .success(let model):
case .failure(let error):
}
}query()
To fetch all or find ContentTypes query method is used.
let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>") stack.contentType().query()
fetch(_:)
This call fetches the latest version of a specific ContentType of a particular stack.
| Name | Type | Description |
|---|---|---|
| completion (required) | Result<ResourceType, Error>, ResponseType) -> Void | A handler which will be called on completion of the operation. |
let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")
stack.contentType(uid: "<CONTENT_TYPE_UID>")
.fetch { (result: Result<ContentTypeModel, Error>, response: ResponseType) in
switch result {
case .success(let model):
case .failure(let error):
}
}