Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Staging to Master #50

Merged
merged 48 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a9f24d5
Update License year in License and Readme
uttamukkoji Feb 1, 2024
fe07b55
feat: added gcp_na region
abhinav-from-contentstack May 13, 2024
a8877eb
fix: updated package version
abhinav-from-contentstack May 14, 2024
51cf937
fix: failing workflow
abhinav-from-contentstack May 17, 2024
cd04902
Merge branch 'master' into fix/dx-563-1
abhinav-from-contentstack May 17, 2024
9e739b4
fix: failing workflow
abhinav-from-contentstack May 17, 2024
5e70a5f
fix: updated workflow
abhinav-from-contentstack May 17, 2024
dc7ba07
feat: added variants implementation
dudeman9801 Jun 28, 2024
43e1a90
Update Contentstack.podspec
abhinav-from-contentstack Aug 23, 2024
aa9d87b
Merge branch 'master' into feat/dx-747
sunil-lakshman Sep 2, 2024
34c5d1f
WIP: fixing build issues
abhinav-from-contentstack Sep 4, 2024
d9b556d
Merge branch 'master' into feat/dx-747
abhinav-from-contentstack Sep 4, 2024
6a804cc
fix: entry parsing issue
Sep 4, 2024
9d2e014
Merge remote-tracking branch 'origin/feat/DX-200_clone' into feat/DX-…
Sep 4, 2024
3c59315
WIP: fixing tests
abhinav-from-contentstack Sep 10, 2024
ffa2558
Merge branch 'feat/dx-747' of github.com:contentstack/contentstack-io…
abhinav-from-contentstack Sep 10, 2024
1cd9cf0
Merge branch 'feat/DX-200_clone' into feat/dx-747
abhinav-from-contentstack Sep 10, 2024
a699de9
fix: updated tests
abhinav-from-contentstack Sep 13, 2024
79a17cc
fix: removed test testcase
abhinav-from-contentstack Sep 13, 2024
4b76a7e
fix: changed some test cases
Sep 15, 2024
9df890c
Merge branch 'master' into feat/DX-200_clone
netrajpatel Sep 23, 2024
ded6a46
Merge pull request #44 from contentstack/fix/retry-on-error
netrajpatel Sep 23, 2024
7b6e08d
Merge branch 'development' into feat/dx-85-gcp-support
Sep 23, 2024
d99d254
Merge pull request #45 from contentstack/feat/dx-85-gcp-support
netrajpatel Sep 23, 2024
dd0e0c1
testing for workflow
reeshika-h Sep 23, 2024
7d6df88
feat: added support for taxonomy
Aug 3, 2024
ae2510c
fix: updated tests to work with JS SDK test stack
abhinav-from-contentstack May 23, 2024
85ad2b5
Delete .github/workflows/sca-scan.yml
aravindbuilt Jun 10, 2024
0c120da
feat: added taxonomy initial support
Aug 6, 2024
9da1d8a
Update Contentstack.podspec
abhinav-from-contentstack Aug 23, 2024
f1bc273
Update License year in License and Readme
uttamukkoji Feb 1, 2024
90961a2
Merge pull request #46 from contentstack/fix/dx-563-1
netrajpatel Sep 23, 2024
ef8122f
Merge branch 'development' into feat/dx-747
Sep 23, 2024
3483bd3
merge changes reverted in project.pbxproj file
reeshika-h Sep 23, 2024
215cb44
fix: fixed test not running issue
Sep 23, 2024
c8055f6
Merge pull request #47 from contentstack/feat/dx-747
netrajpatel Sep 24, 2024
2468901
Merge branch 'development' into feat/DX-200_clone
Sep 24, 2024
e9ca094
Merge pull request #42 from contentstack/feat/DX-200_clone
netrajpatel Sep 24, 2024
430e601
Merge pull request #49 from contentstack/development
netrajpatel Sep 26, 2024
4108f6d
Updated Github workflow and updated the PR's base branch check to sta…
Sep 27, 2024
e9bc305
Merge pull request #51 from contentstack/fix/workflow
netrajpatel Sep 27, 2024
826ef14
Merge pull request #52 from contentstack/development
netrajpatel Sep 27, 2024
734b8b4
feat: early access header support added
reeshika-h Sep 30, 2024
94fc027
Merge pull request #53 from contentstack/feat/DX-1228-Early-access-su…
reeshika-h Oct 1, 2024
6da14e7
feat: added where method to fetch assets
reeshika-h Oct 1, 2024
34c1823
Added testcases for where method
reeshika-h Oct 1, 2024
636e6a0
Merge pull request #54 from contentstack/feat/DX-1222-Fetch-asset-by-…
reeshika-h Oct 3, 2024
d144454
Merge pull request #55 from contentstack/development
reeshika-h Oct 3, 2024
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
12 changes: 6 additions & 6 deletions .github/workflows/check-branch.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Check Branch'
name: "Check Branch"

