mirror of
https://github.com/appwrite/sdk-for-apple.git
synced 2026-11-18 20:53:33 +00:00
* chore: update Apple SDK to 18.3.0 * chore: update Apple SDK to 18.3.0 * chore: update Apple SDK to 19.0.0 * docs: state the SDK targets Appwrite server version 2.0.x * fix: regenerate with the latest sdk-generator and add auto image gravity
44 lines
892 B
Swift
44 lines
892 B
Swift
import Foundation
|
|
import JSONCodable
|
|
|
|
/// JWT
|
|
open class Jwt: Codable {
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case jwt = "jwt"
|
|
}
|
|
|
|
/// JWT encoded string.
|
|
public let jwt: String
|
|
|
|
init(
|
|
jwt: String
|
|
) {
|
|
self.jwt = jwt
|
|
}
|
|
|
|
public required init(from decoder: Decoder) throws {
|
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
|
|
self.jwt = try container.decode(String.self, forKey: .jwt)
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
|
|
try container.encode(jwt, forKey: .jwt)
|
|
}
|
|
|
|
public func toMap() -> [String: Any] {
|
|
return [
|
|
"jwt": jwt as Any
|
|
]
|
|
}
|
|
|
|
public static func from(map: [String: Any]) -> Jwt {
|
|
return Jwt(
|
|
jwt: map["jwt"] as! String
|
|
)
|
|
}
|
|
}
|