Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
2e03ef3
Update config.json
JigarKananiContentstack Sep 22, 2023
06298ad
Sync Test Failing
jigarkanani55 Sep 28, 2023
9868cf0
Async Support For Entry class
jigarkanani55 Oct 21, 2023
bb17ec1
Async Support For Query class
jigarkanani55 Oct 21, 2023
4a2e4e5
asyn-await All change
jigarkanani55 Oct 25, 2023
411438d
fix: improved async await implementation
Nov 27, 2023
cdb012d
feat: added async await changes and test cases for ct, entries and as…
Jan 3, 2024
818c3c0
fix: removed old async await code
Jan 8, 2024
561bd92
fix: fixed minor errors
Jan 8, 2024
6020306
feat: sync api enhancement and tests added
Jan 16, 2024
6c91d93
fix: removed sast-scan file
Jan 16, 2024
18d9138
fix: changed return type of the functions
Jan 19, 2024
e9c3b08
fix: minor fixes
Jan 21, 2024
483e0d1
fix: added callback based code back
Jan 22, 2024
3058417
fix: resolved conflicts
Jan 22, 2024
a525ed1
fix: added missing tests for callback based code
Jan 22, 2024
933c369
fix: added sync api code back
Jan 23, 2024
16111ab
fix: added sca-scan file
Jan 24, 2024
8fcdded
fix: fixed sca-scan file
Jan 24, 2024
d25160b
Update sca-scan.yml
aravindbuilt Jan 25, 2024
8b297da
fix: debug snyk command
Jan 25, 2024
ce9ee5f
fix: added debug command
Jan 25, 2024
c61f7f8
Update sca-scan.yml
aravindbuilt Jan 25, 2024
3a86324
Update sca-scan.yml
aravindbuilt Jan 25, 2024
8d2f4c2
Update sca-scan.yml
aravindbuilt Jan 25, 2024
6d0c2f5
fix: added a code coverage task
Feb 5, 2024
ddabdaa
Merge branch 'feat/support_async_await' of https://github.com/content…
Feb 5, 2024
ba06a4a
fix: minor fix
Feb 5, 2024
7059393
fix: minor fix
Feb 5, 2024
23d53c2
fix: minor fix
Feb 5, 2024
dd03e0a
WIP: seq_id implementation
abhinav-from-contentstack Feb 9, 2024
d7229c9
fix: removed print statements
abhinav-from-contentstack Feb 9, 2024
b049ef9
fix: added fix for seq_id and updated tests
abhinav-from-contentstack Feb 9, 2024
6702c00
fix: added lastSeqId parameter
abhinav-from-contentstack Feb 12, 2024
90bf61b
Merge branch 'master' into fix/CS-43854-sync-update
abhinav-from-contentstack Feb 12, 2024
1d0ed2d
fix: removed print statements
abhinav-from-contentstack Feb 12, 2024
b824744
fix: separated functions for init and seqInit
abhinav-from-contentstack Feb 13, 2024
914f8a4
Merge branch 'feat/support_async_await' into fix/CS-43854-sync-update
abhinav-from-contentstack Feb 14, 2024
8040320
fix: corrected function name and lastSeqId condition
abhinav-from-contentstack Feb 14, 2024
440b370
Merge pull request #28 from contentstack/fix/CS-43854-sync-update
abhinav-from-contentstack Feb 15, 2024
17d6605
Merge branch 'master' into feat/support_async_await
abhinav-from-contentstack Feb 15, 2024
2afb3a8
fix: minor changes for test files
Feb 15, 2024
e3395be
Merge branch 'feat/support_async_await' into fix/CS-44009-workflow-fix
abhinav-from-contentstack Feb 16, 2024
18a2fd0
Merge branch 'next' into fix/CS-44009-workflow-fix
abhinav-from-contentstack Feb 16, 2024
3cdddac
fix: updated ci workflow
abhinav-from-contentstack Feb 19, 2024
74fcef7
fix: changed deployment target to 12.0
abhinav-from-contentstack Feb 20, 2024
e917239
WIP: added an update
abhinav-from-contentstack Feb 21, 2024
5291dea
updated talismanrc
abhinav-from-contentstack Feb 21, 2024
c164e5e
WIP: fixed tests
abhinav-from-contentstack Feb 21, 2024
c37f71c
WIP: updated tests and config
abhinav-from-contentstack Feb 21, 2024
d08c37e
WIP: updated tests and config
abhinav-from-contentstack Feb 21, 2024
ee886ea
WIP: updated config
abhinav-from-contentstack Feb 21, 2024
3700cce
WIP: updated config
abhinav-from-contentstack Feb 21, 2024
59d875a
fix: updated test
abhinav-from-contentstack Feb 22, 2024
2c620f5
fix: updated test
abhinav-from-contentstack Feb 22, 2024
77142a2
fix: updated tests
abhinav-from-contentstack Feb 22, 2024
a161ba3
fix: updated tests
abhinav-from-contentstack Feb 22, 2024
55a9035
fix: updated tests
abhinav-from-contentstack Feb 22, 2024
5cf3259
fix: updated tests
abhinav-from-contentstack Feb 22, 2024
cf0bb44
fix: added verbose flag to workflow
abhinav-from-contentstack Feb 22, 2024
e5febd0
WIP: tests
abhinav-from-contentstack Feb 27, 2024
a8a7d7e
WIP: tests
abhinav-from-contentstack Feb 27, 2024
26d3284
WIP: tests
abhinav-from-contentstack Feb 27, 2024
aaa6094
WIP: tests
abhinav-from-contentstack Feb 27, 2024
fcbabb0
WIP: tests
abhinav-from-contentstack Feb 27, 2024
6d1f975
WIP: tests
abhinav-from-contentstack Feb 27, 2024
972c0d7
WIP: commented tests that were failing on workflow
abhinav-from-contentstack Feb 27, 2024
825c887
fix: updated licence
abhinav-from-contentstack Feb 27, 2024
fa59329
Merge pull request #30 from contentstack/fix/CS-44009-workflow-fix
abhinav-from-contentstack Feb 27, 2024
d875df8
feat: added support for taxonomy
Jun 4, 2024
21ca6b2
fix: resolved conflicts
Jun 19, 2024
bc349c4
fix: reverted async implementation
Jun 20, 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "Contentstack CI"