on:
pull_request:
Expand All @@ -8,13 +8,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Comment PR
if: github.base_ref == 'master' && github.head_ref != 'next'
if: github.base_ref == 'master' && github.head_ref != 'staging'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
- name: Check branch
if: github.base_ref == 'master' && github.head_ref != 'next'
if: github.base_ref == 'master' && github.head_ref != 'staging'
run: |
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
exit 1
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
exit 1
2 changes: 1 addition & 1 deletion .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Build
run: |
# Add commands to build and test your package
xcodebuild -workspace Contentstack.xcworkspace -scheme 'Contentstack' -destination 'platform=iOS Simulator,name=iPhone 13 Pro'
xcodebuild -workspace Contentstack.xcworkspace -scheme 'Contentstack' -destination 'platform=iOS Simulator,name=iPhone 15'

- name: CocoaPods trunk push
run: pod trunk push --allow-warnings
Expand Down
8 changes: 6 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
fileignoreconfig:
- filename: Contentstack.xcodeproj/project.pbxproj
checksum: 331c4ff2e540e9495ff2a0d030ddd7f7c2eda077cb0b1a58c67fc2312b53658e
version: ""
checksum: 10cb4bc5ca755f7392309a88cd6df510a45f8c527ea2f8edc71e1ae1fda60941
- filename: .github/workflows/sast-scan.yml
checksum: 5554abc81d130557f52d64d253c3a23b41fcf0642a9c599131b2c185665ce581
- filename: PrivacyInfo.xcprivacy
checksum: 7697fa6a0a5e0600d35d4678ffff9ef14c5dff5dc1613d37968de7ded3ff1fd0
version: ""
2 changes: 1 addition & 1 deletion Contentstack.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ s.version = '3.13.0'
s.summary = 'Contentstack is a headless CMS with an API-first approach that puts content at the centre.'

s.description = <<-DESC
Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content.
Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content.
In a world where content is consumed via countless channels and form factors across mobile, web and IoT. Contentstack reimagines content management by decoupling code from content. Business users manage content – no training or development required. Developers can create cross-platform apps and take advantage of a headless CMS that delivers content through APIs. With an architecture that’s extensible – but without the bloat of legacy CMS – Contentstack cuts down on infrastructure, maintenance, cost and complexity.
DESC

Expand Down
206 changes: 147 additions & 59 deletions Contentstack.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1540"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Contentstack/Asset.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

BUILT_ASSUME_NONNULL_BEGIN

Expand Down
20 changes: 19 additions & 1 deletion Contentstack/AssetLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

