Update API [skip ci]

This commit is contained in:
Ilya Laktyushin
2021-10-07 03:53:17 +04:00
parent 54de3e7b9f
commit ffe60b7c9f
7 changed files with 44 additions and 23 deletions

View File

@@ -11,9 +11,9 @@ public struct ExportedInvitation: Codable, Equatable {
public let expireDate: Int32?
public let usageLimit: Int32?
public let count: Int32?
public let approvedDate: Int32?
public let requestedCount: Int32?
public init(link: String, isPermanent: Bool, requestApproval: Bool, isRevoked: Bool, adminId: PeerId, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, count: Int32?, approvedDate: Int32?) {
public init(link: String, isPermanent: Bool, requestApproval: Bool, isRevoked: Bool, adminId: PeerId, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, count: Int32?, requestedCount: Int32?) {
self.link = link
self.isPermanent = isPermanent
self.requestApproval = requestApproval
@@ -24,7 +24,7 @@ public struct ExportedInvitation: Codable, Equatable {
self.expireDate = expireDate
self.usageLimit = usageLimit
self.count = count
self.approvedDate = approvedDate
self.requestedCount = requestedCount
}
public init(from decoder: Decoder) throws {
@@ -40,7 +40,7 @@ public struct ExportedInvitation: Codable, Equatable {
self.expireDate = try container.decodeIfPresent(Int32.self, forKey: "expireDate")
self.usageLimit = try container.decodeIfPresent(Int32.self, forKey: "usageLimit")
self.count = try container.decodeIfPresent(Int32.self, forKey: "count")
self.approvedDate = try? container.decodeIfPresent(Int32.self, forKey: "approvedDate")
self.requestedCount = try? container.decodeIfPresent(Int32.self, forKey: "requestedCount")
}
public func encode(to encoder: Encoder) throws {
@@ -56,14 +56,14 @@ public struct ExportedInvitation: Codable, Equatable {
try container.encodeIfPresent(self.expireDate, forKey: "expireDate")
try container.encodeIfPresent(self.usageLimit, forKey: "usageLimit")
try container.encodeIfPresent(self.count, forKey: "count")
try container.encodeIfPresent(self.approvedDate, forKey: "approvedDate")
try container.encodeIfPresent(self.requestedCount, forKey: "requestedCount")
}
public static func ==(lhs: ExportedInvitation, rhs: ExportedInvitation) -> Bool {
return lhs.link == rhs.link && lhs.isPermanent == rhs.isPermanent && lhs.requestApproval == rhs.requestApproval && lhs.isRevoked == rhs.isRevoked && lhs.adminId == rhs.adminId && lhs.date == rhs.date && lhs.startDate == rhs.startDate && lhs.expireDate == rhs.expireDate && lhs.usageLimit == rhs.usageLimit && lhs.count == rhs.count && lhs.approvedDate == rhs.approvedDate
return lhs.link == rhs.link && lhs.isPermanent == rhs.isPermanent && lhs.requestApproval == rhs.requestApproval && lhs.isRevoked == rhs.isRevoked && lhs.adminId == rhs.adminId && lhs.date == rhs.date && lhs.startDate == rhs.startDate && lhs.expireDate == rhs.expireDate && lhs.usageLimit == rhs.usageLimit && lhs.count == rhs.count && lhs.requestedCount == rhs.requestedCount
}
public func withUpdated(isRevoked: Bool) -> ExportedInvitation {
return ExportedInvitation(link: self.link, isPermanent: self.isPermanent, requestApproval: self.requestApproval, isRevoked: isRevoked, adminId: self.adminId, date: self.date, startDate: self.startDate, expireDate: self.expireDate, usageLimit: self.usageLimit, count: self.count, approvedDate: self.approvedDate)
return ExportedInvitation(link: self.link, isPermanent: self.isPermanent, requestApproval: self.requestApproval, isRevoked: isRevoked, adminId: self.adminId, date: self.date, startDate: self.startDate, expireDate: self.expireDate, usageLimit: self.usageLimit, count: self.count, requestedCount: self.requestedCount)
}
}