Tusker/Pachyderm/Request/FormAttachment.swift

36 lines
913 B
Swift
Raw Permalink Normal View History

2018-09-11 14:52:21 +00:00
//
// Attachment.swift
// Pachyderm
//
// Created by Shadowfacts on 9/8/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import Foundation
public struct FormAttachment {
let mimeType: String
let data: Data
let fileName: String
public init(mimeType: String, data: Data, fileName: String) {
self.mimeType = mimeType
self.data = data
self.fileName = fileName
}
}
extension FormAttachment {
public init(jepgData data: Data, fileName: String = "file.jpg") {
self.init(mimeType: "image/jpg", data: data, fileName: fileName)
}
public init(pngData data: Data, fileName: String = "file.png") {
self.init(mimeType: "image/png", data: data, fileName: fileName)
}
public init(gifData data: Data, fileName: String = "file.gif") {
self.init(mimeType: "image/gif", data: data, fileName: fileName)
}
}