BUILT_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -230,6 +230,24 @@ typedef NS_ENUM(NSUInteger, OrderBy) {
*/

- (void)fetchAll:(void (^) (ResponseType type,NSArray<Asset *> * BUILT_NULLABLE_P result,NSError * BUILT_NULLABLE_P error))completionBlock;

/**
This method fetches assets using other fields than UID..

//Obj-C
[assetLib where:(NSString *)field equalTo:(NSObject *)value];

//Swift
assetLib.where("fieldName","value");

This allows filtering assets by specifying the field name and the value to match.
@param field The name of the field to filter by.
@param value The value that the field should match.
*/
- (void)where:(NSString *)field equalTo:(NSObject *)value ;

- (NSDictionary*)getPostParamDictionary;

@end

BUILT_ASSUME_NONNULL_END
19 changes: 19 additions & 0 deletions Contentstack/AssetLibrary.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ - (void)cancelRequest {
[self.requestOperation cancel];
}
}
// MARK: - Where Query -
- (NSDictionary*) getPostParamDictionary {
return [self.postParamDictionary copy];
}

- (void)where:(NSString *)field equalTo:(NSObject *)value {
if (field.length == 0 || !value) {
NSLog(@"Field or value cannot be empty");
return;
}
NSMutableDictionary *queryDict = [NSMutableDictionary dictionary];
NSDictionary *existingQuery = self.postParamDictionary[@"query"];
// If an existing query exists, merge it
if (existingQuery) {
[queryDict addEntriesFromDictionary:existingQuery];
}
queryDict[field] = value;
[self.postParamDictionary setObject:queryDict forKey:@"query"];
}


@end
27 changes: 25 additions & 2 deletions Contentstack/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//

#import <Foundation/Foundation.h>
#import "ContentstackDefinitions.h"
#import "CSURLSessionDelegate.h"
#import <Contentstack/ContentstackDefinitions.h>
#import <Contentstack/CSURLSessionDelegate.h>
@interface Config : NSObject

/**----------------------------------------------------------------------------------------
Expand Down Expand Up @@ -88,4 +88,27 @@
*/
@property (nullable, retain) id<CSURLSessionDelegate> delegate;



/**
Early access features

//Obj-C
Config *config = [[Config alloc] init];
[config setEarlyAccess:@[@"Taxonomy", @"Teams", @"Terms", @"LivePreview"]];

//Swift
let config = Config()
config.setEarlyAccess(["Taxonomy", "Teams", "Terms", "LivePreview"])

*/
@property (nonatomic, strong, nullable) NSArray<NSString *> *setEarlyAccess;


/**
Set early access features

@param setearlyAccess An array of early access feature names
*/
- (NSDictionary<NSString *, NSString *> *)earlyAccessHeaders;
@end
10 changes: 9 additions & 1 deletion Contentstack/Config.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ -(instancetype)init {
if (self) {
_region = US;
_host = @"cdn.contentstack.io";
_version = kCSIO_ApiVersion;
_version = kCSIO_ApiVersion;
_setEarlyAccess = nil;
}
return self;
}
Expand All @@ -25,4 +26,11 @@ - (void)setRegion:(ContentstackRegion)region {
_host = [self hostURL:_region];
}
}
- (NSDictionary<NSString *, NSString *> *)earlyAccessHeaders {
if (_setEarlyAccess.count > 0) {
NSString *earlyAccessString = [_setEarlyAccess componentsJoinedByString:@","];
return @{@"x-header-ea": earlyAccessString};
}
return @{};
}
@end
2 changes: 1 addition & 1 deletion Contentstack/ContentType.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

@class Entry;
@class Query;
Expand Down
36 changes: 35 additions & 1 deletion Contentstack/Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

@class Asset;
@class Group;
Expand Down Expand Up @@ -87,6 +87,10 @@ BUILT_ASSUME_NONNULL_BEGIN
* Readonly property to check deletedBy of entry
*/
@property (nonatomic, copy, readonly) NSString *deletedBy;
/**
* Readonly property to check deletedBy of entry
*/
@property (nonatomic, copy, readonly) NSMutableDictionary *localHeaders;


/**
Expand Down Expand Up @@ -124,6 +128,36 @@ BUILT_ASSUME_NONNULL_BEGIN
*/
- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey;

