Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/workflows/sca-scan.yml

This file was deleted.

16 changes: 12 additions & 4 deletions Contentstack.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
23A53F501E277BBE001DBE35 /* NSObject+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 23A53F331E276BA5001DBE35 /* NSObject+Extensions.m */; };
23A53F5A1E277CD3001DBE35 /* Contentstack.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 230B38C01C16E98B00444A14 /* Contentstack.framework */; };
23B6F12A1B5662EE00A9E983 /* ISO8601DateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B6F1281B5662EE00A9E983 /* ISO8601DateFormatter.m */; };
4714B7D42C5EAFCC004E941E /* Taxonomy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4714B7D32C5EAFCC004E941E /* Taxonomy.m */; };
479EC6642C5FCBDC00C5630B /* Taxonomy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4714B7D52C5EAFF5004E941E /* Taxonomy.h */; settings = {ATTRIBUTES = (Public, ); }; };
565E11BB1BD76654005AD47F /* MMDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 565E11AA1BD76654005AD47F /* MMDocument.m */; };
565E11BC1BD76654005AD47F /* MMElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 565E11AD1BD76654005AD47F /* MMElement.m */; };
565E11BD1BD76654005AD47F /* MMGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 565E11AF1BD76654005AD47F /* MMGenerator.m */; };
Expand Down Expand Up @@ -207,6 +209,8 @@
23B6F1281B5662EE00A9E983 /* ISO8601DateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISO8601DateFormatter.m; sourceTree = "<group>"; };
23C545FB1C1976FE007BBD27 /* ios-build-framework-script.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "ios-build-framework-script.sh"; sourceTree = "<group>"; };
3CF581B9F7526EDA48ED5C6F /* Pods-ContentstackTest.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContentstackTest.debug.xcconfig"; path = "Target Support Files/Pods-ContentstackTest/Pods-ContentstackTest.debug.xcconfig"; sourceTree = "<group>"; };
4714B7D32C5EAFCC004E941E /* Taxonomy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Taxonomy.m; sourceTree = "<group>"; };
4714B7D52C5EAFF5004E941E /* Taxonomy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Taxonomy.h; sourceTree = "<group>"; };
565E11A91BD76654005AD47F /* MMDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMDocument.h; sourceTree = "<group>"; };
565E11AA1BD76654005AD47F /* MMDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMDocument.m; sourceTree = "<group>"; };
565E11AB1BD76654005AD47F /* MMDocument_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMDocument_Private.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -315,6 +319,8 @@
0FD6BAEE29CD6E73001A0930 /* CSURLSessionDelegate.h */,
0F9C0FAF221ADAC90091205A /* ThirdPartyNamespaceHeader */,
230B38C41C16E98B00444A14 /* Info.plist */,
4714B7D32C5EAFCC004E941E /* Taxonomy.m */,
4714B7D52C5EAFF5004E941E /* Taxonomy.h */,
);
path = Contentstack;
sourceTree = "<group>";
Expand Down Expand Up @@ -492,6 +498,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
479EC6642C5FCBDC00C5630B /* Taxonomy.h in Headers */,
0F9C0FC8221ADAC90091205A /* NamespacedDependencies.h in Headers */,
23A53F3C1E276C83001DBE35 /* CSIOAPIURLs.h in Headers */,
23A53F3E1E276C83001DBE35 /* CSIOCoreHTTPNetworking.h in Headers */,
Expand Down Expand Up @@ -769,6 +776,7 @@
230B38EA1C16EB4400444A14 /* MMScanner.m in Sources */,
230B38E81C16EB4400444A14 /* MMMarkdown.m in Sources */,
230B38E91C16EB4400444A14 /* MMParser.m in Sources */,
4714B7D42C5EAFCC004E941E /* Taxonomy.m in Sources */,
230B38E51C16EB4400444A14 /* MMElement.m in Sources */,
230B39021C16EB8F00444A14 /* ISO8601DateFormatter.m in Sources */,
230B38E61C16EB4400444A14 /* MMGenerator.m in Sources */,
Expand Down Expand Up @@ -839,7 +847,7 @@
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ThirdPartyExtension",
"$(PROJECT_DIR)/ThirdPartyExtension/**",
);
GCC_PREFIX_HEADER = ./Contentstack/ThirdPartyNamespaceHeader/NamespacedDependencies.h;
INFOPLIST_FILE = Contentstack/Info.plist;
Expand Down Expand Up @@ -868,7 +876,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ThirdPartyExtension",
"$(PROJECT_DIR)/ThirdPartyExtension/**",
);
GCC_PREFIX_HEADER = ./Contentstack/ThirdPartyNamespaceHeader/NamespacedDependencies.h;
INFOPLIST_FILE = Contentstack/Info.plist;
Expand Down Expand Up @@ -917,7 +925,7 @@
23A0F86A1B3801D1003334E9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ALWAYS_SEARCH_USER_PATHS = YES;
BITCODE_GENERATION_MODE = marker;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -972,7 +980,7 @@
23A0F86B1B3801D1003334E9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ALWAYS_SEARCH_USER_PATHS = YES;
BITCODE_GENERATION_MODE = bitcode;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "230B38BF1C16E98B00444A14"
BuildableName = "Contentstack.framework"
BlueprintName = "Contentstack"
ReferencedContainer = "container:Contentstack.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,20 +48,9 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "230B38BF1C16E98B00444A14"
BuildableName = "Contentstack.framework"
BlueprintName = "Contentstack"
ReferencedContainer = "container:Contentstack.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand All @@ -70,11 +68,9 @@
ReferencedContainer = "container:Contentstack.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
Expand All @@ -93,7 +89,7 @@
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
1 change: 1 addition & 0 deletions Contentstack/Contentstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import <Contentstack/Config.h>
#import <Contentstack/Stack.h>
#import <Contentstack/ContentType.h>
#import <Contentstack/Taxonomy.h>
#import <Contentstack/Entry.h>
#import <Contentstack/Query.h>
#import <Contentstack/Asset.h>
Expand Down
13 changes: 13 additions & 0 deletions Contentstack/Entry.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ - (instancetype)initWithContentType:(ContentType*)contentType withEntryUID:(NSSt
return self;
}

