Skip to content

Commit

Permalink
[Auto Generated] 0.1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
jigardafda committed Mar 29, 2022
1 parent 8abc816 commit 8bddc5b
Show file tree
Hide file tree
Showing 118 changed files with 367,530 additions and 370,928 deletions.
2 changes: 2 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# disabled rules
--disable redundantSelf,trailingCommas,hoistPatternLet,modifierorder
9 changes: 7 additions & 2 deletions FDKClient.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Pod::Spec.new do |s|
s.name = 'FDKClient'
s.version = '0.1.3'
s.version = '0.1.15'
s.summary = 'FDK Client SDK for Swift language'

s.description = 'FDK Client SDK for Swift language that can be used to make Apps or extensions.'
Expand All @@ -23,7 +23,7 @@ Pod::Spec.new do |s|

s.subspec 'Common' do |subspec|
subspec.source_files = 'Sources/code/common/**/*'
subspec.dependency 'Alamofire', '= 5.0.2'
subspec.dependency 'Alamofire', '= 5.4.4'
end

s.subspec 'Application' do |subspec|
Expand All @@ -35,4 +35,9 @@ Pod::Spec.new do |s|
subspec.source_files = 'Sources/code/platform/**/*'
subspec.dependency 'FDKClient/Common'
end

s.subspec 'Public' do |subspec|
subspec.source_files = 'Sources/code/public/**/*'
subspec.dependency 'FDKClient/Common'
end
end
25 changes: 25 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"object": {
"pins": [
{
"package": "Alamofire",
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
"state": {
"branch": null,
"revision": "d120af1e8638c7da36c8481fd61a66c0c08dc4fc",
"version": "5.4.4"
}
},
{
"package": "CryptoSwift",
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git",
"state": {
"branch": null,
"revision": "5669f222e46c8134fb1f399c745fa6882b43532e",
"version": "1.3.8"
}
}
]
},
"version": 1
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
.library(name: "FDKClient", targets: ["FDKClient"]),
],
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", .branch("master")),
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMinor(from: "5.4.4")),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.3.8")),
],
targets: [
Expand Down
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ Get started with the Swift Development SDK for Fynd Platform
3. Add `import FDKClient`
4. Start integrating

### Sample Usage - PublicClient

```swift
let config = PublicConfig()
let publicClient = PublicClient(config: config)
publicClient.webhook.fetchAllWebhookEvents() { (webhookEvents, error) in
if let webhookEvents = webhookEvents {
print(webhookEvents.debugDescription)
} else if let error = error {
print(error.message)
}
}
```

### Sample Usage - ApplicationClient

```swift
Expand All @@ -34,11 +48,11 @@ applicationClient.catalog.getProductDetailBySlug(slug: "product-slug") { (produc
### Sample Usage - PlatformClient

```swift
guard let config = PlatformConfig(companyId: "COMPANY_ID",
apiKey: "API_KEY",
apiSecret: "API_SECRET",
domain: "DOMAIN") {
return
guard let config = PlatformConfig(
companyId: "COMPANY_ID",
apiKey: "API_KEY",
apiSecret: "API_SECRET") {
return
}
let platformClient = PlatformClient(config: config)
platformClient.catalog.getCompanyDetail { (response, error) in
Expand Down
29 changes: 19 additions & 10 deletions Sources/code/application/ApplicationAPIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ class ApplicationAPIClient {
extraHeaders: [(key: String, value: String)] = [],
body: [String: Any]?,
responseType: String = "application/json",
onResponse: @escaping OnResponse) {
onResponse: @escaping OnResponse)
{
var headers = [
(key: "Authorization", value: "Bearer " + "\(config.applicationId):\(config.applicationToken)".asBase64)
]
headers.append((key: "x-fp-sdk-version", value: "0.1.15"))
headers.append(contentsOf: extraHeaders)
headers.append(contentsOf: config.extraHeaders)
if let userAgent = config.userAgent {
headers.append((key: "User-Agent", value: userAgent))
}
headers.append(contentsOf: extraHeaders)
AlmofireHelper.request(config.domain.appendAsPath(url),
query: query,
parameters: body,
type: method,
headers: headers,
responseType: responseType,
onResponse: onResponse)
if let language = config.language {
headers.append((key: "Accept-Language", value: language))
}
if let currency = config.currency {
headers.append((key: "x-currency-code", value: currency))
}
AlmofireHelper.request(url,
query: query,
parameters: body,
type: method,
headers: headers,
responseType: responseType,
onResponse: onResponse)
}
}
}
Loading

0 comments on commit 8bddc5b

Please sign in to comment.