Skip to content
Snippets Groups Projects
Select Git revision
  • c381331529de5fd3b3ca357d3482223be78fcac5
  • main default protected
  • development
  • integration
  • v1.1.5
  • v1.1.4
  • v1.1.3
  • v1.1.2
  • v1.1.1
  • v1.1.0
  • v1.0.0
11 results

MessengerWaitForNodes.swift

Blame
  • FileSend.swift 740 B
    import Foundation
    
    public struct FileSend: Equatable {
      public init(
        name: String,
        type: String,
        preview: Data,
        contents: Data
      ) {
        self.name = name
        self.type = type
        self.preview = preview
        self.contents = contents
      }
    
      public var name: String
      public var type: String
      public var preview: Data
      public var contents: Data
    }
    
    extension FileSend: Codable {
      enum CodingKeys: String, CodingKey {
        case name = "Name"
        case type = "Type"
        case preview = "Preview"
        case contents = "Contents"
      }
    
      public static func decode(_ data: Data) throws -> Self {
        try JSONDecoder().decode(Self.self, from: data)
      }
    
      public func encode() throws -> Data {
        try JSONEncoder().encode(self)
      }
    }