Multipart

public enum Multipart
extension Multipart: CustomStringConvertible
extension Multipart: RawRepresentable
extension Multipart: MediaSubtype
extension Multipart: Hashable

Represents the multipart media type. See the official documentation for details.

You typically use Multipart as a MediaType.

let multipart = Multipart.formData()
let mediaType = MediaType.multipart(multipart) // Creates: multipart/form-data

You can use standard switch statement to access multipart values.

func isSupported(multipart: Multipart) -> Bool {
  switch multipart {
  case .formData, .mixed: return true
  default: return false
  }
}

isSupported(audio: .formData()) // Returns: true
isSupported(audio: .mixed()) // Returns: true
isSupported(audio: .voiceMessage()) // Returns: false

See also

MediaType