on:
push:
branches: [ master, development ]
branches: [ master, next ]
pull_request:
branches: [ master ]
branches: [ master, next ]

jobs:
macOS:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sca-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- name: Run Snyk to check for vulnerabilities
run: snyk test --all-projects --fail-on=all
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@ fastlane/screenshots/**/*.png
fastlane/test_output

TestCase
docs
docs

fastlane/
Gemfile
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>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "2.2">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<AutocreatedTestPlanReference>
</AutocreatedTestPlanReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ContentstackTests"
BuildableName = "ContentstackTests"
BlueprintName = "ContentstackTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ContentstackTests"
BuildableName = "ContentstackTests"
BlueprintName = "ContentstackTests"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
5 changes: 5 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ fileignoreconfig:
checksum: a1c17f932d0b00df127851f50456923546ee912ba9b4d60d1f244768d61b858d
- filename: Tests/DVRRecordings/SyncTest.json
checksum: e5148d9f58da7689f249969c25a0c36d6d9f26be062a2c6bd9aaf389118f0039
- filename: Contentstack.xcodeproj/xcshareddata/xcschemes/Contentstack iOS.xcscheme
checksum: 10ca4b0b986ae6166f69d7f985ca5b06238ac70dac3dd378fbf3dbdfd966afff
- filename: Contentstack.xcodeproj/xcshareddata/xcschemes/Contentstack iOS Tests.xcscheme
checksum: c439f6d268ae2ea0af023daeffdff2af5928d0610f90fa14c9e6e6ce7e4b3fad
version: ""



Expand Down
291 changes: 173 additions & 118 deletions Contentstack.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0F4A75D2241BAC4300E3A024"
BuildableName = "Contentstack iOS Tests.xctest"
BlueprintName = "Contentstack iOS Tests"
ReferencedContainer = "container:Contentstack.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
consoleMode = "0"
structuredConsoleMode = "1">
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
</LocationScenarioReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import PackageDescription

let package = Package(
name: "ContentstackSwift",
platforms: [.macOS(.v10_13),
.iOS(.v11),
.tvOS(.v11),
.watchOS(.v4)],
platforms: [.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6)],

