Skip to content

Commit 3c4c121

Browse files
Priyanka MistryPriyanka Mistry
Priyanka Mistry
authored and
Priyanka Mistry
committed
Updated to 3.1.0
1 parent a006c74 commit 3c4c121

19 files changed

+881
-170
lines changed

.DS_Store

6 KB
Binary file not shown.

Contentstack.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Contentstack'
3-
s.version = '3.0.0'
3+
s.version = '3.1.0'
44
s.summary = 'Built.io Contentstack is a headless CMS with an API-first approach that puts content at the centre.'
55

66
s.description = <<-DESC

SDK/.DS_Store

6 KB
Binary file not shown.
-369 KB
Binary file not shown.

SDK/Contentstack.framework/Headers/Assets.h renamed to SDK/Contentstack.framework/Headers/Asset.h

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Assets.h
2+
// Asset.h
33
// contentstack
44
//
55
// Created by Priyanka Mistry on 19/05/16.
@@ -13,7 +13,7 @@ BUILT_ASSUME_NONNULL_BEGIN
1313

1414
@class ContentType;
1515

16-
@interface Assets : NSObject
16+
@interface Asset : NSObject
1717

1818
/**----------------------------------------------------------------------------------------
1919
* @name Properties
@@ -33,12 +33,7 @@ BUILT_ASSUME_NONNULL_BEGIN
3333
/**
3434
* Readonly property to check type of asset
3535
*/
36-
@property (nonatomic, copy, readonly) NSString *assetType;
37-
38-
/**
39-
* Readonly property to check ContentType name of asset
40-
*/
41-
@property (nonatomic, copy, readonly) ContentType *contentType;
36+
@property (nonatomic, copy, readonly) NSString *fileType;
4237

4338
/**
4439
* Readonly property to check value of asset's uid
@@ -50,11 +45,6 @@ BUILT_ASSUME_NONNULL_BEGIN
5045
*/
5146
@property (nonatomic, copy, readonly) NSString *url;
5247

53-
/**
54-
* Readonly property to check Language of asset
55-
*/
56-
@property (nonatomic, assign, readonly) Language language;
57-
5848
/**
5949
* Readonly property to check tags of asset
6050
*/
@@ -122,6 +112,72 @@ BUILT_ASSUME_NONNULL_BEGIN
122112
@param dictionary User Info
123113
*/
124114
- (void)configureWithDictionary:(NSDictionary*)dictionary;
115+
116+
//MARK: Manually set headers -
117+
/**---------------------------------------------------------------------------------------
118+
* @name Manually set headers
119+
* ---------------------------------------------------------------------------------------
120+
*/
121+
122+
/**
123+
Set a header for Asset
124+
125+
//'blt5d4sample2633b' is a dummy Stack API key
126+
127+
//Obj-C
128+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
129+
Asset *asset = [stack asset];
130+
[asset setHeader:@"MyValue" forKey:@"My-Custom-Header"];
131+
132+
//Swift
133+
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
134+
var asset:Asset = stack.asset()
135+
asset.setHeader("MyValue", forKey: "My-Custom-Header")
136+
137+
@param headerValue The header key
138+
@param headerKey The header value
139+
*/
140+
- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey;
141+
142+
/**
143+
Set a header for Asset
144+
145+
//'blt5d4sample2633b' is a dummy Stack API key
146+
147+
//Obj-C
148+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
149+
Asset *asset = [stack asset];
150+
[asset addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];
151+
152+
//Swift
153+
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
154+
var asset:Asset = stack.asset()
155+
asset.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
156+
157+
158+
@param headers The headers as dictionary which needs to be added to the application
159+
*/
160+
- (void)addHeadersWithDictionary:(NSDictionary *)headers;
161+
162+
/**
163+
Removes a header from this Asset
164+
165+
//'blt5d4sample2633b' is a dummy Stack API key
166+
167+
//Obj-C
168+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
169+
Asset *asset = [stack asset];
170+
[asset removeHeaderForKey:@"My-Custom-Header"];
171+
172+
//Swift
173+
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
174+
var asset:Asset = stack.asset()
175+
asset.removeHeaderForKey("My-Custom-Header")
176+
177+
@param headerKey The header key that needs to be removed
178+
*/
179+
- (void)removeHeaderForKey:(NSString *)headerKey;
180+
125181
//MARK: - Fetch -
126182
/**---------------------------------------------------------------------------------------
127183
* @name Fetch
@@ -134,16 +190,15 @@ BUILT_ASSUME_NONNULL_BEGIN
134190
//Obj-C
135191
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
136192
//'bltf4fsamplec857bk' is uid of an asset
137-
Assets* assetObj = [stack assetWithUID:@"bltf4fsamplec857bk"];
193+
Asset* assetObj = [stack assetWithUID:@"bltf4fsamplec857bk"];
138194
[assetObj fetch:^(ResponseType type, NSError *error) {
139195
//error if exists then use 'error' object for details
140196
}];
141197
142-
143198
//Swift
144199
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
145200
//'bltf4fsamplec857bk' is uid of an asset
146-
var assetObj:Entry = contentTypeObj.entryWithUID("bltf4fsamplec857bk")
201+
var assetObj:Asset = stack.assetWithUID("bltf4fsamplec857bk")
147202
assetObj.fetch { (responseType, error!) -> Void in
148203
//error if exists then use 'error' object for details
149204
}

SDK/Contentstack.framework/Headers/AssetLibrary.h

Lines changed: 144 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
BUILT_ASSUME_NONNULL_BEGIN
1313

14+
typedef NS_ENUM(NSUInteger, OrderBy) {
15+
OrderByAscending = 0,
16+
OrderByDescending
17+
};
18+
1419
@interface AssetLibrary : NSObject
1520

1621
/**----------------------------------------------------------------------------------------
@@ -23,6 +28,134 @@ BUILT_ASSUME_NONNULL_BEGIN
2328
*/
2429
@property (nonatomic, assign) CachePolicy cachePolicy;
2530

