forked from shadowfacts/Tusker
36 lines
913 B
Swift
36 lines
913 B
Swift
//
|
|
// 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)
|
|
}
|
|
}
|