Skip to content

Commit 2e8d271

Browse files
author
Qiming Yuan
committed
4.5.0 release.
1 parent 7143d14 commit 2e8d271

File tree

20 files changed

+4438
-925
lines changed

20 files changed

+4438
-925
lines changed

.jazzy.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"FileRequests",
2727
"Files",
2828
"Paper",
29+
"SeenState",
2930
"Sharing",
3031
"Team",
3132
"TeamCommon",

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.4.0
135+
github "https://github.com/dropbox/SwiftyDropbox" ~> 4.5.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.4.0</string>
18+
<string>4.5.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.4.0</string>
18+
<string>4.5.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSHumanReadableCopyright</key>

Source/SwiftyDropbox/Shared/Generated/FilePropertiesRoutes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ open class FilePropertiesRoutes {
4141
}
4242

4343
/// Permanently removes the specified property group from the file. To remove specific property field key value
44-
/// pairs, see propertiesUpdate. To update a template, see templatesUpdateForUser or templatesUpdateForTeam.
45-
/// Templates can't be removed once created.
44+
/// pairs, see propertiesUpdate. To update a template, see templatesUpdateForUser or templatesUpdateForTeam. To
45+
/// remove a template, see templatesRemoveForUser or templatesRemoveForTeam.
4646
///
4747
/// - parameter path: A unique identifier for the file or folder.
4848
/// - parameter propertyTemplateIds: A list of identifiers for a template created by templatesAddForUser or

Source/SwiftyDropbox/Shared/Generated/Files.swift

Lines changed: 775 additions & 21 deletions
Large diffs are not rendered by default.

Source/SwiftyDropbox/Shared/Generated/FilesRoutes.swift

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,39 @@ open class FilesRoutes {
185185
return client.request(route, serverArgs: serverArgs)
186186
}
187187

