Skip to content

Commit 4291ce2

Browse files
committed
Add an overload initializer for UploadOptions
1 parent fe4407e commit 4291ce2

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

Sources/MuxUploadSDK/PublicAPI/Options/UploadOptions.swift

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public struct UploadOptions {
1313
/// transport the direct upload input to Mux
1414
public struct Transport {
1515

16+
static let defaultChunkSizeInBytes = 8 * 1024 * 1024
17+
1618
/// At least 8M is recommended
1719
public var chunkSizeInBytes: Int
1820

@@ -24,7 +26,7 @@ public struct UploadOptions {
2426
/// size and chunk request retry limit of 3
2527
public static var `default`: Transport {
2628
Transport(
27-
chunkSizeInBytes: 8 * 1024 * 1024,
29+
chunkSizeInBytes: defaultChunkSizeInBytes,
2830
retryLimitPerChunk: 3
2931
)
3032
}
@@ -185,7 +187,7 @@ public struct UploadOptions {
185187
UploadOptions()
186188
}
187189

188-
// MARK: Upload Options Initializer
190+
// MARK: Upload Options Initializers
189191

190192
/// - Parameters:
191193
/// - inputStandardization: options to enable or
@@ -207,6 +209,33 @@ public struct UploadOptions {
207209
self.eventTracking = eventTracking
208210
}
209211

212+
/// - Parameters:
213+
/// - eventTracking: event tracking options for the
214+
/// direct upload
215+
/// - inputStandardization: options to enable or
216+
/// disable standardizing the format of the direct
217+
/// upload inputs, it is requested by default. To
218+
/// prevent the SDK from making any changes to the
219+
/// format of the input use ``UploadOptions.InputStandardization.skipped``
220+
/// - chunkSize: the size of each file chunk in
221+
/// bytes the SDK sends when uploading, default
222+
/// value is 8MB
223+
/// - retriesPerChunk: number of retry attempts
224+
/// if the chunk request fails, default value is 3
225+
public init(
226+
eventTracking: EventTracking = .default,
227+
inputStandardization: InputStandardization = .default,
228+
chunkSizeInBytes: Int = 8 * 1024 * 1024,
229+
retryLimitPerChunk: Int = 3
230+
) {
231+
self.eventTracking = eventTracking
232+
self.inputStandardization = inputStandardization
233+
self.transport = Transport(
234+
chunkSizeInBytes: chunkSizeInBytes,
235+
retryLimitPerChunk: retryLimitPerChunk
236+
)
237+
}
238+
210239
}
211240

212241
// MARK: - Extensions

0 commit comments

Comments
 (0)