Skip to content

Commit

Permalink
Nests FormDataProvider under MultipartFormData.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljubinkovicdj93 committed Mar 22, 2023
1 parent f43c09c commit d4578c6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Sources/Moya/MultipartFormData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import Alamofire

/// Represents "multipart/form-data" for an upload.
public struct MultipartFormData: Hashable {

/// Method to provide the form data.
public enum FormDataProvider: Hashable {
case data(Foundation.Data)
case file(URL)
case stream(InputStream, UInt64)
}

/// `FileManager` to use for file operations, if needed. `FileManager.default` by default.
public let fileManager: FileManager

Expand All @@ -28,22 +36,15 @@ extension MultipartFormData: ExpressibleByArrayLiteral {
/// Represents the body part of "multipart/form-data" for an upload.
public struct MultipartFormBodyPart: Hashable {

/// Method to provide the form data.
public enum FormDataProvider: Hashable {
case data(Foundation.Data)
case file(URL)
case stream(InputStream, UInt64)
}

public init(provider: FormDataProvider, name: String, fileName: String? = nil, mimeType: String? = nil) {
public init(provider: MultipartFormData.FormDataProvider, name: String, fileName: String? = nil, mimeType: String? = nil) {
self.provider = provider
self.name = name
self.fileName = fileName
self.mimeType = mimeType
}

/// The method being used for providing form data.
public let provider: FormDataProvider
public let provider: MultipartFormData.FormDataProvider

/// The name.
public let name: String
Expand Down

0 comments on commit d4578c6

Please sign in to comment.