EntryQueryable

View as Markdown

EntryQueryable

Query class for Entry.

locale(_:)

Instance method to fetch Entry for specific locale.

NameTypeDescription
locale (required)string

The code for fetching entry for locale.

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query()

.locale("<LOCALE_CODE>")

.fetch { (result: Result<ContentstackResponse<EntryModel>, Error>, response: ResponseType) in

   switch result {

    case .success(let contentstackResponse):


    case .failure(let error):


   }

}

only(fields:)

Specifies an array of only keys in BASE object that would be included in the response.

NameTypeDescription
key (required)[string]

List for field uids to included in response.

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query()

.only(["<FIELD_UID_TO_EXCEPT>"])

.fetch { (result: Result<ContentstackResponse<EntryModel>, Error>, response: ResponseType) in

   switch result {

    case .success(let contentstackResponse):


    case .failure(let error):


   }

}

except(fields:)

Specifies an array of except keys in BASE object that would be included in the response.

NameTypeDescription
key (required)[string]

List for field uids to excepted in response

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query()

.except(["<FIELD_UID_TO_EXCEPT>"])

.fetch { (result: Result<ContentstackResponse<EntryModel>, Error>, response: ResponseType) in

   switch result {

    case .success(let contentstackResponse):


    case .failure(let error):


   }

}

includeReference(with:)

Instance method to include reference objects with given key in response.

NameTypeDescription
key (required)[string]

List for reference field uids to include reference in response.

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query()

.includeReference(with: ["<REFERENCE_FIELD_UIDS>"])

.fetch { (result: Result<ContentstackResponse<EntryModel>, Error>, response: ResponseType) in

   switch result {

    case .success(let contentstackResponse):


    case .failure(let error):


   }

}

include(params:)

Instance method for including count, Unpublished, ContentType schema, Global Fields schema, and Reference ContentType Uid in result.

NameTypeDescription
params (required)Query.Include

The member of your Query.Include that you want to include in response

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.count])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.refContentTypeUID])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.contentType])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.globalField])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.fallback])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.embeddedItems])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.

])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.count, .


])

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query().include(params: [.all])

includeReferenceField(with:only:)

Specifies an array of only keys in reference object that would be included in the response.

NameTypeDescription
key (required)string

Reference field uid as key to include reference.

fields[String]

List of field uid's to be included in response.

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query()

.includeReferenceField(with: "<REFERENCE_FIELD_UID>",only:["<ONLY_FIELD_UIDS>"])

.fetch { (result: Result<ContentstackResponse<EntryModel>, Error>, response: ResponseType) in

   switch result {

    case .success(let contentstackResponse):


    case .failure(let error):


   }

}

includeReferenceField(with:except:)

Specifies an array of except keys in reference object that would be included in the response.

NameTypeDescription
key (required)string

Reference field uid as key to include reference.

fields[String]

List of field uid's to be excluded in response.

let stack = Contentstack.stack(apiKey: "<API_KEY>", deliveryToken: "<DELIVERY_TOKEN>", environment: "<ENVIRNOMENT>")

stack.contentType(uid: contentTypeUID).entry().query()

.includeReferenceField(with: "<REFERENCE_FIELD_UID>",except:["<EXCEPT_FIELD_UIDS>"])

.fetch { (result: Result<ContentstackResponse<EntryModel>, Error>, response: ResponseType) in

   switch result {

    case .success(let contentstackResponse):


    case .failure(let error):


   }

}

includeMetadata()

Includes AssetQuery metadata along with response body.

let stack = Contentstack.stack(apiKey:"API_KEY", deliveryToken:"DELIVERY_TOKEN", environment: "ENVIRNOMENT")

stack.contentType(uid: contentTypeUID).entry().query()

.includeMetadata()

.fetch { (result: Result ContentstackResponse<EntryMode>, Error<response: ResponseType>) in

switch result {

case.success(let contentstackResponse):

case.failure(let error):


  }

}