Skip to content

Commit

Permalink
Updated to 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Priyanka Mistry authored and Priyanka Mistry committed Dec 16, 2016
1 parent a006c74 commit 3c4c121
Show file tree
Hide file tree
Showing 19 changed files with 881 additions and 170 deletions.
Binary file added .DS_Store
Binary file not shown.
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 = '3.0.0'
s.version = '3.1.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 added SDK/.DS_Store
Binary file not shown.
Binary file modified SDK/Contentstack.framework/Contentstack
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Assets.h
// Asset.h
// contentstack
//
// Created by Priyanka Mistry on 19/05/16.
Expand All @@ -13,7 +13,7 @@ BUILT_ASSUME_NONNULL_BEGIN

@class ContentType;

@interface Assets : NSObject
@interface Asset : NSObject

/**----------------------------------------------------------------------------------------
* @name Properties
Expand All @@ -33,12 +33,7 @@ BUILT_ASSUME_NONNULL_BEGIN
/**
* 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;
@property (nonatomic, copy, readonly) NSString *fileType;

/**
* Readonly property to check value of asset's uid
Expand All @@ -50,11 +45,6 @@ BUILT_ASSUME_NONNULL_BEGIN
*/
@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
*/
Expand Down Expand Up @@ -122,6 +112,72 @@ BUILT_ASSUME_NONNULL_BEGIN
@param dictionary User Info
*/
- (void)configureWithDictionary:(NSDictionary*)dictionary;

//MARK: Manually set headers -
/**---------------------------------------------------------------------------------------
* @name Manually set headers
* ---------------------------------------------------------------------------------------
*/

/**
Set a header for Asset
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
Asset *asset = [stack asset];
[asset setHeader:@"MyValue" forKey:@"My-Custom-Header"];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
var asset:Asset = stack.asset()
asset.setHeader("MyValue", forKey: "My-Custom-Header")
@param headerValue The header key
@param headerKey The header value
*/
- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey;

/**
Set a header for Asset
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
Asset *asset = [stack asset];
[asset addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
var asset:Asset = stack.asset()
asset.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
@param headers The headers as dictionary which needs to be added to the application
*/
- (void)addHeadersWithDictionary:(NSDictionary *)headers;

/**
Removes a header from this Asset
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
Asset *asset = [stack asset];
[asset removeHeaderForKey:@"My-Custom-Header"];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
var asset:Asset = stack.asset()
asset.removeHeaderForKey("My-Custom-Header")
@param headerKey The header key that needs to be removed
*/
- (void)removeHeaderForKey:(NSString *)headerKey;

//MARK: - Fetch -
/**---------------------------------------------------------------------------------------
* @name Fetch
Expand All @@ -134,16 +190,15 @@ BUILT_ASSUME_NONNULL_BEGIN
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
//'bltf4fsamplec857bk' is uid of an asset
Assets* assetObj = [stack assetWithUID:@"bltf4fsamplec857bk"];
Asset* 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")
var assetObj:Asset = stack.assetWithUID("bltf4fsamplec857bk")
assetObj.fetch { (responseType, error!) -> Void in
//error if exists then use 'error' object for details
}
Expand Down
155 changes: 144 additions & 11 deletions SDK/Contentstack.framework/Headers/AssetLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

BUILT_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, OrderBy) {
OrderByAscending = 0,
OrderByDescending
};

@interface AssetLibrary : NSObject

/**----------------------------------------------------------------------------------------
Expand All @@ -23,6 +28,134 @@ BUILT_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, assign) CachePolicy cachePolicy;

//MARK: - Sorting
/**---------------------------------------------------------------------------------------
* @name Sorting
* ---------------------------------------------------------------------------------------
*/

/**
Sorts the assets in the given order on the basis of the specified field.
//Obj-C
[assetLib sortWithKey:@"updated_at" orderBy:Ascending];
//Swift
assetLib.sortWithKey("updated_at" orderBy:Ascending)
@param key field uid based on which the ordering should be done.
@param order ascending or descending order in which results should come.
*/
- (void)sortWithKey:(NSString *)key orderBy:(OrderBy)order;

//MARK: Include -
/**---------------------------------------------------------------------------------------
* @name Include
* ---------------------------------------------------------------------------------------
*/