products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
Expand Down
9 changes: 9 additions & 0 deletions Sources/ContentstackResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ where ItemType: EndpointAccessible & Decodable {
}
self.items = [entry]
}
case .taxnomies:
if let taxonomies = try container.decodeIfPresent([ItemType].self, forKey: .entries) {
let containerFields = try decoder.container(keyedBy: JSONCodingKeys.self)
let response = try containerFields.decode(Dictionary<String, Any>.self)
if let contentType = response["content_type"] as? ContentTypeModel {
fields = ["content_type": contentType]
}
self.items = taxonomies
}
default:
print("sync")
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/EndPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public enum Endpoint: String {
case assets
/// The synchronization endpoint.
case sync = "stacks/sync"

case taxnomies = "taxonomies"
/// The path component string for the current endpoint.
public var pathComponent: String {
return rawValue
Expand Down
17 changes: 11 additions & 6 deletions Sources/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Query: BaseQuery, EntryQueryable {

public typealias ResourceType = EntryModel

internal var contentTypeUid: String
internal var contentTypeUid: String?
/// Stack instance for Entry to be fetched
public var stack: Stack
/// URI Parameters
Expand All @@ -23,11 +23,16 @@ public class Query: BaseQuery, EntryQueryable {
public var cachePolicy: CachePolicy


internal required init(contentType: ContentType) {
self.stack = contentType.stack
self.contentTypeUid = contentType.uid!
self.cachePolicy = contentType.cachePolicy
self.parameters[QueryParameter.contentType] = contentTypeUid
internal required init(contentType: ContentType?, stack: Stack? = nil, cachePolicy: CachePolicy? = nil) {
if let contentType = contentType {
self.stack = contentType.stack
self.contentTypeUid = contentType.uid!
self.cachePolicy = contentType.cachePolicy
self.parameters[QueryParameter.contentType] = contentTypeUid
} else {
self.stack = stack!
self.cachePolicy = cachePolicy!
}
}

/// Use this method to do a search on `Entries` which enables
Expand Down
12 changes: 12 additions & 0 deletions Sources/QueryOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ extension Query {
case exists(Bool)
/// Search on a field by Regex. <https://www.contentstack.com/docs/developers/apis/content-delivery-api/#search-by-regex>
case matches(String)
case eqBelow(String)
case below(String)
case eqAbove(String)
case above(String)

internal var string: String {
switch self {
Expand All @@ -98,6 +102,10 @@ extension Query {
case .isGreaterThanOrEqual: return "$gte"
case .exists: return "$exists"
case .matches: return "$regex"
case .eqBelow: return "$eq_below"
case .below: return "$below"
case .eqAbove: return "$eq_above"
case .above: return "$above"
}
}

Expand Down Expand Up @@ -137,6 +145,10 @@ extension Query {
return value.stringValue
case .exists(let value): return value
case .matches(let value): return value
case .eqBelow(let value): return value
case .below(let value): return value
case .eqAbove(let value): return value
case .above(let value): return value
}
}
internal var query: Any {
Expand Down
2 changes: 2 additions & 0 deletions Sources/QueryParameter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ internal enum QueryParameter {
internal static let tags = "tags"

internal static let contentType = "content_type"

internal static let taxonomies = "taxonomies"

internal static let uid = "uid"

Expand Down
17 changes: 9 additions & 8 deletions Sources/QueryProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,20 @@ extension BaseQuery {
/// }
/// }
/// ```
///
public func find<ResourceType>(_ completion: @escaping ResultsHandler<ContentstackResponse<ResourceType>>)
where ResourceType: Decodable & EndpointAccessible {
if self.queryParameter.count > 0,
let query = self.queryParameter.jsonString {
self.parameters[QueryParameter.query] = query
}
self.stack.fetch(endpoint: ResourceType.endpoint,
cachePolicy: self.cachePolicy, parameters: parameters, headers: headers, then: completion)
where ResourceType: Decodable & EndpointAccessible {
if self.queryParameter.count > 0,
let query = self.queryParameter.jsonString {
self.parameters[QueryParameter.query] = query
}
self.stack.fetch(endpoint: ResourceType.endpoint,
cachePolicy: self.cachePolicy, parameters: parameters, headers: headers, then: completion)
}
}
/// A concrete implementation of BaseQuery which serves as the base class for `Query`,
/// `ContentTypeQuery` and `AssetQuery`.
public protocol BaseQuery: QueryProtocol, Queryable {}
public protocol BaseQuery: QueryProtocol {}
extension BaseQuery {
/// Method to adding Query.Operation to a Query/
/// - Parameters:
Expand Down
Loading