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.

19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
### Version: 3.15.0
#### Date: Jun-16-2025

##### Enhancement:
- Added support for Global Fields

### Version: 3.14.0
#### Date: Oct-04-2024

##### Enhancement:
- Early access header support
- Fetch asset by query

### Version: 3.13.0
#### Date: Aug-23-2024

##### Enhancement:
- Added support for Taxonomy

### Version: 3.12.3
#### Date: May-16-2023

Expand Down
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.14.0'
s.version = '3.15.0'
s.summary = 'Contentstack is a headless CMS with an API-first approach that puts content at the centre.'

s.description = <<-DESC
Expand Down
12 changes: 12 additions & 0 deletions Contentstack.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
64B3EA282BF7C4AF009E0F38 /* libThirdPartyExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 238E841B1B4FE29A00BFDB32 /* libThirdPartyExtension.a */; };
64F5220E2BF5C76E00AE6E0F /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 64F5220D2BF5C76E00AE6E0F /* PrivacyInfo.xcprivacy */; };
64F5220F2BF5C76E00AE6E0F /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 64F5220D2BF5C76E00AE6E0F /* PrivacyInfo.xcprivacy */; };
678803D22DED82A100E4AA75 /* GlobalField.h in Headers */ = {isa = PBXBuildFile; fileRef = 678803D12DED829800E4AA75 /* GlobalField.h */; };
678803D42DED82AF00E4AA75 /* GlobalField.m in Sources */ = {isa = PBXBuildFile; fileRef = 678803D32DED82AC00E4AA75 /* GlobalField.m */; };
678803D62DEDB24800E4AA75 /* GlobalFieldTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 678803D52DEDB23800E4AA75 /* GlobalFieldTest.m */; };
E653FF942F28495541E9B22B /* libPods-Contentstack.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4514C6AB47DF26BA926C681A /* libPods-Contentstack.a */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -244,6 +247,9 @@
606DDA20A6F0593F40494FED /* Pods-ContentstackTest.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContentstackTest.release.xcconfig"; path = "Target Support Files/Pods-ContentstackTest/Pods-ContentstackTest.release.xcconfig"; sourceTree = "<group>"; };
609D1D72B25D2FBE4E26FA70 /* 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>"; };
64F5220D2BF5C76E00AE6E0F /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
678803D12DED829800E4AA75 /* GlobalField.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GlobalField.h; sourceTree = "<group>"; };
678803D32DED82AC00E4AA75 /* GlobalField.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GlobalField.m; sourceTree = "<group>"; };
678803D52DEDB23800E4AA75 /* GlobalFieldTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GlobalFieldTest.m; sourceTree = "<group>"; };
7EB1C6B5FF6A451CEB50B3A4 /* libPods-ContentstackTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ContentstackTest.a"; sourceTree = BUILT_PRODUCTS_DIR; };
8B7BE798B2EEFA3CC2763E3F /* Pods-Contentstack.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Contentstack.release.xcconfig"; path = "Target Support Files/Pods-Contentstack/Pods-Contentstack.release.xcconfig"; sourceTree = "<group>"; };
9980728A1E1BDC5000524FD3 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
Expand Down Expand Up @@ -306,6 +312,8 @@
230B38C11C16E98B00444A14 /* Contentstack */ = {
isa = PBXGroup;
children = (
678803D12DED829800E4AA75 /* GlobalField.h */,
678803D32DED82AC00E4AA75 /* GlobalField.m */,
0F9C0FA4221ADAC80091205A /* Asset.h */,
0F9C0FA3221ADAC80091205A /* Asset.m */,
0F9C0F98221ADAC70091205A /* AssetLibrary.h */,
Expand Down Expand Up @@ -432,6 +440,7 @@
children = (
0F41A91025C7CC9C007EF2DA /* ContentstackTest.m */,
0F41A91125C7CC9C007EF2DA /* SyncTest.m */,
678803D52DEDB23800E4AA75 /* GlobalFieldTest.m */,
23A53F591E277CD3001DBE35 /* Info.plist */,
473AFDAF2CA22233002D331D /* config.json */,
);
Expand Down Expand Up @@ -534,6 +543,7 @@
230B39011C16EB8D00444A14 /* ISO8601DateFormatter.h in Headers */,
23A53F401E276C83001DBE35 /* CSIOInternalHeaders.h in Headers */,
0F9C0FB1221ADAC90091205A /* AssetLibrary.h in Headers */,
678803D22DED82A100E4AA75 /* GlobalField.h in Headers */,
0FD6BAEF29CD6E73001A0930 /* CSURLSessionDelegate.h in Headers */,
0F9C0FB6221ADAC90091205A /* Config.h in Headers */,
0F9C0FC2221ADAC90091205A /* Query.h in Headers */,
Expand Down Expand Up @@ -777,6 +787,7 @@
230B38FA1C16EB8000444A14 /* MMGenerator.h in Sources */,
0FEAEF2B2361A18600985FF9 /* CSURLSessionManager.m in Sources */,
230B38FB1C16EB8000444A14 /* MMHTMLParser.h in Sources */,
678803D42DED82AF00E4AA75 /* GlobalField.m in Sources */,
230B38FC1C16EB8000444A14 /* MMMarkdown-Prefix.pch in Sources */,
0F9C0FC4221ADAC90091205A /* Config.m in Sources */,
230B38FD1C16EB8000444A14 /* MMMarkdown.h in Sources */,
Expand Down Expand Up @@ -825,6 +836,7 @@
files = (
0F41A91425C7CC9C007EF2DA /* ContentstackTest.m in Sources */,
0F41A91525C7CC9C007EF2DA /* SyncTest.m in Sources */,
678803D62DEDB24800E4AA75 /* GlobalFieldTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
210 changes: 210 additions & 0 deletions Contentstack/GlobalField.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
//
// GlobalField.h
// Contentstack
//
// Created by Reeshika Hosmani on 02/06/25.
// Copyright © 2025 Contentstack. All rights reserved.
//

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


BUILT_ASSUME_NONNULL_BEGIN

@interface GlobalField : NSObject

- (instancetype)init UNAVAILABLE_ATTRIBUTE;
//- (instancetype)initWithStack:(Stack*)stack;
//- (instancetype)initWithStack:(Stack*)stack withName:(NSString*)globalFieldName;

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

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

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

/**
* Readonly property to check description
*/
@property (nonatomic, copy, readonly) NSString *Description;

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

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

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

/**
* Readonly property to check the branch
*/
@property (nonatomic, copy, readonly) NSString *branch;

/**
* Readonly property to get schema of global field
*/
@property (nonatomic, copy, readonly) NSArray<NSDictionary *> *schema;

/**
* Readonly property to check if global field is inbuilt class
*/
@property (nonatomic, assign, readonly) BOOL inbuiltClass;

/**
* Readonly property to check if global field maintains revisions
*/
@property (nonatomic, assign, readonly) BOOL maintainRevisions;

/**
* Readonly property to get last activity of global field
*/
@property (nonatomic, copy, readonly) NSDictionary *lastActivity;

/**
* Readonly property to get all properties of global field
*/
@property (nonatomic, copy, readonly) NSDictionary<NSString *, id> *properties;

/**
* property to assign cache policy like CACHE_THEN_NETWORK, NETWORK_ELSE_CACHE, NETWORK_ONLY, etc.
*/
@property (nonatomic, assign) CachePolicy cachePolicy;
//MARK: - Manually set headers
/**---------------------------------------------------------------------------------------
* @name Manually set headers
* ---------------------------------------------------------------------------------------
*/

/**
Set a header for GlobalField.

//Obj-C
[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
*/
- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey;
/**
Set a header for GlobalField.

//Obj-C
[contentTypeObj addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];

//Swift
contentTypeObj.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])


@param headers The headers as dictionary which needs to be added to the application
*/
- (void)addHeadersWithDictionary:(NSDictionary<NSString *, NSString *> *)headers;
/**
Removes a header from this GlobalField.

//Obj-C
[contentTypeObj removeHeaderForKey:@"My-Custom-Header"];

//Swift
contentTypeObj.removeHeaderForKey("My-Custom-Header")

@param headerKey The header key that needs to be removed
*/
- (void)removeHeaderForKey:(NSString *)headerKey;

/**
Retrieve the branch of the globalField.

//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
GlobalField *globalField = [stack GlobalField];
[globalField includeBranch];

//Swift
var stack:Stack = Contentstack.stackWithAPIKey("API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var globalField:Asset = stack.GlobalField()
globalField.includeBranch()

*/
-(void)includeBranch;

/**
Retrieve the schema of globalField.

//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
GlobalField *globalField = [stack GlobalField];
[globalField includeGlobalFieldSchema];

//Swift
var stack:Stack = Contentstack.stackWithAPIKey("API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var globalField:Asset = stack.GlobalField()
globalField.includeGlobalFieldSchema()

*/
-(void)includeGlobalFieldSchema;


/**
Fetches an asset asynchronously provided asset UID

//Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
//'ASSET_UID' is uid of an asset
Asset* assetObj = [stack assetWithUID:@"ASSET_UID"];
[assetObj fetch:^(ResponseType type, NSError *error) {
//error if exists then use 'error' object for details
}];

//Swift
var stack:Stack = Contentstack.stackWithAPIKey("API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
//'ASSET_UID' is uid of an asset
var assetObj:Asset = stack.assetWithUID("ASSET_UID")
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;

/**
This method provides all the GlobalFields present in the stack.

//Obj-C
[globalField fetchAll:^(ResponseType type,NSArray<GlobalField *> * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error {
//error for any error description
//result for reponse data
}];

//Swift
globalField.fetchAll { (type, 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 globalFields.
*/
- (void)fetchAll:(void (^) (ResponseType type,NSArray<GlobalField *> * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error))completionBlock;
@end

BUILT_ASSUME_NONNULL_END
Loading