Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add an overload initializer for UploadOptions #81

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion Sources/MuxUploadSDK/PublicAPI/Options/UploadOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public struct UploadOptions {
UploadOptions()
}

// MARK: Upload Options Initializer
// MARK: Upload Options Initializers

/// - Parameters:
/// - inputStandardization: options to enable or
Expand All @@ -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,
Copy link
Contributor Author

@andrewjl-mux andrewjl-mux Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swift won't allow use of a constant as a default argument in a publicly accessible method unless it is also made publicly accessible. Need to think through the right spelling for these before exposing so for now they're (sadly) repeated literals.

retryLimitPerChunk: Int = 3
) {
self.eventTracking = eventTracking
self.inputStandardization = inputStandardization
self.transport = Transport(
chunkSizeInBytes: chunkSizeInBytes,
retryLimitPerChunk: retryLimitPerChunk
)
}

}

// MARK: - Extensions
Expand Down