/**
Set a single variant uid as header

//'API_KEY' is a ENVIRONMENT Stack API key

//Obj-C
[entryObj variantUid:@"variantUid"];

//Swift
entryObj.variantUid("variantUid")

@param variantUid The variant uid
*/
- (void)variantUid:(NSString *)variantUid;

/**
Set multiple variant uids as header

//'API_KEY' is a ENVIRONMENT Stack API key

//Obj-C
[entryObj variantUids:@["variant1", "variant2"]];

//Swift
entryObj.setHeader(["variant1", "variant2"])

@param variantUids The variant uids
*/
- (void)variantUids:(NSArray *)variantUids;

/**
Set a header for Entry

Expand Down
11 changes: 11 additions & 0 deletions Contentstack/Entry.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ - (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey {
[self.localHeaders setObject:headerValue forKey:headerKey];
}

- (void)variantUid:(NSString *)variantUid {
NSString *key = @"x-cs-variant-uid";
[self.localHeaders setObject:variantUid forKey: key];
}

- (void)variantUids:(NSArray *)variantUids {
NSString *key = @"x-cs-variant-uid";
NSString *joinedString = [variantUids componentsJoinedByString:@","];
[self.localHeaders setObject:joinedString forKey: key];
}

- (void)addHeadersWithDictionary:(NSDictionary<NSString *, NSString *> *)headers {
[headers enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[self.localHeaders setObject:obj forKey:key];
Expand Down
2 changes: 1 addition & 1 deletion Contentstack/Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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


@class Asset;
Expand Down
2 changes: 1 addition & 1 deletion Contentstack/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

@class QueryResult;
@class Entry;
Expand Down
2 changes: 1 addition & 1 deletion Contentstack/QueryResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

BUILT_ASSUME_NONNULL_BEGIN

Expand Down
5 changes: 4 additions & 1 deletion Contentstack/QueryResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ - (NSInteger)totalCount {
// if condition is fix for value of "entries" key ie.array inside array in response JSON
if (objectsArray.firstObject && [objectsArray.firstObject isKindOfClass:[NSDictionary class]]) {
[objectsArray enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) {
Entry *formEntry = [self.taxonomy entry];
Entry *formEntry = [self.contentType entry];
if (formEntry == NULL) {
formEntry = [self.taxonomy entry];
}
[formEntry configureWithDictionary:obj];
[entryObjects addObject:formEntry];
}];
Expand Down
4 changes: 3 additions & 1 deletion Contentstack/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

@class Config;
@class ContentType;
Expand Down Expand Up @@ -68,6 +68,8 @@ BUILT_ASSUME_NONNULL_BEGIN

- (Taxonomy *)taxonomy;

- (NSDictionary *)getHeaders;

//MARK: - Manually set headers
/**---------------------------------------------------------------------------------------
* @name Manually set headers
Expand Down
9 changes: 9 additions & 0 deletions Contentstack/Stack.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ - (instancetype)initWithAPIKey:(NSString*)apiKey andaccessToken:(NSString *)acce
_commonDateFormatter.includeTime = YES;

_requestOperationSet = [NSMutableSet set];
// Add early access headers only if they exist
NSDictionary *earlyAccessHeaders = [_config earlyAccessHeaders];
if (earlyAccessHeaders.count > 0) {
[_stackHeaders addEntriesFromDictionary:earlyAccessHeaders];
}


[self setHeader:_apiKey forKey:kCSIO_SiteApiKey];
Expand Down Expand Up @@ -128,6 +133,10 @@ - (void)removeHeaderForKey:(NSString *)headerKey {
}
}

- (NSDictionary *)getHeaders {
return [self.stackHeaders copy];
}

- (NSString *)imageTransformWithUrl:(NSString *)url andParams:(NSDictionary<NSString *, id> *)params{
if([url rangeOfString:@"?" options:NSCaseInsensitiveSearch].length==0) {
url = [url stringByAppendingString:@"?"];
Expand Down
2 changes: 1 addition & 1 deletion Contentstack/Taxonomy.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

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

@class Query;

Expand Down
Loading
Loading