Entry Class Reference
Inherits from | NSObject |
---|---|
Declared in | Entry.h |
Properties
uid
Readonly property to check value of entry’s uid
@property (nonatomic, copy, readonly) NSString *uid
Declared In
Entry.h
deleted
Readonly property to check if entry is deleted
@property (nonatomic, assign, readonly, getter=isDeleted) BOOL deleted
Declared In
Entry.h
tags
Readonly property to check tags of entry
@property (nonatomic, copy, readonly) NSArray<NSString*> *tags
Declared In
Entry.h
contentTypeName
Readonly property to check ContentType name of entry
@property (nonatomic, copy, readonly) NSString *contentTypeName
Declared In
Entry.h
title
Readonly property to check title of entry
@property (nonatomic, copy, readonly) NSString *title
Declared In
Entry.h
url
Readonly property to check url of entry
@property (nonatomic, copy, readonly) NSString *url
Declared In
Entry.h
)
Readonly property to check Language of entry
@property (nonatomic, assign) Language language __attribute ( ( deprecated ( "Use the locale instead." )
Declared In
Entry.h
locale
Readonly property to check Language of entry
@property (nonatomic, assign) NSString *locale
Declared In
Entry.h
createdAt
Readonly property to check createAt of entry
@property (nonatomic, copy, readonly) NSDate *createdAt
Declared In
Entry.h
createdBy
Readonly property to check createdBy of entry
@property (nonatomic, copy, readonly) NSString *createdBy
Declared In
Entry.h
updatedAt
Readonly property to check updatedAt of entry
@property (nonatomic, copy, readonly) NSDate *updatedAt
Declared In
Entry.h
updatedBy
Readonly property to check updatedBy of entry
@property (nonatomic, copy, readonly) NSString *updatedBy
Declared In
Entry.h
deletedAt
Readonly property to check deletedAt of entry
@property (nonatomic, copy, readonly) NSDate *deletedAt
Declared In
Entry.h
deletedBy
Readonly property to check deletedBy of entry
@property (nonatomic, copy, readonly) NSString *deletedBy
Declared In
Entry.h
cachePolicy
property to assign cache policy like CACHE_THEN_NETWORK, NETWORK_ELSE_CACHE, NETWORK_ONLY, etc.
@property (nonatomic, assign) CachePolicy cachePolicy
Declared In
Entry.h
properties
Readonly property to get data of entry.
@property (nonatomic, copy, readonly) NSDictionary<NSString*id> *properties
Declared In
Entry.h
Manually set headers
– setHeader:forKey:
Set a header for Entry
- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey
Parameters
headerValue |
The header key |
---|---|
headerKey |
The header value |
Discussion
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
[entryObj setHeader:@"MyValue" forKey:@"My-Custom-Header"];
//Swift
entryObj.setHeader("MyValue", forKey: "My-Custom-Header")
Declared In
Entry.h
– addHeadersWithDictionary:
Set a header for Entry
- (void)addHeadersWithDictionary:(NSDictionary<NSString*,NSString*> *)headers
Parameters
headers |
The headers as dictionary which needs to be added to the application |
---|
Discussion
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
[entryObj addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];
//Swift
entryObj.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
Declared In
Entry.h
– removeHeaderForKey:
Removes a header from this Entry.
- (void)removeHeaderForKey:(NSString *)headerKey
Parameters
headerKey |
The header key that needs to be removed |
---|
Discussion
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
[entryObj removeHeaderForKey:@"My-Custom-Header"];
//Swift
entryObj.removeHeaderForKey("My-Custom-Header")
Declared In
Entry.h
Configuring manually
– configureWithDictionary:
Configure user properties with built object info.
- (void)configureWithDictionary:(NSDictionary<NSString*,id> *)dictionary
Parameters
dictionary |
User Info |
---|
Discussion
//Obj-C
[entryObj configureWithDictionary:@{@"key_name":@"MyValue"}];
//Swift
entryObj.configureWithDictionary(["key_name":"MyValue"])
Declared In
Entry.h
Check for key existence
– hasKey:
Checks whether an entry has a given property
- (BOOL)hasKey:(NSString *)key
Parameters
key |
The property to be checked |
---|
Return Value
YES if key exists, NO if not
Discussion
//Assuming 'entryObj' is a Entry instance
//Obj-C
BOOL hashKey = [entryObj hasKey:@"key"];
if (hashKey) {
//Hash Key
} else {
//No hash key
}
//Swift
var hashKey:Bool = entryObj.hasKey("key")
if (hashKey) {
//Hash Key
} else {
//No Hash Key
}
Declared In
Entry.h
Get Asset or AssetLibrary
– assetForKey:
Get the info of the specified key of Asset object and returns instance of Assets.
- (Asset *)assetForKey:(NSString *)key
Parameters
key |
Key containing the reference value of Asset |
---|
Return Value
Instance of Asset.
Discussion
// 'projectImage' is a key in project class for asset
//Obj-C
Asset *asset = [entryObj assetForKey:@"projectImage"];
//Swift
var asset:Asset = entryObj.assetForKey("projectImage")
Declared In
Entry.h
– assetsForKey:
Get the array containing instance of Assets mentioned in key specified.
- (NSArray *)assetsForKey:(NSString *)key
Parameters
key |
Key containing the colection reference value of Assets. |
---|
Return Value
Array containing instance of Assets.
Discussion
//'projectImage' is a key in project class for asset
//Obj-C
NSArray *assetArray = [entryObj assetsForKey:@"projectImage"];
//Swift
var assetArray = entryObj.assetsForKey("projectImage")
Declared In
Entry.h
Get Single or Multiple Group/s
– groupForKey:
- (nullable Group *)groupForKey:(NSString *)key
Parameters
key |
Key containing the value of Group |
---|
Return Value
Instance of Group
Discussion
// 'details' is a key in people content type for group
//Obj-C
Group *detailsGroup = [entryObj groupForKey:@"details"];
//Swift
var detailsGroup:Group = entryObj.groupForKey("details")
Declared In
Entry.h
– groupsForKey:
Get the info of the specified key of content type and returns array of Group.
- (NSArray *)groupsForKey:(NSString *)key
Parameters
key |
Key containing the value of Group array |
---|
Return Value
NSArray of Groups
Discussion
// 'addresses' is a key in people for multiple group
//Obj-C
NSArray *groups = [entryObj groupsForKey:@"addresses"];
//Swift
var groups:NSArray = entryObj.groupsForKey("addresses")
Declared In
Entry.h
HTML String from Markdown
– HTMLStringForMarkdownKey:
Converts Markdown to String of HTML String for specified key
- (BUILT_NULLABLE NSString *)HTMLStringForMarkdownKey:(NSString *)key
Parameters
key |
is Markdown string parameter |
---|
Return Value
Markdown to HTML String
Discussion
//Assuming 'entryObj' is a Entry instance
//Obj-C
NSString *markdownString = [entryObj HTMLStringForMarkdownKey:@"markdownString"];
//Swift
var markdownString:NSString = entryObj.HTMLStringForMarkdownKey("markdownString")
Declared In
Entry.h
– HTMLArrayForMarkdownKey:
Converts Markdown to Array of HTML String for specified key
- (BUILT_NULLABLE NSArray *)HTMLArrayForMarkdownKey:(NSString *)key
Parameters
key |
is Multiple Markdown Parameter |
---|
Return Value
HTML Array from Markdown
Discussion
//Assuming 'entryObj' is a Entry instance
//Obj-C
NSArray *markdownArray = [entryObj HTMLArrayForMarkdownKey:@"multiple_markdown"];
//Swift
var markdownArray = entryObj.HTMLArrayForMarkdownKey("multiple_markdown")
Declared In
Entry.h
Only and Except
– includeSchema
This method also includes the schema for the entries returned in the response.
- (void)includeSchema
Discussion
//Obj-C
[entryObj includeContentType];
//Swift
entryObj.includeContentType()
Declared In
Entry.h
– includeContentType
This method also includes the contenttype for the entries returned in the response.
- (void)includeContentType
Discussion
//Obj-C
[entryObj includeContentType];
//Swift
entryObj.includeContentType()
Declared In
Entry.h
– includeReferenceContentTypeUid
This method also includes the content type UIDs of the referenced entries returned in the response.
- (void)includeReferenceContentTypeUid
Discussion
//Obj-C
[entryObj includeReferenceContentTypeUid];
//Swift
entryObj.includeReferenceContentTypeUid(])
Declared In
Entry.h
– includeOnlyFields:
Specifies an array of ‘only’ keys in BASE object that would be included in the response.
- (void)includeOnlyFields:(NSArray *)fieldUIDs
Parameters
fieldUIDs |
Array of the ‘only’ keys to be included in response. |
---|
Discussion
//Obj-C
[entryObj includeOnlyFields:@["name"]];
//Swift
entryObj.includeOnlyFields(["name"])
Specifies an array of keys in BASE object that would be included in the response.
Declared In
Entry.h
– includeAllFieldsExcept:
Specifies an array of keys in reference class object that would be ‘excluded’ from the response.
- (void)includeAllFieldsExcept:(NSArray *)fieldUIDs
Parameters
fieldUIDs |
Array of keys to be excluded from the response. |
---|
Discussion
//Obj-C
[entryObj includeAllFieldsExcept:@["name"]];
//Swift
entryObj.includeAllFieldsExcept(["name"])
Specifies an array of keys in BASE object that would be ‘excluded’ from the response.
Declared In
Entry.h
Reference
– includeRefFieldWithKey:
Include reference objects with given key in response
- (void)includeRefFieldWithKey:(NSArray *)key
Parameters
key |
Array of reference keys to include in response. |
---|
Discussion
//Obj-C
[entryObj includeRefFieldWithKey:@[@"detail"]];
//Swift
entryObj.includeRefFieldWithKey(["detail"])
The include parameter accepts the name of a reference field. By default, no reference field is bought along with the object, only the uids are. To include any reference, this parameter must be used. Nested references can be bought by “.” separating the references. This will work for references which are nested inside groups or references which are nested inside other references.
Declared In
Entry.h
– includeRefFieldWithKey:andOnlyRefValuesWithKeys:
Specifies an array of ‘only’ keys in reference class object that would be included in the response.
- (void)includeRefFieldWithKey:(NSString *)key andOnlyRefValuesWithKeys:(NSArray *)values
Parameters
key |
Key who has reference to some other class object. |
---|---|
values |
Array of the ‘only’ reference keys to be included in response. |
Discussion
//Obj-C
[entryObj includeRefFieldWithKey:@[@"detail"] andOnlyRefValuesWithKeys:@[@"name",@"description"]];
//Swift
entryObj.includeRefFieldWithKey(["detail"], andOnlyRefValuesWithKeys:["name","description"])
Specifies an array of keys in reference class object that would be included in the response.
Declared In
Entry.h
– includeRefFieldWithKey:excludingRefValuesWithKeys:
Specifies an array of keys in reference class object that would be ‘excluded’ from the response.
- (void)includeRefFieldWithKey:(NSString *)key excludingRefValuesWithKeys:(NSArray *)values
Parameters
key |
Key who has reference to some other class object. |
---|---|
values |
Array of the ‘only’ reference keys to be ‘excluded’ from the response. |
Discussion
//Obj-C
[entryObj includeRefFieldWithKey:@[@"detail"] excludingRefValuesWithKeys:@[@"description"]];
//Swift
entryObj.includeRefFieldWithKey(["detail"], excludingRefValuesWithKeys:["description"])
Specifies an array of keys in reference class object that would be ‘excluded’ from the response.
Declared In
Entry.h
– addParamKey:andValue:
This method adds key and value to an Entry.
- (void)addParamKey:(NSString *)key andValue:(NSString *)value
Parameters
key |
The key as string which needs to be added to an Entry |
---|---|
value |
The value as string which needs to be added to an Entry |
Discussion
//Obj-C
[entryObj addParamKey:@"key" andValue:@"value"];
//Swift
entryObj.addParamKey("key", andValue:"value")
Declared In
Entry.h
Fetch
– fetch:
Fetches an entry asynchronously provided entry UID
- (void)fetch:(void ( ^ ) ( ResponseType type , NSError *BUILT_NULLABLE_P error ))callback
Parameters
callback |
Completion block with params NSError |
---|
Discussion
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
ContentType *contentTypeObj = [stack contentTypeWithName:@"blog"];
//'bltf4fsamplec851db' is uid of an entry of 'blog' contenttype
Entry *entryObj = [contentTypeObj entryWithUID:@"bltf4fsamplec851db"];
[entryObj fetch:^(ResponseType type, NSError *error) {
//error if exists then use 'error' object for details
}];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
var contentTypeObj:ContentType = stack.contentTypeWithName("blog")
//'bltf4fsamplec851db' is uid of an entry of 'blog' contenttype
var entryObj:Entry = contentTypeObj.entryWithUID("bltf4fsamplec851db")
entryObj.fetch { (error!) -> Void in
//error if exists then use 'error' object for details
}
Declared In
Entry.h
– entriesForKey:withContentType:
Returns an array of Entries for the specified reference key
- (NSArray *)entriesForKey:(NSString *)referenceKey withContentType:(NSString *)contentTypeName
Parameters
referenceKey |
the reference field key |
---|---|
contentTypeName |
set the contentTypeName to which the object(s) belongs |
Return Value
An array of Entries for the specified key
Discussion
Use this method to retrieve entries when using includeRefFieldWithKey: method of Query. The reference field key may have an array of objects or a single object. This method will return the Entries for the included reference field.
//Obj-C
[entryObj entriesForKey:@"detail" withContentType:"description"];
//Swift
entryObj.entriesForKey("detail" withContentType:"description")
Declared In
Entry.h
Cancel Request
– cancelRequest
Advises the operation object that it should stop executing its task.
- (void)cancelRequest
Discussion
//Obj-C
[entryObj cancelRequest];
//Swift
entryObj.cancelRequest()
This method does not force your operation code to stop. Instead, it updates the object’s internal flags to reflect the change in state. If the operation has already finished executing, this method has no effect. Canceling an operation that is currently in an operation queue, but not yet executing, makes it possible to remove the operation from the queue sooner than usual.
Declared In
Entry.h