31+
//MARK: - Sorting
32+
/**---------------------------------------------------------------------------------------
33+
* @name Sorting
34+
* ---------------------------------------------------------------------------------------
35+
*/
36+
37+
/**
38+
Sorts the assets in the given order on the basis of the specified field.
39+
40+
//Obj-C
41+
[assetLib sortWithKey:@"updated_at" orderBy:Ascending];
42+
43+
//Swift
44+
assetLib.sortWithKey("updated_at" orderBy:Ascending)
45+
46+
@param key field uid based on which the ordering should be done.
47+
@param order ascending or descending order in which results should come.
48+
49+
*/
50+
- (void)sortWithKey:(NSString *)key orderBy:(OrderBy)order;
51+
52+
//MARK: Include -
53+
/**---------------------------------------------------------------------------------------
54+
* @name Include
55+
* ---------------------------------------------------------------------------------------
56+
*/
57+
58+
/**
59+
Provides only the number of assets.
60+
61+
//Obj-C
62+
[assetLib objectsCount];
63+
64+
//Swift
65+
assetLib.objectsCount()
66+
67+
*/
68+
- (void)objectsCount;
69+
70+
71+
/**
72+
This method also includes the total number of assets returned in the response.
73+
74+
//Obj-C
75+
[assetLib includeCount];
76+
77+
//Swift
78+
assetLib.includeCount()
79+
80+
*/
81+
- (void)includeCount;
82+
83+
/**
84+
This method includes the relative url of assets.
85+
86+
//Obj-C
87+
[assetLib includeRelativeUrls];
88+
89+
//Swift
90+
assetLib.includeRelativeUrls()
91+
92+
*/
93+
- (void)includeRelativeUrls;
94+
95+
//MARK: Manually set headers -
96+
/**---------------------------------------------------------------------------------------
97+
* @name Manually set headers
98+
* ---------------------------------------------------------------------------------------
99+
*/
100+
101+
/**
102+
Set a header for AssetLibrary
103+
104+
//'blt5d4sample2633b' is a dummy Stack API key
105+
106+
//Obj-C
107+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
108+
AssetLibrary *assetLib = [stack assetLibrary];
109+
[assetLib setHeader:@"MyValue" forKey:@"My-Custom-Header"];
110+
111+
//Swift
112+
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
113+
var assetLib:AssetLibrary = stack.assetLibrary()
114+
assetLib.setHeader("MyValue", forKey: "My-Custom-Header")
115+
116+
@param headerValue The header key
117+
@param headerKey The header value
118+
*/
119+
- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey;
120+
121+
/**
122+
Set a header for AssetLibrary
123+
124+
//'blt5d4sample2633b' is a dummy Stack API key
125+
126+
//Obj-C
127+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
128+
AssetLibrary *assetLib = [stack assetLibrary];
129+
[assetLib addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];
130+
131+
//Swift
132+
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
133+
var assetLib:AssetLibrary = stack.assetLibrary()
134+
assetLib.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
135+
136+
@param headers The headers as dictionary which needs to be added to the application
137+
*/
138+
- (void)addHeadersWithDictionary:(NSDictionary *)headers;
139+
140+
/**
141+
Removes a header from this AssetLibrary.
142+
143+
//'blt5d4sample2633b' is a dummy Stack API key
144+
145+
//Obj-C
146+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
147+
AssetLibrary *assetLib = [stack assetLibrary];
148+
[assetLib removeHeaderForKey:@"My-Custom-Header"];
149+
150+
//Swift
151+
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
152+
var assetLib:AssetLibrary = stack.assetLibrary()
153+
assetLib.removeHeaderForKey("My-Custom-Header")
154+
155+
@param headerKey The header key that needs to be removed
156+
*/
157+
- (void)removeHeaderForKey:(NSString *)headerKey;
158+
26159
//MARK: Fetch Assets -
27160
/**---------------------------------------------------------------------------------------
28161
* @name Fetch Assets
@@ -32,17 +165,17 @@ BUILT_ASSUME_NONNULL_BEGIN
32165
/**
33166
This method provides all the assets.
34167
35-
//Obj-C
36-
[assetLib fetchAll:^(ResponseType type, NSArray *result, NSError *error) {
37-
//error for any error description
38-
//result for reponse data
39-
}];
40-
41-
//Swift
42-
assetLib.fetchAll { (responseType, result!, error!) -> Void in
43-
//error for any error description
44-
//result for reponse data
45-
}
168+
//Obj-C
169+
[assetLib fetchAll:^(ResponseType type, NSArray *result, NSError *error) {
170+
//error for any error description
171+
//result for reponse data
172+
}];
173+
174+
//Swift
175+
assetLib.fetchAll { (responseType, result!, error!) -> Void in
176+
//error for any error description
177+
//result for reponse data
178+
}
46179
47180
@param completionBlock block to be called once operation is done. The result data contains all the assets.
48181
*/