/**
Provides only the number of assets.
//Obj-C
[assetLib objectsCount];
//Swift
assetLib.objectsCount()
*/
- (void)objectsCount;


/**
This method also includes the total number of assets returned in the response.
//Obj-C
[assetLib includeCount];
//Swift
assetLib.includeCount()
*/
- (void)includeCount;

/**
This method includes the relative url of assets.
//Obj-C
[assetLib includeRelativeUrls];
//Swift
assetLib.includeRelativeUrls()
*/
- (void)includeRelativeUrls;

//MARK: Manually set headers -
/**---------------------------------------------------------------------------------------
* @name Manually set headers
* ---------------------------------------------------------------------------------------
*/

/**
Set a header for AssetLibrary
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
AssetLibrary *assetLib = [stack assetLibrary];
[assetLib setHeader:@"MyValue" forKey:@"My-Custom-Header"];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
var assetLib:AssetLibrary = stack.assetLibrary()
assetLib.setHeader("MyValue", forKey: "My-Custom-Header")
@param headerValue The header key
@param headerKey The header value
*/
- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey;

/**
Set a header for AssetLibrary
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
AssetLibrary *assetLib = [stack assetLibrary];
[assetLib addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
var assetLib:AssetLibrary = stack.assetLibrary()
assetLib.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
@param headers The headers as dictionary which needs to be added to the application
*/
- (void)addHeadersWithDictionary:(NSDictionary *)headers;

/**
Removes a header from this AssetLibrary.
//'blt5d4sample2633b' is a dummy Stack API key
//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"blt5d4sample2633b" accessToken:@"blt3esampletokeneb02" environmentName:@"dummy"];
AssetLibrary *assetLib = [stack assetLibrary];
[assetLib removeHeaderForKey:@"My-Custom-Header"];
//Swift
var stack:Stack = Contentstack.stackWithAPIKey("blt5d4sample2633b", accessToken:"blt3esampletokeneb02", environmentName:@"dummy")
var assetLib:AssetLibrary = stack.assetLibrary()
assetLib.removeHeaderForKey("My-Custom-Header")
@param headerKey The header key that needs to be removed
*/
- (void)removeHeaderForKey:(NSString *)headerKey;

//MARK: Fetch Assets -
/**---------------------------------------------------------------------------------------
* @name Fetch Assets
Expand All @@ -32,17 +165,17 @@ BUILT_ASSUME_NONNULL_BEGIN
/**
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
}
//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.
*/
Expand Down
10 changes: 5 additions & 5 deletions SDK/Contentstack.framework/Headers/ContentType.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

BUILT_ASSUME_NONNULL_BEGIN

Expand All @@ -28,11 +28,11 @@ BUILT_ASSUME_NONNULL_BEGIN
/**
Set a header for ContentType
//Obj-C
[contentTypeObj setHeader:@"MyValue" forKey:@"My-Custom-Header"];
//Obj-C
[contentTypeObj setHeader:@"MyValue" forKey:@"My-Custom-Header"];
//Swift
contentTypeObj.setHeader("MyValue", forKey: "My-Custom-Header")
//Swift
contentTypeObj.setHeader("MyValue", forKey: "My-Custom-Header")
@param headerValue The header key
@param headerKey The header value
Expand Down
3 changes: 2 additions & 1 deletion SDK/Contentstack.framework/Headers/Contentstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#import <Contentstack/ContentType.h>
#import <Contentstack/Entry.h>
#import <Contentstack/Query.h>
#import <Contentstack/Assets.h>
#import <Contentstack/Asset.h>
#import <Contentstack/AssetLibrary.h>
#import <Contentstack/QueryResult.h>
#import <Contentstack/Group.h>

@class Stack;

Expand Down
3 changes: 2 additions & 1 deletion SDK/Contentstack.framework/Headers/ContentstackIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#import <Contentstack/Query.h>
#import <Contentstack/QueryResult.h>
#import <ContentStack/Config.h>
#import <Contentstack/Assets.h>
#import <Contentstack/Asset.h>
#import <Contentstack/AssetLibrary.h>
#import <Contentstack/Group.h>

#endif /* ContentstackIO_h */
Loading

0 comments on commit 3c4c121

Please sign in to comment.