Skip to content

Commit 5b298ea

Browse files
authored
0.12.0 (#114)
* allow setting signature from external source * lib version bump * Update README.md * Update Upload API.md * formatting * Update Upload API.md * custom uploadSignature can be provided for methods: - Upload file from url - Multipart file uploading - Create files group from a set of files - Create files group from a set of files UUIDs. - Files group info * custom uploadSignature can be provided for main uploadFile method that decides which upload method to use internally * custom uploadSignature can be provided for upload method of UploadedFile object * increase timeout for video conversion integration test * documentation updated * Update Sources/Uploadcare/Uploadcare.swift Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update README.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update Documentation/Upload API.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update README.md * Update README.md * Update README.md * Update Upload API.md * Update README.md * Update README.md * Update Upload API.md * Update REST API.md * Update Documentation/REST API.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update Documentation/REST API.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update Documentation/Upload API.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update Documentation/Upload API.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update README.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * Update README.md Co-authored-by: Roman Sedykh <rsedykh@gmail.com> * fixed when storing behavour param was missing for direct upload request * version bump * removed deprecated files for tests * Swift version 5.1 -> 5.6 * removed unused allTests property in tests * refactoring * refactoring * refactoring * bumped api version to 0.7 * - removed sorting by size for getting list of files method - data param for dateTimeUploadedASC ordering is optional now * removed rekognitionInfo from File model * removed imageInfo from File model * removed videoInfo from File model * warning * metadata added to File model * docs * order * Improvements for handling responses in RequestManager * Added methods for REST API to get/update/delete File metadata * store group method is not available for REST API anymore * use keyDecodingStrategy for decoders * Revert "use keyDecodingStrategy for decoders" This reverts commit d210ca2. * added contentInfo property to File data model * delete group method added for REST API * models updated * added FileInfoQuery to set request query to include appdata * new models for AppData added * refactoring * appData field added for File model * refactoring * execute AWS recognition method added * added method to check aws recognition status * integration tests for aws recognition execution and and status check * Added execution of ClamAV addon, checking it’s status and integration tests for it * RemoveBGAddonExecutionParams model added * remove.bg addon execution and status + refactoring * integration tests for remove.bg addon methods * done field added to UploadedFile model * added contentInfo file to UploadedFile model * added metadata property to UploadedFile model * bump lib version * metadata can be provided for upload from url method * metadata can be provided for direct upload method * metadata can be provided for multipart uploads * set swift version 5.5 * demo app fixed * updated project for carthage * more swift versions * podfile updated * warning removed * set lib version 0.9.0 * metadata param for main upload method - metadata param for main upload method - don’t get fileinfo if only public key provided after direct upload integration test for direct upload when only public key provided * pass metadata from UploadedFile when calling upload * added integratin test for multipart uploading if only public key provided * Update README.md * Update REST API.md * Update REST API.md * Update REST API.md * Update REST API.md * Update Upload API.md * Update README.md * Update test.yml * Update REST API.md * Update REST API.md * Update Upload API.md * Update REST API.md * Update REST API.md * couple links updated * test updated * fixed parsing of UploadedFile model * added new integration test to upload a video file and check that parsing of response works * version bump * spaces * cleanup * async tests file * async version of getProjectInfo and test * formatting * async getListOfWebhooks and test * async performRequest * async webhooks methods * refactoring * refactoring * async listOfGroups and groupInfo + tests * async list of files and tests * one more test * async pagination for list of files * async fileinfo and test * error handling * refactoring * refactoring * async groups list and pagination + tests * Equatable conformance * Equatable for Group and check results in test * async getAuthenticatedUrlFromUrl and test * UploadAPIIntegrationAsyncTests * async directUploadInForeground and test * async deleteFile and test * async deleteFiles and test * async storeFile and test * async storeFiles and test * async copyFileToLocalStorage and test * async copyFileToRemoteStorage and test * async convertDocuments, convertDocumentsWithSettings, documentConversionJobStatus and tests * async convertVideosWithSettings, convertVideos, videoConversionJobStatus and tests * … * async methods for metadata and test * Async methods for AWS recognition and test * Async methods for Clamav addon and test * async methods for Remove.bg addon and tests * async deleteGroup method * refactoring * async methods for upload from url and it’s status and test * warning fixed * async fileInfo and test * updated unsplash link * tests refactoring * async multipart upload and test * test improved * uploadSignature param for directUploadInForeground * async uploadFile method in Uploadcare class + test * docs * async upload method for UploadedFile class and test * test updated * async methods to create groups + tests * tests renames * cleanup * tests annotation * fixed build for tvOS * annotation * fixed build for watchOS * tests are available for watchOS too * … * documentation updated * docs * docs * docs * docs * docs * spaces * docs * docs * docs * docs * docs * docs * docs * docs * readme * update semf * demo app refactoring * async * refactoring * more async methods * dead link * more async * widget updated to fix a warning * use new AsyncImage in widget * warning fixed * cleanup * async files load in demo app * discardableResult * async file delete in demo * demo app project updated * readme updated * docs updated * docs updated * test updated * docs with examples * docs * docs * docs * docs * REST API docs * docs * docs * couple fixes * uploadAndWaitForCompletion method and test added * docs * bump lib version * podspec updated * updated carthage project * Update README.md * bump version to 0.10.0 * podspec updated * Update test.yml * Linux support (#111) * wip * dependencies for Linux * package version * nsec * wip * wip * wip * wip * commented code that breaks building for linux * use apple's Crypto * sha1 and sha256 implementations using Crypto * AsyncHTTPClient for requests * Package.reslolved * wip * empty line * wip * disable tests for methods with callbacks for LInux * disable CI for PRs to develop for now * wip * wip * wip * removed force unwrapping in tests * return Data from request if need * directUploadInForeground for Linux * space * default store value - auto * multipart upload for Linux * fix * fixes * no need to delete headers * added testing on Ubuntu in workflow * Update test.yml * Update test.yml * swift-tools-version:5.6 --------- Co-authored-by: Sergei Armodin <dolph-in@yandex.ru~> * version bump * swift-crypto 3.0.0 * marked audio property of ContentInfo as required * removed deprecated methods * Webhook model is updated * version property updated for Webhook model * event param for create and update webhook methods * one more test * docs updated * added saveInGroup param for convertDocuments methods * fixed Carthage project * added testing with Swift 5.9 on Ubuntu * version bump * sources list updated in widget * menu UI fixed * tests updated * widget refactoring * widget cookie fix * async getSourceChunk * async loadMore * async uploadFileFromPath * smaller list of sources * run tests on Ubuntu for minimum and maximum supported Swift versions only * formatting * added back OneDrive external source for widget --------- Co-authored-by: Roman Sedykh Co-authored-by: Sergei Armodin
1 parent 84148eb commit 5b298ea

25 files changed

+343
-1138
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
32-
swift: [5.8.1, 5.7.3, 5.6.3]
32+
swift: [5.9, 5.6.3]
3333

3434
steps:
3535
- name: Checkout

Demo/Demo/Views/ContentView.swift

+33-24
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@ struct MainView: View {
2222
@State private var messageText: String = ""
2323

2424
@State var isUploading: Bool = false
25-
25+
26+
private let sources: [SocialSource] = [
27+
SocialSource(source: .facebook),
28+
SocialSource(source: .gdrive),
29+
SocialSource(source: .gphotos),
30+
SocialSource(source: .dropbox),
31+
SocialSource(source: .instagram),
32+
SocialSource(source: .onedrive)
33+
]
34+
2635
var body: some View {
2736
NavigationView {
2837
ZStack {
@@ -42,34 +51,13 @@ struct MainView: View {
4251
.navigationBarTitle(Text("Uploadcare demo"), displayMode: .automatic)
4352
.sheet(isPresented: self.$widgetVisible, content: {
4453
NavigationView {
45-
SelectSourceView(publicKey: publicKey)
54+
SelectSourceView(publicKey: publicKey, sources: sources)
4655
.navigationBarItems(trailing: Button("Close") {
4756
self.widgetVisible = false
4857
})
4958
.environmentObject(api)
5059
}
5160
})
52-
53-
.actionSheet(isPresented: $isShowingAddFilesAlert, content: {
54-
ActionSheet(
55-
title: Text("Select source"),
56-
message: Text(""),
57-
buttons: [
58-
.default(Text("Photos"), action: {
59-
self.pickerType = .photos
60-
self.isShowingSheetWithPicker.toggle()
61-
}),
62-
.default(Text("Files"), action: {
63-
self.pickerType = .files
64-
self.isShowingSheetWithPicker.toggle()
65-
}),
66-
.default(Text("External Sources"), action: {
67-
self.widgetVisible = true
68-
}),
69-
.cancel()
70-
]
71-
)
72-
})
7361
.sheet(isPresented: $isShowingSheetWithPicker) {
7462
if self.pickerType == .photos {
7563
ImagePicker(sourceType: .photoLibrary) { (imageUrl) in
@@ -144,7 +132,28 @@ struct MainView: View {
144132
self.filesListStore.uploadcare = self.api.uploadcare
145133
}
146134
self.isShowingAddFilesAlert.toggle()
147-
}.buttonStyle(NeumorphicButtonStyle(bgColor: Color.gray.opacity(0.05)))
135+
}
136+
.buttonStyle(NeumorphicButtonStyle(bgColor: Color.gray.opacity(0.05)))
137+
.actionSheet(isPresented: $isShowingAddFilesAlert, content: {
138+
ActionSheet(
139+
title: Text("Select source"),
140+
message: Text(""),
141+
buttons: [
142+
.default(Text("Photos"), action: {
143+
self.pickerType = .photos
144+
self.isShowingSheetWithPicker.toggle()
145+
}),
146+
.default(Text("Files"), action: {
147+
self.pickerType = .files
148+
self.isShowingSheetWithPicker.toggle()
149+
}),
150+
.default(Text("External Sources"), action: {
151+
self.widgetVisible = true
152+
}),
153+
.cancel()
154+
]
155+
)
156+
})
148157
}
149158
}
150159
}

Documentation/REST API.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,10 @@ Create and subscribe to a webhook. You can use webhooks to receive notifications
515515
let url = URL(string: "https://yourwebhook.com")!
516516

517517
// Async:
518-
let webhook = try await uploadcare.createWebhook(targetUrl: url, isActive: true, signingSecret: "someSigningSecret")
518+
let webhook = try await uploadcare.createWebhook(targetUrl: url, event: .fileUploaded, isActive: true, signingSecret: "someSigningSecret")
519519

520520
// With a completion callback:
521-
uploadcare.createWebhook(targetUrl: url, isActive: true, signingSecret: "someSigningSecret") { result in
521+
uploadcare.createWebhook(targetUrl: url, event: .fileUploaded, isActive: true, signingSecret: "someSigningSecret") { result in
522522
switch result {
523523
case .failure(let error):
524524
print(error)
@@ -537,10 +537,10 @@ let url = URL(string: "https://yourwebhook.com")!
537537
let webhookId = 100
538538

539539
// Async:
540-
let webhook = try await uploadcare.updateWebhook(id: webhookId, targetUrl: url, isActive: false, signingSecret: "someNewSigningSecret")
540+
let webhook = try await uploadcare.updateWebhook(id: webhookId, targetUrl: url, event: .fileInfoUpdated, isActive: false, signingSecret: "someNewSigningSecret")
541541

542542
// With a completion callback:
543-
uploadcare.updateWebhook(id: webhookId, targetUrl: url, isActive: true, signingSecret: "someNewSigningSecret") { result in
543+
uploadcare.updateWebhook(id: webhookId, targetUrl: url, event: .fileInfoUpdated, isActive: true, signingSecret: "someNewSigningSecret") { result in
544544
switch result {
545545
case .failure(let error):
546546
print(error)

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PackageDescription
66
#if os(Linux)
77
let dependencies: [PackageDescription.Package.Dependency] = [
88
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.18.0"),
9-
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "3.0.0")
9+
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "4.0.0")
1010
]
1111
let targetDependencies: [PackageDescription.Target.Dependency] = [
1212
.product(name: "AsyncHTTPClient", package: "async-http-client"),

Sources/Uploadcare/Constants.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal let RESTAPIHost = "api.uploadcare.com"
1919
/// Library name
2020
internal let libraryName = "UploadcareSwift"
2121
/// Library version
22-
internal let libraryVersion = "0.11.0"
22+
internal let libraryVersion = "0.12.0"
2323

2424
/// API version
2525
internal let APIVersion = "0.7"

Sources/Uploadcare/Uploadcare.swift

+39-20
Original file line numberDiff line numberDiff line change
@@ -1545,10 +1545,10 @@ extension Uploadcare {
15451545
}
15461546
}
15471547

1548-
private func createWebhookRequestBody(targetUrl: URL, isActive: Bool, signingSecret: String? = nil) throws -> Data {
1548+
private func createWebhookRequestBody(targetUrl: URL, event: Webhook.Event, isActive: Bool, signingSecret: String? = nil) throws -> Data {
15491549
var bodyDictionary = [
15501550
"target_url": targetUrl.absoluteString,
1551-
"event": "file.uploaded", // Presently, we only support the file.uploaded event.
1551+
"event": event.rawValue,
15521552
"is_active": "\(isActive)"
15531553
]
15541554

@@ -1564,7 +1564,7 @@ extension Uploadcare {
15641564
/// Example:
15651565
/// ```swift
15661566
/// let url = URL(string: "https://yourwebhook.com")!
1567-
/// uploadcare.createWebhook(targetUrl: url, isActive: true, signingSecret: "someSigningSecret") { result in
1567+
/// uploadcare.createWebhook(targetUrl: url, event: .fileUploaded, isActive: true, signingSecret: "someSigningSecret") { result in
15681568
/// switch result {
15691569
/// case .failure(let error):
15701570
/// print(error)
@@ -1576,15 +1576,16 @@ extension Uploadcare {
15761576
///
15771577
/// - Parameters:
15781578
/// - targetUrl: An URL that is triggered by an event, for example, a file upload. A target URL MUST be unique for each project — event type combination.
1579+
/// - event: An event you subscribe to.
15791580
/// - isActive: Marks a subscription as either active or not, defaults to true, otherwise false.
15801581
/// - signingSecret: Optional secret that, if set, will be used to calculate signatures for the webhook payloads.
15811582
/// - completionHandler: Completion handler.
15821583
#if !os(Linux)
1583-
public func createWebhook(targetUrl: URL, isActive: Bool, signingSecret: String? = nil, _ completionHandler: @escaping (Result<Webhook, RESTAPIError>) -> Void) {
1584+
public func createWebhook(targetUrl: URL, event: Webhook.Event = .fileUploaded, isActive: Bool, signingSecret: String? = nil, _ completionHandler: @escaping (Result<Webhook, RESTAPIError>) -> Void) {
15841585
let url = urlWithPath("/webhooks/")
15851586
var urlRequest = requestManager.makeUrlRequest(fromURL: url, method: .post)
15861587
do {
1587-
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, isActive: isActive, signingSecret: signingSecret)
1588+
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, event: event, isActive: isActive, signingSecret: signingSecret)
15881589
} catch let error {
15891590
DLog(error.localizedDescription)
15901591
}
@@ -1614,14 +1615,15 @@ extension Uploadcare {
16141615
///
16151616
/// - Parameters:
16161617
/// - targetUrl: An URL that is triggered by an event, for example, a file upload. A target URL MUST be unique for each project — event type combination.
1618+
/// - event: An event you subscribe to.
16171619
/// - isActive: Marks a subscription as either active or not, defaults to true, otherwise false.
16181620
/// - signingSecret: Optional secret that, if set, will be used to calculate signatures for the webhook payloads
16191621
/// - Returns: Created webhook.
16201622
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
1621-
public func createWebhook(targetUrl: URL, isActive: Bool, signingSecret: String? = nil) async throws -> Webhook {
1623+
public func createWebhook(targetUrl: URL, event: Webhook.Event = .fileUploaded, isActive: Bool, signingSecret: String? = nil) async throws -> Webhook {
16221624
let url = urlWithPath("/webhooks/")
16231625
var urlRequest = requestManager.makeUrlRequest(fromURL: url, method: .post)
1624-
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, isActive: isActive, signingSecret: signingSecret)
1626+
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, event: event, isActive: isActive, signingSecret: signingSecret)
16251627
requestManager.signRequest(&urlRequest)
16261628

16271629
do {
@@ -1638,7 +1640,7 @@ extension Uploadcare {
16381640
/// ```swift
16391641
/// let url = URL(string: "https://yourwebhook.com")!
16401642
/// let webhookId = 100
1641-
/// uploadcare.updateWebhook(id: webhookId, targetUrl: url, isActive: true, signingSecret: "someNewSigningSecret") { result in
1643+
/// uploadcare.updateWebhook(id: webhookId, targetUrl: url, event: .fileInfoUpdated, isActive: true, signingSecret: "someNewSigningSecret") { result in
16421644
/// switch result {
16431645
/// case .failure(let error):
16441646
/// print(error)
@@ -1651,15 +1653,16 @@ extension Uploadcare {
16511653
/// - Parameters:
16521654
/// - id: Webhook ID.
16531655
/// - targetUrl: Where webhook data will be posted.
1656+
/// - event: An event you subscribe to.
16541657
/// - isActive: Marks a subscription as either active or not.
16551658
/// - signingSecret: Optional secret that, if set, will be used to calculate signatures for the webhook payloads.
16561659
/// - completionHandler: Completion handler.
16571660
#if !os(Linux)
1658-
public func updateWebhook(id: Int, targetUrl: URL, isActive: Bool, signingSecret: String? = nil, _ completionHandler: @escaping (Result<Webhook, RESTAPIError>) -> Void) {
1661+
public func updateWebhook(id: Int, targetUrl: URL, event: Webhook.Event = .fileUploaded, isActive: Bool, signingSecret: String? = nil, _ completionHandler: @escaping (Result<Webhook, RESTAPIError>) -> Void) {
16591662
let url = urlWithPath("/webhooks/\(id)/")
16601663
var urlRequest = requestManager.makeUrlRequest(fromURL: url, method: .put)
16611664
do {
1662-
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, isActive: isActive, signingSecret: signingSecret)
1665+
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, event: event, isActive: isActive, signingSecret: signingSecret)
16631666
} catch let error {
16641667
DLog(error.localizedDescription)
16651668
}
@@ -1683,6 +1686,7 @@ extension Uploadcare {
16831686
/// let webhook = try await uploadcare.updateWebhook(
16841687
/// id: webhookId,
16851688
/// targetUrl: url,
1689+
/// event: .fileInfoUpdated,
16861690
/// isActive: false,
16871691
/// signingSecret: "someNewSigningSecret"
16881692
/// )
@@ -1691,14 +1695,15 @@ extension Uploadcare {
16911695
/// - Parameters:
16921696
/// - id: Webhook ID
16931697
/// - targetUrl: Where webhook data will be posted.
1698+
/// - event: An event you subscribe to.
16941699
/// - isActive: Marks a subscription as either active or not.
16951700
/// - signingSecret: Optional secret that, if set, will be used to calculate signatures for the webhook payloads.
16961701
/// - Returns: Updated webhook.
16971702
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
1698-
public func updateWebhook(id: Int, targetUrl: URL, isActive: Bool, signingSecret: String? = nil) async throws -> Webhook {
1703+
public func updateWebhook(id: Int, targetUrl: URL, event: Webhook.Event = .fileUploaded, isActive: Bool, signingSecret: String? = nil) async throws -> Webhook {
16991704
let url = urlWithPath("/webhooks/\(id)/")
17001705
var urlRequest = requestManager.makeUrlRequest(fromURL: url, method: .put)
1701-
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, isActive: isActive, signingSecret: signingSecret)
1706+
urlRequest.httpBody = try createWebhookRequestBody(targetUrl: targetUrl, event: event, isActive: isActive, signingSecret: signingSecret)
17021707
requestManager.signRequest(&urlRequest)
17031708

17041709
do {
@@ -1794,15 +1799,21 @@ extension Uploadcare {
17941799
public func convertDocuments(
17951800
_ paths: [String],
17961801
store: StoringBehavior? = nil,
1802+
saveInGroup: Bool? = nil,
17971803
_ completionHandler: @escaping (Result<ConvertDocumentsResponse, RESTAPIError>) -> Void
17981804
) {
17991805
let url = urlWithPath("/convert/document/")
18001806
var urlRequest = requestManager.makeUrlRequest(fromURL: url, method: .post)
18011807

18021808
let storeValue = store == StoringBehavior.auto ? .store : store
1809+
var saveInGroupValue: String? = nil
1810+
if let saveInGroup {
1811+
saveInGroupValue = saveInGroup ? "true" : "false"
1812+
}
18031813
let requestData = ConvertRequestData(
18041814
paths: paths,
1805-
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue
1815+
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue,
1816+
saveInGroup: saveInGroupValue
18061817
)
18071818

18081819
urlRequest.httpBody = try? JSONEncoder().encode(requestData)
@@ -1832,14 +1843,19 @@ extension Uploadcare {
18321843
/// - store: A flag indicating if we should store your outputs.
18331844
/// - Returns: Operation response.
18341845
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
1835-
public func convertDocuments(_ paths: [String], store: StoringBehavior? = nil) async throws -> ConvertDocumentsResponse {
1846+
public func convertDocuments(_ paths: [String], store: StoringBehavior? = nil, saveInGroup: Bool? = nil) async throws -> ConvertDocumentsResponse {
18361847
let url = urlWithPath("/convert/document/")
18371848
var urlRequest = requestManager.makeUrlRequest(fromURL: url, method: .post)
18381849

18391850
let storeValue = store == StoringBehavior.auto ? .store : store
1851+
var saveInGroupValue: String? = nil
1852+
if let saveInGroup {
1853+
saveInGroupValue = saveInGroup ? "true" : "false"
1854+
}
18401855
let requestData = ConvertRequestData(
18411856
paths: paths,
1842-
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue
1857+
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue,
1858+
saveInGroup: saveInGroupValue
18431859
)
18441860

18451861
urlRequest.httpBody = try? JSONEncoder().encode(requestData)
@@ -1881,11 +1897,12 @@ extension Uploadcare {
18811897
public func convertDocumentsWithSettings(
18821898
_ tasks: [DocumentConversionJobSettings],
18831899
store: StoringBehavior? = nil,
1900+
saveInGroup: Bool? = nil,
18841901
_ completionHandler: @escaping (Result<ConvertDocumentsResponse, RESTAPIError>) -> Void
18851902
) {
18861903
var paths = [String]()
18871904
tasks.forEach({ paths.append($0.stringValue) })
1888-
convertDocuments(paths, store: store, completionHandler)
1905+
convertDocuments(paths, store: store, saveInGroup: saveInGroup, completionHandler)
18891906
}
18901907
#endif
18911908

@@ -1914,10 +1931,10 @@ extension Uploadcare {
19141931
/// - store: A flag indicating if we should store your outputs.
19151932
/// - Returns: Operation response.
19161933
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
1917-
public func convertDocumentsWithSettings(_ tasks: [DocumentConversionJobSettings], store: StoringBehavior? = nil) async throws -> ConvertDocumentsResponse {
1934+
public func convertDocumentsWithSettings(_ tasks: [DocumentConversionJobSettings], store: StoringBehavior? = nil, saveInGroup: Bool? = nil) async throws -> ConvertDocumentsResponse {
19181935
var paths = [String]()
19191936
tasks.forEach({ paths.append($0.stringValue) })
1920-
return try await convertDocuments(paths, store: store)
1937+
return try await convertDocuments(paths, store: store, saveInGroup: saveInGroup)
19211938
}
19221939

19231940
/// Document conversion job status.
@@ -2096,7 +2113,8 @@ extension Uploadcare {
20962113
let storeValue = store == StoringBehavior.auto ? .store : store
20972114
let requestData = ConvertRequestData(
20982115
paths: paths,
2099-
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue
2116+
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue,
2117+
saveInGroup: nil
21002118
)
21012119

21022120
urlRequest.httpBody = try? JSONEncoder().encode(requestData)
@@ -2136,7 +2154,8 @@ extension Uploadcare {
21362154
let storeValue = store == StoringBehavior.auto ? .store : store
21372155
let requestData = ConvertRequestData(
21382156
paths: paths,
2139-
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue
2157+
store: storeValue?.rawValue ?? StoringBehavior.store.rawValue,
2158+
saveInGroup: nil
21402159
)
21412160

21422161
urlRequest.httpBody = try? JSONEncoder().encode(requestData)

0 commit comments

Comments
 (0)