Skip to content

Commit da51e56

Browse files
author
Pranay Sowdaboina
committed
5.1.0 release.
1 parent ac12087 commit da51e56

File tree

22 files changed

+12233
-6832
lines changed

22 files changed

+12233
-6832
lines changed

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "https://github.com/Alamofire/Alamofire.git" ~> 4.7.3
1+
github "https://github.com/Alamofire/Alamofire.git" ~> 4.8.2

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "Alamofire/Alamofire" "4.7.3"
1+
github "Alamofire/Alamofire" "4.8.2"

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import PackageDescription
77
let package = Package(
88
name: "SwiftyDropbox",
99
dependencies: [
10-
.Package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMinor(from: "4.7.3")),
10+
.Package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMinor(from: "4.8.2")),
1111
]
1212
)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ To install the Dropbox Swift SDK via Carthage, you need to create a `Cartfile` i
121121

122122
```
123123
# SwiftyDropbox
124-
github "https://github.com/dropbox/SwiftyDropbox" ~> 5.0.0
124+
github "https://github.com/dropbox/SwiftyDropbox" ~> 5.1.0
125125
```
126126

127127
Then, run the following command to install the dependency to checkout and build the Dropbox Swift SDK repository:

Source/SwiftyDropbox/Platform/SwiftyDropbox_iOS/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>5.0.0</string>
18+
<string>5.1.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

Source/SwiftyDropbox/Platform/SwiftyDropbox_macOS/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>5.0.0</string>
18+
<string>5.1.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSHumanReadableCopyright</key>

Source/SwiftyDropbox/Shared/Generated/Auth.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ open class Auth {
7373
case userSuspended
7474
/// The access token has expired.
7575
case expiredAccessToken
76+
/// The access token does not have the required scope to access the route.
77+
case missingScope(Auth.TokenScopeError)
7678
/// An unspecified error.
7779
case other
7880

@@ -104,6 +106,10 @@ open class Auth {
104106
var d = [String: JSON]()
105107
d[".tag"] = .str("expired_access_token")
106108
return .dictionary(d)
109+
case .missingScope(let arg):
110+
var d = Serialization.getFields(Auth.TokenScopeErrorSerializer().serialize(arg))
111+
d[".tag"] = .str("missing_scope")
112+
return .dictionary(d)
107113
case .other:
108114
var d = [String: JSON]()
109115
d[".tag"] = .str("other")
@@ -125,6 +131,9 @@ open class Auth {
125131
return AuthError.userSuspended
126132
case "expired_access_token":
127133
return AuthError.expiredAccessToken
134+
case "missing_scope":
135+
let v = Auth.TokenScopeErrorSerializer().deserialize(json)
136+
return AuthError.missingScope(v)
128137
case "other":
129138
return AuthError.other
130139
default:
@@ -444,6 +453,37 @@ open class Auth {
444453
}
445454
}
446455

456+
/// The TokenScopeError struct
457+
open class TokenScopeError: CustomStringConvertible {
458+
/// The required scope to access the route.
459+
public let requiredScope: String
460+
public init(requiredScope: String) {
461+
stringValidator()(requiredScope)
462+
self.requiredScope = requiredScope
463+
}
464+
open var description: String {
465+
return "\(SerializeUtil.prepareJSONForSerialization(TokenScopeErrorSerializer().serialize(self)))"
466+
}
467+
}
468+
open class TokenScopeErrorSerializer: JSONSerializer {
469+
public init() { }
470+
open func serialize(_ value: TokenScopeError) -> JSON {
471+
let output = [
472+
"required_scope": Serialization._StringSerializer.serialize(value.requiredScope),
473+
]
474+
return .dictionary(output)
475+
}
476+
open func deserialize(_ json: JSON) -> TokenScopeError {
477+
switch json {
478+
case .dictionary(let dict):
479+
let requiredScope = Serialization._StringSerializer.deserialize(dict["required_scope"] ?? .null)
480+
return TokenScopeError(requiredScope: requiredScope)
481+
default:
482+
fatalError("Type error deserializing")
483+
}
484+
}
485+
}
486+
447487

448488
/// Stone Route Objects
449489

0 commit comments

Comments
 (0)