Skip to content

Commit 29a89af

Browse files
author
Qiming Yuan
committed
4.4.0 release.
1 parent 03bfc1c commit 29a89af

File tree

14 files changed

+13511
-4447
lines changed

14 files changed

+13511
-4447
lines changed

README.md

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

133133
```
134134
# SwiftyDropbox
135-
github "https://github.com/dropbox/SwiftyDropbox" ~> 4.3.0
135+
github "https://github.com/dropbox/SwiftyDropbox" ~> 4.4.0
136136
```
137137

138138
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>4.3.0</string>
18+
<string>4.4.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>4.3.0</string>
18+
<string>4.4.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSHumanReadableCopyright</key>

Source/SwiftyDropbox/Shared/Generated/Common.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ open class Common {
126126

127127
/// Information about current user's root.
128128
open class RootInfo: CustomStringConvertible {
129-
/// The namespace id for user's root namespace. It will be the namespace id of the shared team root if the user
130-
/// is member of a CDM team. Otherwise it will be same as homeNamespaceId in RootInfo.
129+
/// The namespace ID for user's root namespace. It will be the namespace ID of the shared team root if the user
130+
/// is member of a team with a separate team root. Otherwise it will be same as homeNamespaceId in RootInfo.
131131
open let rootNamespaceId: String
132-
/// The namespace id for user's home namespace.
132+
/// The namespace ID for user's home namespace.
133133
open let homeNamespaceId: String
134134
public init(rootNamespaceId: String, homeNamespaceId: String) {
135135
stringValidator(pattern: "[-_0-9a-zA-Z:]+")(rootNamespaceId)
@@ -183,7 +183,7 @@ open class Common {
183183
}
184184
}
185185

186-
/// Root info when user is member of a CDM team.
186+
/// Root info when user is member of a team with a separate root namespace ID.
187187
open class TeamRootInfo: Common.RootInfo {
188188
/// The path for user's home directory under the shared team root.
189189
open let homePath: String
@@ -219,7 +219,8 @@ open class Common {
219219
}
220220
}
221221

222-
/// Root info when user is not member of a CDM team.
222+
/// Root info when user is not member of a team or the user is a member of a team and the team does not have a
223+
/// separate root namespace.
223224
open class UserRootInfo: Common.RootInfo {
224225
open override var description: String {
225226
return "\(SerializeUtil.prepareJSONForSerialization(UserRootInfoSerializer().serialize(self)))"

Source/SwiftyDropbox/Shared/Generated/FileRequests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ open class FileRequests {
381381
open class FileRequestDeadline: CustomStringConvertible {
382382
/// The deadline for this file request.
383383
open let deadline: Date
384-
/// If set, allow uploads after the deadline has passed. These uploads will be marked overdue.
384+
/// If set, allow uploads after the deadline has passed. These uploads will be marked overdue.
385385
open let allowLateUploads: FileRequests.GracePeriod?
386386
public init(deadline: Date, allowLateUploads: FileRequests.GracePeriod? = nil) {
387387
self.deadline = deadline

Source/SwiftyDropbox/Shared/Generated/Files.swift

Lines changed: 148 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,127 @@ open class Files {
10611061
}
10621062
}
10631063

1064+
/// The DownloadZipArg struct
1065+
open class DownloadZipArg: CustomStringConvertible {
1066+
/// The path of the folder to download.
1067+
open let path: String
1068+
public init(path: String) {
1069+
stringValidator(pattern: "(/(.|[\\r\\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)")(path)
1070+
self.path = path
1071+
}
1072+
open var description: String {
1073+
return "\(SerializeUtil.prepareJSONForSerialization(DownloadZipArgSerializer().serialize(self)))"
1074+
}
1075+
}
1076+
open class DownloadZipArgSerializer: JSONSerializer {
1077+
public init() { }
1078+
open func serialize(_ value: DownloadZipArg) -> JSON {
1079+
let output = [
1080+
"path": Serialization._StringSerializer.serialize(value.path),
1081+
]
1082+
return .dictionary(output)
1083+
}
1084+
open func deserialize(_ json: JSON) -> DownloadZipArg {
1085+
switch json {
1086+
case .dictionary(let dict):
1087+
let path = Serialization._StringSerializer.deserialize(dict["path"] ?? .null)
1088+
return DownloadZipArg(path: path)
1089+
default:
1090+
fatalError("Type error deserializing")
1091+
}
1092+
}
1093+
}
1094+
1095+
/// The DownloadZipError union
1096+
public enum DownloadZipError: CustomStringConvertible {
1097+
/// An unspecified error.
1098+
case path(Files.LookupError)
1099+
/// The folder is too large to download.
1100+
case tooLarge
1101+
/// The folder has too many files to download.
1102+
case tooManyFiles
1103+
/// An unspecified error.
1104+
case other
1105+
1106+
public var description: String {
1107+
return "\(SerializeUtil.prepareJSONForSerialization(DownloadZipErrorSerializer().serialize(self)))"
1108+
}
1109+
}
1110+
open class DownloadZipErrorSerializer: JSONSerializer {
1111+
public init() { }
1112+
open func serialize(_ value: DownloadZipError) -> JSON {
1113+
switch value {
1114+
case .path(let arg):
1115+
var d = ["path": Files.LookupErrorSerializer().serialize(arg)]
1116+
d[".tag"] = .str("path")
1117+
return .dictionary(d)
1118+
case .tooLarge:
1119+
var d = [String: JSON]()
1120+
d[".tag"] = .str("too_large")
1121+
return .dictionary(d)
1122+
case .tooManyFiles:
1123+
var d = [String: JSON]()
1124+
d[".tag"] = .str("too_many_files")
1125+
return .dictionary(d)
1126+
case .other:
1127+
var d = [String: JSON]()
1128+
d[".tag"] = .str("other")
1129+
return .dictionary(d)
1130+
}
1131+
}
1132+
open func deserialize(_ json: JSON) -> DownloadZipError {
1133+
switch json {
1134+
case .dictionary(let d):
1135+
let tag = Serialization.getTag(d)
1136+
switch tag {
1137+
case "path":
1138+
let v = Files.LookupErrorSerializer().deserialize(d["path"] ?? .null)
1139+
return DownloadZipError.path(v)
1140+
case "too_large":
1141+
return DownloadZipError.tooLarge
1142+
case "too_many_files":
1143+
return DownloadZipError.tooManyFiles
1144+
case "other":
1145+
return DownloadZipError.other
1146+
default:
1147+
return DownloadZipError.other
1148+
}
1149+
default:
1150+
fatalError("Failed to deserialize")
1151+
}
1152+
}
1153+
}
1154+
1155+
/// The DownloadZipResult struct
1156+
open class DownloadZipResult: CustomStringConvertible {
1157+
/// (no description)
1158+
open let metadata: Files.FolderMetadata
1159+
public init(metadata: Files.FolderMetadata) {
1160+
self.metadata = metadata
1161+
}
1162+
open var description: String {
1163+
return "\(SerializeUtil.prepareJSONForSerialization(DownloadZipResultSerializer().serialize(self)))"
1164+
}
1165+
}
1166+
open class DownloadZipResultSerializer: JSONSerializer {
1167+
public init() { }
1168+
open func serialize(_ value: DownloadZipResult) -> JSON {
1169+
let output = [
1170+
"metadata": Files.FolderMetadataSerializer().serialize(value.metadata),
1171+
]
1172+
return .dictionary(output)
1173+
}
1174+
open func deserialize(_ json: JSON) -> DownloadZipResult {
1175+
switch json {
1176+
case .dictionary(let dict):
1177+
let metadata = Files.FolderMetadataSerializer().deserialize(dict["metadata"] ?? .null)
1178+
return DownloadZipResult(metadata: metadata)
1179+
default:
1180+
fatalError("Type error deserializing")
1181+
}
1182+
}
1183+
}
1184+
10641185
/// The FileMetadata struct
10651186
open class FileMetadata: Files.Metadata {
10661187
/// A unique identifier for the file.
@@ -4230,6 +4351,8 @@ open class Files {
42304351
public enum UploadError: CustomStringConvertible {
42314352
/// Unable to save the uploaded contents to a file.
42324353
case path(Files.UploadWriteFailed)
4354+
/// The supplied property group is invalid.
4355+
case propertiesError(FileProperties.InvalidPropertyGroupError)
42334356
/// An unspecified error.
42344357
case other
42354358

@@ -4245,6 +4368,10 @@ open class Files {
42454368
var d = Serialization.getFields(Files.UploadWriteFailedSerializer().serialize(arg))
42464369
d[".tag"] = .str("path")
42474370
return .dictionary(d)
4371+
case .propertiesError(let arg):
4372+
var d = ["properties_error": FileProperties.InvalidPropertyGroupErrorSerializer().serialize(arg)]
4373+
d[".tag"] = .str("properties_error")
4374+
return .dictionary(d)
42484375
case .other:
42494376
var d = [String: JSON]()
42504377
d[".tag"] = .str("other")
@@ -4259,6 +4386,9 @@ open class Files {
42594386
case "path":
42604387
let v = Files.UploadWriteFailedSerializer().deserialize(json)
42614388
return UploadError.path(v)
4389+
case "properties_error":
4390+
let v = FileProperties.InvalidPropertyGroupErrorSerializer().deserialize(d["properties_error"] ?? .null)
4391+
return UploadError.propertiesError(v)
42624392
case "other":
42634393
return UploadError.other
42644394
default:
@@ -4274,10 +4404,10 @@ open class Files {
42744404
public enum UploadErrorWithProperties: CustomStringConvertible {
42754405
/// Unable to save the uploaded contents to a file.
42764406
case path(Files.UploadWriteFailed)
4407+
/// The supplied property group is invalid.
4408+
case propertiesError(FileProperties.InvalidPropertyGroupError)
42774409
/// An unspecified error.
42784410
case other
4279-
/// An unspecified error.
4280-
case propertiesError(FileProperties.InvalidPropertyGroupError)
42814411

42824412
public var description: String {
42834413
return "\(SerializeUtil.prepareJSONForSerialization(UploadErrorWithPropertiesSerializer().serialize(self)))"
@@ -4291,14 +4421,14 @@ open class Files {
42914421
var d = Serialization.getFields(Files.UploadWriteFailedSerializer().serialize(arg))
42924422
d[".tag"] = .str("path")
42934423
return .dictionary(d)
4294-
case .other:
4295-
var d = [String: JSON]()
4296-
d[".tag"] = .str("other")
4297-
return .dictionary(d)
42984424
case .propertiesError(let arg):
42994425
var d = ["properties_error": FileProperties.InvalidPropertyGroupErrorSerializer().serialize(arg)]
43004426
d[".tag"] = .str("properties_error")
43014427
return .dictionary(d)
4428+
case .other:
4429+
var d = [String: JSON]()
4430+
d[".tag"] = .str("other")
4431+
return .dictionary(d)
43024432
}
43034433
}
43044434
open func deserialize(_ json: JSON) -> UploadErrorWithProperties {
@@ -4309,11 +4439,11 @@ open class Files {
43094439
case "path":
43104440
let v = Files.UploadWriteFailedSerializer().deserialize(json)
43114441
return UploadErrorWithProperties.path(v)
4312-
case "other":
4313-
return UploadErrorWithProperties.other
43144442
case "properties_error":
43154443
let v = FileProperties.InvalidPropertyGroupErrorSerializer().deserialize(d["properties_error"] ?? .null)
43164444
return UploadErrorWithProperties.propertiesError(v)
4445+
case "other":
4446+
return UploadErrorWithProperties.other
43174447
default:
43184448
fatalError("Unknown tag \(tag)")
43194449
}
@@ -5300,6 +5430,16 @@ open class Files {
53005430
attrs: ["host": "content",
53015431
"style": "download"]
53025432
)
5433+
static let downloadZip = Route(
5434+
name: "download_zip",
5435+
namespace: "files",
5436+
deprecated: false,
5437+
argSerializer: Files.DownloadZipArgSerializer(),
5438+
responseSerializer: Files.DownloadZipResultSerializer(),
5439+
errorSerializer: Files.DownloadZipErrorSerializer(),
5440+
attrs: ["host": "content",
5441+
"style": "download"]
5442+
)
53035443
static let getMetadata = Route(
53045444
name: "get_metadata",
53055445
namespace: "files",

Source/SwiftyDropbox/Shared/Generated/FilesRoutes.swift

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,37 @@ open class FilesRoutes {
284284
return client.request(route, serverArgs: serverArgs)
285285
}
286286

287+
/// Download a folder from the user's Dropbox, as a zip file. The folder must be less than 1 GB in size and have
288+
/// fewer than 10,000 total files. The input cannot be a single file.
289+
///
290+
/// - parameter path: The path of the folder to download.
291+
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
292+
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure, an
293+
/// NSError will be thrown).
294+
/// - parameter destination: A closure used to compute the destination, given the temporary file location and the
295+
/// response.
296+
///
297+
/// - returns: Through the response callback, the caller will receive a `Files.DownloadZipResult` object on success
298+
/// or a `Files.DownloadZipError` object on failure.
299+
@discardableResult open func downloadZip(path: String, overwrite: Bool = false, destination: @escaping (URL, HTTPURLResponse) -> URL) -> DownloadRequestFile<Files.DownloadZipResultSerializer, Files.DownloadZipErrorSerializer> {
300+
let route = Files.downloadZip
301+
let serverArgs = Files.DownloadZipArg(path: path)
302+
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
303+
}
304+
305+
/// Download a folder from the user's Dropbox, as a zip file. The folder must be less than 1 GB in size and have
306+
/// fewer than 10,000 total files. The input cannot be a single file.
307+
///
308+
/// - parameter path: The path of the folder to download.
309+
///
310+
/// - returns: Through the response callback, the caller will receive a `Files.DownloadZipResult` object on success
311+
/// or a `Files.DownloadZipError` object on failure.
312+
@discardableResult open func downloadZip(path: String) -> DownloadRequestMemory<Files.DownloadZipResultSerializer, Files.DownloadZipErrorSerializer> {
313+
let route = Files.downloadZip
314+
let serverArgs = Files.DownloadZipArg(path: path)
315+
return client.request(route, serverArgs: serverArgs)
316+
}
317+
287318
/// Returns the metadata for a file or folder. Note: Metadata for the root folder is unsupported.
288319
///
289320
/// - parameter path: The path of a file or folder on Dropbox.

Source/SwiftyDropbox/Shared/Generated/Team.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5286,6 +5286,8 @@ open class Team {
52865286
case cannotKeepAccountAndDeleteData
52875287
/// The email address of the user is too long to be disabled.
52885288
case emailAddressTooLongToBeDisabled
5289+
/// Cannot keep account of an invited user.
5290+
case cannotKeepInvitedUserAccount
52895291

52905292
public var description: String {
52915293
return "\(SerializeUtil.prepareJSONForSerialization(MembersRemoveErrorSerializer().serialize(self)))"
@@ -5355,6 +5357,10 @@ open class Team {
53555357
var d = [String: JSON]()
53565358
d[".tag"] = .str("email_address_too_long_to_be_disabled")
53575359
return .dictionary(d)
5360+
case .cannotKeepInvitedUserAccount:
5361+
var d = [String: JSON]()
5362+
d[".tag"] = .str("cannot_keep_invited_user_account")
5363+
return .dictionary(d)
53585364
}
53595365
}
53605366
open func deserialize(_ json: JSON) -> MembersRemoveError {
@@ -5392,6 +5398,8 @@ open class Team {
53925398
return MembersRemoveError.cannotKeepAccountAndDeleteData
53935399
case "email_address_too_long_to_be_disabled":
53945400
return MembersRemoveError.emailAddressTooLongToBeDisabled
5401+
case "cannot_keep_invited_user_account":
5402+
return MembersRemoveError.cannotKeepInvitedUserAccount
53955403
default:
53965404
fatalError("Unknown tag \(tag)")
53975405
}
@@ -6095,7 +6103,8 @@ open class Team {
60956103
open let namespaceId: String
60966104
/// The type of this namespace.
60976105
open let namespaceType: Team.NamespaceType
6098-
/// If this is a team member folder, the ID of the team member. Otherwise, this field is not present.
6106+
/// If this is a team member or app folder, the ID of the owning team member. Otherwise, this field is not
6107+
/// present.
60996108
open let teamMemberId: String?
61006109
public init(name: String, namespaceId: String, namespaceType: Team.NamespaceType, teamMemberId: String? = nil) {
61016110
stringValidator()(name)

0 commit comments

Comments
 (0)