Skip to content

Commit a006c74

Browse files
author
Priyanka Mistry
committed
Updated to new version 3.0.0
1 parent 81d3c57 commit a006c74

14 files changed

+552
-127
lines changed

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 = '1.0.1'
3+
s.version = '3.0.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
842 KB
Binary file not shown.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//
2+
// AssetLibrary.h
3+
// contentstack
4+
//
5+
// Created by Priyanka Mistry on 05/10/16.
6+
// Copyright © 2016 Built.io. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import "ContentstackDefinitions.h"
11+
12+
BUILT_ASSUME_NONNULL_BEGIN
13+
14+
@interface AssetLibrary : NSObject
15+
16+
/**----------------------------------------------------------------------------------------
17+
* @name Properties
18+
*-----------------------------------------------------------------------------------------
19+
*/
20+
21+
/**
22+
* property to assign cache policy like CACHE_THEN_NETWORK, NETWORK_ELSE_CACHE, NETWORK_ONLY, etc.
23+
*/
24+
@property (nonatomic, assign) CachePolicy cachePolicy;
25+
26+
//MARK: Fetch Assets -
27+
/**---------------------------------------------------------------------------------------
28+
* @name Fetch Assets
29+
* ---------------------------------------------------------------------------------------
30+
*/
31+
32+
/**
33+
This method provides all the assets.
34+
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+
}
46+
47+
@param completionBlock block to be called once operation is done. The result data contains all the assets.
48+
*/
49+
50+
- (void)fetchAll:(void (^) (ResponseType type,NSArray * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error))completionBlock;
51+
@end
52+
53+
BUILT_ASSUME_NONNULL_END
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
//
2+
// Assets.h
3+
// contentstack
4+
//
5+
// Created by Priyanka Mistry on 19/05/16.
6+
// Copyright © 2016 Built.io. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import "ContentstackDefinitions.h"
11+
12+
BUILT_ASSUME_NONNULL_BEGIN
13+
14+
@class ContentType;
15+
16+
@interface Assets : NSObject
17+
18+
/**----------------------------------------------------------------------------------------
19+
* @name Properties
20+
*-----------------------------------------------------------------------------------------
21+
*/
22+
23+
/**
24+
* Readonly property to check fileName of asset
25+
*/
26+
@property (nonatomic, copy, readonly) NSString *fileName;
27+
28+
/**
29+
* Readonly property to check fileSize of asset
30+
*/
31+
@property (nonatomic, assign, readonly) unsigned int fileSize;
32+
33+
/**
34+
* Readonly property to check type of asset
35+
*/
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;
42+
43+
/**
44+
* Readonly property to check value of asset's uid
45+
*/
46+
@property (nonatomic, copy, readonly) NSString *uid;
47+
48+
/**
49+
* Readonly property to check value of asset's url
50+
*/
51+
@property (nonatomic, copy, readonly) NSString *url;
52+
53+
/**
54+
* Readonly property to check Language of asset
55+
*/
56+
@property (nonatomic, assign, readonly) Language language;
57+
58+
/**
59+
* Readonly property to check tags of asset
60+
*/
61+
@property (nonatomic, copy, readonly) NSArray *tags;
62+
63+
/**
64+
* Readonly property to check createAt of asset
65+
*/
66+
@property (nonatomic, copy, readonly) NSDate *createdAt;
67+
68+
/**
69+
* Readonly property to check createdBy of asset
70+
*/
71+
@property (nonatomic, copy, readonly) NSString *createdBy;
72+
73+
/**
74+
* Readonly property to check updatedAt of asset
75+
*/
76+
@property (nonatomic, copy, readonly) NSDate *updatedAt;
77+
78+
/**
79+
* Readonly property to check updatedBy of asset
80+
*/
81+
@property (nonatomic, copy, readonly) NSString *updatedBy;
82+
83+
/**
84+
* Readonly property to check deletedAt of asset
85+
*/
86+
@property (nonatomic, copy, readonly) NSDate *deletedAt;
87+
88+
/**
89+
* Readonly property to check deletedBy of asset
90+
*/
91+
@property (nonatomic, copy, readonly) NSString *deletedBy;
92+
93+
/**
94+
* Readonly property to check publish details of asset
95+
*/
96+
@property (nonatomic, copy, readonly) NSDictionary *publishDetails;
97+
98+
/**
99+
* property to assign cache policy like CACHE_THEN_NETWORK, NETWORK_ELSE_CACHE, NETWORK_ONLY, etc.
100+
*/
101+
@property (nonatomic, assign) CachePolicy cachePolicy;
102+
103+
104+
- (instancetype)init UNAVAILABLE_ATTRIBUTE;
105+
106+
107+
//MARK: Configuring manually -
108+
/**---------------------------------------------------------------------------------------
109+
* @name Configuring manually
110+
* ---------------------------------------------------------------------------------------
111+
*/
112+
113+
/**
114+
Configure user properties with built object info.
115+
116+
//Obj-C
117+
[assetObj configureWithDictionary:@{@"key_name":@"MyValue"}];
118+
119+
//Swift
120+
assetObj.configureWithDictionary(["key_name":"MyValue"])
121+
122+
@param dictionary User Info
123+
*/
124+
- (void)configureWithDictionary:(NSDictionary*)dictionary;
125+
//MARK: - Fetch -
126+
/**---------------------------------------------------------------------------------------
127+
* @name Fetch
128+
* ---------------------------------------------------------------------------------------
129+
*/
130+
131+
/**
132+
Fetches an asset asynchronously provided asset UID
133+
134+
//Obj-C
135+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
136+
//'bltf4fsamplec857bk' is uid of an asset
137+
Assets* assetObj = [stack assetWithUID:@"bltf4fsamplec857bk"];
138+
[assetObj fetch:^(ResponseType type, NSError *error) {
139+
//error if exists then use 'error' object for details
140+
}];
141+
142+
143+
//Swift
144+
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
145+
//'bltf4fsamplec857bk' is uid of an asset
146+
var assetObj:Entry = contentTypeObj.entryWithUID("bltf4fsamplec857bk")
147+
assetObj.fetch { (responseType, error!) -> Void in
148+
//error if exists then use 'error' object for details
149+
}
150+
151+
@param callback Completion block with params NSError
152+
*/
153+
154+
- (void)fetch:(void(^)(ResponseType type, NSError * BUILT_NULLABLE_P error))callback;
155+
156+
@end
157+
BUILT_ASSUME_NONNULL_END
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// Config.h
3+
// contentstack
4+
//
5+
// Created by Priyanka Mistry on 01/06/16.
6+
// Copyright © 2016 Built.io. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface Config : NSObject
12+
13+
/**----------------------------------------------------------------------------------------
14+
* @name Properties
15+
*-----------------------------------------------------------------------------------------
16+
*/
17+
18+
//MARK: - Contentstack host
19+
/**
20+
Host name of Contentstack api server.
21+
22+
//Obj-C
23+
Config *config = [[Config alloc] init];
24+
config.host = @"api.contentstack.io";
25+
26+
//Swift
27+
var config:Config = Config()
28+
config.host = "api.contentstack.io"
29+
30+
*/
31+
@property (nonatomic, copy) NSString *host;
32+
33+
/**
34+
SSL state of Contentstack api server.
35+
36+
//Obj-C
37+
Config *config = [[Config alloc] init];
38+
config.isSSL = YES;
39+
40+
//Swift
41+
var config:Config = Config()
42+
config.isSSL = true
43+
44+
*/
45+
@property (nonatomic, assign) BOOL isSSL;
46+
47+
/**
48+
API version of Contentstack api server.
49+
50+
//Obj-C
51+
Config *config = [[Config alloc] init];
52+
NSString version = config.version;
53+
54+
//Swift
55+
var config:Config = Config()
56+
let version = config.version
57+
58+
*/
59+
@property (nonatomic, copy, readonly) NSString *version;
60+
61+
@end