- (instancetype)initWithTaxonomy:(Taxonomy *)taxonomy {
if (self = [super init]) {
_taxonomy = taxonomy;
_localHeaders = [NSMutableDictionary dictionary];
_objectProperties = [NSMutableDictionary dictionary];
_postParamDictionary = [NSMutableDictionary dictionary];
}
return self;
}

-(void)setLanguage:(Language)language {
_language = language;
[self setLocale:[self localeCode:language]];
Expand All @@ -63,6 +73,9 @@ - (instancetype)initWithContentType:(ContentType*)contentType {
return [self initWithContentType:contentType withEntryUID:nil];
}

//- (instancetype)initWithTaxonomy:(Taxonomy*)taxonomy {
// return [self initWithTaxonomy:taxonomy];
//}
//MARK: - Headers -

- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey {
Expand Down
5 changes: 5 additions & 0 deletions Contentstack/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ This method provides all the entries for the specified language in the response.
*/
- (void)search:(NSString *)searchString;

- (void)query:(NSDictionary *)queryString;

//MARK: - Tags -
/**---------------------------------------------------------------------------------------
* @name Tags
Expand Down Expand Up @@ -759,6 +761,9 @@ This method provides all the entries from a specified contenttype.
*/
- (void)find:(void (^) (ResponseType type,QueryResult * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error))completionBlock;


- (void)findTaxonomy:(void (^) (ResponseType type,QueryResult * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error))completionBlock;

/**
This method provides the first entry from a specified contenttype.

Expand Down
45 changes: 45 additions & 0 deletions Contentstack/Query.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "CSIOAPIURLs.h"
#import "QueryResult.h"
#import "ContentType.h"
#import "Taxonomy.h"
#import "CSIOInternalHeaders.h"
#import "NSObject+Extensions.h"

Expand Down Expand Up @@ -39,6 +40,16 @@ - (instancetype)initWithContentType:(ContentType*)contentType {
return self;
}

- (instancetype)initWithTaxonomy:(Taxonomy*)taxonomy {
if (self = [super init]) {
_taxonomy = taxonomy;
_localHeaders = [NSMutableDictionary dictionary];
_queryDictionary = [NSMutableDictionary dictionary];
_requestOperationSet = [NSMutableSet set];
}
return self;
}

//MARK: - Headers

- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey {
Expand Down Expand Up @@ -84,6 +95,11 @@ - (void)tags:(NSArray*)tagsArray {
[self.queryDictionary setObject:[tagsArray componentsJoinedByString:@","] forKey:kCSIO_Tags];
}

//MARK: - Query -
- (void)query:(NSDictionary *)query {
[self.queryDictionary setObject:query forKey:kCSIO_Queryable];
}

////MARK: - Before/After UID -
//- (void)beforeUID:(NSString *)uid {
// [self.queryDictionary setObject:uid forKey:kCSIO_BeforeUID];
Expand Down Expand Up @@ -501,6 +517,35 @@ - (void)find:(void (^) (ResponseType type,QueryResult * BUILT_NULLABLE_P result,
}
}

//MARK: Execute Query -

- (void)findTaxonomy:(void (^) (ResponseType type,QueryResult * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error))completionBlock {

[self.queryDictionary setObject:self.taxonomy.stack.environment forKey:kCSIO_Environment];

NSMutableDictionary *paramDictionary = [NSMutableDictionary dictionaryWithDictionary:self.queryDictionary];

NSMutableDictionary *headers = [NSMutableDictionary dictionaryWithDictionary:self.taxonomy.headers];

[headers addEntriesFromDictionary:self.localHeaders];

NSString *path = [CSIOAPIURLs fetchTaxonomyWithVersion:self.taxonomy.stack.version];

NSURLSessionDataTask *op = [self.taxonomy.stack.network requestForStack:self.taxonomy.stack withURLPath:path requestType:CSIOCoreNetworkingRequestTypeGET params:paramDictionary additionalHeaders:headers cachePolicy:self.cachePolicy completion:^(ResponseType responseType, id responseJSON, NSError *error) {

if (error) {
completionBlock(responseType, nil, error);
}else {
QueryResult *queryResult = [[QueryResult alloc] initWithTaxonomy:self.taxonomy objectDictionary:responseJSON];

completionBlock(responseType, queryResult, nil);
}
}];
if (op && ![op isKindOfClass:[NSNull class]]) {
[self.requestOperationSet addObject:op];
}
}

- (void)findOne:(void (^) (ResponseType type,Entry * BUILT_NULLABLE_P entry,NSError * BUILT_NULLABLE_P error))completionBlock {
[self.queryDictionary setObject:@(1) forKey:kCSIO_Limit];

Expand Down
4 changes: 4 additions & 0 deletions Contentstack/QueryResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
BUILT_ASSUME_NONNULL_BEGIN

@class ContentType;
@class Taxonomy;
@class Entry;
@interface QueryResult : NSObject


- (instancetype)init UNAVAILABLE_ATTRIBUTE;

//- (BUILT_NULLABLE NSArray<Entry *> *)getResult;
- (instancetype)initWithTaxonomy:(Taxonomy*)taxonomy objectDictionary:(NSDictionary*)dictionary;

//MARK: Result -
/**---------------------------------------------------------------------------------------
* @name Result
Expand Down
20 changes: 19 additions & 1 deletion Contentstack/QueryResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "CSIOInternalHeaders.h"
#import "CSIOConstants.h"
#import "ContentType.h"
#import "Taxonomy.h"
#import "Entry.h"

@interface QueryResult ()
Expand All @@ -30,6 +31,17 @@ - (instancetype)initWithContentType:(ContentType*)contentType objectDictionary:(
return self;
}

- (instancetype)initWithTaxonomy:(Taxonomy*)taxonomy objectDictionary:(NSDictionary*)dictionary{
if (self = [super init]) {
self.taxonomy = taxonomy;
self.resultsDictionary = [NSMutableDictionary dictionary];
if (dictionary) {
[self.resultsDictionary addEntriesFromDictionary:dictionary];
}
}
return self;
}

- (NSInteger)totalCount {

if ([self.resultsDictionary objectForKey:kCSIO_Count]) {
Expand All @@ -55,7 +67,13 @@ - (NSInteger)totalCount {
NSArray *objectsArray = (NSArray*)[self.resultsDictionary objectForKey:kCSIO_Entries];
NSMutableArray *entryObjects = [NSMutableArray array];
// if condition is fix for value of "entries" key ie.array inside array in response JSON
if (objectsArray.firstObject && [objectsArray.firstObject isKindOfClass:[NSArray class]]) {
if (objectsArray.firstObject && [objectsArray.firstObject isKindOfClass:[NSDictionary class]]) {
[objectsArray enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) {
Entry *formEntry = [self.taxonomy entry];
[formEntry configureWithDictionary:obj];
[entryObjects addObject:formEntry];
}];
} else if (objectsArray.firstObject && [objectsArray.firstObject isKindOfClass:[NSArray class]]) {
[objectsArray enumerateObjectsUsingBlock:^(NSArray *obj, NSUInteger idx, BOOL * _Nonnull stop) {
[obj enumerateObjectsUsingBlock:^(NSDictionary *objDict, NSUInteger idx, BOOL * _Nonnull stop) {
Entry *formEntry = [self.contentType entry];
Expand Down
3 changes: 3 additions & 0 deletions Contentstack/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@class Config;
@class ContentType;
@class Taxonomy;
@class AssetLibrary;
@class Asset;
@class SyncStack;
Expand Down Expand Up @@ -65,6 +66,8 @@ BUILT_ASSUME_NONNULL_BEGIN
*/
- (ContentType *)contentTypeWithName:(NSString *)contentTypeName;

- (Taxonomy *)taxonomy;

//MARK: - Manually set headers
/**---------------------------------------------------------------------------------------
* @name Manually set headers
Expand Down
7 changes: 7 additions & 0 deletions Contentstack/Stack.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "CSIOConstants.h"
#import "CSIOCoreHTTPNetworking.h"
#import "ContentType.h"
#import "Taxonomy.h"
#import "CSIOAPIURLs.h"
#import "NSObject+Extensions.h"

Expand Down Expand Up @@ -86,6 +87,12 @@ -(ContentType*)contentTypeWithName:(NSString*)contentTypeName; {
return contentType;
}

//MARK: - Taxonomy
-(Taxonomy*)taxonomy {
Taxonomy *taxonomy = [[Taxonomy alloc] initWithStack:self];
return taxonomy;
}

//MARK: - Asset

-(Asset *)asset {
Expand Down
Loading