1111
1212BUILT_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 */
0 commit comments