SDK/Contentstack.framework/Headers/ContentType.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
@class Entry;
1313
@class Query;
14+
@class Assets;
1415

1516
BUILT_ASSUME_NONNULL_BEGIN
1617

SDK/Contentstack.framework/Headers/Contentstack.h

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
// Copyright (c) 2015 Built.io. All rights reserved.
77
//
88

9-
// sdk-version: 1.0.1
9+
// sdk-version: 3.0.0
1010

1111
#import <Foundation/Foundation.h>
12-
12+
#import <Contentstack/Config.h>
1313
#import <Contentstack/Stack.h>
1414
#import <Contentstack/ContentType.h>
1515
#import <Contentstack/Entry.h>
1616
#import <Contentstack/Query.h>
17+
#import <Contentstack/Assets.h>
18+
#import <Contentstack/AssetLibrary.h>
1719
#import <Contentstack/QueryResult.h>
1820

1921
@class Stack;
@@ -22,41 +24,51 @@ BUILT_ASSUME_NONNULL_BEGIN
2224

2325
@interface Contentstack : NSObject
2426

25-
- (instancetype)init UNAVAILABLE_ATTRIBUTE;
27+
/**----------------------------------------------------------------------------------------
28+
* @name Intialize Stack
29+
*-----------------------------------------------------------------------------------------
30+
*/
31+
2632
/**
27-
Create a new Stack instance with stack's apikey, token and environment name.
33+
Create a new Stack instance with stack's apikey, token, environment name and config.
2834
2935
//Obj-C
30-
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
36+
Config *config = [[Config alloc] init];
37+
config.host = @"customcontentstack.io";
38+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"prod" config:config];
3139
3240
//Swift
33-
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
41+
let config:Config = Config()
42+
config.host = "customcontentstack.io"
43+
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b",accessToken:"blt3esampletokeneb02", environmentName:@"prod", config:config)
3444
3545
@param apiKey stack apiKey.
36-
@param token acesstoken of stack.
46+
@param acesstoken stack acessToken.
3747
@param environmentName environment name in which to perform action.
48+
@param config config of stack.
3849
3950
@return new instance of Stack.
4051
*/
41-
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString*)token environmentName:(NSString*)environmentName;
52+
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString *)accessToken environmentName:(NSString*)environmentName config:(Config *)config;
4253

