Skip to content

Commit

Permalink
Updated to new version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Priyanka Mistry committed Nov 2, 2016
1 parent 81d3c57 commit a006c74
Show file tree
Hide file tree
Showing 14 changed files with 552 additions and 127 deletions.
2 changes: 1 addition & 1 deletion Contentstack.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Contentstack'
s.version = '1.0.1'
s.version = '3.0.0'
s.summary = 'Built.io Contentstack is a headless CMS with an API-first approach that puts content at the centre.'

s.description = <<-DESC
Expand Down
Binary file modified SDK/Contentstack.framework/Contentstack
Binary file not shown.
53 changes: 53 additions & 0 deletions SDK/Contentstack.framework/Headers/AssetLibrary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// AssetLibrary.h
// contentstack
//
// Created by Priyanka Mistry on 05/10/16.
// Copyright © 2016 Built.io. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ContentstackDefinitions.h"

BUILT_ASSUME_NONNULL_BEGIN

@interface AssetLibrary : NSObject

/**----------------------------------------------------------------------------------------
* @name Properties
*-----------------------------------------------------------------------------------------
*/

/**
* property to assign cache policy like CACHE_THEN_NETWORK, NETWORK_ELSE_CACHE, NETWORK_ONLY, etc.
*/
@property (nonatomic, assign) CachePolicy cachePolicy;

//MARK: Fetch Assets -
/**---------------------------------------------------------------------------------------
* @name Fetch Assets
* ---------------------------------------------------------------------------------------
*/

/**
This method provides all the assets.
//Obj-C
[assetLib fetchAll:^(ResponseType type, NSArray *result, NSError *error) {
//error for any error description
//result for reponse data
}];
//Swift
assetLib.fetchAll { (responseType, result!, error!) -> Void in
//error for any error description
//result for reponse data
}
@param completionBlock block to be called once operation is done. The result data contains all the assets.
*/

- (void)fetchAll:(void (^) (ResponseType type,NSArray * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error))completionBlock;
@end

BUILT_ASSUME_NONNULL_END
157 changes: 157 additions & 0 deletions SDK/Contentstack.framework/Headers/Assets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
//
// Assets.h
// contentstack
//
// Created by Priyanka Mistry on 19/05/16.
// Copyright © 2016 Built.io. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ContentstackDefinitions.h"

BUILT_ASSUME_NONNULL_BEGIN

@class ContentType;

@interface Assets : NSObject

/**----------------------------------------------------------------------------------------
* @name Properties
*-----------------------------------------------------------------------------------------
*/

/**
* Readonly property to check fileName of asset
*/
@property (nonatomic, copy, readonly) NSString *fileName;

/**
* Readonly property to check fileSize of asset
*/
@property (nonatomic, assign, readonly) unsigned int fileSize;

/**
* Readonly property to check type of asset
*/
@property (nonatomic, copy, readonly) NSString *assetType;

/**
* Readonly property to check ContentType name of asset
*/
@property (nonatomic, copy, readonly) ContentType *contentType;

/**
* Readonly property to check value of asset's uid
*/
@property (nonatomic, copy, readonly) NSString *uid;

/**
* Readonly property to check value of asset's url
*/
@property (nonatomic, copy, readonly) NSString *url;

/**
* Readonly property to check Language of asset
*/
@property (nonatomic, assign, readonly) Language language;

/**
* Readonly property to check tags of asset
*/
@property (nonatomic, copy, readonly) NSArray *tags;

/**
* Readonly property to check createAt of asset
*/
@property (nonatomic, copy, readonly) NSDate *createdAt;

/**
* Readonly property to check createdBy of asset
*/
@property (nonatomic, copy, readonly) NSString *createdBy;

/**
* Readonly property to check updatedAt of asset
*/
@property (nonatomic, copy, readonly) NSDate *updatedAt;

/**
* Readonly property to check updatedBy of asset
*/
@property (nonatomic, copy, readonly) NSString *updatedBy;

/**
* Readonly property to check deletedAt of asset
*/
@property (nonatomic, copy, readonly) NSDate *deletedAt;

/**
* Readonly property to check deletedBy of asset
*/
@property (nonatomic, copy, readonly) NSString *deletedBy;

/**
* Readonly property to check publish details of asset
*/
@property (nonatomic, copy, readonly) NSDictionary *publishDetails;

/**
* property to assign cache policy like CACHE_THEN_NETWORK, NETWORK_ELSE_CACHE, NETWORK_ONLY, etc.
*/
@property (nonatomic, assign) CachePolicy cachePolicy;


- (instancetype)init UNAVAILABLE_ATTRIBUTE;


//MARK: Configuring manually -
/**---------------------------------------------------------------------------------------
* @name Configuring manually
* ---------------------------------------------------------------------------------------
*/

/**
Configure user properties with built object info.
//Obj-C
[assetObj configureWithDictionary:@{@"key_name":@"MyValue"}];
//Swift
assetObj.configureWithDictionary(["key_name":"MyValue"])
@param dictionary User Info
*/
- (void)configureWithDictionary:(NSDictionary*)dictionary;
//MARK: - Fetch -
/**---------------------------------------------------------------------------------------
* @name Fetch
* ---------------------------------------------------------------------------------------
*/