188+
/// Create multiple folders at once. This route is asynchronous for large batches, which returns a job ID
189+
/// immediately and runs the create folder batch asynchronously. Otherwise, creates the folders and returns the
190+
/// result synchronously for smaller inputs. You can force asynchronous behaviour by using the forceAsync in
191+
/// CreateFolderBatchArg flag. Use createFolderBatchCheck to check the job status.
192+
///
193+
/// - parameter paths: List of paths to be created in the user's Dropbox. Duplicate path arguments in the batch are
194+
/// considered only once.
195+
/// - parameter autorename: If there's a conflict, have the Dropbox server try to autorename the folder to avoid the
196+
/// conflict.
197+
/// - parameter forceAsync: Whether to force the create to happen asynchronously.
198+
///
199+
/// - returns: Through the response callback, the caller will receive a `Files.CreateFolderBatchLaunch` object on
200+
/// success or a `Void` object on failure.
201+
@discardableResult open func createFolderBatch(paths: Array<String>, autorename: Bool = false, forceAsync: Bool = false) -> RpcRequest<Files.CreateFolderBatchLaunchSerializer, VoidSerializer> {
202+
let route = Files.createFolderBatch
203+
let serverArgs = Files.CreateFolderBatchArg(paths: paths, autorename: autorename, forceAsync: forceAsync)
204+
return client.request(route, serverArgs: serverArgs)
205+
}
206+
207+
/// Returns the status of an asynchronous job for createFolderBatch. If success, it returns list of result for each
208+
/// entry.
209+
///
210+
/// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method
211+
/// that launched the job.
212+
///
213+
/// - returns: Through the response callback, the caller will receive a `Files.CreateFolderBatchJobStatus` object
214+
/// on success or a `Async.PollError` object on failure.
215+
@discardableResult open func createFolderBatchCheck(asyncJobId: String) -> RpcRequest<Files.CreateFolderBatchJobStatusSerializer, Async.PollErrorSerializer> {
216+
let route = Files.createFolderBatchCheck
217+
let serverArgs = Async.PollArg(asyncJobId: asyncJobId)
218+
return client.request(route, serverArgs: serverArgs)
219+
}
220+
188221
/// Create a folder at a given path.
189222
///
190223
/// - parameter path: Path in the user's Dropbox to create.
@@ -204,13 +237,15 @@ open class FilesRoutes {
204237
/// corresponding FileMetadata or FolderMetadata for the item at time of deletion, and not a DeletedMetadata object.
205238
///
206239
/// - parameter path: Path in the user's Dropbox to delete.
240+
/// - parameter parentRev: Perform delete if given "rev" matches the existing file's latest "rev". This field does
241+
/// not support deleting a folder.
207242
///
208243
/// - returns: Through the response callback, the caller will receive a `Files.Metadata` object on success or a
209244
/// `Files.DeleteError` object on failure.
210245
@available(*, unavailable, message:"delete is deprecated. Use delete_v2.")
211-
@discardableResult open func delete(path: String) -> RpcRequest<Files.MetadataSerializer, Files.DeleteErrorSerializer> {
246+
@discardableResult open func delete(path: String, parentRev: String? = nil) -> RpcRequest<Files.MetadataSerializer, Files.DeleteErrorSerializer> {
212247
let route = Files.delete
213-
let serverArgs = Files.DeleteArg(path: path)
248+
let serverArgs = Files.DeleteArg(path: path, parentRev: parentRev)
214249
return client.request(route, serverArgs: serverArgs)
215250
}
216251

@@ -244,12 +279,14 @@ open class FilesRoutes {
244279
/// corresponding FileMetadata or FolderMetadata for the item at time of deletion, and not a DeletedMetadata object.
245280
///
246281
/// - parameter path: Path in the user's Dropbox to delete.
282+
/// - parameter parentRev: Perform delete if given "rev" matches the existing file's latest "rev". This field does
283+
/// not support deleting a folder.
247284
///
248285
/// - returns: Through the response callback, the caller will receive a `Files.DeleteResult` object on success or a
249286
/// `Files.DeleteError` object on failure.
250-
@discardableResult open func deleteV2(path: String) -> RpcRequest<Files.DeleteResultSerializer, Files.DeleteErrorSerializer> {
287+
@discardableResult open func deleteV2(path: String, parentRev: String? = nil) -> RpcRequest<Files.DeleteResultSerializer, Files.DeleteErrorSerializer> {
251288
let route = Files.deleteV2
252-
let serverArgs = Files.DeleteArg(path: path)
289+
let serverArgs = Files.DeleteArg(path: path, parentRev: parentRev)
253290
return client.request(route, serverArgs: serverArgs)
254291
}
255292

@@ -391,6 +428,7 @@ open class FilesRoutes {
391428
/// - parameter format: The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg
392429
/// should be preferred, while png is better for screenshots and digital arts.
393430
/// - parameter size: The size for the thumbnail image.
431+
/// - parameter mode: How to resize and crop the image to achieve the desired size.
394432
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
395433
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure, an
396434
/// NSError will be thrown).
@@ -399,9 +437,9 @@ open class FilesRoutes {
399437
///
400438
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
401439
/// `Files.ThumbnailError` object on failure.
402-
@discardableResult open func getThumbnail(path: String, format: Files.ThumbnailFormat = .jpeg, size: Files.ThumbnailSize = .w64h64, overwrite: Bool = false, destination: @escaping (URL, HTTPURLResponse) -> URL) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.ThumbnailErrorSerializer> {
440+
@discardableResult open func getThumbnail(path: String, format: Files.ThumbnailFormat = .jpeg, size: Files.ThumbnailSize = .w64h64, mode: Files.ThumbnailMode = .strict, overwrite: Bool = false, destination: @escaping (URL, HTTPURLResponse) -> URL) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.ThumbnailErrorSerializer> {
403441
let route = Files.getThumbnail
404-
let serverArgs = Files.ThumbnailArg(path: path, format: format, size: size)
442+
let serverArgs = Files.ThumbnailArg(path: path, format: format, size: size, mode: mode)
405443
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
406444
}
407445

@@ -412,12 +450,13 @@ open class FilesRoutes {
412450
/// - parameter format: The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg
413451
/// should be preferred, while png is better for screenshots and digital arts.
414452
/// - parameter size: The size for the thumbnail image.
453+
/// - parameter mode: How to resize and crop the image to achieve the desired size.
415454
///
416455
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
417456
/// `Files.ThumbnailError` object on failure.
418-
@discardableResult open func getThumbnail(path: String, format: Files.ThumbnailFormat = .jpeg, size: Files.ThumbnailSize = .w64h64) -> DownloadRequestMemory<Files.FileMetadataSerializer, Files.ThumbnailErrorSerializer> {
457+
@discardableResult open func getThumbnail(path: String, format: Files.ThumbnailFormat = .jpeg, size: Files.ThumbnailSize = .w64h64, mode: Files.ThumbnailMode = .strict) -> DownloadRequestMemory<Files.FileMetadataSerializer, Files.ThumbnailErrorSerializer> {
419458
let route = Files.getThumbnail
420-
let serverArgs = Files.ThumbnailArg(path: path, format: format, size: size)
459+
let serverArgs = Files.ThumbnailArg(path: path, format: format, size: size, mode: mode)
421460
return client.request(route, serverArgs: serverArgs)
422461
}
423462

@@ -633,12 +672,14 @@ open class FilesRoutes {
633672
/// endpoint is only available for Dropbox Business apps.
634673
///
635674
/// - parameter path: Path in the user's Dropbox to delete.
675+
/// - parameter parentRev: Perform delete if given "rev" matches the existing file's latest "rev". This field does
676+
/// not support deleting a folder.
636677
///
637678
/// - returns: Through the response callback, the caller will receive a `Void` object on success or a
638679
/// `Files.DeleteError` object on failure.
639-
@discardableResult open func permanentlyDelete(path: String) -> RpcRequest<VoidSerializer, Files.DeleteErrorSerializer> {
680+
@discardableResult open func permanentlyDelete(path: String, parentRev: String? = nil) -> RpcRequest<VoidSerializer, Files.DeleteErrorSerializer> {
640681
let route = Files.permanentlyDelete
641-
let serverArgs = Files.DeleteArg(path: path)
682+
let serverArgs = Files.DeleteArg(path: path, parentRev: parentRev)
642683
return client.request(route, serverArgs: serverArgs)
643684
}
644685

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
///
2+
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
3+
///
4+
/// Auto-generated by Stone, do not modify.
5+
///
6+
7+
import Foundation
8+
9+
/// Datatypes and serializers for the seen_state namespace
10+
open class SeenState {
11+
/// Possible platforms on which a user may view content.
12+
public enum PlatformType: CustomStringConvertible {
13+
/// The content was viewed on the web.
14+
case web
15+
/// The content was viewed on a mobile client.
16+
case mobile
17+
/// The content was viewed on a desktop client.
18+
case desktop
19+
/// The content was viewed on an unknown platform.
20+
case unknown
21+
/// An unspecified error.
22+
case other
23+
24+
public var description: String {
25+
return "\(SerializeUtil.prepareJSONForSerialization(PlatformTypeSerializer().serialize(self)))"
26+
}
27+
}
28+
open class PlatformTypeSerializer: JSONSerializer {
29+
public init() { }
30+
open func serialize(_ value: PlatformType) -> JSON {
31+
switch value {
32+
case .web:
33+
var d = [String: JSON]()
34+
d[".tag"] = .str("web")
35+
return .dictionary(d)
36+
case .mobile:
37+
var d = [String: JSON]()
38+
d[".tag"] = .str("mobile")
39+
return .dictionary(d)
40+
case .desktop:
41+
var d = [String: JSON]()
42+
d[".tag"] = .str("desktop")
43+
return .dictionary(d)
44+
case .unknown:
45+
var d = [String: JSON]()
46+
d[".tag"] = .str("unknown")
47+
return .dictionary(d)
48+
case .other:
49+
var d = [String: JSON]()
50+
d[".tag"] = .str("other")
51+
return .dictionary(d)
52+
}
53+
}
54+
open func deserialize(_ json: JSON) -> PlatformType {
55+
switch json {
56+
case .dictionary(let d):
57+
let tag = Serialization.getTag(d)
58+
switch tag {
59+
case "web":
60+
return PlatformType.web
61+
case "mobile":
62+
return PlatformType.mobile
63+
case "desktop":
64+
return PlatformType.desktop
65+
case "unknown":
66+
return PlatformType.unknown
67+
case "other":
68+
return PlatformType.other
69+
default:
70+
return PlatformType.other
71+
}
72+
default:
73+
fatalError("Failed to deserialize")
74+
}
75+
}
76+
}
77+
78+
}

0 commit comments

Comments
 (0)