SDK/Contentstack.framework/Headers/ContentType.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@class Entry;
1313
@class Query;
14-
@class Assets;
14+
@class Asset;
1515

1616
BUILT_ASSUME_NONNULL_BEGIN
1717

@@ -28,11 +28,11 @@ BUILT_ASSUME_NONNULL_BEGIN
2828
/**
2929
Set a header for ContentType
3030
31-
//Obj-C
32-
[contentTypeObj setHeader:@"MyValue" forKey:@"My-Custom-Header"];
31+
//Obj-C
32+
[contentTypeObj setHeader:@"MyValue" forKey:@"My-Custom-Header"];
3333
34-
//Swift
35-
contentTypeObj.setHeader("MyValue", forKey: "My-Custom-Header")
34+
//Swift
35+
contentTypeObj.setHeader("MyValue", forKey: "My-Custom-Header")
3636
3737
@param headerValue The header key
3838
@param headerKey The header value

SDK/Contentstack.framework/Headers/Contentstack.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
#import <Contentstack/ContentType.h>
1515
#import <Contentstack/Entry.h>
1616
#import <Contentstack/Query.h>
17-
#import <Contentstack/Assets.h>
17+
#import <Contentstack/Asset.h>
1818
#import <Contentstack/AssetLibrary.h>
1919
#import <Contentstack/QueryResult.h>
20+
#import <Contentstack/Group.h>
2021

2122
@class Stack;
2223

SDK/Contentstack.framework/Headers/ContentstackIO.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#import <Contentstack/Query.h>
1616
#import <Contentstack/QueryResult.h>
1717
#import <ContentStack/Config.h>
18-
#import <Contentstack/Assets.h>
18+
#import <Contentstack/Asset.h>
1919
#import <Contentstack/AssetLibrary.h>
20+
#import <Contentstack/Group.h>
2021

2122
#endif /* ContentstackIO_h */

0 commit comments

Comments
 (0)