/**
Fetches an asset asynchronously provided asset UID
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
//'bltf4fsamplec857bk' is uid of an asset
Assets* assetObj = [stack assetWithUID:@"bltf4fsamplec857bk"];
[assetObj 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")
//'bltf4fsamplec857bk' is uid of an asset
var assetObj:Entry = contentTypeObj.entryWithUID("bltf4fsamplec857bk")
assetObj.fetch { (responseType, error!) -> Void in
//error if exists then use 'error' object for details
}
@param callback Completion block with params NSError
*/

- (void)fetch:(void(^)(ResponseType type, NSError * BUILT_NULLABLE_P error))callback;

@end
BUILT_ASSUME_NONNULL_END
61 changes: 61 additions & 0 deletions SDK/Contentstack.framework/Headers/Config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// Config.h
// contentstack
//
// Created by Priyanka Mistry on 01/06/16.
// Copyright © 2016 Built.io. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Config : NSObject

/**----------------------------------------------------------------------------------------
* @name Properties
*-----------------------------------------------------------------------------------------
*/

//MARK: - Contentstack host
/**
Host name of Contentstack api server.
//Obj-C
Config *config = [[Config alloc] init];
config.host = @"api.contentstack.io";
//Swift
var config:Config = Config()
config.host = "api.contentstack.io"
*/
@property (nonatomic, copy) NSString *host;

/**
SSL state of Contentstack api server.
//Obj-C
Config *config = [[Config alloc] init];
config.isSSL = YES;
//Swift
var config:Config = Config()
config.isSSL = true
*/
@property (nonatomic, assign) BOOL isSSL;

/**
API version of Contentstack api server.
//Obj-C
Config *config = [[Config alloc] init];
NSString version = config.version;
//Swift
var config:Config = Config()
let version = config.version
*/
@property (nonatomic, copy, readonly) NSString *version;

@end
1 change: 1 addition & 0 deletions SDK/Contentstack.framework/Headers/ContentType.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@class Entry;
@class Query;
@class Assets;

BUILT_ASSUME_NONNULL_BEGIN

Expand Down
50 changes: 31 additions & 19 deletions SDK/Contentstack.framework/Headers/Contentstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
// Copyright (c) 2015 Built.io. All rights reserved.
//

// sdk-version: 1.0.1
// sdk-version: 3.0.0

#import <Foundation/Foundation.h>

#import <Contentstack/Config.h>
#import <Contentstack/Stack.h>
#import <Contentstack/ContentType.h>
#import <Contentstack/Entry.h>
#import <Contentstack/Query.h>
#import <Contentstack/Assets.h>
#import <Contentstack/AssetLibrary.h>
#import <Contentstack/QueryResult.h>

@class Stack;
Expand All @@ -22,41 +24,51 @@ BUILT_ASSUME_NONNULL_BEGIN

@interface Contentstack : NSObject

- (instancetype)init UNAVAILABLE_ATTRIBUTE;
/**----------------------------------------------------------------------------------------
* @name Intialize Stack
*-----------------------------------------------------------------------------------------
*/

/**
Create a new Stack instance with stack's apikey, token and environment name.
Create a new Stack instance with stack's apikey, token, environment name and config.
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
Config *config = [[Config alloc] init];
config.host = @"customcontentstack.io";
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"prod" config:config];
//Swift
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
let config:Config = Config()
config.host = "customcontentstack.io"
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b",accessToken:"blt3esampletokeneb02", environmentName:@"prod", config:config)
@param apiKey stack apiKey.
@param token acesstoken of stack.
@param acesstoken stack acessToken.
@param environmentName environment name in which to perform action.
@param config config of stack.
@return new instance of Stack.
*/
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString*)token environmentName:(NSString*)environmentName;
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString *)accessToken environmentName:(NSString*)environmentName config:(Config *)config;

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

/**
Create a new Stack instance with stack's apikey, token and environment name.
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentUID:@"dummyUID"];
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"prod"];
//Swift
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentUID:@"dummyUID")
let stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"prod")
@param apiKey stack apiKey.
@param token acesstoken of stack.
@param environmentUID environment uid in which to perform action.
@return new instance of Stack.
@param apiKey stack apiKey.
@param token acesstoken of stack.
@param environmentName environment name in which to perform action.
@return new instance of Stack.
*/
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString*)token environmentUID:(NSString*)environmentUID;
+ (Stack*)stackWithAPIKey:(NSString*)apiKey accessToken:(NSString*)token environmentName:(NSString*)environmentName;


/**
Cancel all network request for Stack instance.
Expand Down
5 changes: 5 additions & 0 deletions SDK/Contentstack.framework/Headers/ContentstackDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
# define BUILT_ASSUME_NONNULL_END
#endif

#if __has_include(<Realm/Realm.h>)
# define REALM_INCLUDED
#endif


typedef NS_ENUM(NSUInteger, CachePolicy) {
NETWORK_ONLY = 0,
CACHE_ONLY,
Expand Down
Loading

0 comments on commit a006c74

Please sign in to comment.