Skip to content
Snippets Groups Projects
Select Git revision
  • c5d4b73a10e76455da5800a56450c4a6cce239ad
  • release default
  • master protected
  • hotfix/gtnNoToken
  • XX-4441
  • Jakub/rootless-CI
  • jonah/refactorProviders
  • Ace/Huawei
  • AceVentura/AccountBackup
  • hotfix/delete-error
  • waitingRoundsRewrite
  • dev
  • quantumSecure
  • hotfix/ratelimit
  • fullRateLimit
  • XX-3564/TlsCipherSuite
  • hotfix/notifications-db
  • hotfix/groupNotification
  • Project/LastMile
  • notls
  • url-repo-rename
  • v2.3.0
  • v2.2.0
  • v2.1.0
  • v2.0.0
  • v1.0.0
26 results

main.go

Blame
  • Progress.swift 774 B
    import Foundation
    
    public struct Progress: Equatable {
      public init(
        completed: Bool,
        transmitted: Int,
        total: Int,
        error: String?
      ) {
        self.completed = completed
        self.transmitted = transmitted
        self.total = total
        self.error = error
      }
    
      public var completed: Bool
      public var transmitted: Int
      public var total: Int
      public var error: String?
    }
    
    extension Progress: Codable {
      enum CodingKeys: String, CodingKey {
        case completed = "Completed"
        case transmitted = "Transmitted"
        case total = "Total"
        case error = "Err"
      }
    
      public static func decode(_ data: Data) throws -> Self {
        try JSONDecoder().decode(Self.self, from: data)
      }
    
      public func encode() throws -> Data {
        try JSONEncoder().encode(self)
      }
    }