From 13ce78a1917a898c929c60d02c73c3042a582350 Mon Sep 17 00:00:00 2001 From: AJ Lauer Barinov Date: Thu, 27 Jul 2023 13:11:24 -0700 Subject: [PATCH] Add an overload initializer for UploadOptions --- .../PublicAPI/Options/UploadOptions.swift | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Sources/MuxUploadSDK/PublicAPI/Options/UploadOptions.swift b/Sources/MuxUploadSDK/PublicAPI/Options/UploadOptions.swift index a948a8f1..5f8f5d40 100644 --- a/Sources/MuxUploadSDK/PublicAPI/Options/UploadOptions.swift +++ b/Sources/MuxUploadSDK/PublicAPI/Options/UploadOptions.swift @@ -185,7 +185,7 @@ public struct UploadOptions { UploadOptions() } - // MARK: Upload Options Initializer + // MARK: Upload Options Initializers /// - Parameters: /// - inputStandardization: options to enable or @@ -207,6 +207,33 @@ public struct UploadOptions { self.eventTracking = eventTracking } + /// - Parameters: + /// - eventTracking: event tracking options for the + /// direct upload + /// - inputStandardization: options to enable or + /// disable standardizing the format of the direct + /// upload inputs, it is requested by default. To + /// prevent the SDK from making any changes to the + /// format of the input use ``UploadOptions.InputStandardization.skipped`` + /// - chunkSize: the size of each file chunk in + /// bytes the SDK sends when uploading, default + /// value is 8MB + /// - retriesPerChunk: number of retry attempts + /// if the chunk request fails, default value is 3 + public init( + eventTracking: EventTracking = .default, + inputStandardization: InputStandardization = .default, + chunkSizeInBytes: Int = 8 * 1024 * 1024, + retryLimitPerChunk: Int = 3 + ) { + self.eventTracking = eventTracking + self.inputStandardization = inputStandardization + self.transport = Transport( + chunkSizeInBytes: chunkSizeInBytes, + retryLimitPerChunk: retryLimitPerChunk + ) + } + } // MARK: - Extensions