Update API [skip ci]

This commit is contained in:
Ilya Laktyushin
2021-01-13 18:48:29 +03:00
parent 545608e8d4
commit b078caa4f4
6 changed files with 42 additions and 62 deletions

View File

@@ -2,16 +2,18 @@ import Postbox
public struct ExportedInvitation: PostboxCoding, Equatable {
public let link: String
public let revoked: Bool
public let isPermanent: Bool
public let isRevoked: Bool
public let adminId: PeerId
public let date: Int32
public let expireDate: Int32?
public let usageLimit: Int32?
public let count: Int32?
public init(link: String, revoked: Bool, adminId: PeerId, date: Int32, expireDate: Int32?, usageLimit: Int32?, count: Int32?) {
public init(link: String, isPermanent: Bool, isRevoked: Bool, adminId: PeerId, date: Int32, expireDate: Int32?, usageLimit: Int32?, count: Int32?) {
self.link = link
self.revoked = revoked
self.isPermanent = isPermanent
self.isRevoked = isRevoked
self.adminId = adminId
self.date = date
self.expireDate = expireDate
@@ -21,7 +23,8 @@ public struct ExportedInvitation: PostboxCoding, Equatable {
public init(decoder: PostboxDecoder) {
self.link = decoder.decodeStringForKey("l", orElse: "")
self.revoked = decoder.decodeBoolForKey("revoked", orElse: false)
self.isPermanent = decoder.decodeBoolForKey("permanent", orElse: false)
self.isRevoked = decoder.decodeBoolForKey("revoked", orElse: false)
self.adminId = PeerId(decoder.decodeInt64ForKey("adminId", orElse: 0))
self.date = decoder.decodeInt32ForKey("date", orElse: 0)
self.expireDate = decoder.decodeOptionalInt32ForKey("expireDate")
@@ -31,7 +34,8 @@ public struct ExportedInvitation: PostboxCoding, Equatable {
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeString(self.link, forKey: "l")
encoder.encodeBool(self.revoked, forKey: "revoked")
encoder.encodeBool(self.isPermanent, forKey: "permanent")
encoder.encodeBool(self.isRevoked, forKey: "revoked")
encoder.encodeInt64(self.adminId.toInt64(), forKey: "adminId")
encoder.encodeInt32(self.date, forKey: "date")
if let expireDate = self.expireDate {
@@ -52,6 +56,6 @@ public struct ExportedInvitation: PostboxCoding, Equatable {
}
public static func ==(lhs: ExportedInvitation, rhs: ExportedInvitation) -> Bool {
return lhs.link == rhs.link && lhs.revoked == rhs.revoked && lhs.adminId == rhs.adminId && lhs.date == rhs.date && lhs.expireDate == rhs.expireDate && lhs.usageLimit == rhs.usageLimit && lhs.count == rhs.count
return lhs.link == rhs.link && lhs.isPermanent == rhs.isPermanent && lhs.isRevoked == rhs.isRevoked && lhs.adminId == rhs.adminId && lhs.date == rhs.date && lhs.expireDate == rhs.expireDate && lhs.usageLimit == rhs.usageLimit && lhs.count == rhs.count
}
}