-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add zip download support #749
Conversation
Sources/Modules/FilesModule.swift
Outdated
/// - name: The name of the zip file to be created | ||
/// - items: Array of files or folders to be part of the created zip | ||
/// - completion: Returns a standard ZipDownload object or an error | ||
public func createZip( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this private to match the implementation in Python and .Net SDKs? The idea is to offer just one method that simply does the download and sends back a "combined response."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
docs/usage/files.md
Outdated
@@ -520,3 +520,59 @@ client.files.listRepresentations( | |||
``` | |||
|
|||
[get-representations]: https://opensource.box.com/box-ios-sdk/Classes/FilesModule.html#/s:6BoxSDK11FilesModuleC19listRepresentations6fileId18representationHint10completionySS_AA018FileRepresentationJ0OSgys6ResultOySayAA0lM0VGAA0A8SDKErrorCGctF | |||
|
|||
Create Zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per comment above, let's make Create Zip private, so this section can be removed.
Tests/Modules/FilesModuleSpecs.swift
Outdated
@@ -1875,6 +1875,122 @@ class FilesModuleSpecs: QuickSpec { | |||
}) | |||
} | |||
|
|||
describe("createZip()") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per comment above, let's make Create Zip private, so this test can be removed.
@@ -164,6 +164,21 @@ class BoxJSONDecoder { | |||
return color | |||
} | |||
|
|||
static func optionalDecodeZip<T>(json: [[String: Any]]) throws -> T? where T: BoxModel { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool, BTW! Good job!
@@ -28,6 +28,7 @@ file's contents, upload new versions, and perform other common file operations | |||
- [Set Shared Link](#set-shared-link) | |||
- [Remove Shared Link](#remove-shared-link) | |||
- [Get Representations](#get-representations) | |||
- [Download Zip](#download-zip) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can roll back this commit. Running Jazzy Docs during the release will auto generate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this one in since it doesn't seem like jazzy updates this, but if jazzy makes a duplicate during the release process I can delete it then
docs/usage/files.md
Outdated
@@ -553,3 +554,5 @@ client.files.downloadZip(name: name, items: items, destinationURL: destinationUR | |||
print("Zip download status: \(zipDownloadStatus.state)") | |||
} | |||
``` | |||
|
|||
[download-zip]: https://opensource.box.com/box-ios-sdk/Classes/FilesModule.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can roll back this commit. Running Jazzy Docs during the release will auto generate this.
Sources/Modules/FilesModule.swift
Outdated
|
||
switch zipDownloadResult { | ||
case .success: | ||
self.getZipDownloadStatus(statusURL: zip.statusUrl, completion: completion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to combine this with zip.nameConflicts, returned from the call to createZip, so that callers to downloadZip get back both the download status AND the name conflicts (since we made createZip private). You can follow the example in .Net.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if you choose "commit suggestion" then I don't have to re-approve, but feel free to change it if you otherwise want to.
Co-authored-by: Patrick Simon <[email protected]>
Goals ⚽
Implementation Details 🚧
client.files.downloadZip(name:items:destinationURL:completion:)
.Testing Details 🔍