43-
/**
44-
Create a new Stack instance with stack's apikey, token and environment name.
4554

55+
/**
56+
Create a new Stack instance with stack's apikey, token and environment name.
57+
4658
//Obj-C
47-
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentUID:@"dummyUID"];
59+
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"prod"];
4860
4961
//Swift
50-
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentUID:@"dummyUID")
51-
62+
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"prod")
5263
53-
@param apiKey stack apiKey.
54-
@param token acesstoken of stack.
55-
@param environmentUID environment uid in which to perform action.
56-
57-
@return new instance of Stack.
64+
@param apiKey stack apiKey.
65+
@param token acesstoken of stack.
66+
@param environmentName environment name in which to perform action.
67+
68+
@return new instance of Stack.
5869
*/
59-
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString*)token environmentUID:(NSString*)environmentUID;
70+
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString*)token environmentName:(NSString*)environmentName;
71+
6072

6173
/**
6274
Cancel all network request for Stack instance.

SDK/Contentstack.framework/Headers/ContentstackDefinitions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
# define BUILT_ASSUME_NONNULL_END
5858
#endif
5959

60+
#if __has_include(<Realm/Realm.h>)
61+
# define REALM_INCLUDED
62+
#endif
63+
64+
6065
typedef NS_ENUM(NSUInteger, CachePolicy) {
6166
NETWORK_ONLY = 0,
6267
CACHE_ONLY,

0 commit comments

Comments
 (0)