From 96bfab5d93236be51315f982f998a3b45efeb50e Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Thu, 5 Nov 2020 14:56:15 +1100 Subject: [PATCH] Re-generate protos --- Podfile | 1 + Podfile.lock | 3 +- Pods | 2 +- SessionMessagingKit/ControlMessage.swift | 4 + .../Protos/Generated/SNProto.swift | 7077 +++++++++++++++++ .../Protos/Generated/SessionProtos.pb.swift | 5199 ++++++++++++ SessionMessagingKit/Protos/Makefile | 12 + .../Protos/SessionProtos.proto | 475 ++ Signal.xcodeproj/project.pbxproj | 24 + 9 files changed, 12795 insertions(+), 2 deletions(-) create mode 100644 SessionMessagingKit/Protos/Generated/SNProto.swift create mode 100644 SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift create mode 100644 SessionMessagingKit/Protos/Makefile create mode 100644 SessionMessagingKit/Protos/SessionProtos.proto diff --git a/Podfile b/Podfile index 832910280..b9868d936 100644 --- a/Podfile +++ b/Podfile @@ -107,6 +107,7 @@ end target 'SessionMessagingKit' do pod 'PromiseKit', :inhibit_warnings => true + pod 'SwiftProtobuf', '~> 1.5.0', :inhibit_warnings => true end target 'SessionSnodeKit' do diff --git a/Podfile.lock b/Podfile.lock index bbf6ea8b9..6764fdd27 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -227,6 +227,7 @@ DEPENDENCIES: - SQLCipher (>= 4.0.1) - SSZipArchive - Starscream (from `https://github.com/signalapp/Starscream.git`, branch `signal-release`) + - SwiftProtobuf (~> 1.5.0) - YapDatabase/SQLCipher (from `https://github.com/signalapp/YapDatabase.git`, branch `signal-release`) - YYImage (from `https://github.com/signalapp/YYImage`) - ZXingObjC (~> 3.6.4) @@ -339,6 +340,6 @@ SPEC CHECKSUMS: YYImage: 6db68da66f20d9f169ceb94dfb9947c3867b9665 ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: 4a5edd85603c82fca8290ab8a0db1231bbe418b2 +PODFILE CHECKSUM: 2834fe9a900f54e92e43b8f13c0df20409683f26 COCOAPODS: 1.10.0.rc.1 diff --git a/Pods b/Pods index 7d18aa682..ceaefa107 160000 --- a/Pods +++ b/Pods @@ -1 +1 @@ -Subproject commit 7d18aa682b4d5d16403b2cbcd500d6bf055573db +Subproject commit ceaefa107175deb5bddd8c8556491f4ebd548046 diff --git a/SessionMessagingKit/ControlMessage.swift b/SessionMessagingKit/ControlMessage.swift index 8f41ac52a..6b7b5b2d9 100644 --- a/SessionMessagingKit/ControlMessage.swift +++ b/SessionMessagingKit/ControlMessage.swift @@ -5,4 +5,8 @@ public class ControlMessage : Message { public enum Kind { case sessionRequest } + + func foo() { + + } } diff --git a/SessionMessagingKit/Protos/Generated/SNProto.swift b/SessionMessagingKit/Protos/Generated/SNProto.swift new file mode 100644 index 000000000..68afedae4 --- /dev/null +++ b/SessionMessagingKit/Protos/Generated/SNProto.swift @@ -0,0 +1,7077 @@ +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// + +import Foundation + +// WARNING: This code is generated. Only edit within the markers. + +private let logTag = "SNProto" + +public enum SNProtoError: Error { + case invalidProtobuf(description: String) +} + +// MARK: - SNProtoEnvelope + +@objc public class SNProtoEnvelope: NSObject { + + // MARK: - SNProtoEnvelopeType + + @objc public enum SNProtoEnvelopeType: Int32 { + case unknown = 0 + case ciphertext = 1 + case keyExchange = 2 + case prekeyBundle = 3 + case receipt = 5 + case unidentifiedSender = 6 + case closedGroupCiphertext = 7 + case fallbackMessage = 101 + } + + private class func SNProtoEnvelopeTypeWrap(_ value: SessionProtos_Envelope.TypeEnum) -> SNProtoEnvelopeType { + switch value { + case .unknown: return .unknown + case .ciphertext: return .ciphertext + case .keyExchange: return .keyExchange + case .prekeyBundle: return .prekeyBundle + case .receipt: return .receipt + case .unidentifiedSender: return .unidentifiedSender + case .closedGroupCiphertext: return .closedGroupCiphertext + case .fallbackMessage: return .fallbackMessage + } + } + + private class func SNProtoEnvelopeTypeUnwrap(_ value: SNProtoEnvelopeType) -> SessionProtos_Envelope.TypeEnum { + switch value { + case .unknown: return .unknown + case .ciphertext: return .ciphertext + case .keyExchange: return .keyExchange + case .prekeyBundle: return .prekeyBundle + case .receipt: return .receipt + case .unidentifiedSender: return .unidentifiedSender + case .closedGroupCiphertext: return .closedGroupCiphertext + case .fallbackMessage: return .fallbackMessage + } + } + + // MARK: - SNProtoEnvelopeBuilder + + @objc public class func builder(type: SNProtoEnvelopeType, timestamp: UInt64) -> SNProtoEnvelopeBuilder { + return SNProtoEnvelopeBuilder(type: type, timestamp: timestamp) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoEnvelopeBuilder { + let builder = SNProtoEnvelopeBuilder(type: type, timestamp: timestamp) + if let _value = source { + builder.setSource(_value) + } + if hasSourceDevice { + builder.setSourceDevice(sourceDevice) + } + if let _value = relay { + builder.setRelay(_value) + } + if let _value = legacyMessage { + builder.setLegacyMessage(_value) + } + if let _value = content { + builder.setContent(_value) + } + if let _value = serverGuid { + builder.setServerGuid(_value) + } + if hasServerTimestamp { + builder.setServerTimestamp(serverTimestamp) + } + return builder + } + + @objc public class SNProtoEnvelopeBuilder: NSObject { + + private var proto = SessionProtos_Envelope() + + @objc fileprivate override init() {} + + @objc fileprivate init(type: SNProtoEnvelopeType, timestamp: UInt64) { + super.init() + + setType(type) + setTimestamp(timestamp) + } + + @objc public func setType(_ valueParam: SNProtoEnvelopeType) { + proto.type = SNProtoEnvelopeTypeUnwrap(valueParam) + } + + @objc public func setSource(_ valueParam: String) { + proto.source = valueParam + } + + @objc public func setSourceDevice(_ valueParam: UInt32) { + proto.sourceDevice = valueParam + } + + @objc public func setRelay(_ valueParam: String) { + proto.relay = valueParam + } + + @objc public func setTimestamp(_ valueParam: UInt64) { + proto.timestamp = valueParam + } + + @objc public func setLegacyMessage(_ valueParam: Data) { + proto.legacyMessage = valueParam + } + + @objc public func setContent(_ valueParam: Data) { + proto.content = valueParam + } + + @objc public func setServerGuid(_ valueParam: String) { + proto.serverGuid = valueParam + } + + @objc public func setServerTimestamp(_ valueParam: UInt64) { + proto.serverTimestamp = valueParam + } + + @objc public func build() throws -> SNProtoEnvelope { + return try SNProtoEnvelope.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoEnvelope.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_Envelope + + @objc public let type: SNProtoEnvelopeType + + @objc public let timestamp: UInt64 + + @objc public var source: String? { + guard proto.hasSource else { + return nil + } + return proto.source + } + @objc public var hasSource: Bool { + return proto.hasSource + } + + @objc public var sourceDevice: UInt32 { + return proto.sourceDevice + } + @objc public var hasSourceDevice: Bool { + return proto.hasSourceDevice + } + + @objc public var relay: String? { + guard proto.hasRelay else { + return nil + } + return proto.relay + } + @objc public var hasRelay: Bool { + return proto.hasRelay + } + + @objc public var legacyMessage: Data? { + guard proto.hasLegacyMessage else { + return nil + } + return proto.legacyMessage + } + @objc public var hasLegacyMessage: Bool { + return proto.hasLegacyMessage + } + + @objc public var content: Data? { + guard proto.hasContent else { + return nil + } + return proto.content + } + @objc public var hasContent: Bool { + return proto.hasContent + } + + @objc public var serverGuid: String? { + guard proto.hasServerGuid else { + return nil + } + return proto.serverGuid + } + @objc public var hasServerGuid: Bool { + return proto.hasServerGuid + } + + @objc public var serverTimestamp: UInt64 { + return proto.serverTimestamp + } + @objc public var hasServerTimestamp: Bool { + return proto.hasServerTimestamp + } + + private init(proto: SessionProtos_Envelope, + type: SNProtoEnvelopeType, + timestamp: UInt64) { + self.proto = proto + self.type = type + self.timestamp = timestamp + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoEnvelope { + let proto = try SessionProtos_Envelope(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_Envelope) throws -> SNProtoEnvelope { + guard proto.hasType else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type") + } + let type = SNProtoEnvelopeTypeWrap(proto.type) + + guard proto.hasTimestamp else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: timestamp") + } + let timestamp = proto.timestamp + + // MARK: - Begin Validation Logic for SNProtoEnvelope - + + // MARK: - End Validation Logic for SNProtoEnvelope - + + let result = SNProtoEnvelope(proto: proto, + type: type, + timestamp: timestamp) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoEnvelope { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoEnvelope.SNProtoEnvelopeBuilder { + @objc public func buildIgnoringErrors() -> SNProtoEnvelope? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoTypingMessage + +@objc public class SNProtoTypingMessage: NSObject { + + // MARK: - SNProtoTypingMessageAction + + @objc public enum SNProtoTypingMessageAction: Int32 { + case started = 0 + case stopped = 1 + } + + private class func SNProtoTypingMessageActionWrap(_ value: SessionProtos_TypingMessage.Action) -> SNProtoTypingMessageAction { + switch value { + case .started: return .started + case .stopped: return .stopped + } + } + + private class func SNProtoTypingMessageActionUnwrap(_ value: SNProtoTypingMessageAction) -> SessionProtos_TypingMessage.Action { + switch value { + case .started: return .started + case .stopped: return .stopped + } + } + + // MARK: - SNProtoTypingMessageBuilder + + @objc public class func builder(timestamp: UInt64, action: SNProtoTypingMessageAction) -> SNProtoTypingMessageBuilder { + return SNProtoTypingMessageBuilder(timestamp: timestamp, action: action) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoTypingMessageBuilder { + let builder = SNProtoTypingMessageBuilder(timestamp: timestamp, action: action) + if let _value = groupID { + builder.setGroupID(_value) + } + return builder + } + + @objc public class SNProtoTypingMessageBuilder: NSObject { + + private var proto = SessionProtos_TypingMessage() + + @objc fileprivate override init() {} + + @objc fileprivate init(timestamp: UInt64, action: SNProtoTypingMessageAction) { + super.init() + + setTimestamp(timestamp) + setAction(action) + } + + @objc public func setTimestamp(_ valueParam: UInt64) { + proto.timestamp = valueParam + } + + @objc public func setAction(_ valueParam: SNProtoTypingMessageAction) { + proto.action = SNProtoTypingMessageActionUnwrap(valueParam) + } + + @objc public func setGroupID(_ valueParam: Data) { + proto.groupID = valueParam + } + + @objc public func build() throws -> SNProtoTypingMessage { + return try SNProtoTypingMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoTypingMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_TypingMessage + + @objc public let timestamp: UInt64 + + @objc public let action: SNProtoTypingMessageAction + + @objc public var groupID: Data? { + guard proto.hasGroupID else { + return nil + } + return proto.groupID + } + @objc public var hasGroupID: Bool { + return proto.hasGroupID + } + + private init(proto: SessionProtos_TypingMessage, + timestamp: UInt64, + action: SNProtoTypingMessageAction) { + self.proto = proto + self.timestamp = timestamp + self.action = action + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoTypingMessage { + let proto = try SessionProtos_TypingMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_TypingMessage) throws -> SNProtoTypingMessage { + guard proto.hasTimestamp else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: timestamp") + } + let timestamp = proto.timestamp + + guard proto.hasAction else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: action") + } + let action = SNProtoTypingMessageActionWrap(proto.action) + + // MARK: - Begin Validation Logic for SNProtoTypingMessage - + + // MARK: - End Validation Logic for SNProtoTypingMessage - + + let result = SNProtoTypingMessage(proto: proto, + timestamp: timestamp, + action: action) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoTypingMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoTypingMessage.SNProtoTypingMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoTypingMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoContent + +@objc public class SNProtoContent: NSObject { + + // MARK: - SNProtoContentBuilder + + @objc public class func builder() -> SNProtoContentBuilder { + return SNProtoContentBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoContentBuilder { + let builder = SNProtoContentBuilder() + if let _value = dataMessage { + builder.setDataMessage(_value) + } + if let _value = syncMessage { + builder.setSyncMessage(_value) + } + if let _value = callMessage { + builder.setCallMessage(_value) + } + if let _value = nullMessage { + builder.setNullMessage(_value) + } + if let _value = receiptMessage { + builder.setReceiptMessage(_value) + } + if let _value = typingMessage { + builder.setTypingMessage(_value) + } + if let _value = prekeyBundleMessage { + builder.setPrekeyBundleMessage(_value) + } + if let _value = lokiDeviceLinkMessage { + builder.setLokiDeviceLinkMessage(_value) + } + return builder + } + + @objc public class SNProtoContentBuilder: NSObject { + + private var proto = SessionProtos_Content() + + @objc fileprivate override init() {} + + @objc public func setDataMessage(_ valueParam: SNProtoDataMessage) { + proto.dataMessage = valueParam.proto + } + + @objc public func setSyncMessage(_ valueParam: SNProtoSyncMessage) { + proto.syncMessage = valueParam.proto + } + + @objc public func setCallMessage(_ valueParam: SNProtoCallMessage) { + proto.callMessage = valueParam.proto + } + + @objc public func setNullMessage(_ valueParam: SNProtoNullMessage) { + proto.nullMessage = valueParam.proto + } + + @objc public func setReceiptMessage(_ valueParam: SNProtoReceiptMessage) { + proto.receiptMessage = valueParam.proto + } + + @objc public func setTypingMessage(_ valueParam: SNProtoTypingMessage) { + proto.typingMessage = valueParam.proto + } + + @objc public func setPrekeyBundleMessage(_ valueParam: SNProtoPrekeyBundleMessage) { + proto.prekeyBundleMessage = valueParam.proto + } + + @objc public func setLokiDeviceLinkMessage(_ valueParam: SNProtoLokiDeviceLinkMessage) { + proto.lokiDeviceLinkMessage = valueParam.proto + } + + @objc public func build() throws -> SNProtoContent { + return try SNProtoContent.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoContent.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_Content + + @objc public let dataMessage: SNProtoDataMessage? + + @objc public let syncMessage: SNProtoSyncMessage? + + @objc public let callMessage: SNProtoCallMessage? + + @objc public let nullMessage: SNProtoNullMessage? + + @objc public let receiptMessage: SNProtoReceiptMessage? + + @objc public let typingMessage: SNProtoTypingMessage? + + @objc public let prekeyBundleMessage: SNProtoPrekeyBundleMessage? + + @objc public let lokiDeviceLinkMessage: SNProtoLokiDeviceLinkMessage? + + private init(proto: SessionProtos_Content, + dataMessage: SNProtoDataMessage?, + syncMessage: SNProtoSyncMessage?, + callMessage: SNProtoCallMessage?, + nullMessage: SNProtoNullMessage?, + receiptMessage: SNProtoReceiptMessage?, + typingMessage: SNProtoTypingMessage?, + prekeyBundleMessage: SNProtoPrekeyBundleMessage?, + lokiDeviceLinkMessage: SNProtoLokiDeviceLinkMessage?) { + self.proto = proto + self.dataMessage = dataMessage + self.syncMessage = syncMessage + self.callMessage = callMessage + self.nullMessage = nullMessage + self.receiptMessage = receiptMessage + self.typingMessage = typingMessage + self.prekeyBundleMessage = prekeyBundleMessage + self.lokiDeviceLinkMessage = lokiDeviceLinkMessage + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoContent { + let proto = try SessionProtos_Content(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_Content) throws -> SNProtoContent { + var dataMessage: SNProtoDataMessage? = nil + if proto.hasDataMessage { + dataMessage = try SNProtoDataMessage.parseProto(proto.dataMessage) + } + + var syncMessage: SNProtoSyncMessage? = nil + if proto.hasSyncMessage { + syncMessage = try SNProtoSyncMessage.parseProto(proto.syncMessage) + } + + var callMessage: SNProtoCallMessage? = nil + if proto.hasCallMessage { + callMessage = try SNProtoCallMessage.parseProto(proto.callMessage) + } + + var nullMessage: SNProtoNullMessage? = nil + if proto.hasNullMessage { + nullMessage = try SNProtoNullMessage.parseProto(proto.nullMessage) + } + + var receiptMessage: SNProtoReceiptMessage? = nil + if proto.hasReceiptMessage { + receiptMessage = try SNProtoReceiptMessage.parseProto(proto.receiptMessage) + } + + var typingMessage: SNProtoTypingMessage? = nil + if proto.hasTypingMessage { + typingMessage = try SNProtoTypingMessage.parseProto(proto.typingMessage) + } + + var prekeyBundleMessage: SNProtoPrekeyBundleMessage? = nil + if proto.hasPrekeyBundleMessage { + prekeyBundleMessage = try SNProtoPrekeyBundleMessage.parseProto(proto.prekeyBundleMessage) + } + + var lokiDeviceLinkMessage: SNProtoLokiDeviceLinkMessage? = nil + if proto.hasLokiDeviceLinkMessage { + lokiDeviceLinkMessage = try SNProtoLokiDeviceLinkMessage.parseProto(proto.lokiDeviceLinkMessage) + } + + // MARK: - Begin Validation Logic for SNProtoContent - + + // MARK: - End Validation Logic for SNProtoContent - + + let result = SNProtoContent(proto: proto, + dataMessage: dataMessage, + syncMessage: syncMessage, + callMessage: callMessage, + nullMessage: nullMessage, + receiptMessage: receiptMessage, + typingMessage: typingMessage, + prekeyBundleMessage: prekeyBundleMessage, + lokiDeviceLinkMessage: lokiDeviceLinkMessage) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoContent { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoContent.SNProtoContentBuilder { + @objc public func buildIgnoringErrors() -> SNProtoContent? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoPrekeyBundleMessage + +@objc public class SNProtoPrekeyBundleMessage: NSObject { + + // MARK: - SNProtoPrekeyBundleMessageBuilder + + @objc public class func builder() -> SNProtoPrekeyBundleMessageBuilder { + return SNProtoPrekeyBundleMessageBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoPrekeyBundleMessageBuilder { + let builder = SNProtoPrekeyBundleMessageBuilder() + if let _value = identityKey { + builder.setIdentityKey(_value) + } + if hasDeviceID { + builder.setDeviceID(deviceID) + } + if hasPrekeyID { + builder.setPrekeyID(prekeyID) + } + if hasSignedKeyID { + builder.setSignedKeyID(signedKeyID) + } + if let _value = prekey { + builder.setPrekey(_value) + } + if let _value = signedKey { + builder.setSignedKey(_value) + } + if let _value = signature { + builder.setSignature(_value) + } + return builder + } + + @objc public class SNProtoPrekeyBundleMessageBuilder: NSObject { + + private var proto = SessionProtos_PrekeyBundleMessage() + + @objc fileprivate override init() {} + + @objc public func setIdentityKey(_ valueParam: Data) { + proto.identityKey = valueParam + } + + @objc public func setDeviceID(_ valueParam: UInt32) { + proto.deviceID = valueParam + } + + @objc public func setPrekeyID(_ valueParam: UInt32) { + proto.prekeyID = valueParam + } + + @objc public func setSignedKeyID(_ valueParam: UInt32) { + proto.signedKeyID = valueParam + } + + @objc public func setPrekey(_ valueParam: Data) { + proto.prekey = valueParam + } + + @objc public func setSignedKey(_ valueParam: Data) { + proto.signedKey = valueParam + } + + @objc public func setSignature(_ valueParam: Data) { + proto.signature = valueParam + } + + @objc public func build() throws -> SNProtoPrekeyBundleMessage { + return try SNProtoPrekeyBundleMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoPrekeyBundleMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_PrekeyBundleMessage + + @objc public var identityKey: Data? { + guard proto.hasIdentityKey else { + return nil + } + return proto.identityKey + } + @objc public var hasIdentityKey: Bool { + return proto.hasIdentityKey + } + + @objc public var deviceID: UInt32 { + return proto.deviceID + } + @objc public var hasDeviceID: Bool { + return proto.hasDeviceID + } + + @objc public var prekeyID: UInt32 { + return proto.prekeyID + } + @objc public var hasPrekeyID: Bool { + return proto.hasPrekeyID + } + + @objc public var signedKeyID: UInt32 { + return proto.signedKeyID + } + @objc public var hasSignedKeyID: Bool { + return proto.hasSignedKeyID + } + + @objc public var prekey: Data? { + guard proto.hasPrekey else { + return nil + } + return proto.prekey + } + @objc public var hasPrekey: Bool { + return proto.hasPrekey + } + + @objc public var signedKey: Data? { + guard proto.hasSignedKey else { + return nil + } + return proto.signedKey + } + @objc public var hasSignedKey: Bool { + return proto.hasSignedKey + } + + @objc public var signature: Data? { + guard proto.hasSignature else { + return nil + } + return proto.signature + } + @objc public var hasSignature: Bool { + return proto.hasSignature + } + + private init(proto: SessionProtos_PrekeyBundleMessage) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoPrekeyBundleMessage { + let proto = try SessionProtos_PrekeyBundleMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_PrekeyBundleMessage) throws -> SNProtoPrekeyBundleMessage { + // MARK: - Begin Validation Logic for SNProtoPrekeyBundleMessage - + + // MARK: - End Validation Logic for SNProtoPrekeyBundleMessage - + + let result = SNProtoPrekeyBundleMessage(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoPrekeyBundleMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoPrekeyBundleMessage.SNProtoPrekeyBundleMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoPrekeyBundleMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoLokiDeviceLinkMessage + +@objc public class SNProtoLokiDeviceLinkMessage: NSObject { + + // MARK: - SNProtoLokiDeviceLinkMessageBuilder + + @objc public class func builder() -> SNProtoLokiDeviceLinkMessageBuilder { + return SNProtoLokiDeviceLinkMessageBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoLokiDeviceLinkMessageBuilder { + let builder = SNProtoLokiDeviceLinkMessageBuilder() + if let _value = masterPublicKey { + builder.setMasterPublicKey(_value) + } + if let _value = slavePublicKey { + builder.setSlavePublicKey(_value) + } + if let _value = slaveSignature { + builder.setSlaveSignature(_value) + } + if let _value = masterSignature { + builder.setMasterSignature(_value) + } + return builder + } + + @objc public class SNProtoLokiDeviceLinkMessageBuilder: NSObject { + + private var proto = SessionProtos_LokiDeviceLinkMessage() + + @objc fileprivate override init() {} + + @objc public func setMasterPublicKey(_ valueParam: String) { + proto.masterPublicKey = valueParam + } + + @objc public func setSlavePublicKey(_ valueParam: String) { + proto.slavePublicKey = valueParam + } + + @objc public func setSlaveSignature(_ valueParam: Data) { + proto.slaveSignature = valueParam + } + + @objc public func setMasterSignature(_ valueParam: Data) { + proto.masterSignature = valueParam + } + + @objc public func build() throws -> SNProtoLokiDeviceLinkMessage { + return try SNProtoLokiDeviceLinkMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoLokiDeviceLinkMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_LokiDeviceLinkMessage + + @objc public var masterPublicKey: String? { + guard proto.hasMasterPublicKey else { + return nil + } + return proto.masterPublicKey + } + @objc public var hasMasterPublicKey: Bool { + return proto.hasMasterPublicKey + } + + @objc public var slavePublicKey: String? { + guard proto.hasSlavePublicKey else { + return nil + } + return proto.slavePublicKey + } + @objc public var hasSlavePublicKey: Bool { + return proto.hasSlavePublicKey + } + + @objc public var slaveSignature: Data? { + guard proto.hasSlaveSignature else { + return nil + } + return proto.slaveSignature + } + @objc public var hasSlaveSignature: Bool { + return proto.hasSlaveSignature + } + + @objc public var masterSignature: Data? { + guard proto.hasMasterSignature else { + return nil + } + return proto.masterSignature + } + @objc public var hasMasterSignature: Bool { + return proto.hasMasterSignature + } + + private init(proto: SessionProtos_LokiDeviceLinkMessage) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoLokiDeviceLinkMessage { + let proto = try SessionProtos_LokiDeviceLinkMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_LokiDeviceLinkMessage) throws -> SNProtoLokiDeviceLinkMessage { + // MARK: - Begin Validation Logic for SNProtoLokiDeviceLinkMessage - + + // MARK: - End Validation Logic for SNProtoLokiDeviceLinkMessage - + + let result = SNProtoLokiDeviceLinkMessage(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoLokiDeviceLinkMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoLokiDeviceLinkMessage.SNProtoLokiDeviceLinkMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoLokiDeviceLinkMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoCallMessageOffer + +@objc public class SNProtoCallMessageOffer: NSObject { + + // MARK: - SNProtoCallMessageOfferBuilder + + @objc public class func builder(id: UInt64, sessionDescription: String) -> SNProtoCallMessageOfferBuilder { + return SNProtoCallMessageOfferBuilder(id: id, sessionDescription: sessionDescription) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoCallMessageOfferBuilder { + let builder = SNProtoCallMessageOfferBuilder(id: id, sessionDescription: sessionDescription) + return builder + } + + @objc public class SNProtoCallMessageOfferBuilder: NSObject { + + private var proto = SessionProtos_CallMessage.Offer() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: UInt64, sessionDescription: String) { + super.init() + + setId(id) + setSessionDescription(sessionDescription) + } + + @objc public func setId(_ valueParam: UInt64) { + proto.id = valueParam + } + + @objc public func setSessionDescription(_ valueParam: String) { + proto.sessionDescription = valueParam + } + + @objc public func build() throws -> SNProtoCallMessageOffer { + return try SNProtoCallMessageOffer.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoCallMessageOffer.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_CallMessage.Offer + + @objc public let id: UInt64 + + @objc public let sessionDescription: String + + private init(proto: SessionProtos_CallMessage.Offer, + id: UInt64, + sessionDescription: String) { + self.proto = proto + self.id = id + self.sessionDescription = sessionDescription + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoCallMessageOffer { + let proto = try SessionProtos_CallMessage.Offer(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_CallMessage.Offer) throws -> SNProtoCallMessageOffer { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + guard proto.hasSessionDescription else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: sessionDescription") + } + let sessionDescription = proto.sessionDescription + + // MARK: - Begin Validation Logic for SNProtoCallMessageOffer - + + // MARK: - End Validation Logic for SNProtoCallMessageOffer - + + let result = SNProtoCallMessageOffer(proto: proto, + id: id, + sessionDescription: sessionDescription) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoCallMessageOffer { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoCallMessageOffer.SNProtoCallMessageOfferBuilder { + @objc public func buildIgnoringErrors() -> SNProtoCallMessageOffer? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoCallMessageAnswer + +@objc public class SNProtoCallMessageAnswer: NSObject { + + // MARK: - SNProtoCallMessageAnswerBuilder + + @objc public class func builder(id: UInt64, sessionDescription: String) -> SNProtoCallMessageAnswerBuilder { + return SNProtoCallMessageAnswerBuilder(id: id, sessionDescription: sessionDescription) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoCallMessageAnswerBuilder { + let builder = SNProtoCallMessageAnswerBuilder(id: id, sessionDescription: sessionDescription) + return builder + } + + @objc public class SNProtoCallMessageAnswerBuilder: NSObject { + + private var proto = SessionProtos_CallMessage.Answer() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: UInt64, sessionDescription: String) { + super.init() + + setId(id) + setSessionDescription(sessionDescription) + } + + @objc public func setId(_ valueParam: UInt64) { + proto.id = valueParam + } + + @objc public func setSessionDescription(_ valueParam: String) { + proto.sessionDescription = valueParam + } + + @objc public func build() throws -> SNProtoCallMessageAnswer { + return try SNProtoCallMessageAnswer.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoCallMessageAnswer.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_CallMessage.Answer + + @objc public let id: UInt64 + + @objc public let sessionDescription: String + + private init(proto: SessionProtos_CallMessage.Answer, + id: UInt64, + sessionDescription: String) { + self.proto = proto + self.id = id + self.sessionDescription = sessionDescription + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoCallMessageAnswer { + let proto = try SessionProtos_CallMessage.Answer(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_CallMessage.Answer) throws -> SNProtoCallMessageAnswer { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + guard proto.hasSessionDescription else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: sessionDescription") + } + let sessionDescription = proto.sessionDescription + + // MARK: - Begin Validation Logic for SNProtoCallMessageAnswer - + + // MARK: - End Validation Logic for SNProtoCallMessageAnswer - + + let result = SNProtoCallMessageAnswer(proto: proto, + id: id, + sessionDescription: sessionDescription) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoCallMessageAnswer { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoCallMessageAnswer.SNProtoCallMessageAnswerBuilder { + @objc public func buildIgnoringErrors() -> SNProtoCallMessageAnswer? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoCallMessageIceUpdate + +@objc public class SNProtoCallMessageIceUpdate: NSObject { + + // MARK: - SNProtoCallMessageIceUpdateBuilder + + @objc public class func builder(id: UInt64, sdpMid: String, sdpMlineIndex: UInt32, sdp: String) -> SNProtoCallMessageIceUpdateBuilder { + return SNProtoCallMessageIceUpdateBuilder(id: id, sdpMid: sdpMid, sdpMlineIndex: sdpMlineIndex, sdp: sdp) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoCallMessageIceUpdateBuilder { + let builder = SNProtoCallMessageIceUpdateBuilder(id: id, sdpMid: sdpMid, sdpMlineIndex: sdpMlineIndex, sdp: sdp) + return builder + } + + @objc public class SNProtoCallMessageIceUpdateBuilder: NSObject { + + private var proto = SessionProtos_CallMessage.IceUpdate() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: UInt64, sdpMid: String, sdpMlineIndex: UInt32, sdp: String) { + super.init() + + setId(id) + setSdpMid(sdpMid) + setSdpMlineIndex(sdpMlineIndex) + setSdp(sdp) + } + + @objc public func setId(_ valueParam: UInt64) { + proto.id = valueParam + } + + @objc public func setSdpMid(_ valueParam: String) { + proto.sdpMid = valueParam + } + + @objc public func setSdpMlineIndex(_ valueParam: UInt32) { + proto.sdpMlineIndex = valueParam + } + + @objc public func setSdp(_ valueParam: String) { + proto.sdp = valueParam + } + + @objc public func build() throws -> SNProtoCallMessageIceUpdate { + return try SNProtoCallMessageIceUpdate.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoCallMessageIceUpdate.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_CallMessage.IceUpdate + + @objc public let id: UInt64 + + @objc public let sdpMid: String + + @objc public let sdpMlineIndex: UInt32 + + @objc public let sdp: String + + private init(proto: SessionProtos_CallMessage.IceUpdate, + id: UInt64, + sdpMid: String, + sdpMlineIndex: UInt32, + sdp: String) { + self.proto = proto + self.id = id + self.sdpMid = sdpMid + self.sdpMlineIndex = sdpMlineIndex + self.sdp = sdp + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoCallMessageIceUpdate { + let proto = try SessionProtos_CallMessage.IceUpdate(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_CallMessage.IceUpdate) throws -> SNProtoCallMessageIceUpdate { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + guard proto.hasSdpMid else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdpMid") + } + let sdpMid = proto.sdpMid + + guard proto.hasSdpMlineIndex else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdpMlineIndex") + } + let sdpMlineIndex = proto.sdpMlineIndex + + guard proto.hasSdp else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdp") + } + let sdp = proto.sdp + + // MARK: - Begin Validation Logic for SNProtoCallMessageIceUpdate - + + // MARK: - End Validation Logic for SNProtoCallMessageIceUpdate - + + let result = SNProtoCallMessageIceUpdate(proto: proto, + id: id, + sdpMid: sdpMid, + sdpMlineIndex: sdpMlineIndex, + sdp: sdp) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoCallMessageIceUpdate { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoCallMessageIceUpdate.SNProtoCallMessageIceUpdateBuilder { + @objc public func buildIgnoringErrors() -> SNProtoCallMessageIceUpdate? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoCallMessageBusy + +@objc public class SNProtoCallMessageBusy: NSObject { + + // MARK: - SNProtoCallMessageBusyBuilder + + @objc public class func builder(id: UInt64) -> SNProtoCallMessageBusyBuilder { + return SNProtoCallMessageBusyBuilder(id: id) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoCallMessageBusyBuilder { + let builder = SNProtoCallMessageBusyBuilder(id: id) + return builder + } + + @objc public class SNProtoCallMessageBusyBuilder: NSObject { + + private var proto = SessionProtos_CallMessage.Busy() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: UInt64) { + super.init() + + setId(id) + } + + @objc public func setId(_ valueParam: UInt64) { + proto.id = valueParam + } + + @objc public func build() throws -> SNProtoCallMessageBusy { + return try SNProtoCallMessageBusy.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoCallMessageBusy.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_CallMessage.Busy + + @objc public let id: UInt64 + + private init(proto: SessionProtos_CallMessage.Busy, + id: UInt64) { + self.proto = proto + self.id = id + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoCallMessageBusy { + let proto = try SessionProtos_CallMessage.Busy(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_CallMessage.Busy) throws -> SNProtoCallMessageBusy { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + // MARK: - Begin Validation Logic for SNProtoCallMessageBusy - + + // MARK: - End Validation Logic for SNProtoCallMessageBusy - + + let result = SNProtoCallMessageBusy(proto: proto, + id: id) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoCallMessageBusy { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoCallMessageBusy.SNProtoCallMessageBusyBuilder { + @objc public func buildIgnoringErrors() -> SNProtoCallMessageBusy? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoCallMessageHangup + +@objc public class SNProtoCallMessageHangup: NSObject { + + // MARK: - SNProtoCallMessageHangupBuilder + + @objc public class func builder(id: UInt64) -> SNProtoCallMessageHangupBuilder { + return SNProtoCallMessageHangupBuilder(id: id) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoCallMessageHangupBuilder { + let builder = SNProtoCallMessageHangupBuilder(id: id) + return builder + } + + @objc public class SNProtoCallMessageHangupBuilder: NSObject { + + private var proto = SessionProtos_CallMessage.Hangup() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: UInt64) { + super.init() + + setId(id) + } + + @objc public func setId(_ valueParam: UInt64) { + proto.id = valueParam + } + + @objc public func build() throws -> SNProtoCallMessageHangup { + return try SNProtoCallMessageHangup.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoCallMessageHangup.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_CallMessage.Hangup + + @objc public let id: UInt64 + + private init(proto: SessionProtos_CallMessage.Hangup, + id: UInt64) { + self.proto = proto + self.id = id + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoCallMessageHangup { + let proto = try SessionProtos_CallMessage.Hangup(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_CallMessage.Hangup) throws -> SNProtoCallMessageHangup { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + // MARK: - Begin Validation Logic for SNProtoCallMessageHangup - + + // MARK: - End Validation Logic for SNProtoCallMessageHangup - + + let result = SNProtoCallMessageHangup(proto: proto, + id: id) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoCallMessageHangup { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoCallMessageHangup.SNProtoCallMessageHangupBuilder { + @objc public func buildIgnoringErrors() -> SNProtoCallMessageHangup? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoCallMessage + +@objc public class SNProtoCallMessage: NSObject { + + // MARK: - SNProtoCallMessageBuilder + + @objc public class func builder() -> SNProtoCallMessageBuilder { + return SNProtoCallMessageBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoCallMessageBuilder { + let builder = SNProtoCallMessageBuilder() + if let _value = offer { + builder.setOffer(_value) + } + if let _value = answer { + builder.setAnswer(_value) + } + builder.setIceUpdate(iceUpdate) + if let _value = hangup { + builder.setHangup(_value) + } + if let _value = busy { + builder.setBusy(_value) + } + if let _value = profileKey { + builder.setProfileKey(_value) + } + return builder + } + + @objc public class SNProtoCallMessageBuilder: NSObject { + + private var proto = SessionProtos_CallMessage() + + @objc fileprivate override init() {} + + @objc public func setOffer(_ valueParam: SNProtoCallMessageOffer) { + proto.offer = valueParam.proto + } + + @objc public func setAnswer(_ valueParam: SNProtoCallMessageAnswer) { + proto.answer = valueParam.proto + } + + @objc public func addIceUpdate(_ valueParam: SNProtoCallMessageIceUpdate) { + var items = proto.iceUpdate + items.append(valueParam.proto) + proto.iceUpdate = items + } + + @objc public func setIceUpdate(_ wrappedItems: [SNProtoCallMessageIceUpdate]) { + proto.iceUpdate = wrappedItems.map { $0.proto } + } + + @objc public func setHangup(_ valueParam: SNProtoCallMessageHangup) { + proto.hangup = valueParam.proto + } + + @objc public func setBusy(_ valueParam: SNProtoCallMessageBusy) { + proto.busy = valueParam.proto + } + + @objc public func setProfileKey(_ valueParam: Data) { + proto.profileKey = valueParam + } + + @objc public func build() throws -> SNProtoCallMessage { + return try SNProtoCallMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoCallMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_CallMessage + + @objc public let offer: SNProtoCallMessageOffer? + + @objc public let answer: SNProtoCallMessageAnswer? + + @objc public let iceUpdate: [SNProtoCallMessageIceUpdate] + + @objc public let hangup: SNProtoCallMessageHangup? + + @objc public let busy: SNProtoCallMessageBusy? + + @objc public var profileKey: Data? { + guard proto.hasProfileKey else { + return nil + } + return proto.profileKey + } + @objc public var hasProfileKey: Bool { + return proto.hasProfileKey + } + + private init(proto: SessionProtos_CallMessage, + offer: SNProtoCallMessageOffer?, + answer: SNProtoCallMessageAnswer?, + iceUpdate: [SNProtoCallMessageIceUpdate], + hangup: SNProtoCallMessageHangup?, + busy: SNProtoCallMessageBusy?) { + self.proto = proto + self.offer = offer + self.answer = answer + self.iceUpdate = iceUpdate + self.hangup = hangup + self.busy = busy + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoCallMessage { + let proto = try SessionProtos_CallMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_CallMessage) throws -> SNProtoCallMessage { + var offer: SNProtoCallMessageOffer? = nil + if proto.hasOffer { + offer = try SNProtoCallMessageOffer.parseProto(proto.offer) + } + + var answer: SNProtoCallMessageAnswer? = nil + if proto.hasAnswer { + answer = try SNProtoCallMessageAnswer.parseProto(proto.answer) + } + + var iceUpdate: [SNProtoCallMessageIceUpdate] = [] + iceUpdate = try proto.iceUpdate.map { try SNProtoCallMessageIceUpdate.parseProto($0) } + + var hangup: SNProtoCallMessageHangup? = nil + if proto.hasHangup { + hangup = try SNProtoCallMessageHangup.parseProto(proto.hangup) + } + + var busy: SNProtoCallMessageBusy? = nil + if proto.hasBusy { + busy = try SNProtoCallMessageBusy.parseProto(proto.busy) + } + + // MARK: - Begin Validation Logic for SNProtoCallMessage - + + // MARK: - End Validation Logic for SNProtoCallMessage - + + let result = SNProtoCallMessage(proto: proto, + offer: offer, + answer: answer, + iceUpdate: iceUpdate, + hangup: hangup, + busy: busy) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoCallMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoCallMessage.SNProtoCallMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoCallMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoClosedGroupCiphertextMessageWrapper + +@objc public class SNProtoClosedGroupCiphertextMessageWrapper: NSObject { + + // MARK: - SNProtoClosedGroupCiphertextMessageWrapperBuilder + + @objc public class func builder(ciphertext: Data, ephemeralPublicKey: Data) -> SNProtoClosedGroupCiphertextMessageWrapperBuilder { + return SNProtoClosedGroupCiphertextMessageWrapperBuilder(ciphertext: ciphertext, ephemeralPublicKey: ephemeralPublicKey) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoClosedGroupCiphertextMessageWrapperBuilder { + let builder = SNProtoClosedGroupCiphertextMessageWrapperBuilder(ciphertext: ciphertext, ephemeralPublicKey: ephemeralPublicKey) + return builder + } + + @objc public class SNProtoClosedGroupCiphertextMessageWrapperBuilder: NSObject { + + private var proto = SessionProtos_ClosedGroupCiphertextMessageWrapper() + + @objc fileprivate override init() {} + + @objc fileprivate init(ciphertext: Data, ephemeralPublicKey: Data) { + super.init() + + setCiphertext(ciphertext) + setEphemeralPublicKey(ephemeralPublicKey) + } + + @objc public func setCiphertext(_ valueParam: Data) { + proto.ciphertext = valueParam + } + + @objc public func setEphemeralPublicKey(_ valueParam: Data) { + proto.ephemeralPublicKey = valueParam + } + + @objc public func build() throws -> SNProtoClosedGroupCiphertextMessageWrapper { + return try SNProtoClosedGroupCiphertextMessageWrapper.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoClosedGroupCiphertextMessageWrapper.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_ClosedGroupCiphertextMessageWrapper + + @objc public let ciphertext: Data + + @objc public let ephemeralPublicKey: Data + + private init(proto: SessionProtos_ClosedGroupCiphertextMessageWrapper, + ciphertext: Data, + ephemeralPublicKey: Data) { + self.proto = proto + self.ciphertext = ciphertext + self.ephemeralPublicKey = ephemeralPublicKey + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoClosedGroupCiphertextMessageWrapper { + let proto = try SessionProtos_ClosedGroupCiphertextMessageWrapper(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_ClosedGroupCiphertextMessageWrapper) throws -> SNProtoClosedGroupCiphertextMessageWrapper { + guard proto.hasCiphertext else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: ciphertext") + } + let ciphertext = proto.ciphertext + + guard proto.hasEphemeralPublicKey else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: ephemeralPublicKey") + } + let ephemeralPublicKey = proto.ephemeralPublicKey + + // MARK: - Begin Validation Logic for SNProtoClosedGroupCiphertextMessageWrapper - + + // MARK: - End Validation Logic for SNProtoClosedGroupCiphertextMessageWrapper - + + let result = SNProtoClosedGroupCiphertextMessageWrapper(proto: proto, + ciphertext: ciphertext, + ephemeralPublicKey: ephemeralPublicKey) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoClosedGroupCiphertextMessageWrapper { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoClosedGroupCiphertextMessageWrapper.SNProtoClosedGroupCiphertextMessageWrapperBuilder { + @objc public func buildIgnoringErrors() -> SNProtoClosedGroupCiphertextMessageWrapper? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageQuoteQuotedAttachment + +@objc public class SNProtoDataMessageQuoteQuotedAttachment: NSObject { + + // MARK: - SNProtoDataMessageQuoteQuotedAttachmentFlags + + @objc public enum SNProtoDataMessageQuoteQuotedAttachmentFlags: Int32 { + case voiceMessage = 1 + } + + private class func SNProtoDataMessageQuoteQuotedAttachmentFlagsWrap(_ value: SessionProtos_DataMessage.Quote.QuotedAttachment.Flags) -> SNProtoDataMessageQuoteQuotedAttachmentFlags { + switch value { + case .voiceMessage: return .voiceMessage + } + } + + private class func SNProtoDataMessageQuoteQuotedAttachmentFlagsUnwrap(_ value: SNProtoDataMessageQuoteQuotedAttachmentFlags) -> SessionProtos_DataMessage.Quote.QuotedAttachment.Flags { + switch value { + case .voiceMessage: return .voiceMessage + } + } + + // MARK: - SNProtoDataMessageQuoteQuotedAttachmentBuilder + + @objc public class func builder() -> SNProtoDataMessageQuoteQuotedAttachmentBuilder { + return SNProtoDataMessageQuoteQuotedAttachmentBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageQuoteQuotedAttachmentBuilder { + let builder = SNProtoDataMessageQuoteQuotedAttachmentBuilder() + if let _value = contentType { + builder.setContentType(_value) + } + if let _value = fileName { + builder.setFileName(_value) + } + if let _value = thumbnail { + builder.setThumbnail(_value) + } + if hasFlags { + builder.setFlags(flags) + } + return builder + } + + @objc public class SNProtoDataMessageQuoteQuotedAttachmentBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Quote.QuotedAttachment() + + @objc fileprivate override init() {} + + @objc public func setContentType(_ valueParam: String) { + proto.contentType = valueParam + } + + @objc public func setFileName(_ valueParam: String) { + proto.fileName = valueParam + } + + @objc public func setThumbnail(_ valueParam: SNProtoAttachmentPointer) { + proto.thumbnail = valueParam.proto + } + + @objc public func setFlags(_ valueParam: UInt32) { + proto.flags = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageQuoteQuotedAttachment { + return try SNProtoDataMessageQuoteQuotedAttachment.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageQuoteQuotedAttachment.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Quote.QuotedAttachment + + @objc public let thumbnail: SNProtoAttachmentPointer? + + @objc public var contentType: String? { + guard proto.hasContentType else { + return nil + } + return proto.contentType + } + @objc public var hasContentType: Bool { + return proto.hasContentType + } + + @objc public var fileName: String? { + guard proto.hasFileName else { + return nil + } + return proto.fileName + } + @objc public var hasFileName: Bool { + return proto.hasFileName + } + + @objc public var flags: UInt32 { + return proto.flags + } + @objc public var hasFlags: Bool { + return proto.hasFlags + } + + private init(proto: SessionProtos_DataMessage.Quote.QuotedAttachment, + thumbnail: SNProtoAttachmentPointer?) { + self.proto = proto + self.thumbnail = thumbnail + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageQuoteQuotedAttachment { + let proto = try SessionProtos_DataMessage.Quote.QuotedAttachment(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Quote.QuotedAttachment) throws -> SNProtoDataMessageQuoteQuotedAttachment { + var thumbnail: SNProtoAttachmentPointer? = nil + if proto.hasThumbnail { + thumbnail = try SNProtoAttachmentPointer.parseProto(proto.thumbnail) + } + + // MARK: - Begin Validation Logic for SNProtoDataMessageQuoteQuotedAttachment - + + // MARK: - End Validation Logic for SNProtoDataMessageQuoteQuotedAttachment - + + let result = SNProtoDataMessageQuoteQuotedAttachment(proto: proto, + thumbnail: thumbnail) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageQuoteQuotedAttachment { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageQuoteQuotedAttachment.SNProtoDataMessageQuoteQuotedAttachmentBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageQuoteQuotedAttachment? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageQuote + +@objc public class SNProtoDataMessageQuote: NSObject { + + // MARK: - SNProtoDataMessageQuoteBuilder + + @objc public class func builder(id: UInt64, author: String) -> SNProtoDataMessageQuoteBuilder { + return SNProtoDataMessageQuoteBuilder(id: id, author: author) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageQuoteBuilder { + let builder = SNProtoDataMessageQuoteBuilder(id: id, author: author) + if let _value = text { + builder.setText(_value) + } + builder.setAttachments(attachments) + return builder + } + + @objc public class SNProtoDataMessageQuoteBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Quote() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: UInt64, author: String) { + super.init() + + setId(id) + setAuthor(author) + } + + @objc public func setId(_ valueParam: UInt64) { + proto.id = valueParam + } + + @objc public func setAuthor(_ valueParam: String) { + proto.author = valueParam + } + + @objc public func setText(_ valueParam: String) { + proto.text = valueParam + } + + @objc public func addAttachments(_ valueParam: SNProtoDataMessageQuoteQuotedAttachment) { + var items = proto.attachments + items.append(valueParam.proto) + proto.attachments = items + } + + @objc public func setAttachments(_ wrappedItems: [SNProtoDataMessageQuoteQuotedAttachment]) { + proto.attachments = wrappedItems.map { $0.proto } + } + + @objc public func build() throws -> SNProtoDataMessageQuote { + return try SNProtoDataMessageQuote.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageQuote.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Quote + + @objc public let id: UInt64 + + @objc public let author: String + + @objc public let attachments: [SNProtoDataMessageQuoteQuotedAttachment] + + @objc public var text: String? { + guard proto.hasText else { + return nil + } + return proto.text + } + @objc public var hasText: Bool { + return proto.hasText + } + + private init(proto: SessionProtos_DataMessage.Quote, + id: UInt64, + author: String, + attachments: [SNProtoDataMessageQuoteQuotedAttachment]) { + self.proto = proto + self.id = id + self.author = author + self.attachments = attachments + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageQuote { + let proto = try SessionProtos_DataMessage.Quote(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Quote) throws -> SNProtoDataMessageQuote { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + guard proto.hasAuthor else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: author") + } + let author = proto.author + + var attachments: [SNProtoDataMessageQuoteQuotedAttachment] = [] + attachments = try proto.attachments.map { try SNProtoDataMessageQuoteQuotedAttachment.parseProto($0) } + + // MARK: - Begin Validation Logic for SNProtoDataMessageQuote - + + // MARK: - End Validation Logic for SNProtoDataMessageQuote - + + let result = SNProtoDataMessageQuote(proto: proto, + id: id, + author: author, + attachments: attachments) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageQuote { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageQuote.SNProtoDataMessageQuoteBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageQuote? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageContactName + +@objc public class SNProtoDataMessageContactName: NSObject { + + // MARK: - SNProtoDataMessageContactNameBuilder + + @objc public class func builder() -> SNProtoDataMessageContactNameBuilder { + return SNProtoDataMessageContactNameBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageContactNameBuilder { + let builder = SNProtoDataMessageContactNameBuilder() + if let _value = givenName { + builder.setGivenName(_value) + } + if let _value = familyName { + builder.setFamilyName(_value) + } + if let _value = prefix { + builder.setPrefix(_value) + } + if let _value = suffix { + builder.setSuffix(_value) + } + if let _value = middleName { + builder.setMiddleName(_value) + } + if let _value = displayName { + builder.setDisplayName(_value) + } + return builder + } + + @objc public class SNProtoDataMessageContactNameBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Contact.Name() + + @objc fileprivate override init() {} + + @objc public func setGivenName(_ valueParam: String) { + proto.givenName = valueParam + } + + @objc public func setFamilyName(_ valueParam: String) { + proto.familyName = valueParam + } + + @objc public func setPrefix(_ valueParam: String) { + proto.prefix = valueParam + } + + @objc public func setSuffix(_ valueParam: String) { + proto.suffix = valueParam + } + + @objc public func setMiddleName(_ valueParam: String) { + proto.middleName = valueParam + } + + @objc public func setDisplayName(_ valueParam: String) { + proto.displayName = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageContactName { + return try SNProtoDataMessageContactName.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageContactName.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Contact.Name + + @objc public var givenName: String? { + guard proto.hasGivenName else { + return nil + } + return proto.givenName + } + @objc public var hasGivenName: Bool { + return proto.hasGivenName + } + + @objc public var familyName: String? { + guard proto.hasFamilyName else { + return nil + } + return proto.familyName + } + @objc public var hasFamilyName: Bool { + return proto.hasFamilyName + } + + @objc public var prefix: String? { + guard proto.hasPrefix else { + return nil + } + return proto.prefix + } + @objc public var hasPrefix: Bool { + return proto.hasPrefix + } + + @objc public var suffix: String? { + guard proto.hasSuffix else { + return nil + } + return proto.suffix + } + @objc public var hasSuffix: Bool { + return proto.hasSuffix + } + + @objc public var middleName: String? { + guard proto.hasMiddleName else { + return nil + } + return proto.middleName + } + @objc public var hasMiddleName: Bool { + return proto.hasMiddleName + } + + @objc public var displayName: String? { + guard proto.hasDisplayName else { + return nil + } + return proto.displayName + } + @objc public var hasDisplayName: Bool { + return proto.hasDisplayName + } + + private init(proto: SessionProtos_DataMessage.Contact.Name) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageContactName { + let proto = try SessionProtos_DataMessage.Contact.Name(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Contact.Name) throws -> SNProtoDataMessageContactName { + // MARK: - Begin Validation Logic for SNProtoDataMessageContactName - + + // MARK: - End Validation Logic for SNProtoDataMessageContactName - + + let result = SNProtoDataMessageContactName(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageContactName { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageContactName.SNProtoDataMessageContactNameBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageContactName? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageContactPhone + +@objc public class SNProtoDataMessageContactPhone: NSObject { + + // MARK: - SNProtoDataMessageContactPhoneType + + @objc public enum SNProtoDataMessageContactPhoneType: Int32 { + case home = 1 + case mobile = 2 + case work = 3 + case custom = 4 + } + + private class func SNProtoDataMessageContactPhoneTypeWrap(_ value: SessionProtos_DataMessage.Contact.Phone.TypeEnum) -> SNProtoDataMessageContactPhoneType { + switch value { + case .home: return .home + case .mobile: return .mobile + case .work: return .work + case .custom: return .custom + } + } + + private class func SNProtoDataMessageContactPhoneTypeUnwrap(_ value: SNProtoDataMessageContactPhoneType) -> SessionProtos_DataMessage.Contact.Phone.TypeEnum { + switch value { + case .home: return .home + case .mobile: return .mobile + case .work: return .work + case .custom: return .custom + } + } + + // MARK: - SNProtoDataMessageContactPhoneBuilder + + @objc public class func builder() -> SNProtoDataMessageContactPhoneBuilder { + return SNProtoDataMessageContactPhoneBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageContactPhoneBuilder { + let builder = SNProtoDataMessageContactPhoneBuilder() + if let _value = value { + builder.setValue(_value) + } + if hasType { + builder.setType(type) + } + if let _value = label { + builder.setLabel(_value) + } + return builder + } + + @objc public class SNProtoDataMessageContactPhoneBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Contact.Phone() + + @objc fileprivate override init() {} + + @objc public func setValue(_ valueParam: String) { + proto.value = valueParam + } + + @objc public func setType(_ valueParam: SNProtoDataMessageContactPhoneType) { + proto.type = SNProtoDataMessageContactPhoneTypeUnwrap(valueParam) + } + + @objc public func setLabel(_ valueParam: String) { + proto.label = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageContactPhone { + return try SNProtoDataMessageContactPhone.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageContactPhone.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Contact.Phone + + @objc public var value: String? { + guard proto.hasValue else { + return nil + } + return proto.value + } + @objc public var hasValue: Bool { + return proto.hasValue + } + + @objc public var type: SNProtoDataMessageContactPhoneType { + return SNProtoDataMessageContactPhone.SNProtoDataMessageContactPhoneTypeWrap(proto.type) + } + @objc public var hasType: Bool { + return proto.hasType + } + + @objc public var label: String? { + guard proto.hasLabel else { + return nil + } + return proto.label + } + @objc public var hasLabel: Bool { + return proto.hasLabel + } + + private init(proto: SessionProtos_DataMessage.Contact.Phone) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageContactPhone { + let proto = try SessionProtos_DataMessage.Contact.Phone(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Contact.Phone) throws -> SNProtoDataMessageContactPhone { + // MARK: - Begin Validation Logic for SNProtoDataMessageContactPhone - + + // MARK: - End Validation Logic for SNProtoDataMessageContactPhone - + + let result = SNProtoDataMessageContactPhone(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageContactPhone { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageContactPhone.SNProtoDataMessageContactPhoneBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageContactPhone? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageContactEmail + +@objc public class SNProtoDataMessageContactEmail: NSObject { + + // MARK: - SNProtoDataMessageContactEmailType + + @objc public enum SNProtoDataMessageContactEmailType: Int32 { + case home = 1 + case mobile = 2 + case work = 3 + case custom = 4 + } + + private class func SNProtoDataMessageContactEmailTypeWrap(_ value: SessionProtos_DataMessage.Contact.Email.TypeEnum) -> SNProtoDataMessageContactEmailType { + switch value { + case .home: return .home + case .mobile: return .mobile + case .work: return .work + case .custom: return .custom + } + } + + private class func SNProtoDataMessageContactEmailTypeUnwrap(_ value: SNProtoDataMessageContactEmailType) -> SessionProtos_DataMessage.Contact.Email.TypeEnum { + switch value { + case .home: return .home + case .mobile: return .mobile + case .work: return .work + case .custom: return .custom + } + } + + // MARK: - SNProtoDataMessageContactEmailBuilder + + @objc public class func builder() -> SNProtoDataMessageContactEmailBuilder { + return SNProtoDataMessageContactEmailBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageContactEmailBuilder { + let builder = SNProtoDataMessageContactEmailBuilder() + if let _value = value { + builder.setValue(_value) + } + if hasType { + builder.setType(type) + } + if let _value = label { + builder.setLabel(_value) + } + return builder + } + + @objc public class SNProtoDataMessageContactEmailBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Contact.Email() + + @objc fileprivate override init() {} + + @objc public func setValue(_ valueParam: String) { + proto.value = valueParam + } + + @objc public func setType(_ valueParam: SNProtoDataMessageContactEmailType) { + proto.type = SNProtoDataMessageContactEmailTypeUnwrap(valueParam) + } + + @objc public func setLabel(_ valueParam: String) { + proto.label = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageContactEmail { + return try SNProtoDataMessageContactEmail.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageContactEmail.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Contact.Email + + @objc public var value: String? { + guard proto.hasValue else { + return nil + } + return proto.value + } + @objc public var hasValue: Bool { + return proto.hasValue + } + + @objc public var type: SNProtoDataMessageContactEmailType { + return SNProtoDataMessageContactEmail.SNProtoDataMessageContactEmailTypeWrap(proto.type) + } + @objc public var hasType: Bool { + return proto.hasType + } + + @objc public var label: String? { + guard proto.hasLabel else { + return nil + } + return proto.label + } + @objc public var hasLabel: Bool { + return proto.hasLabel + } + + private init(proto: SessionProtos_DataMessage.Contact.Email) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageContactEmail { + let proto = try SessionProtos_DataMessage.Contact.Email(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Contact.Email) throws -> SNProtoDataMessageContactEmail { + // MARK: - Begin Validation Logic for SNProtoDataMessageContactEmail - + + // MARK: - End Validation Logic for SNProtoDataMessageContactEmail - + + let result = SNProtoDataMessageContactEmail(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageContactEmail { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageContactEmail.SNProtoDataMessageContactEmailBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageContactEmail? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageContactPostalAddress + +@objc public class SNProtoDataMessageContactPostalAddress: NSObject { + + // MARK: - SNProtoDataMessageContactPostalAddressType + + @objc public enum SNProtoDataMessageContactPostalAddressType: Int32 { + case home = 1 + case work = 2 + case custom = 3 + } + + private class func SNProtoDataMessageContactPostalAddressTypeWrap(_ value: SessionProtos_DataMessage.Contact.PostalAddress.TypeEnum) -> SNProtoDataMessageContactPostalAddressType { + switch value { + case .home: return .home + case .work: return .work + case .custom: return .custom + } + } + + private class func SNProtoDataMessageContactPostalAddressTypeUnwrap(_ value: SNProtoDataMessageContactPostalAddressType) -> SessionProtos_DataMessage.Contact.PostalAddress.TypeEnum { + switch value { + case .home: return .home + case .work: return .work + case .custom: return .custom + } + } + + // MARK: - SNProtoDataMessageContactPostalAddressBuilder + + @objc public class func builder() -> SNProtoDataMessageContactPostalAddressBuilder { + return SNProtoDataMessageContactPostalAddressBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageContactPostalAddressBuilder { + let builder = SNProtoDataMessageContactPostalAddressBuilder() + if hasType { + builder.setType(type) + } + if let _value = label { + builder.setLabel(_value) + } + if let _value = street { + builder.setStreet(_value) + } + if let _value = pobox { + builder.setPobox(_value) + } + if let _value = neighborhood { + builder.setNeighborhood(_value) + } + if let _value = city { + builder.setCity(_value) + } + if let _value = region { + builder.setRegion(_value) + } + if let _value = postcode { + builder.setPostcode(_value) + } + if let _value = country { + builder.setCountry(_value) + } + return builder + } + + @objc public class SNProtoDataMessageContactPostalAddressBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Contact.PostalAddress() + + @objc fileprivate override init() {} + + @objc public func setType(_ valueParam: SNProtoDataMessageContactPostalAddressType) { + proto.type = SNProtoDataMessageContactPostalAddressTypeUnwrap(valueParam) + } + + @objc public func setLabel(_ valueParam: String) { + proto.label = valueParam + } + + @objc public func setStreet(_ valueParam: String) { + proto.street = valueParam + } + + @objc public func setPobox(_ valueParam: String) { + proto.pobox = valueParam + } + + @objc public func setNeighborhood(_ valueParam: String) { + proto.neighborhood = valueParam + } + + @objc public func setCity(_ valueParam: String) { + proto.city = valueParam + } + + @objc public func setRegion(_ valueParam: String) { + proto.region = valueParam + } + + @objc public func setPostcode(_ valueParam: String) { + proto.postcode = valueParam + } + + @objc public func setCountry(_ valueParam: String) { + proto.country = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageContactPostalAddress { + return try SNProtoDataMessageContactPostalAddress.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageContactPostalAddress.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Contact.PostalAddress + + @objc public var type: SNProtoDataMessageContactPostalAddressType { + return SNProtoDataMessageContactPostalAddress.SNProtoDataMessageContactPostalAddressTypeWrap(proto.type) + } + @objc public var hasType: Bool { + return proto.hasType + } + + @objc public var label: String? { + guard proto.hasLabel else { + return nil + } + return proto.label + } + @objc public var hasLabel: Bool { + return proto.hasLabel + } + + @objc public var street: String? { + guard proto.hasStreet else { + return nil + } + return proto.street + } + @objc public var hasStreet: Bool { + return proto.hasStreet + } + + @objc public var pobox: String? { + guard proto.hasPobox else { + return nil + } + return proto.pobox + } + @objc public var hasPobox: Bool { + return proto.hasPobox + } + + @objc public var neighborhood: String? { + guard proto.hasNeighborhood else { + return nil + } + return proto.neighborhood + } + @objc public var hasNeighborhood: Bool { + return proto.hasNeighborhood + } + + @objc public var city: String? { + guard proto.hasCity else { + return nil + } + return proto.city + } + @objc public var hasCity: Bool { + return proto.hasCity + } + + @objc public var region: String? { + guard proto.hasRegion else { + return nil + } + return proto.region + } + @objc public var hasRegion: Bool { + return proto.hasRegion + } + + @objc public var postcode: String? { + guard proto.hasPostcode else { + return nil + } + return proto.postcode + } + @objc public var hasPostcode: Bool { + return proto.hasPostcode + } + + @objc public var country: String? { + guard proto.hasCountry else { + return nil + } + return proto.country + } + @objc public var hasCountry: Bool { + return proto.hasCountry + } + + private init(proto: SessionProtos_DataMessage.Contact.PostalAddress) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageContactPostalAddress { + let proto = try SessionProtos_DataMessage.Contact.PostalAddress(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Contact.PostalAddress) throws -> SNProtoDataMessageContactPostalAddress { + // MARK: - Begin Validation Logic for SNProtoDataMessageContactPostalAddress - + + // MARK: - End Validation Logic for SNProtoDataMessageContactPostalAddress - + + let result = SNProtoDataMessageContactPostalAddress(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageContactPostalAddress { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageContactPostalAddress.SNProtoDataMessageContactPostalAddressBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageContactPostalAddress? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageContactAvatar + +@objc public class SNProtoDataMessageContactAvatar: NSObject { + + // MARK: - SNProtoDataMessageContactAvatarBuilder + + @objc public class func builder() -> SNProtoDataMessageContactAvatarBuilder { + return SNProtoDataMessageContactAvatarBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageContactAvatarBuilder { + let builder = SNProtoDataMessageContactAvatarBuilder() + if let _value = avatar { + builder.setAvatar(_value) + } + if hasIsProfile { + builder.setIsProfile(isProfile) + } + return builder + } + + @objc public class SNProtoDataMessageContactAvatarBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Contact.Avatar() + + @objc fileprivate override init() {} + + @objc public func setAvatar(_ valueParam: SNProtoAttachmentPointer) { + proto.avatar = valueParam.proto + } + + @objc public func setIsProfile(_ valueParam: Bool) { + proto.isProfile = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageContactAvatar { + return try SNProtoDataMessageContactAvatar.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageContactAvatar.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Contact.Avatar + + @objc public let avatar: SNProtoAttachmentPointer? + + @objc public var isProfile: Bool { + return proto.isProfile + } + @objc public var hasIsProfile: Bool { + return proto.hasIsProfile + } + + private init(proto: SessionProtos_DataMessage.Contact.Avatar, + avatar: SNProtoAttachmentPointer?) { + self.proto = proto + self.avatar = avatar + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageContactAvatar { + let proto = try SessionProtos_DataMessage.Contact.Avatar(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Contact.Avatar) throws -> SNProtoDataMessageContactAvatar { + var avatar: SNProtoAttachmentPointer? = nil + if proto.hasAvatar { + avatar = try SNProtoAttachmentPointer.parseProto(proto.avatar) + } + + // MARK: - Begin Validation Logic for SNProtoDataMessageContactAvatar - + + // MARK: - End Validation Logic for SNProtoDataMessageContactAvatar - + + let result = SNProtoDataMessageContactAvatar(proto: proto, + avatar: avatar) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageContactAvatar { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageContactAvatar.SNProtoDataMessageContactAvatarBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageContactAvatar? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageContact + +@objc public class SNProtoDataMessageContact: NSObject { + + // MARK: - SNProtoDataMessageContactBuilder + + @objc public class func builder() -> SNProtoDataMessageContactBuilder { + return SNProtoDataMessageContactBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageContactBuilder { + let builder = SNProtoDataMessageContactBuilder() + if let _value = name { + builder.setName(_value) + } + builder.setNumber(number) + builder.setEmail(email) + builder.setAddress(address) + if let _value = avatar { + builder.setAvatar(_value) + } + if let _value = organization { + builder.setOrganization(_value) + } + return builder + } + + @objc public class SNProtoDataMessageContactBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Contact() + + @objc fileprivate override init() {} + + @objc public func setName(_ valueParam: SNProtoDataMessageContactName) { + proto.name = valueParam.proto + } + + @objc public func addNumber(_ valueParam: SNProtoDataMessageContactPhone) { + var items = proto.number + items.append(valueParam.proto) + proto.number = items + } + + @objc public func setNumber(_ wrappedItems: [SNProtoDataMessageContactPhone]) { + proto.number = wrappedItems.map { $0.proto } + } + + @objc public func addEmail(_ valueParam: SNProtoDataMessageContactEmail) { + var items = proto.email + items.append(valueParam.proto) + proto.email = items + } + + @objc public func setEmail(_ wrappedItems: [SNProtoDataMessageContactEmail]) { + proto.email = wrappedItems.map { $0.proto } + } + + @objc public func addAddress(_ valueParam: SNProtoDataMessageContactPostalAddress) { + var items = proto.address + items.append(valueParam.proto) + proto.address = items + } + + @objc public func setAddress(_ wrappedItems: [SNProtoDataMessageContactPostalAddress]) { + proto.address = wrappedItems.map { $0.proto } + } + + @objc public func setAvatar(_ valueParam: SNProtoDataMessageContactAvatar) { + proto.avatar = valueParam.proto + } + + @objc public func setOrganization(_ valueParam: String) { + proto.organization = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageContact { + return try SNProtoDataMessageContact.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageContact.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Contact + + @objc public let name: SNProtoDataMessageContactName? + + @objc public let number: [SNProtoDataMessageContactPhone] + + @objc public let email: [SNProtoDataMessageContactEmail] + + @objc public let address: [SNProtoDataMessageContactPostalAddress] + + @objc public let avatar: SNProtoDataMessageContactAvatar? + + @objc public var organization: String? { + guard proto.hasOrganization else { + return nil + } + return proto.organization + } + @objc public var hasOrganization: Bool { + return proto.hasOrganization + } + + private init(proto: SessionProtos_DataMessage.Contact, + name: SNProtoDataMessageContactName?, + number: [SNProtoDataMessageContactPhone], + email: [SNProtoDataMessageContactEmail], + address: [SNProtoDataMessageContactPostalAddress], + avatar: SNProtoDataMessageContactAvatar?) { + self.proto = proto + self.name = name + self.number = number + self.email = email + self.address = address + self.avatar = avatar + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageContact { + let proto = try SessionProtos_DataMessage.Contact(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Contact) throws -> SNProtoDataMessageContact { + var name: SNProtoDataMessageContactName? = nil + if proto.hasName { + name = try SNProtoDataMessageContactName.parseProto(proto.name) + } + + var number: [SNProtoDataMessageContactPhone] = [] + number = try proto.number.map { try SNProtoDataMessageContactPhone.parseProto($0) } + + var email: [SNProtoDataMessageContactEmail] = [] + email = try proto.email.map { try SNProtoDataMessageContactEmail.parseProto($0) } + + var address: [SNProtoDataMessageContactPostalAddress] = [] + address = try proto.address.map { try SNProtoDataMessageContactPostalAddress.parseProto($0) } + + var avatar: SNProtoDataMessageContactAvatar? = nil + if proto.hasAvatar { + avatar = try SNProtoDataMessageContactAvatar.parseProto(proto.avatar) + } + + // MARK: - Begin Validation Logic for SNProtoDataMessageContact - + + // MARK: - End Validation Logic for SNProtoDataMessageContact - + + let result = SNProtoDataMessageContact(proto: proto, + name: name, + number: number, + email: email, + address: address, + avatar: avatar) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageContact { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageContact.SNProtoDataMessageContactBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageContact? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessagePreview + +@objc public class SNProtoDataMessagePreview: NSObject { + + // MARK: - SNProtoDataMessagePreviewBuilder + + @objc public class func builder(url: String) -> SNProtoDataMessagePreviewBuilder { + return SNProtoDataMessagePreviewBuilder(url: url) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessagePreviewBuilder { + let builder = SNProtoDataMessagePreviewBuilder(url: url) + if let _value = title { + builder.setTitle(_value) + } + if let _value = image { + builder.setImage(_value) + } + return builder + } + + @objc public class SNProtoDataMessagePreviewBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.Preview() + + @objc fileprivate override init() {} + + @objc fileprivate init(url: String) { + super.init() + + setUrl(url) + } + + @objc public func setUrl(_ valueParam: String) { + proto.url = valueParam + } + + @objc public func setTitle(_ valueParam: String) { + proto.title = valueParam + } + + @objc public func setImage(_ valueParam: SNProtoAttachmentPointer) { + proto.image = valueParam.proto + } + + @objc public func build() throws -> SNProtoDataMessagePreview { + return try SNProtoDataMessagePreview.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessagePreview.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.Preview + + @objc public let url: String + + @objc public let image: SNProtoAttachmentPointer? + + @objc public var title: String? { + guard proto.hasTitle else { + return nil + } + return proto.title + } + @objc public var hasTitle: Bool { + return proto.hasTitle + } + + private init(proto: SessionProtos_DataMessage.Preview, + url: String, + image: SNProtoAttachmentPointer?) { + self.proto = proto + self.url = url + self.image = image + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessagePreview { + let proto = try SessionProtos_DataMessage.Preview(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.Preview) throws -> SNProtoDataMessagePreview { + guard proto.hasURL else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: url") + } + let url = proto.url + + var image: SNProtoAttachmentPointer? = nil + if proto.hasImage { + image = try SNProtoAttachmentPointer.parseProto(proto.image) + } + + // MARK: - Begin Validation Logic for SNProtoDataMessagePreview - + + // MARK: - End Validation Logic for SNProtoDataMessagePreview - + + let result = SNProtoDataMessagePreview(proto: proto, + url: url, + image: image) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessagePreview { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessagePreview.SNProtoDataMessagePreviewBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessagePreview? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageLokiProfile + +@objc public class SNProtoDataMessageLokiProfile: NSObject { + + // MARK: - SNProtoDataMessageLokiProfileBuilder + + @objc public class func builder() -> SNProtoDataMessageLokiProfileBuilder { + return SNProtoDataMessageLokiProfileBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageLokiProfileBuilder { + let builder = SNProtoDataMessageLokiProfileBuilder() + if let _value = displayName { + builder.setDisplayName(_value) + } + if let _value = profilePicture { + builder.setProfilePicture(_value) + } + return builder + } + + @objc public class SNProtoDataMessageLokiProfileBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.LokiProfile() + + @objc fileprivate override init() {} + + @objc public func setDisplayName(_ valueParam: String) { + proto.displayName = valueParam + } + + @objc public func setProfilePicture(_ valueParam: String) { + proto.profilePicture = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageLokiProfile { + return try SNProtoDataMessageLokiProfile.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageLokiProfile.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.LokiProfile + + @objc public var displayName: String? { + guard proto.hasDisplayName else { + return nil + } + return proto.displayName + } + @objc public var hasDisplayName: Bool { + return proto.hasDisplayName + } + + @objc public var profilePicture: String? { + guard proto.hasProfilePicture else { + return nil + } + return proto.profilePicture + } + @objc public var hasProfilePicture: Bool { + return proto.hasProfilePicture + } + + private init(proto: SessionProtos_DataMessage.LokiProfile) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageLokiProfile { + let proto = try SessionProtos_DataMessage.LokiProfile(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.LokiProfile) throws -> SNProtoDataMessageLokiProfile { + // MARK: - Begin Validation Logic for SNProtoDataMessageLokiProfile - + + // MARK: - End Validation Logic for SNProtoDataMessageLokiProfile - + + let result = SNProtoDataMessageLokiProfile(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageLokiProfile { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageLokiProfile.SNProtoDataMessageLokiProfileBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageLokiProfile? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageClosedGroupUpdateSenderKey + +@objc public class SNProtoDataMessageClosedGroupUpdateSenderKey: NSObject { + + // MARK: - SNProtoDataMessageClosedGroupUpdateSenderKeyBuilder + + @objc public class func builder(chainKey: Data, keyIndex: UInt32, publicKey: Data) -> SNProtoDataMessageClosedGroupUpdateSenderKeyBuilder { + return SNProtoDataMessageClosedGroupUpdateSenderKeyBuilder(chainKey: chainKey, keyIndex: keyIndex, publicKey: publicKey) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageClosedGroupUpdateSenderKeyBuilder { + let builder = SNProtoDataMessageClosedGroupUpdateSenderKeyBuilder(chainKey: chainKey, keyIndex: keyIndex, publicKey: publicKey) + return builder + } + + @objc public class SNProtoDataMessageClosedGroupUpdateSenderKeyBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey() + + @objc fileprivate override init() {} + + @objc fileprivate init(chainKey: Data, keyIndex: UInt32, publicKey: Data) { + super.init() + + setChainKey(chainKey) + setKeyIndex(keyIndex) + setPublicKey(publicKey) + } + + @objc public func setChainKey(_ valueParam: Data) { + proto.chainKey = valueParam + } + + @objc public func setKeyIndex(_ valueParam: UInt32) { + proto.keyIndex = valueParam + } + + @objc public func setPublicKey(_ valueParam: Data) { + proto.publicKey = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageClosedGroupUpdateSenderKey { + return try SNProtoDataMessageClosedGroupUpdateSenderKey.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageClosedGroupUpdateSenderKey.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey + + @objc public let chainKey: Data + + @objc public let keyIndex: UInt32 + + @objc public let publicKey: Data + + private init(proto: SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey, + chainKey: Data, + keyIndex: UInt32, + publicKey: Data) { + self.proto = proto + self.chainKey = chainKey + self.keyIndex = keyIndex + self.publicKey = publicKey + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageClosedGroupUpdateSenderKey { + let proto = try SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey) throws -> SNProtoDataMessageClosedGroupUpdateSenderKey { + guard proto.hasChainKey else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: chainKey") + } + let chainKey = proto.chainKey + + guard proto.hasKeyIndex else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: keyIndex") + } + let keyIndex = proto.keyIndex + + guard proto.hasPublicKey else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: publicKey") + } + let publicKey = proto.publicKey + + // MARK: - Begin Validation Logic for SNProtoDataMessageClosedGroupUpdateSenderKey - + + // MARK: - End Validation Logic for SNProtoDataMessageClosedGroupUpdateSenderKey - + + let result = SNProtoDataMessageClosedGroupUpdateSenderKey(proto: proto, + chainKey: chainKey, + keyIndex: keyIndex, + publicKey: publicKey) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageClosedGroupUpdateSenderKey { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageClosedGroupUpdateSenderKey.SNProtoDataMessageClosedGroupUpdateSenderKeyBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageClosedGroupUpdateSenderKey? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessageClosedGroupUpdate + +@objc public class SNProtoDataMessageClosedGroupUpdate: NSObject { + + // MARK: - SNProtoDataMessageClosedGroupUpdateType + + @objc public enum SNProtoDataMessageClosedGroupUpdateType: Int32 { + case new = 0 + case info = 1 + case senderKeyRequest = 2 + case senderKey = 3 + } + + private class func SNProtoDataMessageClosedGroupUpdateTypeWrap(_ value: SessionProtos_DataMessage.ClosedGroupUpdate.TypeEnum) -> SNProtoDataMessageClosedGroupUpdateType { + switch value { + case .new: return .new + case .info: return .info + case .senderKeyRequest: return .senderKeyRequest + case .senderKey: return .senderKey + } + } + + private class func SNProtoDataMessageClosedGroupUpdateTypeUnwrap(_ value: SNProtoDataMessageClosedGroupUpdateType) -> SessionProtos_DataMessage.ClosedGroupUpdate.TypeEnum { + switch value { + case .new: return .new + case .info: return .info + case .senderKeyRequest: return .senderKeyRequest + case .senderKey: return .senderKey + } + } + + // MARK: - SNProtoDataMessageClosedGroupUpdateBuilder + + @objc public class func builder(groupPublicKey: Data, type: SNProtoDataMessageClosedGroupUpdateType) -> SNProtoDataMessageClosedGroupUpdateBuilder { + return SNProtoDataMessageClosedGroupUpdateBuilder(groupPublicKey: groupPublicKey, type: type) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageClosedGroupUpdateBuilder { + let builder = SNProtoDataMessageClosedGroupUpdateBuilder(groupPublicKey: groupPublicKey, type: type) + if let _value = name { + builder.setName(_value) + } + if let _value = groupPrivateKey { + builder.setGroupPrivateKey(_value) + } + builder.setSenderKeys(senderKeys) + builder.setMembers(members) + builder.setAdmins(admins) + return builder + } + + @objc public class SNProtoDataMessageClosedGroupUpdateBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.ClosedGroupUpdate() + + @objc fileprivate override init() {} + + @objc fileprivate init(groupPublicKey: Data, type: SNProtoDataMessageClosedGroupUpdateType) { + super.init() + + setGroupPublicKey(groupPublicKey) + setType(type) + } + + @objc public func setName(_ valueParam: String) { + proto.name = valueParam + } + + @objc public func setGroupPublicKey(_ valueParam: Data) { + proto.groupPublicKey = valueParam + } + + @objc public func setGroupPrivateKey(_ valueParam: Data) { + proto.groupPrivateKey = valueParam + } + + @objc public func addSenderKeys(_ valueParam: SNProtoDataMessageClosedGroupUpdateSenderKey) { + var items = proto.senderKeys + items.append(valueParam.proto) + proto.senderKeys = items + } + + @objc public func setSenderKeys(_ wrappedItems: [SNProtoDataMessageClosedGroupUpdateSenderKey]) { + proto.senderKeys = wrappedItems.map { $0.proto } + } + + @objc public func addMembers(_ valueParam: Data) { + var items = proto.members + items.append(valueParam) + proto.members = items + } + + @objc public func setMembers(_ wrappedItems: [Data]) { + proto.members = wrappedItems + } + + @objc public func addAdmins(_ valueParam: Data) { + var items = proto.admins + items.append(valueParam) + proto.admins = items + } + + @objc public func setAdmins(_ wrappedItems: [Data]) { + proto.admins = wrappedItems + } + + @objc public func setType(_ valueParam: SNProtoDataMessageClosedGroupUpdateType) { + proto.type = SNProtoDataMessageClosedGroupUpdateTypeUnwrap(valueParam) + } + + @objc public func build() throws -> SNProtoDataMessageClosedGroupUpdate { + return try SNProtoDataMessageClosedGroupUpdate.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageClosedGroupUpdate.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.ClosedGroupUpdate + + @objc public let groupPublicKey: Data + + @objc public let senderKeys: [SNProtoDataMessageClosedGroupUpdateSenderKey] + + @objc public let type: SNProtoDataMessageClosedGroupUpdateType + + @objc public var name: String? { + guard proto.hasName else { + return nil + } + return proto.name + } + @objc public var hasName: Bool { + return proto.hasName + } + + @objc public var groupPrivateKey: Data? { + guard proto.hasGroupPrivateKey else { + return nil + } + return proto.groupPrivateKey + } + @objc public var hasGroupPrivateKey: Bool { + return proto.hasGroupPrivateKey + } + + @objc public var members: [Data] { + return proto.members + } + + @objc public var admins: [Data] { + return proto.admins + } + + private init(proto: SessionProtos_DataMessage.ClosedGroupUpdate, + groupPublicKey: Data, + senderKeys: [SNProtoDataMessageClosedGroupUpdateSenderKey], + type: SNProtoDataMessageClosedGroupUpdateType) { + self.proto = proto + self.groupPublicKey = groupPublicKey + self.senderKeys = senderKeys + self.type = type + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageClosedGroupUpdate { + let proto = try SessionProtos_DataMessage.ClosedGroupUpdate(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.ClosedGroupUpdate) throws -> SNProtoDataMessageClosedGroupUpdate { + guard proto.hasGroupPublicKey else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: groupPublicKey") + } + let groupPublicKey = proto.groupPublicKey + + var senderKeys: [SNProtoDataMessageClosedGroupUpdateSenderKey] = [] + senderKeys = try proto.senderKeys.map { try SNProtoDataMessageClosedGroupUpdateSenderKey.parseProto($0) } + + guard proto.hasType else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type") + } + let type = SNProtoDataMessageClosedGroupUpdateTypeWrap(proto.type) + + // MARK: - Begin Validation Logic for SNProtoDataMessageClosedGroupUpdate - + + // MARK: - End Validation Logic for SNProtoDataMessageClosedGroupUpdate - + + let result = SNProtoDataMessageClosedGroupUpdate(proto: proto, + groupPublicKey: groupPublicKey, + senderKeys: senderKeys, + type: type) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageClosedGroupUpdate { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdateBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageClosedGroupUpdate? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoDataMessage + +@objc public class SNProtoDataMessage: NSObject { + + // MARK: - SNProtoDataMessageFlags + + @objc public enum SNProtoDataMessageFlags: Int32 { + case endSession = 1 + case expirationTimerUpdate = 2 + case profileKeyUpdate = 4 + case unlinkDevice = 128 + } + + private class func SNProtoDataMessageFlagsWrap(_ value: SessionProtos_DataMessage.Flags) -> SNProtoDataMessageFlags { + switch value { + case .endSession: return .endSession + case .expirationTimerUpdate: return .expirationTimerUpdate + case .profileKeyUpdate: return .profileKeyUpdate + case .unlinkDevice: return .unlinkDevice + } + } + + private class func SNProtoDataMessageFlagsUnwrap(_ value: SNProtoDataMessageFlags) -> SessionProtos_DataMessage.Flags { + switch value { + case .endSession: return .endSession + case .expirationTimerUpdate: return .expirationTimerUpdate + case .profileKeyUpdate: return .profileKeyUpdate + case .unlinkDevice: return .unlinkDevice + } + } + + // MARK: - SNProtoDataMessageBuilder + + @objc public class func builder() -> SNProtoDataMessageBuilder { + return SNProtoDataMessageBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageBuilder { + let builder = SNProtoDataMessageBuilder() + if let _value = body { + builder.setBody(_value) + } + builder.setAttachments(attachments) + if let _value = group { + builder.setGroup(_value) + } + if hasFlags { + builder.setFlags(flags) + } + if hasExpireTimer { + builder.setExpireTimer(expireTimer) + } + if let _value = profileKey { + builder.setProfileKey(_value) + } + if hasTimestamp { + builder.setTimestamp(timestamp) + } + if let _value = quote { + builder.setQuote(_value) + } + builder.setContact(contact) + builder.setPreview(preview) + if let _value = profile { + builder.setProfile(_value) + } + if let _value = closedGroupUpdate { + builder.setClosedGroupUpdate(_value) + } + if let _value = publicChatInfo { + builder.setPublicChatInfo(_value) + } + return builder + } + + @objc public class SNProtoDataMessageBuilder: NSObject { + + private var proto = SessionProtos_DataMessage() + + @objc fileprivate override init() {} + + @objc public func setBody(_ valueParam: String) { + proto.body = valueParam + } + + @objc public func addAttachments(_ valueParam: SNProtoAttachmentPointer) { + var items = proto.attachments + items.append(valueParam.proto) + proto.attachments = items + } + + @objc public func setAttachments(_ wrappedItems: [SNProtoAttachmentPointer]) { + proto.attachments = wrappedItems.map { $0.proto } + } + + @objc public func setGroup(_ valueParam: SNProtoGroupContext) { + proto.group = valueParam.proto + } + + @objc public func setFlags(_ valueParam: UInt32) { + proto.flags = valueParam + } + + @objc public func setExpireTimer(_ valueParam: UInt32) { + proto.expireTimer = valueParam + } + + @objc public func setProfileKey(_ valueParam: Data) { + proto.profileKey = valueParam + } + + @objc public func setTimestamp(_ valueParam: UInt64) { + proto.timestamp = valueParam + } + + @objc public func setQuote(_ valueParam: SNProtoDataMessageQuote) { + proto.quote = valueParam.proto + } + + @objc public func addContact(_ valueParam: SNProtoDataMessageContact) { + var items = proto.contact + items.append(valueParam.proto) + proto.contact = items + } + + @objc public func setContact(_ wrappedItems: [SNProtoDataMessageContact]) { + proto.contact = wrappedItems.map { $0.proto } + } + + @objc public func addPreview(_ valueParam: SNProtoDataMessagePreview) { + var items = proto.preview + items.append(valueParam.proto) + proto.preview = items + } + + @objc public func setPreview(_ wrappedItems: [SNProtoDataMessagePreview]) { + proto.preview = wrappedItems.map { $0.proto } + } + + @objc public func setProfile(_ valueParam: SNProtoDataMessageLokiProfile) { + proto.profile = valueParam.proto + } + + @objc public func setClosedGroupUpdate(_ valueParam: SNProtoDataMessageClosedGroupUpdate) { + proto.closedGroupUpdate = valueParam.proto + } + + @objc public func setPublicChatInfo(_ valueParam: SNProtoPublicChatInfo) { + proto.publicChatInfo = valueParam.proto + } + + @objc public func build() throws -> SNProtoDataMessage { + return try SNProtoDataMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage + + @objc public let attachments: [SNProtoAttachmentPointer] + + @objc public let group: SNProtoGroupContext? + + @objc public let quote: SNProtoDataMessageQuote? + + @objc public let contact: [SNProtoDataMessageContact] + + @objc public let preview: [SNProtoDataMessagePreview] + + @objc public let profile: SNProtoDataMessageLokiProfile? + + @objc public let closedGroupUpdate: SNProtoDataMessageClosedGroupUpdate? + + @objc public let publicChatInfo: SNProtoPublicChatInfo? + + @objc public var body: String? { + guard proto.hasBody else { + return nil + } + return proto.body + } + @objc public var hasBody: Bool { + return proto.hasBody + } + + @objc public var flags: UInt32 { + return proto.flags + } + @objc public var hasFlags: Bool { + return proto.hasFlags + } + + @objc public var expireTimer: UInt32 { + return proto.expireTimer + } + @objc public var hasExpireTimer: Bool { + return proto.hasExpireTimer + } + + @objc public var profileKey: Data? { + guard proto.hasProfileKey else { + return nil + } + return proto.profileKey + } + @objc public var hasProfileKey: Bool { + return proto.hasProfileKey + } + + @objc public var timestamp: UInt64 { + return proto.timestamp + } + @objc public var hasTimestamp: Bool { + return proto.hasTimestamp + } + + private init(proto: SessionProtos_DataMessage, + attachments: [SNProtoAttachmentPointer], + group: SNProtoGroupContext?, + quote: SNProtoDataMessageQuote?, + contact: [SNProtoDataMessageContact], + preview: [SNProtoDataMessagePreview], + profile: SNProtoDataMessageLokiProfile?, + closedGroupUpdate: SNProtoDataMessageClosedGroupUpdate?, + publicChatInfo: SNProtoPublicChatInfo?) { + self.proto = proto + self.attachments = attachments + self.group = group + self.quote = quote + self.contact = contact + self.preview = preview + self.profile = profile + self.closedGroupUpdate = closedGroupUpdate + self.publicChatInfo = publicChatInfo + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessage { + let proto = try SessionProtos_DataMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage) throws -> SNProtoDataMessage { + var attachments: [SNProtoAttachmentPointer] = [] + attachments = try proto.attachments.map { try SNProtoAttachmentPointer.parseProto($0) } + + var group: SNProtoGroupContext? = nil + if proto.hasGroup { + group = try SNProtoGroupContext.parseProto(proto.group) + } + + var quote: SNProtoDataMessageQuote? = nil + if proto.hasQuote { + quote = try SNProtoDataMessageQuote.parseProto(proto.quote) + } + + var contact: [SNProtoDataMessageContact] = [] + contact = try proto.contact.map { try SNProtoDataMessageContact.parseProto($0) } + + var preview: [SNProtoDataMessagePreview] = [] + preview = try proto.preview.map { try SNProtoDataMessagePreview.parseProto($0) } + + var profile: SNProtoDataMessageLokiProfile? = nil + if proto.hasProfile { + profile = try SNProtoDataMessageLokiProfile.parseProto(proto.profile) + } + + var closedGroupUpdate: SNProtoDataMessageClosedGroupUpdate? = nil + if proto.hasClosedGroupUpdate { + closedGroupUpdate = try SNProtoDataMessageClosedGroupUpdate.parseProto(proto.closedGroupUpdate) + } + + var publicChatInfo: SNProtoPublicChatInfo? = nil + if proto.hasPublicChatInfo { + publicChatInfo = try SNProtoPublicChatInfo.parseProto(proto.publicChatInfo) + } + + // MARK: - Begin Validation Logic for SNProtoDataMessage - + + // MARK: - End Validation Logic for SNProtoDataMessage - + + let result = SNProtoDataMessage(proto: proto, + attachments: attachments, + group: group, + quote: quote, + contact: contact, + preview: preview, + profile: profile, + closedGroupUpdate: closedGroupUpdate, + publicChatInfo: publicChatInfo) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessage.SNProtoDataMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoNullMessage + +@objc public class SNProtoNullMessage: NSObject { + + // MARK: - SNProtoNullMessageBuilder + + @objc public class func builder() -> SNProtoNullMessageBuilder { + return SNProtoNullMessageBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoNullMessageBuilder { + let builder = SNProtoNullMessageBuilder() + if let _value = padding { + builder.setPadding(_value) + } + return builder + } + + @objc public class SNProtoNullMessageBuilder: NSObject { + + private var proto = SessionProtos_NullMessage() + + @objc fileprivate override init() {} + + @objc public func setPadding(_ valueParam: Data) { + proto.padding = valueParam + } + + @objc public func build() throws -> SNProtoNullMessage { + return try SNProtoNullMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoNullMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_NullMessage + + @objc public var padding: Data? { + guard proto.hasPadding else { + return nil + } + return proto.padding + } + @objc public var hasPadding: Bool { + return proto.hasPadding + } + + private init(proto: SessionProtos_NullMessage) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoNullMessage { + let proto = try SessionProtos_NullMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_NullMessage) throws -> SNProtoNullMessage { + // MARK: - Begin Validation Logic for SNProtoNullMessage - + + // MARK: - End Validation Logic for SNProtoNullMessage - + + let result = SNProtoNullMessage(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoNullMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoNullMessage.SNProtoNullMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoNullMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoReceiptMessage + +@objc public class SNProtoReceiptMessage: NSObject { + + // MARK: - SNProtoReceiptMessageType + + @objc public enum SNProtoReceiptMessageType: Int32 { + case delivery = 0 + case read = 1 + } + + private class func SNProtoReceiptMessageTypeWrap(_ value: SessionProtos_ReceiptMessage.TypeEnum) -> SNProtoReceiptMessageType { + switch value { + case .delivery: return .delivery + case .read: return .read + } + } + + private class func SNProtoReceiptMessageTypeUnwrap(_ value: SNProtoReceiptMessageType) -> SessionProtos_ReceiptMessage.TypeEnum { + switch value { + case .delivery: return .delivery + case .read: return .read + } + } + + // MARK: - SNProtoReceiptMessageBuilder + + @objc public class func builder(type: SNProtoReceiptMessageType) -> SNProtoReceiptMessageBuilder { + return SNProtoReceiptMessageBuilder(type: type) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoReceiptMessageBuilder { + let builder = SNProtoReceiptMessageBuilder(type: type) + builder.setTimestamp(timestamp) + return builder + } + + @objc public class SNProtoReceiptMessageBuilder: NSObject { + + private var proto = SessionProtos_ReceiptMessage() + + @objc fileprivate override init() {} + + @objc fileprivate init(type: SNProtoReceiptMessageType) { + super.init() + + setType(type) + } + + @objc public func setType(_ valueParam: SNProtoReceiptMessageType) { + proto.type = SNProtoReceiptMessageTypeUnwrap(valueParam) + } + + @objc public func addTimestamp(_ valueParam: UInt64) { + var items = proto.timestamp + items.append(valueParam) + proto.timestamp = items + } + + @objc public func setTimestamp(_ wrappedItems: [UInt64]) { + proto.timestamp = wrappedItems + } + + @objc public func build() throws -> SNProtoReceiptMessage { + return try SNProtoReceiptMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoReceiptMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_ReceiptMessage + + @objc public let type: SNProtoReceiptMessageType + + @objc public var timestamp: [UInt64] { + return proto.timestamp + } + + private init(proto: SessionProtos_ReceiptMessage, + type: SNProtoReceiptMessageType) { + self.proto = proto + self.type = type + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoReceiptMessage { + let proto = try SessionProtos_ReceiptMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_ReceiptMessage) throws -> SNProtoReceiptMessage { + guard proto.hasType else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type") + } + let type = SNProtoReceiptMessageTypeWrap(proto.type) + + // MARK: - Begin Validation Logic for SNProtoReceiptMessage - + + // MARK: - End Validation Logic for SNProtoReceiptMessage - + + let result = SNProtoReceiptMessage(proto: proto, + type: type) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoReceiptMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoReceiptMessage.SNProtoReceiptMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoReceiptMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoVerified + +@objc public class SNProtoVerified: NSObject { + + // MARK: - SNProtoVerifiedState + + @objc public enum SNProtoVerifiedState: Int32 { + case `default` = 0 + case verified = 1 + case unverified = 2 + } + + private class func SNProtoVerifiedStateWrap(_ value: SessionProtos_Verified.State) -> SNProtoVerifiedState { + switch value { + case .default: return .default + case .verified: return .verified + case .unverified: return .unverified + } + } + + private class func SNProtoVerifiedStateUnwrap(_ value: SNProtoVerifiedState) -> SessionProtos_Verified.State { + switch value { + case .default: return .default + case .verified: return .verified + case .unverified: return .unverified + } + } + + // MARK: - SNProtoVerifiedBuilder + + @objc public class func builder(destination: String) -> SNProtoVerifiedBuilder { + return SNProtoVerifiedBuilder(destination: destination) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoVerifiedBuilder { + let builder = SNProtoVerifiedBuilder(destination: destination) + if let _value = identityKey { + builder.setIdentityKey(_value) + } + if hasState { + builder.setState(state) + } + if let _value = nullMessage { + builder.setNullMessage(_value) + } + return builder + } + + @objc public class SNProtoVerifiedBuilder: NSObject { + + private var proto = SessionProtos_Verified() + + @objc fileprivate override init() {} + + @objc fileprivate init(destination: String) { + super.init() + + setDestination(destination) + } + + @objc public func setDestination(_ valueParam: String) { + proto.destination = valueParam + } + + @objc public func setIdentityKey(_ valueParam: Data) { + proto.identityKey = valueParam + } + + @objc public func setState(_ valueParam: SNProtoVerifiedState) { + proto.state = SNProtoVerifiedStateUnwrap(valueParam) + } + + @objc public func setNullMessage(_ valueParam: Data) { + proto.nullMessage = valueParam + } + + @objc public func build() throws -> SNProtoVerified { + return try SNProtoVerified.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoVerified.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_Verified + + @objc public let destination: String + + @objc public var identityKey: Data? { + guard proto.hasIdentityKey else { + return nil + } + return proto.identityKey + } + @objc public var hasIdentityKey: Bool { + return proto.hasIdentityKey + } + + @objc public var state: SNProtoVerifiedState { + return SNProtoVerified.SNProtoVerifiedStateWrap(proto.state) + } + @objc public var hasState: Bool { + return proto.hasState + } + + @objc public var nullMessage: Data? { + guard proto.hasNullMessage else { + return nil + } + return proto.nullMessage + } + @objc public var hasNullMessage: Bool { + return proto.hasNullMessage + } + + private init(proto: SessionProtos_Verified, + destination: String) { + self.proto = proto + self.destination = destination + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoVerified { + let proto = try SessionProtos_Verified(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_Verified) throws -> SNProtoVerified { + guard proto.hasDestination else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: destination") + } + let destination = proto.destination + + // MARK: - Begin Validation Logic for SNProtoVerified - + + // MARK: - End Validation Logic for SNProtoVerified - + + let result = SNProtoVerified(proto: proto, + destination: destination) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoVerified { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoVerified.SNProtoVerifiedBuilder { + @objc public func buildIgnoringErrors() -> SNProtoVerified? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageSentUnidentifiedDeliveryStatus + +@objc public class SNProtoSyncMessageSentUnidentifiedDeliveryStatus: NSObject { + + // MARK: - SNProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder + + @objc public class func builder() -> SNProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder { + return SNProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder { + let builder = SNProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder() + if let _value = destination { + builder.setDestination(_value) + } + if hasUnidentified { + builder.setUnidentified(unidentified) + } + return builder + } + + @objc public class SNProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus() + + @objc fileprivate override init() {} + + @objc public func setDestination(_ valueParam: String) { + proto.destination = valueParam + } + + @objc public func setUnidentified(_ valueParam: Bool) { + proto.unidentified = valueParam + } + + @objc public func build() throws -> SNProtoSyncMessageSentUnidentifiedDeliveryStatus { + return try SNProtoSyncMessageSentUnidentifiedDeliveryStatus.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageSentUnidentifiedDeliveryStatus.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus + + @objc public var destination: String? { + guard proto.hasDestination else { + return nil + } + return proto.destination + } + @objc public var hasDestination: Bool { + return proto.hasDestination + } + + @objc public var unidentified: Bool { + return proto.unidentified + } + @objc public var hasUnidentified: Bool { + return proto.hasUnidentified + } + + private init(proto: SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageSentUnidentifiedDeliveryStatus { + let proto = try SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus) throws -> SNProtoSyncMessageSentUnidentifiedDeliveryStatus { + // MARK: - Begin Validation Logic for SNProtoSyncMessageSentUnidentifiedDeliveryStatus - + + // MARK: - End Validation Logic for SNProtoSyncMessageSentUnidentifiedDeliveryStatus - + + let result = SNProtoSyncMessageSentUnidentifiedDeliveryStatus(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageSentUnidentifiedDeliveryStatus { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageSentUnidentifiedDeliveryStatus.SNProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageSentUnidentifiedDeliveryStatus? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageSent + +@objc public class SNProtoSyncMessageSent: NSObject { + + // MARK: - SNProtoSyncMessageSentBuilder + + @objc public class func builder() -> SNProtoSyncMessageSentBuilder { + return SNProtoSyncMessageSentBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageSentBuilder { + let builder = SNProtoSyncMessageSentBuilder() + if let _value = destination { + builder.setDestination(_value) + } + if hasTimestamp { + builder.setTimestamp(timestamp) + } + if let _value = message { + builder.setMessage(_value) + } + if hasExpirationStartTimestamp { + builder.setExpirationStartTimestamp(expirationStartTimestamp) + } + builder.setUnidentifiedStatus(unidentifiedStatus) + if hasIsRecipientUpdate { + builder.setIsRecipientUpdate(isRecipientUpdate) + } + return builder + } + + @objc public class SNProtoSyncMessageSentBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Sent() + + @objc fileprivate override init() {} + + @objc public func setDestination(_ valueParam: String) { + proto.destination = valueParam + } + + @objc public func setTimestamp(_ valueParam: UInt64) { + proto.timestamp = valueParam + } + + @objc public func setMessage(_ valueParam: SNProtoDataMessage) { + proto.message = valueParam.proto + } + + @objc public func setExpirationStartTimestamp(_ valueParam: UInt64) { + proto.expirationStartTimestamp = valueParam + } + + @objc public func addUnidentifiedStatus(_ valueParam: SNProtoSyncMessageSentUnidentifiedDeliveryStatus) { + var items = proto.unidentifiedStatus + items.append(valueParam.proto) + proto.unidentifiedStatus = items + } + + @objc public func setUnidentifiedStatus(_ wrappedItems: [SNProtoSyncMessageSentUnidentifiedDeliveryStatus]) { + proto.unidentifiedStatus = wrappedItems.map { $0.proto } + } + + @objc public func setIsRecipientUpdate(_ valueParam: Bool) { + proto.isRecipientUpdate = valueParam + } + + @objc public func build() throws -> SNProtoSyncMessageSent { + return try SNProtoSyncMessageSent.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageSent.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Sent + + @objc public let message: SNProtoDataMessage? + + @objc public let unidentifiedStatus: [SNProtoSyncMessageSentUnidentifiedDeliveryStatus] + + @objc public var destination: String? { + guard proto.hasDestination else { + return nil + } + return proto.destination + } + @objc public var hasDestination: Bool { + return proto.hasDestination + } + + @objc public var timestamp: UInt64 { + return proto.timestamp + } + @objc public var hasTimestamp: Bool { + return proto.hasTimestamp + } + + @objc public var expirationStartTimestamp: UInt64 { + return proto.expirationStartTimestamp + } + @objc public var hasExpirationStartTimestamp: Bool { + return proto.hasExpirationStartTimestamp + } + + @objc public var isRecipientUpdate: Bool { + return proto.isRecipientUpdate + } + @objc public var hasIsRecipientUpdate: Bool { + return proto.hasIsRecipientUpdate + } + + private init(proto: SessionProtos_SyncMessage.Sent, + message: SNProtoDataMessage?, + unidentifiedStatus: [SNProtoSyncMessageSentUnidentifiedDeliveryStatus]) { + self.proto = proto + self.message = message + self.unidentifiedStatus = unidentifiedStatus + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageSent { + let proto = try SessionProtos_SyncMessage.Sent(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Sent) throws -> SNProtoSyncMessageSent { + var message: SNProtoDataMessage? = nil + if proto.hasMessage { + message = try SNProtoDataMessage.parseProto(proto.message) + } + + var unidentifiedStatus: [SNProtoSyncMessageSentUnidentifiedDeliveryStatus] = [] + unidentifiedStatus = try proto.unidentifiedStatus.map { try SNProtoSyncMessageSentUnidentifiedDeliveryStatus.parseProto($0) } + + // MARK: - Begin Validation Logic for SNProtoSyncMessageSent - + + // MARK: - End Validation Logic for SNProtoSyncMessageSent - + + let result = SNProtoSyncMessageSent(proto: proto, + message: message, + unidentifiedStatus: unidentifiedStatus) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageSent { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageSent.SNProtoSyncMessageSentBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageSent? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageContacts + +@objc public class SNProtoSyncMessageContacts: NSObject { + + // MARK: - SNProtoSyncMessageContactsBuilder + + @objc public class func builder() -> SNProtoSyncMessageContactsBuilder { + return SNProtoSyncMessageContactsBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageContactsBuilder { + let builder = SNProtoSyncMessageContactsBuilder() + if let _value = blob { + builder.setBlob(_value) + } + if hasIsComplete { + builder.setIsComplete(isComplete) + } + if let _value = data { + builder.setData(_value) + } + return builder + } + + @objc public class SNProtoSyncMessageContactsBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Contacts() + + @objc fileprivate override init() {} + + @objc public func setBlob(_ valueParam: SNProtoAttachmentPointer) { + proto.blob = valueParam.proto + } + + @objc public func setIsComplete(_ valueParam: Bool) { + proto.isComplete = valueParam + } + + @objc public func setData(_ valueParam: Data) { + proto.data = valueParam + } + + @objc public func build() throws -> SNProtoSyncMessageContacts { + return try SNProtoSyncMessageContacts.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageContacts.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Contacts + + @objc public let blob: SNProtoAttachmentPointer? + + @objc public var isComplete: Bool { + return proto.isComplete + } + @objc public var hasIsComplete: Bool { + return proto.hasIsComplete + } + + @objc public var data: Data? { + guard proto.hasData else { + return nil + } + return proto.data + } + @objc public var hasData: Bool { + return proto.hasData + } + + private init(proto: SessionProtos_SyncMessage.Contacts, + blob: SNProtoAttachmentPointer?) { + self.proto = proto + self.blob = blob + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageContacts { + let proto = try SessionProtos_SyncMessage.Contacts(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Contacts) throws -> SNProtoSyncMessageContacts { + var blob: SNProtoAttachmentPointer? = nil + if proto.hasBlob { + blob = try SNProtoAttachmentPointer.parseProto(proto.blob) + } + + // MARK: - Begin Validation Logic for SNProtoSyncMessageContacts - + + // MARK: - End Validation Logic for SNProtoSyncMessageContacts - + + let result = SNProtoSyncMessageContacts(proto: proto, + blob: blob) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageContacts { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageContacts.SNProtoSyncMessageContactsBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageContacts? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageGroups + +@objc public class SNProtoSyncMessageGroups: NSObject { + + // MARK: - SNProtoSyncMessageGroupsBuilder + + @objc public class func builder() -> SNProtoSyncMessageGroupsBuilder { + return SNProtoSyncMessageGroupsBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageGroupsBuilder { + let builder = SNProtoSyncMessageGroupsBuilder() + if let _value = blob { + builder.setBlob(_value) + } + if let _value = data { + builder.setData(_value) + } + return builder + } + + @objc public class SNProtoSyncMessageGroupsBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Groups() + + @objc fileprivate override init() {} + + @objc public func setBlob(_ valueParam: SNProtoAttachmentPointer) { + proto.blob = valueParam.proto + } + + @objc public func setData(_ valueParam: Data) { + proto.data = valueParam + } + + @objc public func build() throws -> SNProtoSyncMessageGroups { + return try SNProtoSyncMessageGroups.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageGroups.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Groups + + @objc public let blob: SNProtoAttachmentPointer? + + @objc public var data: Data? { + guard proto.hasData else { + return nil + } + return proto.data + } + @objc public var hasData: Bool { + return proto.hasData + } + + private init(proto: SessionProtos_SyncMessage.Groups, + blob: SNProtoAttachmentPointer?) { + self.proto = proto + self.blob = blob + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageGroups { + let proto = try SessionProtos_SyncMessage.Groups(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Groups) throws -> SNProtoSyncMessageGroups { + var blob: SNProtoAttachmentPointer? = nil + if proto.hasBlob { + blob = try SNProtoAttachmentPointer.parseProto(proto.blob) + } + + // MARK: - Begin Validation Logic for SNProtoSyncMessageGroups - + + // MARK: - End Validation Logic for SNProtoSyncMessageGroups - + + let result = SNProtoSyncMessageGroups(proto: proto, + blob: blob) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageGroups { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageGroups.SNProtoSyncMessageGroupsBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageGroups? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageOpenGroupDetails + +@objc public class SNProtoSyncMessageOpenGroupDetails: NSObject { + + // MARK: - SNProtoSyncMessageOpenGroupDetailsBuilder + + @objc public class func builder(url: String, channelID: UInt64) -> SNProtoSyncMessageOpenGroupDetailsBuilder { + return SNProtoSyncMessageOpenGroupDetailsBuilder(url: url, channelID: channelID) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageOpenGroupDetailsBuilder { + let builder = SNProtoSyncMessageOpenGroupDetailsBuilder(url: url, channelID: channelID) + return builder + } + + @objc public class SNProtoSyncMessageOpenGroupDetailsBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.OpenGroupDetails() + + @objc fileprivate override init() {} + + @objc fileprivate init(url: String, channelID: UInt64) { + super.init() + + setUrl(url) + setChannelID(channelID) + } + + @objc public func setUrl(_ valueParam: String) { + proto.url = valueParam + } + + @objc public func setChannelID(_ valueParam: UInt64) { + proto.channelID = valueParam + } + + @objc public func build() throws -> SNProtoSyncMessageOpenGroupDetails { + return try SNProtoSyncMessageOpenGroupDetails.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageOpenGroupDetails.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.OpenGroupDetails + + @objc public let url: String + + @objc public let channelID: UInt64 + + private init(proto: SessionProtos_SyncMessage.OpenGroupDetails, + url: String, + channelID: UInt64) { + self.proto = proto + self.url = url + self.channelID = channelID + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageOpenGroupDetails { + let proto = try SessionProtos_SyncMessage.OpenGroupDetails(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.OpenGroupDetails) throws -> SNProtoSyncMessageOpenGroupDetails { + guard proto.hasURL else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: url") + } + let url = proto.url + + guard proto.hasChannelID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: channelID") + } + let channelID = proto.channelID + + // MARK: - Begin Validation Logic for SNProtoSyncMessageOpenGroupDetails - + + // MARK: - End Validation Logic for SNProtoSyncMessageOpenGroupDetails - + + let result = SNProtoSyncMessageOpenGroupDetails(proto: proto, + url: url, + channelID: channelID) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageOpenGroupDetails { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageOpenGroupDetails.SNProtoSyncMessageOpenGroupDetailsBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageOpenGroupDetails? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageBlocked + +@objc public class SNProtoSyncMessageBlocked: NSObject { + + // MARK: - SNProtoSyncMessageBlockedBuilder + + @objc public class func builder() -> SNProtoSyncMessageBlockedBuilder { + return SNProtoSyncMessageBlockedBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageBlockedBuilder { + let builder = SNProtoSyncMessageBlockedBuilder() + builder.setNumbers(numbers) + builder.setGroupIds(groupIds) + return builder + } + + @objc public class SNProtoSyncMessageBlockedBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Blocked() + + @objc fileprivate override init() {} + + @objc public func addNumbers(_ valueParam: String) { + var items = proto.numbers + items.append(valueParam) + proto.numbers = items + } + + @objc public func setNumbers(_ wrappedItems: [String]) { + proto.numbers = wrappedItems + } + + @objc public func addGroupIds(_ valueParam: Data) { + var items = proto.groupIds + items.append(valueParam) + proto.groupIds = items + } + + @objc public func setGroupIds(_ wrappedItems: [Data]) { + proto.groupIds = wrappedItems + } + + @objc public func build() throws -> SNProtoSyncMessageBlocked { + return try SNProtoSyncMessageBlocked.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageBlocked.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Blocked + + @objc public var numbers: [String] { + return proto.numbers + } + + @objc public var groupIds: [Data] { + return proto.groupIds + } + + private init(proto: SessionProtos_SyncMessage.Blocked) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageBlocked { + let proto = try SessionProtos_SyncMessage.Blocked(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Blocked) throws -> SNProtoSyncMessageBlocked { + // MARK: - Begin Validation Logic for SNProtoSyncMessageBlocked - + + // MARK: - End Validation Logic for SNProtoSyncMessageBlocked - + + let result = SNProtoSyncMessageBlocked(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageBlocked { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageBlocked.SNProtoSyncMessageBlockedBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageBlocked? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageRequest + +@objc public class SNProtoSyncMessageRequest: NSObject { + + // MARK: - SNProtoSyncMessageRequestType + + @objc public enum SNProtoSyncMessageRequestType: Int32 { + case unknown = 0 + case contacts = 1 + case groups = 2 + case blocked = 3 + case configuration = 4 + } + + private class func SNProtoSyncMessageRequestTypeWrap(_ value: SessionProtos_SyncMessage.Request.TypeEnum) -> SNProtoSyncMessageRequestType { + switch value { + case .unknown: return .unknown + case .contacts: return .contacts + case .groups: return .groups + case .blocked: return .blocked + case .configuration: return .configuration + } + } + + private class func SNProtoSyncMessageRequestTypeUnwrap(_ value: SNProtoSyncMessageRequestType) -> SessionProtos_SyncMessage.Request.TypeEnum { + switch value { + case .unknown: return .unknown + case .contacts: return .contacts + case .groups: return .groups + case .blocked: return .blocked + case .configuration: return .configuration + } + } + + // MARK: - SNProtoSyncMessageRequestBuilder + + @objc public class func builder(type: SNProtoSyncMessageRequestType) -> SNProtoSyncMessageRequestBuilder { + return SNProtoSyncMessageRequestBuilder(type: type) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageRequestBuilder { + let builder = SNProtoSyncMessageRequestBuilder(type: type) + return builder + } + + @objc public class SNProtoSyncMessageRequestBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Request() + + @objc fileprivate override init() {} + + @objc fileprivate init(type: SNProtoSyncMessageRequestType) { + super.init() + + setType(type) + } + + @objc public func setType(_ valueParam: SNProtoSyncMessageRequestType) { + proto.type = SNProtoSyncMessageRequestTypeUnwrap(valueParam) + } + + @objc public func build() throws -> SNProtoSyncMessageRequest { + return try SNProtoSyncMessageRequest.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageRequest.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Request + + @objc public let type: SNProtoSyncMessageRequestType + + private init(proto: SessionProtos_SyncMessage.Request, + type: SNProtoSyncMessageRequestType) { + self.proto = proto + self.type = type + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageRequest { + let proto = try SessionProtos_SyncMessage.Request(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Request) throws -> SNProtoSyncMessageRequest { + guard proto.hasType else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type") + } + let type = SNProtoSyncMessageRequestTypeWrap(proto.type) + + // MARK: - Begin Validation Logic for SNProtoSyncMessageRequest - + + // MARK: - End Validation Logic for SNProtoSyncMessageRequest - + + let result = SNProtoSyncMessageRequest(proto: proto, + type: type) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageRequest { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageRequest.SNProtoSyncMessageRequestBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageRequest? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageRead + +@objc public class SNProtoSyncMessageRead: NSObject { + + // MARK: - SNProtoSyncMessageReadBuilder + + @objc public class func builder(sender: String, timestamp: UInt64) -> SNProtoSyncMessageReadBuilder { + return SNProtoSyncMessageReadBuilder(sender: sender, timestamp: timestamp) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageReadBuilder { + let builder = SNProtoSyncMessageReadBuilder(sender: sender, timestamp: timestamp) + return builder + } + + @objc public class SNProtoSyncMessageReadBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Read() + + @objc fileprivate override init() {} + + @objc fileprivate init(sender: String, timestamp: UInt64) { + super.init() + + setSender(sender) + setTimestamp(timestamp) + } + + @objc public func setSender(_ valueParam: String) { + proto.sender = valueParam + } + + @objc public func setTimestamp(_ valueParam: UInt64) { + proto.timestamp = valueParam + } + + @objc public func build() throws -> SNProtoSyncMessageRead { + return try SNProtoSyncMessageRead.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageRead.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Read + + @objc public let sender: String + + @objc public let timestamp: UInt64 + + private init(proto: SessionProtos_SyncMessage.Read, + sender: String, + timestamp: UInt64) { + self.proto = proto + self.sender = sender + self.timestamp = timestamp + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageRead { + let proto = try SessionProtos_SyncMessage.Read(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Read) throws -> SNProtoSyncMessageRead { + guard proto.hasSender else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: sender") + } + let sender = proto.sender + + guard proto.hasTimestamp else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: timestamp") + } + let timestamp = proto.timestamp + + // MARK: - Begin Validation Logic for SNProtoSyncMessageRead - + + // MARK: - End Validation Logic for SNProtoSyncMessageRead - + + let result = SNProtoSyncMessageRead(proto: proto, + sender: sender, + timestamp: timestamp) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageRead { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageRead.SNProtoSyncMessageReadBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageRead? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessageConfiguration + +@objc public class SNProtoSyncMessageConfiguration: NSObject { + + // MARK: - SNProtoSyncMessageConfigurationBuilder + + @objc public class func builder() -> SNProtoSyncMessageConfigurationBuilder { + return SNProtoSyncMessageConfigurationBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageConfigurationBuilder { + let builder = SNProtoSyncMessageConfigurationBuilder() + if hasReadReceipts { + builder.setReadReceipts(readReceipts) + } + if hasUnidentifiedDeliveryIndicators { + builder.setUnidentifiedDeliveryIndicators(unidentifiedDeliveryIndicators) + } + if hasTypingIndicators { + builder.setTypingIndicators(typingIndicators) + } + if hasLinkPreviews { + builder.setLinkPreviews(linkPreviews) + } + return builder + } + + @objc public class SNProtoSyncMessageConfigurationBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage.Configuration() + + @objc fileprivate override init() {} + + @objc public func setReadReceipts(_ valueParam: Bool) { + proto.readReceipts = valueParam + } + + @objc public func setUnidentifiedDeliveryIndicators(_ valueParam: Bool) { + proto.unidentifiedDeliveryIndicators = valueParam + } + + @objc public func setTypingIndicators(_ valueParam: Bool) { + proto.typingIndicators = valueParam + } + + @objc public func setLinkPreviews(_ valueParam: Bool) { + proto.linkPreviews = valueParam + } + + @objc public func build() throws -> SNProtoSyncMessageConfiguration { + return try SNProtoSyncMessageConfiguration.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessageConfiguration.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage.Configuration + + @objc public var readReceipts: Bool { + return proto.readReceipts + } + @objc public var hasReadReceipts: Bool { + return proto.hasReadReceipts + } + + @objc public var unidentifiedDeliveryIndicators: Bool { + return proto.unidentifiedDeliveryIndicators + } + @objc public var hasUnidentifiedDeliveryIndicators: Bool { + return proto.hasUnidentifiedDeliveryIndicators + } + + @objc public var typingIndicators: Bool { + return proto.typingIndicators + } + @objc public var hasTypingIndicators: Bool { + return proto.hasTypingIndicators + } + + @objc public var linkPreviews: Bool { + return proto.linkPreviews + } + @objc public var hasLinkPreviews: Bool { + return proto.hasLinkPreviews + } + + private init(proto: SessionProtos_SyncMessage.Configuration) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageConfiguration { + let proto = try SessionProtos_SyncMessage.Configuration(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Configuration) throws -> SNProtoSyncMessageConfiguration { + // MARK: - Begin Validation Logic for SNProtoSyncMessageConfiguration - + + // MARK: - End Validation Logic for SNProtoSyncMessageConfiguration - + + let result = SNProtoSyncMessageConfiguration(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessageConfiguration { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessageConfiguration.SNProtoSyncMessageConfigurationBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessageConfiguration? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoSyncMessage + +@objc public class SNProtoSyncMessage: NSObject { + + // MARK: - SNProtoSyncMessageBuilder + + @objc public class func builder() -> SNProtoSyncMessageBuilder { + return SNProtoSyncMessageBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoSyncMessageBuilder { + let builder = SNProtoSyncMessageBuilder() + if let _value = sent { + builder.setSent(_value) + } + if let _value = contacts { + builder.setContacts(_value) + } + if let _value = groups { + builder.setGroups(_value) + } + if let _value = request { + builder.setRequest(_value) + } + builder.setRead(read) + if let _value = blocked { + builder.setBlocked(_value) + } + if let _value = verified { + builder.setVerified(_value) + } + if let _value = configuration { + builder.setConfiguration(_value) + } + if let _value = padding { + builder.setPadding(_value) + } + builder.setOpenGroups(openGroups) + return builder + } + + @objc public class SNProtoSyncMessageBuilder: NSObject { + + private var proto = SessionProtos_SyncMessage() + + @objc fileprivate override init() {} + + @objc public func setSent(_ valueParam: SNProtoSyncMessageSent) { + proto.sent = valueParam.proto + } + + @objc public func setContacts(_ valueParam: SNProtoSyncMessageContacts) { + proto.contacts = valueParam.proto + } + + @objc public func setGroups(_ valueParam: SNProtoSyncMessageGroups) { + proto.groups = valueParam.proto + } + + @objc public func setRequest(_ valueParam: SNProtoSyncMessageRequest) { + proto.request = valueParam.proto + } + + @objc public func addRead(_ valueParam: SNProtoSyncMessageRead) { + var items = proto.read + items.append(valueParam.proto) + proto.read = items + } + + @objc public func setRead(_ wrappedItems: [SNProtoSyncMessageRead]) { + proto.read = wrappedItems.map { $0.proto } + } + + @objc public func setBlocked(_ valueParam: SNProtoSyncMessageBlocked) { + proto.blocked = valueParam.proto + } + + @objc public func setVerified(_ valueParam: SNProtoVerified) { + proto.verified = valueParam.proto + } + + @objc public func setConfiguration(_ valueParam: SNProtoSyncMessageConfiguration) { + proto.configuration = valueParam.proto + } + + @objc public func setPadding(_ valueParam: Data) { + proto.padding = valueParam + } + + @objc public func addOpenGroups(_ valueParam: SNProtoSyncMessageOpenGroupDetails) { + var items = proto.openGroups + items.append(valueParam.proto) + proto.openGroups = items + } + + @objc public func setOpenGroups(_ wrappedItems: [SNProtoSyncMessageOpenGroupDetails]) { + proto.openGroups = wrappedItems.map { $0.proto } + } + + @objc public func build() throws -> SNProtoSyncMessage { + return try SNProtoSyncMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoSyncMessage.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_SyncMessage + + @objc public let sent: SNProtoSyncMessageSent? + + @objc public let contacts: SNProtoSyncMessageContacts? + + @objc public let groups: SNProtoSyncMessageGroups? + + @objc public let request: SNProtoSyncMessageRequest? + + @objc public let read: [SNProtoSyncMessageRead] + + @objc public let blocked: SNProtoSyncMessageBlocked? + + @objc public let verified: SNProtoVerified? + + @objc public let configuration: SNProtoSyncMessageConfiguration? + + @objc public let openGroups: [SNProtoSyncMessageOpenGroupDetails] + + @objc public var padding: Data? { + guard proto.hasPadding else { + return nil + } + return proto.padding + } + @objc public var hasPadding: Bool { + return proto.hasPadding + } + + private init(proto: SessionProtos_SyncMessage, + sent: SNProtoSyncMessageSent?, + contacts: SNProtoSyncMessageContacts?, + groups: SNProtoSyncMessageGroups?, + request: SNProtoSyncMessageRequest?, + read: [SNProtoSyncMessageRead], + blocked: SNProtoSyncMessageBlocked?, + verified: SNProtoVerified?, + configuration: SNProtoSyncMessageConfiguration?, + openGroups: [SNProtoSyncMessageOpenGroupDetails]) { + self.proto = proto + self.sent = sent + self.contacts = contacts + self.groups = groups + self.request = request + self.read = read + self.blocked = blocked + self.verified = verified + self.configuration = configuration + self.openGroups = openGroups + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessage { + let proto = try SessionProtos_SyncMessage(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage) throws -> SNProtoSyncMessage { + var sent: SNProtoSyncMessageSent? = nil + if proto.hasSent { + sent = try SNProtoSyncMessageSent.parseProto(proto.sent) + } + + var contacts: SNProtoSyncMessageContacts? = nil + if proto.hasContacts { + contacts = try SNProtoSyncMessageContacts.parseProto(proto.contacts) + } + + var groups: SNProtoSyncMessageGroups? = nil + if proto.hasGroups { + groups = try SNProtoSyncMessageGroups.parseProto(proto.groups) + } + + var request: SNProtoSyncMessageRequest? = nil + if proto.hasRequest { + request = try SNProtoSyncMessageRequest.parseProto(proto.request) + } + + var read: [SNProtoSyncMessageRead] = [] + read = try proto.read.map { try SNProtoSyncMessageRead.parseProto($0) } + + var blocked: SNProtoSyncMessageBlocked? = nil + if proto.hasBlocked { + blocked = try SNProtoSyncMessageBlocked.parseProto(proto.blocked) + } + + var verified: SNProtoVerified? = nil + if proto.hasVerified { + verified = try SNProtoVerified.parseProto(proto.verified) + } + + var configuration: SNProtoSyncMessageConfiguration? = nil + if proto.hasConfiguration { + configuration = try SNProtoSyncMessageConfiguration.parseProto(proto.configuration) + } + + var openGroups: [SNProtoSyncMessageOpenGroupDetails] = [] + openGroups = try proto.openGroups.map { try SNProtoSyncMessageOpenGroupDetails.parseProto($0) } + + // MARK: - Begin Validation Logic for SNProtoSyncMessage - + + // MARK: - End Validation Logic for SNProtoSyncMessage - + + let result = SNProtoSyncMessage(proto: proto, + sent: sent, + contacts: contacts, + groups: groups, + request: request, + read: read, + blocked: blocked, + verified: verified, + configuration: configuration, + openGroups: openGroups) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoSyncMessage { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoSyncMessage.SNProtoSyncMessageBuilder { + @objc public func buildIgnoringErrors() -> SNProtoSyncMessage? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoAttachmentPointer + +@objc public class SNProtoAttachmentPointer: NSObject { + + // MARK: - SNProtoAttachmentPointerFlags + + @objc public enum SNProtoAttachmentPointerFlags: Int32 { + case voiceMessage = 1 + } + + private class func SNProtoAttachmentPointerFlagsWrap(_ value: SessionProtos_AttachmentPointer.Flags) -> SNProtoAttachmentPointerFlags { + switch value { + case .voiceMessage: return .voiceMessage + } + } + + private class func SNProtoAttachmentPointerFlagsUnwrap(_ value: SNProtoAttachmentPointerFlags) -> SessionProtos_AttachmentPointer.Flags { + switch value { + case .voiceMessage: return .voiceMessage + } + } + + // MARK: - SNProtoAttachmentPointerBuilder + + @objc public class func builder(id: UInt64) -> SNProtoAttachmentPointerBuilder { + return SNProtoAttachmentPointerBuilder(id: id) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoAttachmentPointerBuilder { + let builder = SNProtoAttachmentPointerBuilder(id: id) + if let _value = contentType { + builder.setContentType(_value) + } + if let _value = key { + builder.setKey(_value) + } + if hasSize { + builder.setSize(size) + } + if let _value = thumbnail { + builder.setThumbnail(_value) + } + if let _value = digest { + builder.setDigest(_value) + } + if let _value = fileName { + builder.setFileName(_value) + } + if hasFlags { + builder.setFlags(flags) + } + if hasWidth { + builder.setWidth(width) + } + if hasHeight { + builder.setHeight(height) + } + if let _value = caption { + builder.setCaption(_value) + } + if let _value = url { + builder.setUrl(_value) + } + return builder + } + + @objc public class SNProtoAttachmentPointerBuilder: NSObject { + + private var proto = SessionProtos_AttachmentPointer() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: UInt64) { + super.init() + + setId(id) + } + + @objc public func setId(_ valueParam: UInt64) { + proto.id = valueParam + } + + @objc public func setContentType(_ valueParam: String) { + proto.contentType = valueParam + } + + @objc public func setKey(_ valueParam: Data) { + proto.key = valueParam + } + + @objc public func setSize(_ valueParam: UInt32) { + proto.size = valueParam + } + + @objc public func setThumbnail(_ valueParam: Data) { + proto.thumbnail = valueParam + } + + @objc public func setDigest(_ valueParam: Data) { + proto.digest = valueParam + } + + @objc public func setFileName(_ valueParam: String) { + proto.fileName = valueParam + } + + @objc public func setFlags(_ valueParam: UInt32) { + proto.flags = valueParam + } + + @objc public func setWidth(_ valueParam: UInt32) { + proto.width = valueParam + } + + @objc public func setHeight(_ valueParam: UInt32) { + proto.height = valueParam + } + + @objc public func setCaption(_ valueParam: String) { + proto.caption = valueParam + } + + @objc public func setUrl(_ valueParam: String) { + proto.url = valueParam + } + + @objc public func build() throws -> SNProtoAttachmentPointer { + return try SNProtoAttachmentPointer.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoAttachmentPointer.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_AttachmentPointer + + @objc public let id: UInt64 + + @objc public var contentType: String? { + guard proto.hasContentType else { + return nil + } + return proto.contentType + } + @objc public var hasContentType: Bool { + return proto.hasContentType + } + + @objc public var key: Data? { + guard proto.hasKey else { + return nil + } + return proto.key + } + @objc public var hasKey: Bool { + return proto.hasKey + } + + @objc public var size: UInt32 { + return proto.size + } + @objc public var hasSize: Bool { + return proto.hasSize + } + + @objc public var thumbnail: Data? { + guard proto.hasThumbnail else { + return nil + } + return proto.thumbnail + } + @objc public var hasThumbnail: Bool { + return proto.hasThumbnail + } + + @objc public var digest: Data? { + guard proto.hasDigest else { + return nil + } + return proto.digest + } + @objc public var hasDigest: Bool { + return proto.hasDigest + } + + @objc public var fileName: String? { + guard proto.hasFileName else { + return nil + } + return proto.fileName + } + @objc public var hasFileName: Bool { + return proto.hasFileName + } + + @objc public var flags: UInt32 { + return proto.flags + } + @objc public var hasFlags: Bool { + return proto.hasFlags + } + + @objc public var width: UInt32 { + return proto.width + } + @objc public var hasWidth: Bool { + return proto.hasWidth + } + + @objc public var height: UInt32 { + return proto.height + } + @objc public var hasHeight: Bool { + return proto.hasHeight + } + + @objc public var caption: String? { + guard proto.hasCaption else { + return nil + } + return proto.caption + } + @objc public var hasCaption: Bool { + return proto.hasCaption + } + + @objc public var url: String? { + guard proto.hasURL else { + return nil + } + return proto.url + } + @objc public var hasURL: Bool { + return proto.hasURL + } + + private init(proto: SessionProtos_AttachmentPointer, + id: UInt64) { + self.proto = proto + self.id = id + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoAttachmentPointer { + let proto = try SessionProtos_AttachmentPointer(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_AttachmentPointer) throws -> SNProtoAttachmentPointer { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + // MARK: - Begin Validation Logic for SNProtoAttachmentPointer - + + // MARK: - End Validation Logic for SNProtoAttachmentPointer - + + let result = SNProtoAttachmentPointer(proto: proto, + id: id) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoAttachmentPointer { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoAttachmentPointer.SNProtoAttachmentPointerBuilder { + @objc public func buildIgnoringErrors() -> SNProtoAttachmentPointer? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoGroupContext + +@objc public class SNProtoGroupContext: NSObject { + + // MARK: - SNProtoGroupContextType + + @objc public enum SNProtoGroupContextType: Int32 { + case unknown = 0 + case update = 1 + case deliver = 2 + case quit = 3 + case requestInfo = 4 + } + + private class func SNProtoGroupContextTypeWrap(_ value: SessionProtos_GroupContext.TypeEnum) -> SNProtoGroupContextType { + switch value { + case .unknown: return .unknown + case .update: return .update + case .deliver: return .deliver + case .quit: return .quit + case .requestInfo: return .requestInfo + } + } + + private class func SNProtoGroupContextTypeUnwrap(_ value: SNProtoGroupContextType) -> SessionProtos_GroupContext.TypeEnum { + switch value { + case .unknown: return .unknown + case .update: return .update + case .deliver: return .deliver + case .quit: return .quit + case .requestInfo: return .requestInfo + } + } + + // MARK: - SNProtoGroupContextBuilder + + @objc public class func builder(id: Data, type: SNProtoGroupContextType) -> SNProtoGroupContextBuilder { + return SNProtoGroupContextBuilder(id: id, type: type) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoGroupContextBuilder { + let builder = SNProtoGroupContextBuilder(id: id, type: type) + if let _value = name { + builder.setName(_value) + } + builder.setMembers(members) + if let _value = avatar { + builder.setAvatar(_value) + } + builder.setAdmins(admins) + return builder + } + + @objc public class SNProtoGroupContextBuilder: NSObject { + + private var proto = SessionProtos_GroupContext() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: Data, type: SNProtoGroupContextType) { + super.init() + + setId(id) + setType(type) + } + + @objc public func setId(_ valueParam: Data) { + proto.id = valueParam + } + + @objc public func setType(_ valueParam: SNProtoGroupContextType) { + proto.type = SNProtoGroupContextTypeUnwrap(valueParam) + } + + @objc public func setName(_ valueParam: String) { + proto.name = valueParam + } + + @objc public func addMembers(_ valueParam: String) { + var items = proto.members + items.append(valueParam) + proto.members = items + } + + @objc public func setMembers(_ wrappedItems: [String]) { + proto.members = wrappedItems + } + + @objc public func setAvatar(_ valueParam: SNProtoAttachmentPointer) { + proto.avatar = valueParam.proto + } + + @objc public func addAdmins(_ valueParam: String) { + var items = proto.admins + items.append(valueParam) + proto.admins = items + } + + @objc public func setAdmins(_ wrappedItems: [String]) { + proto.admins = wrappedItems + } + + @objc public func build() throws -> SNProtoGroupContext { + return try SNProtoGroupContext.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoGroupContext.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_GroupContext + + @objc public let id: Data + + @objc public let type: SNProtoGroupContextType + + @objc public let avatar: SNProtoAttachmentPointer? + + @objc public var name: String? { + guard proto.hasName else { + return nil + } + return proto.name + } + @objc public var hasName: Bool { + return proto.hasName + } + + @objc public var members: [String] { + return proto.members + } + + @objc public var admins: [String] { + return proto.admins + } + + private init(proto: SessionProtos_GroupContext, + id: Data, + type: SNProtoGroupContextType, + avatar: SNProtoAttachmentPointer?) { + self.proto = proto + self.id = id + self.type = type + self.avatar = avatar + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoGroupContext { + let proto = try SessionProtos_GroupContext(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_GroupContext) throws -> SNProtoGroupContext { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + guard proto.hasType else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type") + } + let type = SNProtoGroupContextTypeWrap(proto.type) + + var avatar: SNProtoAttachmentPointer? = nil + if proto.hasAvatar { + avatar = try SNProtoAttachmentPointer.parseProto(proto.avatar) + } + + // MARK: - Begin Validation Logic for SNProtoGroupContext - + + // MARK: - End Validation Logic for SNProtoGroupContext - + + let result = SNProtoGroupContext(proto: proto, + id: id, + type: type, + avatar: avatar) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoGroupContext { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoGroupContext.SNProtoGroupContextBuilder { + @objc public func buildIgnoringErrors() -> SNProtoGroupContext? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoContactDetailsAvatar + +@objc public class SNProtoContactDetailsAvatar: NSObject { + + // MARK: - SNProtoContactDetailsAvatarBuilder + + @objc public class func builder() -> SNProtoContactDetailsAvatarBuilder { + return SNProtoContactDetailsAvatarBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoContactDetailsAvatarBuilder { + let builder = SNProtoContactDetailsAvatarBuilder() + if let _value = contentType { + builder.setContentType(_value) + } + if hasLength { + builder.setLength(length) + } + return builder + } + + @objc public class SNProtoContactDetailsAvatarBuilder: NSObject { + + private var proto = SessionProtos_ContactDetails.Avatar() + + @objc fileprivate override init() {} + + @objc public func setContentType(_ valueParam: String) { + proto.contentType = valueParam + } + + @objc public func setLength(_ valueParam: UInt32) { + proto.length = valueParam + } + + @objc public func build() throws -> SNProtoContactDetailsAvatar { + return try SNProtoContactDetailsAvatar.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoContactDetailsAvatar.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_ContactDetails.Avatar + + @objc public var contentType: String? { + guard proto.hasContentType else { + return nil + } + return proto.contentType + } + @objc public var hasContentType: Bool { + return proto.hasContentType + } + + @objc public var length: UInt32 { + return proto.length + } + @objc public var hasLength: Bool { + return proto.hasLength + } + + private init(proto: SessionProtos_ContactDetails.Avatar) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoContactDetailsAvatar { + let proto = try SessionProtos_ContactDetails.Avatar(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_ContactDetails.Avatar) throws -> SNProtoContactDetailsAvatar { + // MARK: - Begin Validation Logic for SNProtoContactDetailsAvatar - + + // MARK: - End Validation Logic for SNProtoContactDetailsAvatar - + + let result = SNProtoContactDetailsAvatar(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoContactDetailsAvatar { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoContactDetailsAvatar.SNProtoContactDetailsAvatarBuilder { + @objc public func buildIgnoringErrors() -> SNProtoContactDetailsAvatar? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoContactDetails + +@objc public class SNProtoContactDetails: NSObject { + + // MARK: - SNProtoContactDetailsBuilder + + @objc public class func builder(number: String) -> SNProtoContactDetailsBuilder { + return SNProtoContactDetailsBuilder(number: number) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoContactDetailsBuilder { + let builder = SNProtoContactDetailsBuilder(number: number) + if let _value = name { + builder.setName(_value) + } + if let _value = avatar { + builder.setAvatar(_value) + } + if let _value = color { + builder.setColor(_value) + } + if let _value = verified { + builder.setVerified(_value) + } + if let _value = profileKey { + builder.setProfileKey(_value) + } + if hasBlocked { + builder.setBlocked(blocked) + } + if hasExpireTimer { + builder.setExpireTimer(expireTimer) + } + if let _value = nickname { + builder.setNickname(_value) + } + return builder + } + + @objc public class SNProtoContactDetailsBuilder: NSObject { + + private var proto = SessionProtos_ContactDetails() + + @objc fileprivate override init() {} + + @objc fileprivate init(number: String) { + super.init() + + setNumber(number) + } + + @objc public func setNumber(_ valueParam: String) { + proto.number = valueParam + } + + @objc public func setName(_ valueParam: String) { + proto.name = valueParam + } + + @objc public func setAvatar(_ valueParam: SNProtoContactDetailsAvatar) { + proto.avatar = valueParam.proto + } + + @objc public func setColor(_ valueParam: String) { + proto.color = valueParam + } + + @objc public func setVerified(_ valueParam: SNProtoVerified) { + proto.verified = valueParam.proto + } + + @objc public func setProfileKey(_ valueParam: Data) { + proto.profileKey = valueParam + } + + @objc public func setBlocked(_ valueParam: Bool) { + proto.blocked = valueParam + } + + @objc public func setExpireTimer(_ valueParam: UInt32) { + proto.expireTimer = valueParam + } + + @objc public func setNickname(_ valueParam: String) { + proto.nickname = valueParam + } + + @objc public func build() throws -> SNProtoContactDetails { + return try SNProtoContactDetails.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoContactDetails.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_ContactDetails + + @objc public let number: String + + @objc public let avatar: SNProtoContactDetailsAvatar? + + @objc public let verified: SNProtoVerified? + + @objc public var name: String? { + guard proto.hasName else { + return nil + } + return proto.name + } + @objc public var hasName: Bool { + return proto.hasName + } + + @objc public var color: String? { + guard proto.hasColor else { + return nil + } + return proto.color + } + @objc public var hasColor: Bool { + return proto.hasColor + } + + @objc public var profileKey: Data? { + guard proto.hasProfileKey else { + return nil + } + return proto.profileKey + } + @objc public var hasProfileKey: Bool { + return proto.hasProfileKey + } + + @objc public var blocked: Bool { + return proto.blocked + } + @objc public var hasBlocked: Bool { + return proto.hasBlocked + } + + @objc public var expireTimer: UInt32 { + return proto.expireTimer + } + @objc public var hasExpireTimer: Bool { + return proto.hasExpireTimer + } + + @objc public var nickname: String? { + guard proto.hasNickname else { + return nil + } + return proto.nickname + } + @objc public var hasNickname: Bool { + return proto.hasNickname + } + + private init(proto: SessionProtos_ContactDetails, + number: String, + avatar: SNProtoContactDetailsAvatar?, + verified: SNProtoVerified?) { + self.proto = proto + self.number = number + self.avatar = avatar + self.verified = verified + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoContactDetails { + let proto = try SessionProtos_ContactDetails(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_ContactDetails) throws -> SNProtoContactDetails { + guard proto.hasNumber else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: number") + } + let number = proto.number + + var avatar: SNProtoContactDetailsAvatar? = nil + if proto.hasAvatar { + avatar = try SNProtoContactDetailsAvatar.parseProto(proto.avatar) + } + + var verified: SNProtoVerified? = nil + if proto.hasVerified { + verified = try SNProtoVerified.parseProto(proto.verified) + } + + // MARK: - Begin Validation Logic for SNProtoContactDetails - + + // MARK: - End Validation Logic for SNProtoContactDetails - + + let result = SNProtoContactDetails(proto: proto, + number: number, + avatar: avatar, + verified: verified) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoContactDetails { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoContactDetails.SNProtoContactDetailsBuilder { + @objc public func buildIgnoringErrors() -> SNProtoContactDetails? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoGroupDetailsAvatar + +@objc public class SNProtoGroupDetailsAvatar: NSObject { + + // MARK: - SNProtoGroupDetailsAvatarBuilder + + @objc public class func builder() -> SNProtoGroupDetailsAvatarBuilder { + return SNProtoGroupDetailsAvatarBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoGroupDetailsAvatarBuilder { + let builder = SNProtoGroupDetailsAvatarBuilder() + if let _value = contentType { + builder.setContentType(_value) + } + if hasLength { + builder.setLength(length) + } + return builder + } + + @objc public class SNProtoGroupDetailsAvatarBuilder: NSObject { + + private var proto = SessionProtos_GroupDetails.Avatar() + + @objc fileprivate override init() {} + + @objc public func setContentType(_ valueParam: String) { + proto.contentType = valueParam + } + + @objc public func setLength(_ valueParam: UInt32) { + proto.length = valueParam + } + + @objc public func build() throws -> SNProtoGroupDetailsAvatar { + return try SNProtoGroupDetailsAvatar.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoGroupDetailsAvatar.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_GroupDetails.Avatar + + @objc public var contentType: String? { + guard proto.hasContentType else { + return nil + } + return proto.contentType + } + @objc public var hasContentType: Bool { + return proto.hasContentType + } + + @objc public var length: UInt32 { + return proto.length + } + @objc public var hasLength: Bool { + return proto.hasLength + } + + private init(proto: SessionProtos_GroupDetails.Avatar) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoGroupDetailsAvatar { + let proto = try SessionProtos_GroupDetails.Avatar(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_GroupDetails.Avatar) throws -> SNProtoGroupDetailsAvatar { + // MARK: - Begin Validation Logic for SNProtoGroupDetailsAvatar - + + // MARK: - End Validation Logic for SNProtoGroupDetailsAvatar - + + let result = SNProtoGroupDetailsAvatar(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoGroupDetailsAvatar { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoGroupDetailsAvatar.SNProtoGroupDetailsAvatarBuilder { + @objc public func buildIgnoringErrors() -> SNProtoGroupDetailsAvatar? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoGroupDetails + +@objc public class SNProtoGroupDetails: NSObject { + + // MARK: - SNProtoGroupDetailsBuilder + + @objc public class func builder(id: Data) -> SNProtoGroupDetailsBuilder { + return SNProtoGroupDetailsBuilder(id: id) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoGroupDetailsBuilder { + let builder = SNProtoGroupDetailsBuilder(id: id) + if let _value = name { + builder.setName(_value) + } + builder.setMembers(members) + if let _value = avatar { + builder.setAvatar(_value) + } + if hasActive { + builder.setActive(active) + } + if hasExpireTimer { + builder.setExpireTimer(expireTimer) + } + if let _value = color { + builder.setColor(_value) + } + if hasBlocked { + builder.setBlocked(blocked) + } + builder.setAdmins(admins) + return builder + } + + @objc public class SNProtoGroupDetailsBuilder: NSObject { + + private var proto = SessionProtos_GroupDetails() + + @objc fileprivate override init() {} + + @objc fileprivate init(id: Data) { + super.init() + + setId(id) + } + + @objc public func setId(_ valueParam: Data) { + proto.id = valueParam + } + + @objc public func setName(_ valueParam: String) { + proto.name = valueParam + } + + @objc public func addMembers(_ valueParam: String) { + var items = proto.members + items.append(valueParam) + proto.members = items + } + + @objc public func setMembers(_ wrappedItems: [String]) { + proto.members = wrappedItems + } + + @objc public func setAvatar(_ valueParam: SNProtoGroupDetailsAvatar) { + proto.avatar = valueParam.proto + } + + @objc public func setActive(_ valueParam: Bool) { + proto.active = valueParam + } + + @objc public func setExpireTimer(_ valueParam: UInt32) { + proto.expireTimer = valueParam + } + + @objc public func setColor(_ valueParam: String) { + proto.color = valueParam + } + + @objc public func setBlocked(_ valueParam: Bool) { + proto.blocked = valueParam + } + + @objc public func addAdmins(_ valueParam: String) { + var items = proto.admins + items.append(valueParam) + proto.admins = items + } + + @objc public func setAdmins(_ wrappedItems: [String]) { + proto.admins = wrappedItems + } + + @objc public func build() throws -> SNProtoGroupDetails { + return try SNProtoGroupDetails.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoGroupDetails.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_GroupDetails + + @objc public let id: Data + + @objc public let avatar: SNProtoGroupDetailsAvatar? + + @objc public var name: String? { + guard proto.hasName else { + return nil + } + return proto.name + } + @objc public var hasName: Bool { + return proto.hasName + } + + @objc public var members: [String] { + return proto.members + } + + @objc public var active: Bool { + return proto.active + } + @objc public var hasActive: Bool { + return proto.hasActive + } + + @objc public var expireTimer: UInt32 { + return proto.expireTimer + } + @objc public var hasExpireTimer: Bool { + return proto.hasExpireTimer + } + + @objc public var color: String? { + guard proto.hasColor else { + return nil + } + return proto.color + } + @objc public var hasColor: Bool { + return proto.hasColor + } + + @objc public var blocked: Bool { + return proto.blocked + } + @objc public var hasBlocked: Bool { + return proto.hasBlocked + } + + @objc public var admins: [String] { + return proto.admins + } + + private init(proto: SessionProtos_GroupDetails, + id: Data, + avatar: SNProtoGroupDetailsAvatar?) { + self.proto = proto + self.id = id + self.avatar = avatar + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoGroupDetails { + let proto = try SessionProtos_GroupDetails(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_GroupDetails) throws -> SNProtoGroupDetails { + guard proto.hasID else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: id") + } + let id = proto.id + + var avatar: SNProtoGroupDetailsAvatar? = nil + if proto.hasAvatar { + avatar = try SNProtoGroupDetailsAvatar.parseProto(proto.avatar) + } + + // MARK: - Begin Validation Logic for SNProtoGroupDetails - + + // MARK: - End Validation Logic for SNProtoGroupDetails - + + let result = SNProtoGroupDetails(proto: proto, + id: id, + avatar: avatar) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoGroupDetails { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoGroupDetails.SNProtoGroupDetailsBuilder { + @objc public func buildIgnoringErrors() -> SNProtoGroupDetails? { + return try! self.build() + } +} + +#endif + +// MARK: - SNProtoPublicChatInfo + +@objc public class SNProtoPublicChatInfo: NSObject { + + // MARK: - SNProtoPublicChatInfoBuilder + + @objc public class func builder() -> SNProtoPublicChatInfoBuilder { + return SNProtoPublicChatInfoBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoPublicChatInfoBuilder { + let builder = SNProtoPublicChatInfoBuilder() + if hasServerID { + builder.setServerID(serverID) + } + return builder + } + + @objc public class SNProtoPublicChatInfoBuilder: NSObject { + + private var proto = SessionProtos_PublicChatInfo() + + @objc fileprivate override init() {} + + @objc public func setServerID(_ valueParam: UInt64) { + proto.serverID = valueParam + } + + @objc public func build() throws -> SNProtoPublicChatInfo { + return try SNProtoPublicChatInfo.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoPublicChatInfo.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_PublicChatInfo + + @objc public var serverID: UInt64 { + return proto.serverID + } + @objc public var hasServerID: Bool { + return proto.hasServerID + } + + private init(proto: SessionProtos_PublicChatInfo) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoPublicChatInfo { + let proto = try SessionProtos_PublicChatInfo(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_PublicChatInfo) throws -> SNProtoPublicChatInfo { + // MARK: - Begin Validation Logic for SNProtoPublicChatInfo - + + // MARK: - End Validation Logic for SNProtoPublicChatInfo - + + let result = SNProtoPublicChatInfo(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoPublicChatInfo { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoPublicChatInfo.SNProtoPublicChatInfoBuilder { + @objc public func buildIgnoringErrors() -> SNProtoPublicChatInfo? { + return try! self.build() + } +} + +#endif diff --git a/SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift b/SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift new file mode 100644 index 000000000..e0f28ecc0 --- /dev/null +++ b/SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift @@ -0,0 +1,5199 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: SessionProtos.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +//* +// Copyright (C) 2014-2016 Open Whisper Systems +// +// Licensed according to the LICENSE file in this repository. + +/// iOS - since we use a modern proto-compiler, we must specify +/// the legacy proto format. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct SessionProtos_Envelope { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var type: SessionProtos_Envelope.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var source: String { + get {return _source ?? String()} + set {_source = newValue} + } + /// Returns true if `source` has been explicitly set. + var hasSource: Bool {return self._source != nil} + /// Clears the value of `source`. Subsequent reads from it will return its default value. + mutating func clearSource() {self._source = nil} + + var sourceDevice: UInt32 { + get {return _sourceDevice ?? 0} + set {_sourceDevice = newValue} + } + /// Returns true if `sourceDevice` has been explicitly set. + var hasSourceDevice: Bool {return self._sourceDevice != nil} + /// Clears the value of `sourceDevice`. Subsequent reads from it will return its default value. + mutating func clearSourceDevice() {self._sourceDevice = nil} + + var relay: String { + get {return _relay ?? String()} + set {_relay = newValue} + } + /// Returns true if `relay` has been explicitly set. + var hasRelay: Bool {return self._relay != nil} + /// Clears the value of `relay`. Subsequent reads from it will return its default value. + mutating func clearRelay() {self._relay = nil} + + /// @required + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + /// Contains an encrypted DataMessage + var legacyMessage: Data { + get {return _legacyMessage ?? SwiftProtobuf.Internal.emptyData} + set {_legacyMessage = newValue} + } + /// Returns true if `legacyMessage` has been explicitly set. + var hasLegacyMessage: Bool {return self._legacyMessage != nil} + /// Clears the value of `legacyMessage`. Subsequent reads from it will return its default value. + mutating func clearLegacyMessage() {self._legacyMessage = nil} + + /// Contains an encrypted Content + var content: Data { + get {return _content ?? SwiftProtobuf.Internal.emptyData} + set {_content = newValue} + } + /// Returns true if `content` has been explicitly set. + var hasContent: Bool {return self._content != nil} + /// Clears the value of `content`. Subsequent reads from it will return its default value. + mutating func clearContent() {self._content = nil} + + /// We may eventually want to make this required. + var serverGuid: String { + get {return _serverGuid ?? String()} + set {_serverGuid = newValue} + } + /// Returns true if `serverGuid` has been explicitly set. + var hasServerGuid: Bool {return self._serverGuid != nil} + /// Clears the value of `serverGuid`. Subsequent reads from it will return its default value. + mutating func clearServerGuid() {self._serverGuid = nil} + + /// We may eventually want to make this required. + var serverTimestamp: UInt64 { + get {return _serverTimestamp ?? 0} + set {_serverTimestamp = newValue} + } + /// Returns true if `serverTimestamp` has been explicitly set. + var hasServerTimestamp: Bool {return self._serverTimestamp != nil} + /// Clears the value of `serverTimestamp`. Subsequent reads from it will return its default value. + mutating func clearServerTimestamp() {self._serverTimestamp = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case ciphertext // = 1 + case keyExchange // = 2 + case prekeyBundle // = 3 + case receipt // = 5 + case unidentifiedSender // = 6 + + /// Loki + case closedGroupCiphertext // = 7 + + /// Loki: Encrypted using the fallback session cipher. Contains a pre key bundle if it's a session request. + case fallbackMessage // = 101 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .ciphertext + case 2: self = .keyExchange + case 3: self = .prekeyBundle + case 5: self = .receipt + case 6: self = .unidentifiedSender + case 7: self = .closedGroupCiphertext + case 101: self = .fallbackMessage + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .ciphertext: return 1 + case .keyExchange: return 2 + case .prekeyBundle: return 3 + case .receipt: return 5 + case .unidentifiedSender: return 6 + case .closedGroupCiphertext: return 7 + case .fallbackMessage: return 101 + } + } + + } + + init() {} + + fileprivate var _type: SessionProtos_Envelope.TypeEnum? = nil + fileprivate var _source: String? = nil + fileprivate var _sourceDevice: UInt32? = nil + fileprivate var _relay: String? = nil + fileprivate var _timestamp: UInt64? = nil + fileprivate var _legacyMessage: Data? = nil + fileprivate var _content: Data? = nil + fileprivate var _serverGuid: String? = nil + fileprivate var _serverTimestamp: UInt64? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_Envelope.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_TypingMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + /// @required + var action: SessionProtos_TypingMessage.Action { + get {return _action ?? .started} + set {_action = newValue} + } + /// Returns true if `action` has been explicitly set. + var hasAction: Bool {return self._action != nil} + /// Clears the value of `action`. Subsequent reads from it will return its default value. + mutating func clearAction() {self._action = nil} + + var groupID: Data { + get {return _groupID ?? SwiftProtobuf.Internal.emptyData} + set {_groupID = newValue} + } + /// Returns true if `groupID` has been explicitly set. + var hasGroupID: Bool {return self._groupID != nil} + /// Clears the value of `groupID`. Subsequent reads from it will return its default value. + mutating func clearGroupID() {self._groupID = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Action: SwiftProtobuf.Enum { + typealias RawValue = Int + case started // = 0 + case stopped // = 1 + + init() { + self = .started + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .started + case 1: self = .stopped + default: return nil + } + } + + var rawValue: Int { + switch self { + case .started: return 0 + case .stopped: return 1 + } + } + + } + + init() {} + + fileprivate var _timestamp: UInt64? = nil + fileprivate var _action: SessionProtos_TypingMessage.Action? = nil + fileprivate var _groupID: Data? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_TypingMessage.Action: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_Content { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var dataMessage: SessionProtos_DataMessage { + get {return _dataMessage ?? SessionProtos_DataMessage()} + set {_dataMessage = newValue} + } + /// Returns true if `dataMessage` has been explicitly set. + var hasDataMessage: Bool {return self._dataMessage != nil} + /// Clears the value of `dataMessage`. Subsequent reads from it will return its default value. + mutating func clearDataMessage() {self._dataMessage = nil} + + var syncMessage: SessionProtos_SyncMessage { + get {return _syncMessage ?? SessionProtos_SyncMessage()} + set {_syncMessage = newValue} + } + /// Returns true if `syncMessage` has been explicitly set. + var hasSyncMessage: Bool {return self._syncMessage != nil} + /// Clears the value of `syncMessage`. Subsequent reads from it will return its default value. + mutating func clearSyncMessage() {self._syncMessage = nil} + + var callMessage: SessionProtos_CallMessage { + get {return _callMessage ?? SessionProtos_CallMessage()} + set {_callMessage = newValue} + } + /// Returns true if `callMessage` has been explicitly set. + var hasCallMessage: Bool {return self._callMessage != nil} + /// Clears the value of `callMessage`. Subsequent reads from it will return its default value. + mutating func clearCallMessage() {self._callMessage = nil} + + var nullMessage: SessionProtos_NullMessage { + get {return _nullMessage ?? SessionProtos_NullMessage()} + set {_nullMessage = newValue} + } + /// Returns true if `nullMessage` has been explicitly set. + var hasNullMessage: Bool {return self._nullMessage != nil} + /// Clears the value of `nullMessage`. Subsequent reads from it will return its default value. + mutating func clearNullMessage() {self._nullMessage = nil} + + var receiptMessage: SessionProtos_ReceiptMessage { + get {return _receiptMessage ?? SessionProtos_ReceiptMessage()} + set {_receiptMessage = newValue} + } + /// Returns true if `receiptMessage` has been explicitly set. + var hasReceiptMessage: Bool {return self._receiptMessage != nil} + /// Clears the value of `receiptMessage`. Subsequent reads from it will return its default value. + mutating func clearReceiptMessage() {self._receiptMessage = nil} + + var typingMessage: SessionProtos_TypingMessage { + get {return _typingMessage ?? SessionProtos_TypingMessage()} + set {_typingMessage = newValue} + } + /// Returns true if `typingMessage` has been explicitly set. + var hasTypingMessage: Bool {return self._typingMessage != nil} + /// Clears the value of `typingMessage`. Subsequent reads from it will return its default value. + mutating func clearTypingMessage() {self._typingMessage = nil} + + /// Loki + var prekeyBundleMessage: SessionProtos_PrekeyBundleMessage { + get {return _prekeyBundleMessage ?? SessionProtos_PrekeyBundleMessage()} + set {_prekeyBundleMessage = newValue} + } + /// Returns true if `prekeyBundleMessage` has been explicitly set. + var hasPrekeyBundleMessage: Bool {return self._prekeyBundleMessage != nil} + /// Clears the value of `prekeyBundleMessage`. Subsequent reads from it will return its default value. + mutating func clearPrekeyBundleMessage() {self._prekeyBundleMessage = nil} + + /// Loki + var lokiDeviceLinkMessage: SessionProtos_LokiDeviceLinkMessage { + get {return _lokiDeviceLinkMessage ?? SessionProtos_LokiDeviceLinkMessage()} + set {_lokiDeviceLinkMessage = newValue} + } + /// Returns true if `lokiDeviceLinkMessage` has been explicitly set. + var hasLokiDeviceLinkMessage: Bool {return self._lokiDeviceLinkMessage != nil} + /// Clears the value of `lokiDeviceLinkMessage`. Subsequent reads from it will return its default value. + mutating func clearLokiDeviceLinkMessage() {self._lokiDeviceLinkMessage = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _dataMessage: SessionProtos_DataMessage? = nil + fileprivate var _syncMessage: SessionProtos_SyncMessage? = nil + fileprivate var _callMessage: SessionProtos_CallMessage? = nil + fileprivate var _nullMessage: SessionProtos_NullMessage? = nil + fileprivate var _receiptMessage: SessionProtos_ReceiptMessage? = nil + fileprivate var _typingMessage: SessionProtos_TypingMessage? = nil + fileprivate var _prekeyBundleMessage: SessionProtos_PrekeyBundleMessage? = nil + fileprivate var _lokiDeviceLinkMessage: SessionProtos_LokiDeviceLinkMessage? = nil +} + +/// Loki +struct SessionProtos_PrekeyBundleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var identityKey: Data { + get {return _identityKey ?? SwiftProtobuf.Internal.emptyData} + set {_identityKey = newValue} + } + /// Returns true if `identityKey` has been explicitly set. + var hasIdentityKey: Bool {return self._identityKey != nil} + /// Clears the value of `identityKey`. Subsequent reads from it will return its default value. + mutating func clearIdentityKey() {self._identityKey = nil} + + var deviceID: UInt32 { + get {return _deviceID ?? 0} + set {_deviceID = newValue} + } + /// Returns true if `deviceID` has been explicitly set. + var hasDeviceID: Bool {return self._deviceID != nil} + /// Clears the value of `deviceID`. Subsequent reads from it will return its default value. + mutating func clearDeviceID() {self._deviceID = nil} + + var prekeyID: UInt32 { + get {return _prekeyID ?? 0} + set {_prekeyID = newValue} + } + /// Returns true if `prekeyID` has been explicitly set. + var hasPrekeyID: Bool {return self._prekeyID != nil} + /// Clears the value of `prekeyID`. Subsequent reads from it will return its default value. + mutating func clearPrekeyID() {self._prekeyID = nil} + + var signedKeyID: UInt32 { + get {return _signedKeyID ?? 0} + set {_signedKeyID = newValue} + } + /// Returns true if `signedKeyID` has been explicitly set. + var hasSignedKeyID: Bool {return self._signedKeyID != nil} + /// Clears the value of `signedKeyID`. Subsequent reads from it will return its default value. + mutating func clearSignedKeyID() {self._signedKeyID = nil} + + var prekey: Data { + get {return _prekey ?? SwiftProtobuf.Internal.emptyData} + set {_prekey = newValue} + } + /// Returns true if `prekey` has been explicitly set. + var hasPrekey: Bool {return self._prekey != nil} + /// Clears the value of `prekey`. Subsequent reads from it will return its default value. + mutating func clearPrekey() {self._prekey = nil} + + var signedKey: Data { + get {return _signedKey ?? SwiftProtobuf.Internal.emptyData} + set {_signedKey = newValue} + } + /// Returns true if `signedKey` has been explicitly set. + var hasSignedKey: Bool {return self._signedKey != nil} + /// Clears the value of `signedKey`. Subsequent reads from it will return its default value. + mutating func clearSignedKey() {self._signedKey = nil} + + var signature: Data { + get {return _signature ?? SwiftProtobuf.Internal.emptyData} + set {_signature = newValue} + } + /// Returns true if `signature` has been explicitly set. + var hasSignature: Bool {return self._signature != nil} + /// Clears the value of `signature`. Subsequent reads from it will return its default value. + mutating func clearSignature() {self._signature = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _identityKey: Data? = nil + fileprivate var _deviceID: UInt32? = nil + fileprivate var _prekeyID: UInt32? = nil + fileprivate var _signedKeyID: UInt32? = nil + fileprivate var _prekey: Data? = nil + fileprivate var _signedKey: Data? = nil + fileprivate var _signature: Data? = nil +} + +/// Loki +struct SessionProtos_LokiDeviceLinkMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var masterPublicKey: String { + get {return _masterPublicKey ?? String()} + set {_masterPublicKey = newValue} + } + /// Returns true if `masterPublicKey` has been explicitly set. + var hasMasterPublicKey: Bool {return self._masterPublicKey != nil} + /// Clears the value of `masterPublicKey`. Subsequent reads from it will return its default value. + mutating func clearMasterPublicKey() {self._masterPublicKey = nil} + + var slavePublicKey: String { + get {return _slavePublicKey ?? String()} + set {_slavePublicKey = newValue} + } + /// Returns true if `slavePublicKey` has been explicitly set. + var hasSlavePublicKey: Bool {return self._slavePublicKey != nil} + /// Clears the value of `slavePublicKey`. Subsequent reads from it will return its default value. + mutating func clearSlavePublicKey() {self._slavePublicKey = nil} + + var slaveSignature: Data { + get {return _slaveSignature ?? SwiftProtobuf.Internal.emptyData} + set {_slaveSignature = newValue} + } + /// Returns true if `slaveSignature` has been explicitly set. + var hasSlaveSignature: Bool {return self._slaveSignature != nil} + /// Clears the value of `slaveSignature`. Subsequent reads from it will return its default value. + mutating func clearSlaveSignature() {self._slaveSignature = nil} + + var masterSignature: Data { + get {return _masterSignature ?? SwiftProtobuf.Internal.emptyData} + set {_masterSignature = newValue} + } + /// Returns true if `masterSignature` has been explicitly set. + var hasMasterSignature: Bool {return self._masterSignature != nil} + /// Clears the value of `masterSignature`. Subsequent reads from it will return its default value. + mutating func clearMasterSignature() {self._masterSignature = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _masterPublicKey: String? = nil + fileprivate var _slavePublicKey: String? = nil + fileprivate var _slaveSignature: Data? = nil + fileprivate var _masterSignature: Data? = nil +} + +struct SessionProtos_CallMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var offer: SessionProtos_CallMessage.Offer { + get {return _offer ?? SessionProtos_CallMessage.Offer()} + set {_offer = newValue} + } + /// Returns true if `offer` has been explicitly set. + var hasOffer: Bool {return self._offer != nil} + /// Clears the value of `offer`. Subsequent reads from it will return its default value. + mutating func clearOffer() {self._offer = nil} + + var answer: SessionProtos_CallMessage.Answer { + get {return _answer ?? SessionProtos_CallMessage.Answer()} + set {_answer = newValue} + } + /// Returns true if `answer` has been explicitly set. + var hasAnswer: Bool {return self._answer != nil} + /// Clears the value of `answer`. Subsequent reads from it will return its default value. + mutating func clearAnswer() {self._answer = nil} + + var iceUpdate: [SessionProtos_CallMessage.IceUpdate] = [] + + var hangup: SessionProtos_CallMessage.Hangup { + get {return _hangup ?? SessionProtos_CallMessage.Hangup()} + set {_hangup = newValue} + } + /// Returns true if `hangup` has been explicitly set. + var hasHangup: Bool {return self._hangup != nil} + /// Clears the value of `hangup`. Subsequent reads from it will return its default value. + mutating func clearHangup() {self._hangup = nil} + + var busy: SessionProtos_CallMessage.Busy { + get {return _busy ?? SessionProtos_CallMessage.Busy()} + set {_busy = newValue} + } + /// Returns true if `busy` has been explicitly set. + var hasBusy: Bool {return self._busy != nil} + /// Clears the value of `busy`. Subsequent reads from it will return its default value. + mutating func clearBusy() {self._busy = nil} + + /// Signal-iOS sends profile key with call messages + /// for earlier discovery + var profileKey: Data { + get {return _profileKey ?? SwiftProtobuf.Internal.emptyData} + set {_profileKey = newValue} + } + /// Returns true if `profileKey` has been explicitly set. + var hasProfileKey: Bool {return self._profileKey != nil} + /// Clears the value of `profileKey`. Subsequent reads from it will return its default value. + mutating func clearProfileKey() {self._profileKey = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Offer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// Signal-iOS renamed the description field to avoid + /// conflicts with [NSObject description]. + /// @required + var sessionDescription: String { + get {return _sessionDescription ?? String()} + set {_sessionDescription = newValue} + } + /// Returns true if `sessionDescription` has been explicitly set. + var hasSessionDescription: Bool {return self._sessionDescription != nil} + /// Clears the value of `sessionDescription`. Subsequent reads from it will return its default value. + mutating func clearSessionDescription() {self._sessionDescription = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _sessionDescription: String? = nil + } + + struct Answer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// Signal-iOS renamed the description field to avoid + /// conflicts with [NSObject description]. + /// @required + var sessionDescription: String { + get {return _sessionDescription ?? String()} + set {_sessionDescription = newValue} + } + /// Returns true if `sessionDescription` has been explicitly set. + var hasSessionDescription: Bool {return self._sessionDescription != nil} + /// Clears the value of `sessionDescription`. Subsequent reads from it will return its default value. + mutating func clearSessionDescription() {self._sessionDescription = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _sessionDescription: String? = nil + } + + struct IceUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// @required + var sdpMid: String { + get {return _sdpMid ?? String()} + set {_sdpMid = newValue} + } + /// Returns true if `sdpMid` has been explicitly set. + var hasSdpMid: Bool {return self._sdpMid != nil} + /// Clears the value of `sdpMid`. Subsequent reads from it will return its default value. + mutating func clearSdpMid() {self._sdpMid = nil} + + /// @required + var sdpMlineIndex: UInt32 { + get {return _sdpMlineIndex ?? 0} + set {_sdpMlineIndex = newValue} + } + /// Returns true if `sdpMlineIndex` has been explicitly set. + var hasSdpMlineIndex: Bool {return self._sdpMlineIndex != nil} + /// Clears the value of `sdpMlineIndex`. Subsequent reads from it will return its default value. + mutating func clearSdpMlineIndex() {self._sdpMlineIndex = nil} + + /// @required + var sdp: String { + get {return _sdp ?? String()} + set {_sdp = newValue} + } + /// Returns true if `sdp` has been explicitly set. + var hasSdp: Bool {return self._sdp != nil} + /// Clears the value of `sdp`. Subsequent reads from it will return its default value. + mutating func clearSdp() {self._sdp = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _sdpMid: String? = nil + fileprivate var _sdpMlineIndex: UInt32? = nil + fileprivate var _sdp: String? = nil + } + + struct Busy { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + } + + struct Hangup { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + } + + init() {} + + fileprivate var _offer: SessionProtos_CallMessage.Offer? = nil + fileprivate var _answer: SessionProtos_CallMessage.Answer? = nil + fileprivate var _hangup: SessionProtos_CallMessage.Hangup? = nil + fileprivate var _busy: SessionProtos_CallMessage.Busy? = nil + fileprivate var _profileKey: Data? = nil +} + +struct SessionProtos_ClosedGroupCiphertextMessageWrapper { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var ciphertext: Data { + get {return _ciphertext ?? SwiftProtobuf.Internal.emptyData} + set {_ciphertext = newValue} + } + /// Returns true if `ciphertext` has been explicitly set. + var hasCiphertext: Bool {return self._ciphertext != nil} + /// Clears the value of `ciphertext`. Subsequent reads from it will return its default value. + mutating func clearCiphertext() {self._ciphertext = nil} + + /// @required + var ephemeralPublicKey: Data { + get {return _ephemeralPublicKey ?? SwiftProtobuf.Internal.emptyData} + set {_ephemeralPublicKey = newValue} + } + /// Returns true if `ephemeralPublicKey` has been explicitly set. + var hasEphemeralPublicKey: Bool {return self._ephemeralPublicKey != nil} + /// Clears the value of `ephemeralPublicKey`. Subsequent reads from it will return its default value. + mutating func clearEphemeralPublicKey() {self._ephemeralPublicKey = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _ciphertext: Data? = nil + fileprivate var _ephemeralPublicKey: Data? = nil +} + +struct SessionProtos_DataMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var body: String { + get {return _body ?? String()} + set {_body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return self._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {self._body = nil} + + var attachments: [SessionProtos_AttachmentPointer] = [] + + var group: SessionProtos_GroupContext { + get {return _group ?? SessionProtos_GroupContext()} + set {_group = newValue} + } + /// Returns true if `group` has been explicitly set. + var hasGroup: Bool {return self._group != nil} + /// Clears the value of `group`. Subsequent reads from it will return its default value. + mutating func clearGroup() {self._group = nil} + + var flags: UInt32 { + get {return _flags ?? 0} + set {_flags = newValue} + } + /// Returns true if `flags` has been explicitly set. + var hasFlags: Bool {return self._flags != nil} + /// Clears the value of `flags`. Subsequent reads from it will return its default value. + mutating func clearFlags() {self._flags = nil} + + var expireTimer: UInt32 { + get {return _expireTimer ?? 0} + set {_expireTimer = newValue} + } + /// Returns true if `expireTimer` has been explicitly set. + var hasExpireTimer: Bool {return self._expireTimer != nil} + /// Clears the value of `expireTimer`. Subsequent reads from it will return its default value. + mutating func clearExpireTimer() {self._expireTimer = nil} + + var profileKey: Data { + get {return _profileKey ?? SwiftProtobuf.Internal.emptyData} + set {_profileKey = newValue} + } + /// Returns true if `profileKey` has been explicitly set. + var hasProfileKey: Bool {return self._profileKey != nil} + /// Clears the value of `profileKey`. Subsequent reads from it will return its default value. + mutating func clearProfileKey() {self._profileKey = nil} + + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + var quote: SessionProtos_DataMessage.Quote { + get {return _quote ?? SessionProtos_DataMessage.Quote()} + set {_quote = newValue} + } + /// Returns true if `quote` has been explicitly set. + var hasQuote: Bool {return self._quote != nil} + /// Clears the value of `quote`. Subsequent reads from it will return its default value. + mutating func clearQuote() {self._quote = nil} + + var contact: [SessionProtos_DataMessage.Contact] = [] + + var preview: [SessionProtos_DataMessage.Preview] = [] + + /// Loki: The current user's profile + var profile: SessionProtos_DataMessage.LokiProfile { + get {return _profile ?? SessionProtos_DataMessage.LokiProfile()} + set {_profile = newValue} + } + /// Returns true if `profile` has been explicitly set. + var hasProfile: Bool {return self._profile != nil} + /// Clears the value of `profile`. Subsequent reads from it will return its default value. + mutating func clearProfile() {self._profile = nil} + + /// Loki + var closedGroupUpdate: SessionProtos_DataMessage.ClosedGroupUpdate { + get {return _closedGroupUpdate ?? SessionProtos_DataMessage.ClosedGroupUpdate()} + set {_closedGroupUpdate = newValue} + } + /// Returns true if `closedGroupUpdate` has been explicitly set. + var hasClosedGroupUpdate: Bool {return self._closedGroupUpdate != nil} + /// Clears the value of `closedGroupUpdate`. Subsequent reads from it will return its default value. + mutating func clearClosedGroupUpdate() {self._closedGroupUpdate = nil} + + /// Loki: Internal public chat info + var publicChatInfo: SessionProtos_PublicChatInfo { + get {return _publicChatInfo ?? SessionProtos_PublicChatInfo()} + set {_publicChatInfo = newValue} + } + /// Returns true if `publicChatInfo` has been explicitly set. + var hasPublicChatInfo: Bool {return self._publicChatInfo != nil} + /// Clears the value of `publicChatInfo`. Subsequent reads from it will return its default value. + mutating func clearPublicChatInfo() {self._publicChatInfo = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Flags: SwiftProtobuf.Enum { + typealias RawValue = Int + case endSession // = 1 + case expirationTimerUpdate // = 2 + case profileKeyUpdate // = 4 + case unlinkDevice // = 128 + + init() { + self = .endSession + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .endSession + case 2: self = .expirationTimerUpdate + case 4: self = .profileKeyUpdate + case 128: self = .unlinkDevice + default: return nil + } + } + + var rawValue: Int { + switch self { + case .endSession: return 1 + case .expirationTimerUpdate: return 2 + case .profileKeyUpdate: return 4 + case .unlinkDevice: return 128 + } + } + + } + + struct Quote { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// @required + var author: String { + get {return _author ?? String()} + set {_author = newValue} + } + /// Returns true if `author` has been explicitly set. + var hasAuthor: Bool {return self._author != nil} + /// Clears the value of `author`. Subsequent reads from it will return its default value. + mutating func clearAuthor() {self._author = nil} + + var text: String { + get {return _text ?? String()} + set {_text = newValue} + } + /// Returns true if `text` has been explicitly set. + var hasText: Bool {return self._text != nil} + /// Clears the value of `text`. Subsequent reads from it will return its default value. + mutating func clearText() {self._text = nil} + + var attachments: [SessionProtos_DataMessage.Quote.QuotedAttachment] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct QuotedAttachment { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var contentType: String { + get {return _contentType ?? String()} + set {_contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return self._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {self._contentType = nil} + + var fileName: String { + get {return _fileName ?? String()} + set {_fileName = newValue} + } + /// Returns true if `fileName` has been explicitly set. + var hasFileName: Bool {return self._fileName != nil} + /// Clears the value of `fileName`. Subsequent reads from it will return its default value. + mutating func clearFileName() {self._fileName = nil} + + var thumbnail: SessionProtos_AttachmentPointer { + get {return _thumbnail ?? SessionProtos_AttachmentPointer()} + set {_thumbnail = newValue} + } + /// Returns true if `thumbnail` has been explicitly set. + var hasThumbnail: Bool {return self._thumbnail != nil} + /// Clears the value of `thumbnail`. Subsequent reads from it will return its default value. + mutating func clearThumbnail() {self._thumbnail = nil} + + var flags: UInt32 { + get {return _flags ?? 0} + set {_flags = newValue} + } + /// Returns true if `flags` has been explicitly set. + var hasFlags: Bool {return self._flags != nil} + /// Clears the value of `flags`. Subsequent reads from it will return its default value. + mutating func clearFlags() {self._flags = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Flags: SwiftProtobuf.Enum { + typealias RawValue = Int + case voiceMessage // = 1 + + init() { + self = .voiceMessage + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .voiceMessage + default: return nil + } + } + + var rawValue: Int { + switch self { + case .voiceMessage: return 1 + } + } + + } + + init() {} + + fileprivate var _contentType: String? = nil + fileprivate var _fileName: String? = nil + fileprivate var _thumbnail: SessionProtos_AttachmentPointer? = nil + fileprivate var _flags: UInt32? = nil + } + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _author: String? = nil + fileprivate var _text: String? = nil + } + + struct Contact { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: SessionProtos_DataMessage.Contact.Name { + get {return _name ?? SessionProtos_DataMessage.Contact.Name()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + var number: [SessionProtos_DataMessage.Contact.Phone] = [] + + var email: [SessionProtos_DataMessage.Contact.Email] = [] + + var address: [SessionProtos_DataMessage.Contact.PostalAddress] = [] + + var avatar: SessionProtos_DataMessage.Contact.Avatar { + get {return _avatar ?? SessionProtos_DataMessage.Contact.Avatar()} + set {_avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return self._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {self._avatar = nil} + + var organization: String { + get {return _organization ?? String()} + set {_organization = newValue} + } + /// Returns true if `organization` has been explicitly set. + var hasOrganization: Bool {return self._organization != nil} + /// Clears the value of `organization`. Subsequent reads from it will return its default value. + mutating func clearOrganization() {self._organization = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Name { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var givenName: String { + get {return _givenName ?? String()} + set {_givenName = newValue} + } + /// Returns true if `givenName` has been explicitly set. + var hasGivenName: Bool {return self._givenName != nil} + /// Clears the value of `givenName`. Subsequent reads from it will return its default value. + mutating func clearGivenName() {self._givenName = nil} + + var familyName: String { + get {return _familyName ?? String()} + set {_familyName = newValue} + } + /// Returns true if `familyName` has been explicitly set. + var hasFamilyName: Bool {return self._familyName != nil} + /// Clears the value of `familyName`. Subsequent reads from it will return its default value. + mutating func clearFamilyName() {self._familyName = nil} + + var prefix: String { + get {return _prefix ?? String()} + set {_prefix = newValue} + } + /// Returns true if `prefix` has been explicitly set. + var hasPrefix: Bool {return self._prefix != nil} + /// Clears the value of `prefix`. Subsequent reads from it will return its default value. + mutating func clearPrefix() {self._prefix = nil} + + var suffix: String { + get {return _suffix ?? String()} + set {_suffix = newValue} + } + /// Returns true if `suffix` has been explicitly set. + var hasSuffix: Bool {return self._suffix != nil} + /// Clears the value of `suffix`. Subsequent reads from it will return its default value. + mutating func clearSuffix() {self._suffix = nil} + + var middleName: String { + get {return _middleName ?? String()} + set {_middleName = newValue} + } + /// Returns true if `middleName` has been explicitly set. + var hasMiddleName: Bool {return self._middleName != nil} + /// Clears the value of `middleName`. Subsequent reads from it will return its default value. + mutating func clearMiddleName() {self._middleName = nil} + + var displayName: String { + get {return _displayName ?? String()} + set {_displayName = newValue} + } + /// Returns true if `displayName` has been explicitly set. + var hasDisplayName: Bool {return self._displayName != nil} + /// Clears the value of `displayName`. Subsequent reads from it will return its default value. + mutating func clearDisplayName() {self._displayName = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _givenName: String? = nil + fileprivate var _familyName: String? = nil + fileprivate var _prefix: String? = nil + fileprivate var _suffix: String? = nil + fileprivate var _middleName: String? = nil + fileprivate var _displayName: String? = nil + } + + struct Phone { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var value: String { + get {return _value ?? String()} + set {_value = newValue} + } + /// Returns true if `value` has been explicitly set. + var hasValue: Bool {return self._value != nil} + /// Clears the value of `value`. Subsequent reads from it will return its default value. + mutating func clearValue() {self._value = nil} + + var type: SessionProtos_DataMessage.Contact.Phone.TypeEnum { + get {return _type ?? .home} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var label: String { + get {return _label ?? String()} + set {_label = newValue} + } + /// Returns true if `label` has been explicitly set. + var hasLabel: Bool {return self._label != nil} + /// Clears the value of `label`. Subsequent reads from it will return its default value. + mutating func clearLabel() {self._label = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case home // = 1 + case mobile // = 2 + case work // = 3 + case custom // = 4 + + init() { + self = .home + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .home + case 2: self = .mobile + case 3: self = .work + case 4: self = .custom + default: return nil + } + } + + var rawValue: Int { + switch self { + case .home: return 1 + case .mobile: return 2 + case .work: return 3 + case .custom: return 4 + } + } + + } + + init() {} + + fileprivate var _value: String? = nil + fileprivate var _type: SessionProtos_DataMessage.Contact.Phone.TypeEnum? = nil + fileprivate var _label: String? = nil + } + + struct Email { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var value: String { + get {return _value ?? String()} + set {_value = newValue} + } + /// Returns true if `value` has been explicitly set. + var hasValue: Bool {return self._value != nil} + /// Clears the value of `value`. Subsequent reads from it will return its default value. + mutating func clearValue() {self._value = nil} + + var type: SessionProtos_DataMessage.Contact.Email.TypeEnum { + get {return _type ?? .home} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var label: String { + get {return _label ?? String()} + set {_label = newValue} + } + /// Returns true if `label` has been explicitly set. + var hasLabel: Bool {return self._label != nil} + /// Clears the value of `label`. Subsequent reads from it will return its default value. + mutating func clearLabel() {self._label = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case home // = 1 + case mobile // = 2 + case work // = 3 + case custom // = 4 + + init() { + self = .home + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .home + case 2: self = .mobile + case 3: self = .work + case 4: self = .custom + default: return nil + } + } + + var rawValue: Int { + switch self { + case .home: return 1 + case .mobile: return 2 + case .work: return 3 + case .custom: return 4 + } + } + + } + + init() {} + + fileprivate var _value: String? = nil + fileprivate var _type: SessionProtos_DataMessage.Contact.Email.TypeEnum? = nil + fileprivate var _label: String? = nil + } + + struct PostalAddress { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: SessionProtos_DataMessage.Contact.PostalAddress.TypeEnum { + get {return _type ?? .home} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var label: String { + get {return _label ?? String()} + set {_label = newValue} + } + /// Returns true if `label` has been explicitly set. + var hasLabel: Bool {return self._label != nil} + /// Clears the value of `label`. Subsequent reads from it will return its default value. + mutating func clearLabel() {self._label = nil} + + var street: String { + get {return _street ?? String()} + set {_street = newValue} + } + /// Returns true if `street` has been explicitly set. + var hasStreet: Bool {return self._street != nil} + /// Clears the value of `street`. Subsequent reads from it will return its default value. + mutating func clearStreet() {self._street = nil} + + var pobox: String { + get {return _pobox ?? String()} + set {_pobox = newValue} + } + /// Returns true if `pobox` has been explicitly set. + var hasPobox: Bool {return self._pobox != nil} + /// Clears the value of `pobox`. Subsequent reads from it will return its default value. + mutating func clearPobox() {self._pobox = nil} + + var neighborhood: String { + get {return _neighborhood ?? String()} + set {_neighborhood = newValue} + } + /// Returns true if `neighborhood` has been explicitly set. + var hasNeighborhood: Bool {return self._neighborhood != nil} + /// Clears the value of `neighborhood`. Subsequent reads from it will return its default value. + mutating func clearNeighborhood() {self._neighborhood = nil} + + var city: String { + get {return _city ?? String()} + set {_city = newValue} + } + /// Returns true if `city` has been explicitly set. + var hasCity: Bool {return self._city != nil} + /// Clears the value of `city`. Subsequent reads from it will return its default value. + mutating func clearCity() {self._city = nil} + + var region: String { + get {return _region ?? String()} + set {_region = newValue} + } + /// Returns true if `region` has been explicitly set. + var hasRegion: Bool {return self._region != nil} + /// Clears the value of `region`. Subsequent reads from it will return its default value. + mutating func clearRegion() {self._region = nil} + + var postcode: String { + get {return _postcode ?? String()} + set {_postcode = newValue} + } + /// Returns true if `postcode` has been explicitly set. + var hasPostcode: Bool {return self._postcode != nil} + /// Clears the value of `postcode`. Subsequent reads from it will return its default value. + mutating func clearPostcode() {self._postcode = nil} + + var country: String { + get {return _country ?? String()} + set {_country = newValue} + } + /// Returns true if `country` has been explicitly set. + var hasCountry: Bool {return self._country != nil} + /// Clears the value of `country`. Subsequent reads from it will return its default value. + mutating func clearCountry() {self._country = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case home // = 1 + case work // = 2 + case custom // = 3 + + init() { + self = .home + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .home + case 2: self = .work + case 3: self = .custom + default: return nil + } + } + + var rawValue: Int { + switch self { + case .home: return 1 + case .work: return 2 + case .custom: return 3 + } + } + + } + + init() {} + + fileprivate var _type: SessionProtos_DataMessage.Contact.PostalAddress.TypeEnum? = nil + fileprivate var _label: String? = nil + fileprivate var _street: String? = nil + fileprivate var _pobox: String? = nil + fileprivate var _neighborhood: String? = nil + fileprivate var _city: String? = nil + fileprivate var _region: String? = nil + fileprivate var _postcode: String? = nil + fileprivate var _country: String? = nil + } + + struct Avatar { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var avatar: SessionProtos_AttachmentPointer { + get {return _avatar ?? SessionProtos_AttachmentPointer()} + set {_avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return self._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {self._avatar = nil} + + var isProfile: Bool { + get {return _isProfile ?? false} + set {_isProfile = newValue} + } + /// Returns true if `isProfile` has been explicitly set. + var hasIsProfile: Bool {return self._isProfile != nil} + /// Clears the value of `isProfile`. Subsequent reads from it will return its default value. + mutating func clearIsProfile() {self._isProfile = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _avatar: SessionProtos_AttachmentPointer? = nil + fileprivate var _isProfile: Bool? = nil + } + + init() {} + + fileprivate var _name: SessionProtos_DataMessage.Contact.Name? = nil + fileprivate var _avatar: SessionProtos_DataMessage.Contact.Avatar? = nil + fileprivate var _organization: String? = nil + } + + struct Preview { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var url: String { + get {return _url ?? String()} + set {_url = newValue} + } + /// Returns true if `url` has been explicitly set. + var hasURL: Bool {return self._url != nil} + /// Clears the value of `url`. Subsequent reads from it will return its default value. + mutating func clearURL() {self._url = nil} + + var title: String { + get {return _title ?? String()} + set {_title = newValue} + } + /// Returns true if `title` has been explicitly set. + var hasTitle: Bool {return self._title != nil} + /// Clears the value of `title`. Subsequent reads from it will return its default value. + mutating func clearTitle() {self._title = nil} + + var image: SessionProtos_AttachmentPointer { + get {return _image ?? SessionProtos_AttachmentPointer()} + set {_image = newValue} + } + /// Returns true if `image` has been explicitly set. + var hasImage: Bool {return self._image != nil} + /// Clears the value of `image`. Subsequent reads from it will return its default value. + mutating func clearImage() {self._image = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _url: String? = nil + fileprivate var _title: String? = nil + fileprivate var _image: SessionProtos_AttachmentPointer? = nil + } + + /// Loki + struct LokiProfile { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var displayName: String { + get {return _displayName ?? String()} + set {_displayName = newValue} + } + /// Returns true if `displayName` has been explicitly set. + var hasDisplayName: Bool {return self._displayName != nil} + /// Clears the value of `displayName`. Subsequent reads from it will return its default value. + mutating func clearDisplayName() {self._displayName = nil} + + var profilePicture: String { + get {return _profilePicture ?? String()} + set {_profilePicture = newValue} + } + /// Returns true if `profilePicture` has been explicitly set. + var hasProfilePicture: Bool {return self._profilePicture != nil} + /// Clears the value of `profilePicture`. Subsequent reads from it will return its default value. + mutating func clearProfilePicture() {self._profilePicture = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _displayName: String? = nil + fileprivate var _profilePicture: String? = nil + } + + /// Loki + struct ClosedGroupUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + /// @required + var groupPublicKey: Data { + get {return _groupPublicKey ?? SwiftProtobuf.Internal.emptyData} + set {_groupPublicKey = newValue} + } + /// Returns true if `groupPublicKey` has been explicitly set. + var hasGroupPublicKey: Bool {return self._groupPublicKey != nil} + /// Clears the value of `groupPublicKey`. Subsequent reads from it will return its default value. + mutating func clearGroupPublicKey() {self._groupPublicKey = nil} + + var groupPrivateKey: Data { + get {return _groupPrivateKey ?? SwiftProtobuf.Internal.emptyData} + set {_groupPrivateKey = newValue} + } + /// Returns true if `groupPrivateKey` has been explicitly set. + var hasGroupPrivateKey: Bool {return self._groupPrivateKey != nil} + /// Clears the value of `groupPrivateKey`. Subsequent reads from it will return its default value. + mutating func clearGroupPrivateKey() {self._groupPrivateKey = nil} + + var senderKeys: [SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey] = [] + + var members: [Data] = [] + + var admins: [Data] = [] + + /// @required + var type: SessionProtos_DataMessage.ClosedGroupUpdate.TypeEnum { + get {return _type ?? .new} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// groupPublicKey, name, groupPrivateKey, senderKeys, members, admins + case new // = 0 + + /// groupPublicKey, name, senderKeys, members, admins + case info // = 1 + + /// groupPublicKey + case senderKeyRequest // = 2 + + /// groupPublicKey, senderKeys + case senderKey // = 3 + + init() { + self = .new + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .new + case 1: self = .info + case 2: self = .senderKeyRequest + case 3: self = .senderKey + default: return nil + } + } + + var rawValue: Int { + switch self { + case .new: return 0 + case .info: return 1 + case .senderKeyRequest: return 2 + case .senderKey: return 3 + } + } + + } + + struct SenderKey { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var chainKey: Data { + get {return _chainKey ?? SwiftProtobuf.Internal.emptyData} + set {_chainKey = newValue} + } + /// Returns true if `chainKey` has been explicitly set. + var hasChainKey: Bool {return self._chainKey != nil} + /// Clears the value of `chainKey`. Subsequent reads from it will return its default value. + mutating func clearChainKey() {self._chainKey = nil} + + /// @required + var keyIndex: UInt32 { + get {return _keyIndex ?? 0} + set {_keyIndex = newValue} + } + /// Returns true if `keyIndex` has been explicitly set. + var hasKeyIndex: Bool {return self._keyIndex != nil} + /// Clears the value of `keyIndex`. Subsequent reads from it will return its default value. + mutating func clearKeyIndex() {self._keyIndex = nil} + + /// @required + var publicKey: Data { + get {return _publicKey ?? SwiftProtobuf.Internal.emptyData} + set {_publicKey = newValue} + } + /// Returns true if `publicKey` has been explicitly set. + var hasPublicKey: Bool {return self._publicKey != nil} + /// Clears the value of `publicKey`. Subsequent reads from it will return its default value. + mutating func clearPublicKey() {self._publicKey = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _chainKey: Data? = nil + fileprivate var _keyIndex: UInt32? = nil + fileprivate var _publicKey: Data? = nil + } + + init() {} + + fileprivate var _name: String? = nil + fileprivate var _groupPublicKey: Data? = nil + fileprivate var _groupPrivateKey: Data? = nil + fileprivate var _type: SessionProtos_DataMessage.ClosedGroupUpdate.TypeEnum? = nil + } + + init() {} + + fileprivate var _body: String? = nil + fileprivate var _group: SessionProtos_GroupContext? = nil + fileprivate var _flags: UInt32? = nil + fileprivate var _expireTimer: UInt32? = nil + fileprivate var _profileKey: Data? = nil + fileprivate var _timestamp: UInt64? = nil + fileprivate var _quote: SessionProtos_DataMessage.Quote? = nil + fileprivate var _profile: SessionProtos_DataMessage.LokiProfile? = nil + fileprivate var _closedGroupUpdate: SessionProtos_DataMessage.ClosedGroupUpdate? = nil + fileprivate var _publicChatInfo: SessionProtos_PublicChatInfo? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_DataMessage.Flags: CaseIterable { + // Support synthesized by the compiler. +} + +extension SessionProtos_DataMessage.Quote.QuotedAttachment.Flags: CaseIterable { + // Support synthesized by the compiler. +} + +extension SessionProtos_DataMessage.Contact.Phone.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +extension SessionProtos_DataMessage.Contact.Email.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +extension SessionProtos_DataMessage.Contact.PostalAddress.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +extension SessionProtos_DataMessage.ClosedGroupUpdate.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_NullMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var padding: Data { + get {return _padding ?? SwiftProtobuf.Internal.emptyData} + set {_padding = newValue} + } + /// Returns true if `padding` has been explicitly set. + var hasPadding: Bool {return self._padding != nil} + /// Clears the value of `padding`. Subsequent reads from it will return its default value. + mutating func clearPadding() {self._padding = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _padding: Data? = nil +} + +struct SessionProtos_ReceiptMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var type: SessionProtos_ReceiptMessage.TypeEnum { + get {return _type ?? .delivery} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var timestamp: [UInt64] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case delivery // = 0 + case read // = 1 + + init() { + self = .delivery + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .delivery + case 1: self = .read + default: return nil + } + } + + var rawValue: Int { + switch self { + case .delivery: return 0 + case .read: return 1 + } + } + + } + + init() {} + + fileprivate var _type: SessionProtos_ReceiptMessage.TypeEnum? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_ReceiptMessage.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_Verified { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var destination: String { + get {return _destination ?? String()} + set {_destination = newValue} + } + /// Returns true if `destination` has been explicitly set. + var hasDestination: Bool {return self._destination != nil} + /// Clears the value of `destination`. Subsequent reads from it will return its default value. + mutating func clearDestination() {self._destination = nil} + + var identityKey: Data { + get {return _identityKey ?? SwiftProtobuf.Internal.emptyData} + set {_identityKey = newValue} + } + /// Returns true if `identityKey` has been explicitly set. + var hasIdentityKey: Bool {return self._identityKey != nil} + /// Clears the value of `identityKey`. Subsequent reads from it will return its default value. + mutating func clearIdentityKey() {self._identityKey = nil} + + var state: SessionProtos_Verified.State { + get {return _state ?? .default} + set {_state = newValue} + } + /// Returns true if `state` has been explicitly set. + var hasState: Bool {return self._state != nil} + /// Clears the value of `state`. Subsequent reads from it will return its default value. + mutating func clearState() {self._state = nil} + + var nullMessage: Data { + get {return _nullMessage ?? SwiftProtobuf.Internal.emptyData} + set {_nullMessage = newValue} + } + /// Returns true if `nullMessage` has been explicitly set. + var hasNullMessage: Bool {return self._nullMessage != nil} + /// Clears the value of `nullMessage`. Subsequent reads from it will return its default value. + mutating func clearNullMessage() {self._nullMessage = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum State: SwiftProtobuf.Enum { + typealias RawValue = Int + case `default` // = 0 + case verified // = 1 + case unverified // = 2 + + init() { + self = .default + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .default + case 1: self = .verified + case 2: self = .unverified + default: return nil + } + } + + var rawValue: Int { + switch self { + case .default: return 0 + case .verified: return 1 + case .unverified: return 2 + } + } + + } + + init() {} + + fileprivate var _destination: String? = nil + fileprivate var _identityKey: Data? = nil + fileprivate var _state: SessionProtos_Verified.State? = nil + fileprivate var _nullMessage: Data? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_Verified.State: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_SyncMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var sent: SessionProtos_SyncMessage.Sent { + get {return _sent ?? SessionProtos_SyncMessage.Sent()} + set {_sent = newValue} + } + /// Returns true if `sent` has been explicitly set. + var hasSent: Bool {return self._sent != nil} + /// Clears the value of `sent`. Subsequent reads from it will return its default value. + mutating func clearSent() {self._sent = nil} + + var contacts: SessionProtos_SyncMessage.Contacts { + get {return _contacts ?? SessionProtos_SyncMessage.Contacts()} + set {_contacts = newValue} + } + /// Returns true if `contacts` has been explicitly set. + var hasContacts: Bool {return self._contacts != nil} + /// Clears the value of `contacts`. Subsequent reads from it will return its default value. + mutating func clearContacts() {self._contacts = nil} + + var groups: SessionProtos_SyncMessage.Groups { + get {return _groups ?? SessionProtos_SyncMessage.Groups()} + set {_groups = newValue} + } + /// Returns true if `groups` has been explicitly set. + var hasGroups: Bool {return self._groups != nil} + /// Clears the value of `groups`. Subsequent reads from it will return its default value. + mutating func clearGroups() {self._groups = nil} + + var request: SessionProtos_SyncMessage.Request { + get {return _request ?? SessionProtos_SyncMessage.Request()} + set {_request = newValue} + } + /// Returns true if `request` has been explicitly set. + var hasRequest: Bool {return self._request != nil} + /// Clears the value of `request`. Subsequent reads from it will return its default value. + mutating func clearRequest() {self._request = nil} + + var read: [SessionProtos_SyncMessage.Read] = [] + + var blocked: SessionProtos_SyncMessage.Blocked { + get {return _blocked ?? SessionProtos_SyncMessage.Blocked()} + set {_blocked = newValue} + } + /// Returns true if `blocked` has been explicitly set. + var hasBlocked: Bool {return self._blocked != nil} + /// Clears the value of `blocked`. Subsequent reads from it will return its default value. + mutating func clearBlocked() {self._blocked = nil} + + var verified: SessionProtos_Verified { + get {return _verified ?? SessionProtos_Verified()} + set {_verified = newValue} + } + /// Returns true if `verified` has been explicitly set. + var hasVerified: Bool {return self._verified != nil} + /// Clears the value of `verified`. Subsequent reads from it will return its default value. + mutating func clearVerified() {self._verified = nil} + + var configuration: SessionProtos_SyncMessage.Configuration { + get {return _configuration ?? SessionProtos_SyncMessage.Configuration()} + set {_configuration = newValue} + } + /// Returns true if `configuration` has been explicitly set. + var hasConfiguration: Bool {return self._configuration != nil} + /// Clears the value of `configuration`. Subsequent reads from it will return its default value. + mutating func clearConfiguration() {self._configuration = nil} + + var padding: Data { + get {return _padding ?? SwiftProtobuf.Internal.emptyData} + set {_padding = newValue} + } + /// Returns true if `padding` has been explicitly set. + var hasPadding: Bool {return self._padding != nil} + /// Clears the value of `padding`. Subsequent reads from it will return its default value. + mutating func clearPadding() {self._padding = nil} + + var openGroups: [SessionProtos_SyncMessage.OpenGroupDetails] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Sent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var destination: String { + get {return _destination ?? String()} + set {_destination = newValue} + } + /// Returns true if `destination` has been explicitly set. + var hasDestination: Bool {return self._destination != nil} + /// Clears the value of `destination`. Subsequent reads from it will return its default value. + mutating func clearDestination() {self._destination = nil} + + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + var message: SessionProtos_DataMessage { + get {return _message ?? SessionProtos_DataMessage()} + set {_message = newValue} + } + /// Returns true if `message` has been explicitly set. + var hasMessage: Bool {return self._message != nil} + /// Clears the value of `message`. Subsequent reads from it will return its default value. + mutating func clearMessage() {self._message = nil} + + var expirationStartTimestamp: UInt64 { + get {return _expirationStartTimestamp ?? 0} + set {_expirationStartTimestamp = newValue} + } + /// Returns true if `expirationStartTimestamp` has been explicitly set. + var hasExpirationStartTimestamp: Bool {return self._expirationStartTimestamp != nil} + /// Clears the value of `expirationStartTimestamp`. Subsequent reads from it will return its default value. + mutating func clearExpirationStartTimestamp() {self._expirationStartTimestamp = nil} + + var unidentifiedStatus: [SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus] = [] + + var isRecipientUpdate: Bool { + get {return _isRecipientUpdate ?? false} + set {_isRecipientUpdate = newValue} + } + /// Returns true if `isRecipientUpdate` has been explicitly set. + var hasIsRecipientUpdate: Bool {return self._isRecipientUpdate != nil} + /// Clears the value of `isRecipientUpdate`. Subsequent reads from it will return its default value. + mutating func clearIsRecipientUpdate() {self._isRecipientUpdate = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct UnidentifiedDeliveryStatus { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var destination: String { + get {return _destination ?? String()} + set {_destination = newValue} + } + /// Returns true if `destination` has been explicitly set. + var hasDestination: Bool {return self._destination != nil} + /// Clears the value of `destination`. Subsequent reads from it will return its default value. + mutating func clearDestination() {self._destination = nil} + + var unidentified: Bool { + get {return _unidentified ?? false} + set {_unidentified = newValue} + } + /// Returns true if `unidentified` has been explicitly set. + var hasUnidentified: Bool {return self._unidentified != nil} + /// Clears the value of `unidentified`. Subsequent reads from it will return its default value. + mutating func clearUnidentified() {self._unidentified = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _destination: String? = nil + fileprivate var _unidentified: Bool? = nil + } + + init() {} + + fileprivate var _destination: String? = nil + fileprivate var _timestamp: UInt64? = nil + fileprivate var _message: SessionProtos_DataMessage? = nil + fileprivate var _expirationStartTimestamp: UInt64? = nil + fileprivate var _isRecipientUpdate: Bool? = nil + } + + struct Contacts { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var blob: SessionProtos_AttachmentPointer { + get {return _blob ?? SessionProtos_AttachmentPointer()} + set {_blob = newValue} + } + /// Returns true if `blob` has been explicitly set. + var hasBlob: Bool {return self._blob != nil} + /// Clears the value of `blob`. Subsequent reads from it will return its default value. + mutating func clearBlob() {self._blob = nil} + + /// Signal-iOS renamed this property. + var isComplete: Bool { + get {return _isComplete ?? false} + set {_isComplete = newValue} + } + /// Returns true if `isComplete` has been explicitly set. + var hasIsComplete: Bool {return self._isComplete != nil} + /// Clears the value of `isComplete`. Subsequent reads from it will return its default value. + mutating func clearIsComplete() {self._isComplete = nil} + + /// Loki + var data: Data { + get {return _data ?? SwiftProtobuf.Internal.emptyData} + set {_data = newValue} + } + /// Returns true if `data` has been explicitly set. + var hasData: Bool {return self._data != nil} + /// Clears the value of `data`. Subsequent reads from it will return its default value. + mutating func clearData() {self._data = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _blob: SessionProtos_AttachmentPointer? = nil + fileprivate var _isComplete: Bool? = nil + fileprivate var _data: Data? = nil + } + + struct Groups { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var blob: SessionProtos_AttachmentPointer { + get {return _blob ?? SessionProtos_AttachmentPointer()} + set {_blob = newValue} + } + /// Returns true if `blob` has been explicitly set. + var hasBlob: Bool {return self._blob != nil} + /// Clears the value of `blob`. Subsequent reads from it will return its default value. + mutating func clearBlob() {self._blob = nil} + + /// Loki + var data: Data { + get {return _data ?? SwiftProtobuf.Internal.emptyData} + set {_data = newValue} + } + /// Returns true if `data` has been explicitly set. + var hasData: Bool {return self._data != nil} + /// Clears the value of `data`. Subsequent reads from it will return its default value. + mutating func clearData() {self._data = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _blob: SessionProtos_AttachmentPointer? = nil + fileprivate var _data: Data? = nil + } + + /// Loki + struct OpenGroupDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var url: String { + get {return _url ?? String()} + set {_url = newValue} + } + /// Returns true if `url` has been explicitly set. + var hasURL: Bool {return self._url != nil} + /// Clears the value of `url`. Subsequent reads from it will return its default value. + mutating func clearURL() {self._url = nil} + + /// @required + var channelID: UInt64 { + get {return _channelID ?? 0} + set {_channelID = newValue} + } + /// Returns true if `channelID` has been explicitly set. + var hasChannelID: Bool {return self._channelID != nil} + /// Clears the value of `channelID`. Subsequent reads from it will return its default value. + mutating func clearChannelID() {self._channelID = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _url: String? = nil + fileprivate var _channelID: UInt64? = nil + } + + struct Blocked { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var numbers: [String] = [] + + var groupIds: [Data] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct Request { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var type: SessionProtos_SyncMessage.Request.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case contacts // = 1 + case groups // = 2 + case blocked // = 3 + case configuration // = 4 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .contacts + case 2: self = .groups + case 3: self = .blocked + case 4: self = .configuration + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .contacts: return 1 + case .groups: return 2 + case .blocked: return 3 + case .configuration: return 4 + } + } + + } + + init() {} + + fileprivate var _type: SessionProtos_SyncMessage.Request.TypeEnum? = nil + } + + struct Read { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var sender: String { + get {return _sender ?? String()} + set {_sender = newValue} + } + /// Returns true if `sender` has been explicitly set. + var hasSender: Bool {return self._sender != nil} + /// Clears the value of `sender`. Subsequent reads from it will return its default value. + mutating func clearSender() {self._sender = nil} + + /// @required + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _sender: String? = nil + fileprivate var _timestamp: UInt64? = nil + } + + struct Configuration { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var readReceipts: Bool { + get {return _readReceipts ?? false} + set {_readReceipts = newValue} + } + /// Returns true if `readReceipts` has been explicitly set. + var hasReadReceipts: Bool {return self._readReceipts != nil} + /// Clears the value of `readReceipts`. Subsequent reads from it will return its default value. + mutating func clearReadReceipts() {self._readReceipts = nil} + + var unidentifiedDeliveryIndicators: Bool { + get {return _unidentifiedDeliveryIndicators ?? false} + set {_unidentifiedDeliveryIndicators = newValue} + } + /// Returns true if `unidentifiedDeliveryIndicators` has been explicitly set. + var hasUnidentifiedDeliveryIndicators: Bool {return self._unidentifiedDeliveryIndicators != nil} + /// Clears the value of `unidentifiedDeliveryIndicators`. Subsequent reads from it will return its default value. + mutating func clearUnidentifiedDeliveryIndicators() {self._unidentifiedDeliveryIndicators = nil} + + var typingIndicators: Bool { + get {return _typingIndicators ?? false} + set {_typingIndicators = newValue} + } + /// Returns true if `typingIndicators` has been explicitly set. + var hasTypingIndicators: Bool {return self._typingIndicators != nil} + /// Clears the value of `typingIndicators`. Subsequent reads from it will return its default value. + mutating func clearTypingIndicators() {self._typingIndicators = nil} + + var linkPreviews: Bool { + get {return _linkPreviews ?? false} + set {_linkPreviews = newValue} + } + /// Returns true if `linkPreviews` has been explicitly set. + var hasLinkPreviews: Bool {return self._linkPreviews != nil} + /// Clears the value of `linkPreviews`. Subsequent reads from it will return its default value. + mutating func clearLinkPreviews() {self._linkPreviews = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _readReceipts: Bool? = nil + fileprivate var _unidentifiedDeliveryIndicators: Bool? = nil + fileprivate var _typingIndicators: Bool? = nil + fileprivate var _linkPreviews: Bool? = nil + } + + init() {} + + fileprivate var _sent: SessionProtos_SyncMessage.Sent? = nil + fileprivate var _contacts: SessionProtos_SyncMessage.Contacts? = nil + fileprivate var _groups: SessionProtos_SyncMessage.Groups? = nil + fileprivate var _request: SessionProtos_SyncMessage.Request? = nil + fileprivate var _blocked: SessionProtos_SyncMessage.Blocked? = nil + fileprivate var _verified: SessionProtos_Verified? = nil + fileprivate var _configuration: SessionProtos_SyncMessage.Configuration? = nil + fileprivate var _padding: Data? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_SyncMessage.Request.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_AttachmentPointer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var contentType: String { + get {return _contentType ?? String()} + set {_contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return self._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {self._contentType = nil} + + var key: Data { + get {return _key ?? SwiftProtobuf.Internal.emptyData} + set {_key = newValue} + } + /// Returns true if `key` has been explicitly set. + var hasKey: Bool {return self._key != nil} + /// Clears the value of `key`. Subsequent reads from it will return its default value. + mutating func clearKey() {self._key = nil} + + var size: UInt32 { + get {return _size ?? 0} + set {_size = newValue} + } + /// Returns true if `size` has been explicitly set. + var hasSize: Bool {return self._size != nil} + /// Clears the value of `size`. Subsequent reads from it will return its default value. + mutating func clearSize() {self._size = nil} + + var thumbnail: Data { + get {return _thumbnail ?? SwiftProtobuf.Internal.emptyData} + set {_thumbnail = newValue} + } + /// Returns true if `thumbnail` has been explicitly set. + var hasThumbnail: Bool {return self._thumbnail != nil} + /// Clears the value of `thumbnail`. Subsequent reads from it will return its default value. + mutating func clearThumbnail() {self._thumbnail = nil} + + var digest: Data { + get {return _digest ?? SwiftProtobuf.Internal.emptyData} + set {_digest = newValue} + } + /// Returns true if `digest` has been explicitly set. + var hasDigest: Bool {return self._digest != nil} + /// Clears the value of `digest`. Subsequent reads from it will return its default value. + mutating func clearDigest() {self._digest = nil} + + var fileName: String { + get {return _fileName ?? String()} + set {_fileName = newValue} + } + /// Returns true if `fileName` has been explicitly set. + var hasFileName: Bool {return self._fileName != nil} + /// Clears the value of `fileName`. Subsequent reads from it will return its default value. + mutating func clearFileName() {self._fileName = nil} + + var flags: UInt32 { + get {return _flags ?? 0} + set {_flags = newValue} + } + /// Returns true if `flags` has been explicitly set. + var hasFlags: Bool {return self._flags != nil} + /// Clears the value of `flags`. Subsequent reads from it will return its default value. + mutating func clearFlags() {self._flags = nil} + + var width: UInt32 { + get {return _width ?? 0} + set {_width = newValue} + } + /// Returns true if `width` has been explicitly set. + var hasWidth: Bool {return self._width != nil} + /// Clears the value of `width`. Subsequent reads from it will return its default value. + mutating func clearWidth() {self._width = nil} + + var height: UInt32 { + get {return _height ?? 0} + set {_height = newValue} + } + /// Returns true if `height` has been explicitly set. + var hasHeight: Bool {return self._height != nil} + /// Clears the value of `height`. Subsequent reads from it will return its default value. + mutating func clearHeight() {self._height = nil} + + var caption: String { + get {return _caption ?? String()} + set {_caption = newValue} + } + /// Returns true if `caption` has been explicitly set. + var hasCaption: Bool {return self._caption != nil} + /// Clears the value of `caption`. Subsequent reads from it will return its default value. + mutating func clearCaption() {self._caption = nil} + + /// Loki + var url: String { + get {return _url ?? String()} + set {_url = newValue} + } + /// Returns true if `url` has been explicitly set. + var hasURL: Bool {return self._url != nil} + /// Clears the value of `url`. Subsequent reads from it will return its default value. + mutating func clearURL() {self._url = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Flags: SwiftProtobuf.Enum { + typealias RawValue = Int + case voiceMessage // = 1 + + init() { + self = .voiceMessage + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .voiceMessage + default: return nil + } + } + + var rawValue: Int { + switch self { + case .voiceMessage: return 1 + } + } + + } + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _contentType: String? = nil + fileprivate var _key: Data? = nil + fileprivate var _size: UInt32? = nil + fileprivate var _thumbnail: Data? = nil + fileprivate var _digest: Data? = nil + fileprivate var _fileName: String? = nil + fileprivate var _flags: UInt32? = nil + fileprivate var _width: UInt32? = nil + fileprivate var _height: UInt32? = nil + fileprivate var _caption: String? = nil + fileprivate var _url: String? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_AttachmentPointer.Flags: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_GroupContext { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: Data { + get {return _id ?? SwiftProtobuf.Internal.emptyData} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// @required + var type: SessionProtos_GroupContext.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + var members: [String] = [] + + var avatar: SessionProtos_AttachmentPointer { + get {return _avatar ?? SessionProtos_AttachmentPointer()} + set {_avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return self._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {self._avatar = nil} + + /// Loki + var admins: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case update // = 1 + case deliver // = 2 + case quit // = 3 + case requestInfo // = 4 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .update + case 2: self = .deliver + case 3: self = .quit + case 4: self = .requestInfo + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .update: return 1 + case .deliver: return 2 + case .quit: return 3 + case .requestInfo: return 4 + } + } + + } + + init() {} + + fileprivate var _id: Data? = nil + fileprivate var _type: SessionProtos_GroupContext.TypeEnum? = nil + fileprivate var _name: String? = nil + fileprivate var _avatar: SessionProtos_AttachmentPointer? = nil +} + +#if swift(>=4.2) + +extension SessionProtos_GroupContext.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct SessionProtos_ContactDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var number: String { + get {return _number ?? String()} + set {_number = newValue} + } + /// Returns true if `number` has been explicitly set. + var hasNumber: Bool {return self._number != nil} + /// Clears the value of `number`. Subsequent reads from it will return its default value. + mutating func clearNumber() {self._number = nil} + + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + var avatar: SessionProtos_ContactDetails.Avatar { + get {return _avatar ?? SessionProtos_ContactDetails.Avatar()} + set {_avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return self._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {self._avatar = nil} + + var color: String { + get {return _color ?? String()} + set {_color = newValue} + } + /// Returns true if `color` has been explicitly set. + var hasColor: Bool {return self._color != nil} + /// Clears the value of `color`. Subsequent reads from it will return its default value. + mutating func clearColor() {self._color = nil} + + var verified: SessionProtos_Verified { + get {return _verified ?? SessionProtos_Verified()} + set {_verified = newValue} + } + /// Returns true if `verified` has been explicitly set. + var hasVerified: Bool {return self._verified != nil} + /// Clears the value of `verified`. Subsequent reads from it will return its default value. + mutating func clearVerified() {self._verified = nil} + + var profileKey: Data { + get {return _profileKey ?? SwiftProtobuf.Internal.emptyData} + set {_profileKey = newValue} + } + /// Returns true if `profileKey` has been explicitly set. + var hasProfileKey: Bool {return self._profileKey != nil} + /// Clears the value of `profileKey`. Subsequent reads from it will return its default value. + mutating func clearProfileKey() {self._profileKey = nil} + + var blocked: Bool { + get {return _blocked ?? false} + set {_blocked = newValue} + } + /// Returns true if `blocked` has been explicitly set. + var hasBlocked: Bool {return self._blocked != nil} + /// Clears the value of `blocked`. Subsequent reads from it will return its default value. + mutating func clearBlocked() {self._blocked = nil} + + var expireTimer: UInt32 { + get {return _expireTimer ?? 0} + set {_expireTimer = newValue} + } + /// Returns true if `expireTimer` has been explicitly set. + var hasExpireTimer: Bool {return self._expireTimer != nil} + /// Clears the value of `expireTimer`. Subsequent reads from it will return its default value. + mutating func clearExpireTimer() {self._expireTimer = nil} + + /// Loki + var nickname: String { + get {return _nickname ?? String()} + set {_nickname = newValue} + } + /// Returns true if `nickname` has been explicitly set. + var hasNickname: Bool {return self._nickname != nil} + /// Clears the value of `nickname`. Subsequent reads from it will return its default value. + mutating func clearNickname() {self._nickname = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Avatar { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var contentType: String { + get {return _contentType ?? String()} + set {_contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return self._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {self._contentType = nil} + + var length: UInt32 { + get {return _length ?? 0} + set {_length = newValue} + } + /// Returns true if `length` has been explicitly set. + var hasLength: Bool {return self._length != nil} + /// Clears the value of `length`. Subsequent reads from it will return its default value. + mutating func clearLength() {self._length = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _contentType: String? = nil + fileprivate var _length: UInt32? = nil + } + + init() {} + + fileprivate var _number: String? = nil + fileprivate var _name: String? = nil + fileprivate var _avatar: SessionProtos_ContactDetails.Avatar? = nil + fileprivate var _color: String? = nil + fileprivate var _verified: SessionProtos_Verified? = nil + fileprivate var _profileKey: Data? = nil + fileprivate var _blocked: Bool? = nil + fileprivate var _expireTimer: UInt32? = nil + fileprivate var _nickname: String? = nil +} + +struct SessionProtos_GroupDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// @required + var id: Data { + get {return _id ?? SwiftProtobuf.Internal.emptyData} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + var members: [String] = [] + + var avatar: SessionProtos_GroupDetails.Avatar { + get {return _avatar ?? SessionProtos_GroupDetails.Avatar()} + set {_avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return self._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {self._avatar = nil} + + var active: Bool { + get {return _active ?? true} + set {_active = newValue} + } + /// Returns true if `active` has been explicitly set. + var hasActive: Bool {return self._active != nil} + /// Clears the value of `active`. Subsequent reads from it will return its default value. + mutating func clearActive() {self._active = nil} + + var expireTimer: UInt32 { + get {return _expireTimer ?? 0} + set {_expireTimer = newValue} + } + /// Returns true if `expireTimer` has been explicitly set. + var hasExpireTimer: Bool {return self._expireTimer != nil} + /// Clears the value of `expireTimer`. Subsequent reads from it will return its default value. + mutating func clearExpireTimer() {self._expireTimer = nil} + + var color: String { + get {return _color ?? String()} + set {_color = newValue} + } + /// Returns true if `color` has been explicitly set. + var hasColor: Bool {return self._color != nil} + /// Clears the value of `color`. Subsequent reads from it will return its default value. + mutating func clearColor() {self._color = nil} + + var blocked: Bool { + get {return _blocked ?? false} + set {_blocked = newValue} + } + /// Returns true if `blocked` has been explicitly set. + var hasBlocked: Bool {return self._blocked != nil} + /// Clears the value of `blocked`. Subsequent reads from it will return its default value. + mutating func clearBlocked() {self._blocked = nil} + + /// Loki + var admins: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Avatar { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var contentType: String { + get {return _contentType ?? String()} + set {_contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return self._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {self._contentType = nil} + + var length: UInt32 { + get {return _length ?? 0} + set {_length = newValue} + } + /// Returns true if `length` has been explicitly set. + var hasLength: Bool {return self._length != nil} + /// Clears the value of `length`. Subsequent reads from it will return its default value. + mutating func clearLength() {self._length = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _contentType: String? = nil + fileprivate var _length: UInt32? = nil + } + + init() {} + + fileprivate var _id: Data? = nil + fileprivate var _name: String? = nil + fileprivate var _avatar: SessionProtos_GroupDetails.Avatar? = nil + fileprivate var _active: Bool? = nil + fileprivate var _expireTimer: UInt32? = nil + fileprivate var _color: String? = nil + fileprivate var _blocked: Bool? = nil +} + +/// Internal - DO NOT SEND +struct SessionProtos_PublicChatInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var serverID: UInt64 { + get {return _serverID ?? 0} + set {_serverID = newValue} + } + /// Returns true if `serverID` has been explicitly set. + var hasServerID: Bool {return self._serverID != nil} + /// Clears the value of `serverID`. Subsequent reads from it will return its default value. + mutating func clearServerID() {self._serverID = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _serverID: UInt64? = nil +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "SessionProtos" + +extension SessionProtos_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Envelope" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "source"), + 7: .same(proto: "sourceDevice"), + 3: .same(proto: "relay"), + 5: .same(proto: "timestamp"), + 6: .same(proto: "legacyMessage"), + 8: .same(proto: "content"), + 9: .same(proto: "serverGuid"), + 10: .same(proto: "serverTimestamp"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + case 2: try decoder.decodeSingularStringField(value: &self._source) + case 3: try decoder.decodeSingularStringField(value: &self._relay) + case 5: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + case 6: try decoder.decodeSingularBytesField(value: &self._legacyMessage) + case 7: try decoder.decodeSingularUInt32Field(value: &self._sourceDevice) + case 8: try decoder.decodeSingularBytesField(value: &self._content) + case 9: try decoder.decodeSingularStringField(value: &self._serverGuid) + case 10: try decoder.decodeSingularUInt64Field(value: &self._serverTimestamp) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = self._source { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._relay { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 5) + } + if let v = self._legacyMessage { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._sourceDevice { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 7) + } + if let v = self._content { + try visitor.visitSingularBytesField(value: v, fieldNumber: 8) + } + if let v = self._serverGuid { + try visitor.visitSingularStringField(value: v, fieldNumber: 9) + } + if let v = self._serverTimestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_Envelope, rhs: SessionProtos_Envelope) -> Bool { + if lhs._type != rhs._type {return false} + if lhs._source != rhs._source {return false} + if lhs._sourceDevice != rhs._sourceDevice {return false} + if lhs._relay != rhs._relay {return false} + if lhs._timestamp != rhs._timestamp {return false} + if lhs._legacyMessage != rhs._legacyMessage {return false} + if lhs._content != rhs._content {return false} + if lhs._serverGuid != rhs._serverGuid {return false} + if lhs._serverTimestamp != rhs._serverTimestamp {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_Envelope.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "CIPHERTEXT"), + 2: .same(proto: "KEY_EXCHANGE"), + 3: .same(proto: "PREKEY_BUNDLE"), + 5: .same(proto: "RECEIPT"), + 6: .same(proto: "UNIDENTIFIED_SENDER"), + 7: .same(proto: "CLOSED_GROUP_CIPHERTEXT"), + 101: .same(proto: "FALLBACK_MESSAGE"), + ] +} + +extension SessionProtos_TypingMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TypingMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "timestamp"), + 2: .same(proto: "action"), + 3: .same(proto: "groupId"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + case 2: try decoder.decodeSingularEnumField(value: &self._action) + case 3: try decoder.decodeSingularBytesField(value: &self._groupID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._action { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._groupID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_TypingMessage, rhs: SessionProtos_TypingMessage) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs._action != rhs._action {return false} + if lhs._groupID != rhs._groupID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_TypingMessage.Action: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "STARTED"), + 1: .same(proto: "STOPPED"), + ] +} + +extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Content" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "dataMessage"), + 2: .same(proto: "syncMessage"), + 3: .same(proto: "callMessage"), + 4: .same(proto: "nullMessage"), + 5: .same(proto: "receiptMessage"), + 6: .same(proto: "typingMessage"), + 101: .same(proto: "prekeyBundleMessage"), + 103: .same(proto: "lokiDeviceLinkMessage"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._dataMessage) + case 2: try decoder.decodeSingularMessageField(value: &self._syncMessage) + case 3: try decoder.decodeSingularMessageField(value: &self._callMessage) + case 4: try decoder.decodeSingularMessageField(value: &self._nullMessage) + case 5: try decoder.decodeSingularMessageField(value: &self._receiptMessage) + case 6: try decoder.decodeSingularMessageField(value: &self._typingMessage) + case 101: try decoder.decodeSingularMessageField(value: &self._prekeyBundleMessage) + case 103: try decoder.decodeSingularMessageField(value: &self._lokiDeviceLinkMessage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._dataMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._syncMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = self._callMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = self._nullMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = self._receiptMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if let v = self._typingMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } + if let v = self._prekeyBundleMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 101) + } + if let v = self._lokiDeviceLinkMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 103) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_Content, rhs: SessionProtos_Content) -> Bool { + if lhs._dataMessage != rhs._dataMessage {return false} + if lhs._syncMessage != rhs._syncMessage {return false} + if lhs._callMessage != rhs._callMessage {return false} + if lhs._nullMessage != rhs._nullMessage {return false} + if lhs._receiptMessage != rhs._receiptMessage {return false} + if lhs._typingMessage != rhs._typingMessage {return false} + if lhs._prekeyBundleMessage != rhs._prekeyBundleMessage {return false} + if lhs._lokiDeviceLinkMessage != rhs._lokiDeviceLinkMessage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_PrekeyBundleMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PrekeyBundleMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "identityKey"), + 2: .same(proto: "deviceID"), + 3: .same(proto: "prekeyID"), + 4: .same(proto: "signedKeyID"), + 5: .same(proto: "prekey"), + 6: .same(proto: "signedKey"), + 7: .same(proto: "signature"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._identityKey) + case 2: try decoder.decodeSingularUInt32Field(value: &self._deviceID) + case 3: try decoder.decodeSingularUInt32Field(value: &self._prekeyID) + case 4: try decoder.decodeSingularUInt32Field(value: &self._signedKeyID) + case 5: try decoder.decodeSingularBytesField(value: &self._prekey) + case 6: try decoder.decodeSingularBytesField(value: &self._signedKey) + case 7: try decoder.decodeSingularBytesField(value: &self._signature) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._identityKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = self._deviceID { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } + if let v = self._prekeyID { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 3) + } + if let v = self._signedKeyID { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 4) + } + if let v = self._prekey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 5) + } + if let v = self._signedKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._signature { + try visitor.visitSingularBytesField(value: v, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_PrekeyBundleMessage, rhs: SessionProtos_PrekeyBundleMessage) -> Bool { + if lhs._identityKey != rhs._identityKey {return false} + if lhs._deviceID != rhs._deviceID {return false} + if lhs._prekeyID != rhs._prekeyID {return false} + if lhs._signedKeyID != rhs._signedKeyID {return false} + if lhs._prekey != rhs._prekey {return false} + if lhs._signedKey != rhs._signedKey {return false} + if lhs._signature != rhs._signature {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_LokiDeviceLinkMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LokiDeviceLinkMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "masterPublicKey"), + 2: .same(proto: "slavePublicKey"), + 3: .same(proto: "slaveSignature"), + 4: .same(proto: "masterSignature"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._masterPublicKey) + case 2: try decoder.decodeSingularStringField(value: &self._slavePublicKey) + case 3: try decoder.decodeSingularBytesField(value: &self._slaveSignature) + case 4: try decoder.decodeSingularBytesField(value: &self._masterSignature) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._masterPublicKey { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._slavePublicKey { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._slaveSignature { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } + if let v = self._masterSignature { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_LokiDeviceLinkMessage, rhs: SessionProtos_LokiDeviceLinkMessage) -> Bool { + if lhs._masterPublicKey != rhs._masterPublicKey {return false} + if lhs._slavePublicKey != rhs._slavePublicKey {return false} + if lhs._slaveSignature != rhs._slaveSignature {return false} + if lhs._masterSignature != rhs._masterSignature {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_CallMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CallMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "offer"), + 2: .same(proto: "answer"), + 3: .same(proto: "iceUpdate"), + 4: .same(proto: "hangup"), + 5: .same(proto: "busy"), + 6: .same(proto: "profileKey"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._offer) + case 2: try decoder.decodeSingularMessageField(value: &self._answer) + case 3: try decoder.decodeRepeatedMessageField(value: &self.iceUpdate) + case 4: try decoder.decodeSingularMessageField(value: &self._hangup) + case 5: try decoder.decodeSingularMessageField(value: &self._busy) + case 6: try decoder.decodeSingularBytesField(value: &self._profileKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._offer { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._answer { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if !self.iceUpdate.isEmpty { + try visitor.visitRepeatedMessageField(value: self.iceUpdate, fieldNumber: 3) + } + if let v = self._hangup { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = self._busy { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if let v = self._profileKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_CallMessage, rhs: SessionProtos_CallMessage) -> Bool { + if lhs._offer != rhs._offer {return false} + if lhs._answer != rhs._answer {return false} + if lhs.iceUpdate != rhs.iceUpdate {return false} + if lhs._hangup != rhs._hangup {return false} + if lhs._busy != rhs._busy {return false} + if lhs._profileKey != rhs._profileKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_CallMessage.Offer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_CallMessage.protoMessageName + ".Offer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "sessionDescription"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._sessionDescription) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._sessionDescription { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_CallMessage.Offer, rhs: SessionProtos_CallMessage.Offer) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._sessionDescription != rhs._sessionDescription {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_CallMessage.Answer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_CallMessage.protoMessageName + ".Answer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "sessionDescription"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._sessionDescription) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._sessionDescription { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_CallMessage.Answer, rhs: SessionProtos_CallMessage.Answer) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._sessionDescription != rhs._sessionDescription {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_CallMessage.IceUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_CallMessage.protoMessageName + ".IceUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "sdpMid"), + 3: .same(proto: "sdpMLineIndex"), + 4: .same(proto: "sdp"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._sdpMid) + case 3: try decoder.decodeSingularUInt32Field(value: &self._sdpMlineIndex) + case 4: try decoder.decodeSingularStringField(value: &self._sdp) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._sdpMid { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._sdpMlineIndex { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 3) + } + if let v = self._sdp { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_CallMessage.IceUpdate, rhs: SessionProtos_CallMessage.IceUpdate) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._sdpMid != rhs._sdpMid {return false} + if lhs._sdpMlineIndex != rhs._sdpMlineIndex {return false} + if lhs._sdp != rhs._sdp {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_CallMessage.Busy: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_CallMessage.protoMessageName + ".Busy" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_CallMessage.Busy, rhs: SessionProtos_CallMessage.Busy) -> Bool { + if lhs._id != rhs._id {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_CallMessage.Hangup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_CallMessage.protoMessageName + ".Hangup" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_CallMessage.Hangup, rhs: SessionProtos_CallMessage.Hangup) -> Bool { + if lhs._id != rhs._id {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_ClosedGroupCiphertextMessageWrapper: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClosedGroupCiphertextMessageWrapper" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "ciphertext"), + 2: .same(proto: "ephemeralPublicKey"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._ciphertext) + case 2: try decoder.decodeSingularBytesField(value: &self._ephemeralPublicKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._ciphertext { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = self._ephemeralPublicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_ClosedGroupCiphertextMessageWrapper, rhs: SessionProtos_ClosedGroupCiphertextMessageWrapper) -> Bool { + if lhs._ciphertext != rhs._ciphertext {return false} + if lhs._ephemeralPublicKey != rhs._ephemeralPublicKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DataMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "body"), + 2: .same(proto: "attachments"), + 3: .same(proto: "group"), + 4: .same(proto: "flags"), + 5: .same(proto: "expireTimer"), + 6: .same(proto: "profileKey"), + 7: .same(proto: "timestamp"), + 8: .same(proto: "quote"), + 9: .same(proto: "contact"), + 10: .same(proto: "preview"), + 101: .same(proto: "profile"), + 103: .same(proto: "closedGroupUpdate"), + 999: .same(proto: "publicChatInfo"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._body) + case 2: try decoder.decodeRepeatedMessageField(value: &self.attachments) + case 3: try decoder.decodeSingularMessageField(value: &self._group) + case 4: try decoder.decodeSingularUInt32Field(value: &self._flags) + case 5: try decoder.decodeSingularUInt32Field(value: &self._expireTimer) + case 6: try decoder.decodeSingularBytesField(value: &self._profileKey) + case 7: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + case 8: try decoder.decodeSingularMessageField(value: &self._quote) + case 9: try decoder.decodeRepeatedMessageField(value: &self.contact) + case 10: try decoder.decodeRepeatedMessageField(value: &self.preview) + case 101: try decoder.decodeSingularMessageField(value: &self._profile) + case 103: try decoder.decodeSingularMessageField(value: &self._closedGroupUpdate) + case 999: try decoder.decodeSingularMessageField(value: &self._publicChatInfo) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._body { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if !self.attachments.isEmpty { + try visitor.visitRepeatedMessageField(value: self.attachments, fieldNumber: 2) + } + if let v = self._group { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = self._flags { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 4) + } + if let v = self._expireTimer { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 5) + } + if let v = self._profileKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 7) + } + if let v = self._quote { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } + if !self.contact.isEmpty { + try visitor.visitRepeatedMessageField(value: self.contact, fieldNumber: 9) + } + if !self.preview.isEmpty { + try visitor.visitRepeatedMessageField(value: self.preview, fieldNumber: 10) + } + if let v = self._profile { + try visitor.visitSingularMessageField(value: v, fieldNumber: 101) + } + if let v = self._closedGroupUpdate { + try visitor.visitSingularMessageField(value: v, fieldNumber: 103) + } + if let v = self._publicChatInfo { + try visitor.visitSingularMessageField(value: v, fieldNumber: 999) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage, rhs: SessionProtos_DataMessage) -> Bool { + if lhs._body != rhs._body {return false} + if lhs.attachments != rhs.attachments {return false} + if lhs._group != rhs._group {return false} + if lhs._flags != rhs._flags {return false} + if lhs._expireTimer != rhs._expireTimer {return false} + if lhs._profileKey != rhs._profileKey {return false} + if lhs._timestamp != rhs._timestamp {return false} + if lhs._quote != rhs._quote {return false} + if lhs.contact != rhs.contact {return false} + if lhs.preview != rhs.preview {return false} + if lhs._profile != rhs._profile {return false} + if lhs._closedGroupUpdate != rhs._closedGroupUpdate {return false} + if lhs._publicChatInfo != rhs._publicChatInfo {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Flags: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "END_SESSION"), + 2: .same(proto: "EXPIRATION_TIMER_UPDATE"), + 4: .same(proto: "PROFILE_KEY_UPDATE"), + 128: .same(proto: "UNLINK_DEVICE"), + ] +} + +extension SessionProtos_DataMessage.Quote: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".Quote" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "author"), + 3: .same(proto: "text"), + 4: .same(proto: "attachments"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._author) + case 3: try decoder.decodeSingularStringField(value: &self._text) + case 4: try decoder.decodeRepeatedMessageField(value: &self.attachments) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._author { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._text { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if !self.attachments.isEmpty { + try visitor.visitRepeatedMessageField(value: self.attachments, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Quote, rhs: SessionProtos_DataMessage.Quote) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._author != rhs._author {return false} + if lhs._text != rhs._text {return false} + if lhs.attachments != rhs.attachments {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.Quote.protoMessageName + ".QuotedAttachment" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "contentType"), + 2: .same(proto: "fileName"), + 3: .same(proto: "thumbnail"), + 4: .same(proto: "flags"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._contentType) + case 2: try decoder.decodeSingularStringField(value: &self._fileName) + case 3: try decoder.decodeSingularMessageField(value: &self._thumbnail) + case 4: try decoder.decodeSingularUInt32Field(value: &self._flags) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._fileName { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._thumbnail { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = self._flags { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Quote.QuotedAttachment, rhs: SessionProtos_DataMessage.Quote.QuotedAttachment) -> Bool { + if lhs._contentType != rhs._contentType {return false} + if lhs._fileName != rhs._fileName {return false} + if lhs._thumbnail != rhs._thumbnail {return false} + if lhs._flags != rhs._flags {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Quote.QuotedAttachment.Flags: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "VOICE_MESSAGE"), + ] +} + +extension SessionProtos_DataMessage.Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".Contact" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 3: .same(proto: "number"), + 4: .same(proto: "email"), + 5: .same(proto: "address"), + 6: .same(proto: "avatar"), + 7: .same(proto: "organization"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._name) + case 3: try decoder.decodeRepeatedMessageField(value: &self.number) + case 4: try decoder.decodeRepeatedMessageField(value: &self.email) + case 5: try decoder.decodeRepeatedMessageField(value: &self.address) + case 6: try decoder.decodeSingularMessageField(value: &self._avatar) + case 7: try decoder.decodeSingularStringField(value: &self._organization) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.number.isEmpty { + try visitor.visitRepeatedMessageField(value: self.number, fieldNumber: 3) + } + if !self.email.isEmpty { + try visitor.visitRepeatedMessageField(value: self.email, fieldNumber: 4) + } + if !self.address.isEmpty { + try visitor.visitRepeatedMessageField(value: self.address, fieldNumber: 5) + } + if let v = self._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } + if let v = self._organization { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Contact, rhs: SessionProtos_DataMessage.Contact) -> Bool { + if lhs._name != rhs._name {return false} + if lhs.number != rhs.number {return false} + if lhs.email != rhs.email {return false} + if lhs.address != rhs.address {return false} + if lhs._avatar != rhs._avatar {return false} + if lhs._organization != rhs._organization {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Contact.Name: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.Contact.protoMessageName + ".Name" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "givenName"), + 2: .same(proto: "familyName"), + 3: .same(proto: "prefix"), + 4: .same(proto: "suffix"), + 5: .same(proto: "middleName"), + 6: .same(proto: "displayName"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._givenName) + case 2: try decoder.decodeSingularStringField(value: &self._familyName) + case 3: try decoder.decodeSingularStringField(value: &self._prefix) + case 4: try decoder.decodeSingularStringField(value: &self._suffix) + case 5: try decoder.decodeSingularStringField(value: &self._middleName) + case 6: try decoder.decodeSingularStringField(value: &self._displayName) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._givenName { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._familyName { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._prefix { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._suffix { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if let v = self._middleName { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } + if let v = self._displayName { + try visitor.visitSingularStringField(value: v, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Contact.Name, rhs: SessionProtos_DataMessage.Contact.Name) -> Bool { + if lhs._givenName != rhs._givenName {return false} + if lhs._familyName != rhs._familyName {return false} + if lhs._prefix != rhs._prefix {return false} + if lhs._suffix != rhs._suffix {return false} + if lhs._middleName != rhs._middleName {return false} + if lhs._displayName != rhs._displayName {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Contact.Phone: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.Contact.protoMessageName + ".Phone" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "type"), + 3: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._value) + case 2: try decoder.decodeSingularEnumField(value: &self._type) + case 3: try decoder.decodeSingularStringField(value: &self._label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._value { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._label { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Contact.Phone, rhs: SessionProtos_DataMessage.Contact.Phone) -> Bool { + if lhs._value != rhs._value {return false} + if lhs._type != rhs._type {return false} + if lhs._label != rhs._label {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Contact.Phone.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "HOME"), + 2: .same(proto: "MOBILE"), + 3: .same(proto: "WORK"), + 4: .same(proto: "CUSTOM"), + ] +} + +extension SessionProtos_DataMessage.Contact.Email: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.Contact.protoMessageName + ".Email" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "type"), + 3: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._value) + case 2: try decoder.decodeSingularEnumField(value: &self._type) + case 3: try decoder.decodeSingularStringField(value: &self._label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._value { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._label { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Contact.Email, rhs: SessionProtos_DataMessage.Contact.Email) -> Bool { + if lhs._value != rhs._value {return false} + if lhs._type != rhs._type {return false} + if lhs._label != rhs._label {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Contact.Email.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "HOME"), + 2: .same(proto: "MOBILE"), + 3: .same(proto: "WORK"), + 4: .same(proto: "CUSTOM"), + ] +} + +extension SessionProtos_DataMessage.Contact.PostalAddress: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.Contact.protoMessageName + ".PostalAddress" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "label"), + 3: .same(proto: "street"), + 4: .same(proto: "pobox"), + 5: .same(proto: "neighborhood"), + 6: .same(proto: "city"), + 7: .same(proto: "region"), + 8: .same(proto: "postcode"), + 9: .same(proto: "country"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + case 2: try decoder.decodeSingularStringField(value: &self._label) + case 3: try decoder.decodeSingularStringField(value: &self._street) + case 4: try decoder.decodeSingularStringField(value: &self._pobox) + case 5: try decoder.decodeSingularStringField(value: &self._neighborhood) + case 6: try decoder.decodeSingularStringField(value: &self._city) + case 7: try decoder.decodeSingularStringField(value: &self._region) + case 8: try decoder.decodeSingularStringField(value: &self._postcode) + case 9: try decoder.decodeSingularStringField(value: &self._country) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = self._label { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._street { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._pobox { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if let v = self._neighborhood { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } + if let v = self._city { + try visitor.visitSingularStringField(value: v, fieldNumber: 6) + } + if let v = self._region { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + if let v = self._postcode { + try visitor.visitSingularStringField(value: v, fieldNumber: 8) + } + if let v = self._country { + try visitor.visitSingularStringField(value: v, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Contact.PostalAddress, rhs: SessionProtos_DataMessage.Contact.PostalAddress) -> Bool { + if lhs._type != rhs._type {return false} + if lhs._label != rhs._label {return false} + if lhs._street != rhs._street {return false} + if lhs._pobox != rhs._pobox {return false} + if lhs._neighborhood != rhs._neighborhood {return false} + if lhs._city != rhs._city {return false} + if lhs._region != rhs._region {return false} + if lhs._postcode != rhs._postcode {return false} + if lhs._country != rhs._country {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Contact.PostalAddress.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "HOME"), + 2: .same(proto: "WORK"), + 3: .same(proto: "CUSTOM"), + ] +} + +extension SessionProtos_DataMessage.Contact.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.Contact.protoMessageName + ".Avatar" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "avatar"), + 2: .same(proto: "isProfile"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._avatar) + case 2: try decoder.decodeSingularBoolField(value: &self._isProfile) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._isProfile { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Contact.Avatar, rhs: SessionProtos_DataMessage.Contact.Avatar) -> Bool { + if lhs._avatar != rhs._avatar {return false} + if lhs._isProfile != rhs._isProfile {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.Preview: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".Preview" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "url"), + 2: .same(proto: "title"), + 3: .same(proto: "image"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._url) + case 2: try decoder.decodeSingularStringField(value: &self._title) + case 3: try decoder.decodeSingularMessageField(value: &self._image) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._url { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._title { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._image { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.Preview, rhs: SessionProtos_DataMessage.Preview) -> Bool { + if lhs._url != rhs._url {return false} + if lhs._title != rhs._title {return false} + if lhs._image != rhs._image {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.LokiProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".LokiProfile" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "displayName"), + 2: .same(proto: "profilePicture"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._displayName) + case 2: try decoder.decodeSingularStringField(value: &self._profilePicture) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._displayName { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._profilePicture { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.LokiProfile, rhs: SessionProtos_DataMessage.LokiProfile) -> Bool { + if lhs._displayName != rhs._displayName {return false} + if lhs._profilePicture != rhs._profilePicture {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.ClosedGroupUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".ClosedGroupUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "groupPublicKey"), + 3: .same(proto: "groupPrivateKey"), + 4: .same(proto: "senderKeys"), + 5: .same(proto: "members"), + 6: .same(proto: "admins"), + 7: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._name) + case 2: try decoder.decodeSingularBytesField(value: &self._groupPublicKey) + case 3: try decoder.decodeSingularBytesField(value: &self._groupPrivateKey) + case 4: try decoder.decodeRepeatedMessageField(value: &self.senderKeys) + case 5: try decoder.decodeRepeatedBytesField(value: &self.members) + case 6: try decoder.decodeRepeatedBytesField(value: &self.admins) + case 7: try decoder.decodeSingularEnumField(value: &self._type) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._groupPublicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } + if let v = self._groupPrivateKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } + if !self.senderKeys.isEmpty { + try visitor.visitRepeatedMessageField(value: self.senderKeys, fieldNumber: 4) + } + if !self.members.isEmpty { + try visitor.visitRepeatedBytesField(value: self.members, fieldNumber: 5) + } + if !self.admins.isEmpty { + try visitor.visitRepeatedBytesField(value: self.admins, fieldNumber: 6) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.ClosedGroupUpdate, rhs: SessionProtos_DataMessage.ClosedGroupUpdate) -> Bool { + if lhs._name != rhs._name {return false} + if lhs._groupPublicKey != rhs._groupPublicKey {return false} + if lhs._groupPrivateKey != rhs._groupPrivateKey {return false} + if lhs.senderKeys != rhs.senderKeys {return false} + if lhs.members != rhs.members {return false} + if lhs.admins != rhs.admins {return false} + if lhs._type != rhs._type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_DataMessage.ClosedGroupUpdate.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "NEW"), + 1: .same(proto: "INFO"), + 2: .same(proto: "SENDER_KEY_REQUEST"), + 3: .same(proto: "SENDER_KEY"), + ] +} + +extension SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.ClosedGroupUpdate.protoMessageName + ".SenderKey" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "chainKey"), + 2: .same(proto: "keyIndex"), + 3: .same(proto: "publicKey"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._chainKey) + case 2: try decoder.decodeSingularUInt32Field(value: &self._keyIndex) + case 3: try decoder.decodeSingularBytesField(value: &self._publicKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._chainKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = self._keyIndex { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } + if let v = self._publicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey, rhs: SessionProtos_DataMessage.ClosedGroupUpdate.SenderKey) -> Bool { + if lhs._chainKey != rhs._chainKey {return false} + if lhs._keyIndex != rhs._keyIndex {return false} + if lhs._publicKey != rhs._publicKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_NullMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NullMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "padding"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._padding) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._padding { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_NullMessage, rhs: SessionProtos_NullMessage) -> Bool { + if lhs._padding != rhs._padding {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_ReceiptMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ReceiptMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "timestamp"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + case 2: try decoder.decodeRepeatedUInt64Field(value: &self.timestamp) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if !self.timestamp.isEmpty { + try visitor.visitRepeatedUInt64Field(value: self.timestamp, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_ReceiptMessage, rhs: SessionProtos_ReceiptMessage) -> Bool { + if lhs._type != rhs._type {return false} + if lhs.timestamp != rhs.timestamp {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_ReceiptMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DELIVERY"), + 1: .same(proto: "READ"), + ] +} + +extension SessionProtos_Verified: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Verified" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .same(proto: "identityKey"), + 3: .same(proto: "state"), + 4: .same(proto: "nullMessage"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._destination) + case 2: try decoder.decodeSingularBytesField(value: &self._identityKey) + case 3: try decoder.decodeSingularEnumField(value: &self._state) + case 4: try decoder.decodeSingularBytesField(value: &self._nullMessage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._destination { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._identityKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } + if let v = self._state { + try visitor.visitSingularEnumField(value: v, fieldNumber: 3) + } + if let v = self._nullMessage { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_Verified, rhs: SessionProtos_Verified) -> Bool { + if lhs._destination != rhs._destination {return false} + if lhs._identityKey != rhs._identityKey {return false} + if lhs._state != rhs._state {return false} + if lhs._nullMessage != rhs._nullMessage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_Verified.State: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DEFAULT"), + 1: .same(proto: "VERIFIED"), + 2: .same(proto: "UNVERIFIED"), + ] +} + +extension SessionProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SyncMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "sent"), + 2: .same(proto: "contacts"), + 3: .same(proto: "groups"), + 4: .same(proto: "request"), + 5: .same(proto: "read"), + 6: .same(proto: "blocked"), + 7: .same(proto: "verified"), + 9: .same(proto: "configuration"), + 8: .same(proto: "padding"), + 100: .same(proto: "openGroups"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._sent) + case 2: try decoder.decodeSingularMessageField(value: &self._contacts) + case 3: try decoder.decodeSingularMessageField(value: &self._groups) + case 4: try decoder.decodeSingularMessageField(value: &self._request) + case 5: try decoder.decodeRepeatedMessageField(value: &self.read) + case 6: try decoder.decodeSingularMessageField(value: &self._blocked) + case 7: try decoder.decodeSingularMessageField(value: &self._verified) + case 8: try decoder.decodeSingularBytesField(value: &self._padding) + case 9: try decoder.decodeSingularMessageField(value: &self._configuration) + case 100: try decoder.decodeRepeatedMessageField(value: &self.openGroups) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._sent { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._contacts { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = self._groups { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = self._request { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if !self.read.isEmpty { + try visitor.visitRepeatedMessageField(value: self.read, fieldNumber: 5) + } + if let v = self._blocked { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } + if let v = self._verified { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } + if let v = self._padding { + try visitor.visitSingularBytesField(value: v, fieldNumber: 8) + } + if let v = self._configuration { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } + if !self.openGroups.isEmpty { + try visitor.visitRepeatedMessageField(value: self.openGroups, fieldNumber: 100) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage, rhs: SessionProtos_SyncMessage) -> Bool { + if lhs._sent != rhs._sent {return false} + if lhs._contacts != rhs._contacts {return false} + if lhs._groups != rhs._groups {return false} + if lhs._request != rhs._request {return false} + if lhs.read != rhs.read {return false} + if lhs._blocked != rhs._blocked {return false} + if lhs._verified != rhs._verified {return false} + if lhs._configuration != rhs._configuration {return false} + if lhs._padding != rhs._padding {return false} + if lhs.openGroups != rhs.openGroups {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Sent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .same(proto: "timestamp"), + 3: .same(proto: "message"), + 4: .same(proto: "expirationStartTimestamp"), + 5: .same(proto: "unidentifiedStatus"), + 6: .same(proto: "isRecipientUpdate"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._destination) + case 2: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + case 3: try decoder.decodeSingularMessageField(value: &self._message) + case 4: try decoder.decodeSingularUInt64Field(value: &self._expirationStartTimestamp) + case 5: try decoder.decodeRepeatedMessageField(value: &self.unidentifiedStatus) + case 6: try decoder.decodeSingularBoolField(value: &self._isRecipientUpdate) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._destination { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 2) + } + if let v = self._message { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = self._expirationStartTimestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 4) + } + if !self.unidentifiedStatus.isEmpty { + try visitor.visitRepeatedMessageField(value: self.unidentifiedStatus, fieldNumber: 5) + } + if let v = self._isRecipientUpdate { + try visitor.visitSingularBoolField(value: v, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Sent, rhs: SessionProtos_SyncMessage.Sent) -> Bool { + if lhs._destination != rhs._destination {return false} + if lhs._timestamp != rhs._timestamp {return false} + if lhs._message != rhs._message {return false} + if lhs._expirationStartTimestamp != rhs._expirationStartTimestamp {return false} + if lhs.unidentifiedStatus != rhs.unidentifiedStatus {return false} + if lhs._isRecipientUpdate != rhs._isRecipientUpdate {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.Sent.protoMessageName + ".UnidentifiedDeliveryStatus" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .same(proto: "unidentified"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._destination) + case 2: try decoder.decodeSingularBoolField(value: &self._unidentified) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._destination { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._unidentified { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus, rhs: SessionProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus) -> Bool { + if lhs._destination != rhs._destination {return false} + if lhs._unidentified != rhs._unidentified {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Contacts: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Contacts" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "blob"), + 2: .same(proto: "isComplete"), + 101: .same(proto: "data"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._blob) + case 2: try decoder.decodeSingularBoolField(value: &self._isComplete) + case 101: try decoder.decodeSingularBytesField(value: &self._data) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._blob { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._isComplete { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + if let v = self._data { + try visitor.visitSingularBytesField(value: v, fieldNumber: 101) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Contacts, rhs: SessionProtos_SyncMessage.Contacts) -> Bool { + if lhs._blob != rhs._blob {return false} + if lhs._isComplete != rhs._isComplete {return false} + if lhs._data != rhs._data {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Groups: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Groups" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "blob"), + 101: .same(proto: "data"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._blob) + case 101: try decoder.decodeSingularBytesField(value: &self._data) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._blob { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._data { + try visitor.visitSingularBytesField(value: v, fieldNumber: 101) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Groups, rhs: SessionProtos_SyncMessage.Groups) -> Bool { + if lhs._blob != rhs._blob {return false} + if lhs._data != rhs._data {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.OpenGroupDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".OpenGroupDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "url"), + 2: .same(proto: "channelID"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._url) + case 2: try decoder.decodeSingularUInt64Field(value: &self._channelID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._url { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._channelID { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.OpenGroupDetails, rhs: SessionProtos_SyncMessage.OpenGroupDetails) -> Bool { + if lhs._url != rhs._url {return false} + if lhs._channelID != rhs._channelID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Blocked: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Blocked" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "numbers"), + 2: .same(proto: "groupIds"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.numbers) + case 2: try decoder.decodeRepeatedBytesField(value: &self.groupIds) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.numbers.isEmpty { + try visitor.visitRepeatedStringField(value: self.numbers, fieldNumber: 1) + } + if !self.groupIds.isEmpty { + try visitor.visitRepeatedBytesField(value: self.groupIds, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Blocked, rhs: SessionProtos_SyncMessage.Blocked) -> Bool { + if lhs.numbers != rhs.numbers {return false} + if lhs.groupIds != rhs.groupIds {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Request" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Request, rhs: SessionProtos_SyncMessage.Request) -> Bool { + if lhs._type != rhs._type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Request.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "CONTACTS"), + 2: .same(proto: "GROUPS"), + 3: .same(proto: "BLOCKED"), + 4: .same(proto: "CONFIGURATION"), + ] +} + +extension SessionProtos_SyncMessage.Read: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Read" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "sender"), + 2: .same(proto: "timestamp"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._sender) + case 2: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._sender { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Read, rhs: SessionProtos_SyncMessage.Read) -> Bool { + if lhs._sender != rhs._sender {return false} + if lhs._timestamp != rhs._timestamp {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_SyncMessage.Configuration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Configuration" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "readReceipts"), + 2: .same(proto: "unidentifiedDeliveryIndicators"), + 3: .same(proto: "typingIndicators"), + 4: .same(proto: "linkPreviews"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self._readReceipts) + case 2: try decoder.decodeSingularBoolField(value: &self._unidentifiedDeliveryIndicators) + case 3: try decoder.decodeSingularBoolField(value: &self._typingIndicators) + case 4: try decoder.decodeSingularBoolField(value: &self._linkPreviews) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._readReceipts { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } + if let v = self._unidentifiedDeliveryIndicators { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + if let v = self._typingIndicators { + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + } + if let v = self._linkPreviews { + try visitor.visitSingularBoolField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_SyncMessage.Configuration, rhs: SessionProtos_SyncMessage.Configuration) -> Bool { + if lhs._readReceipts != rhs._readReceipts {return false} + if lhs._unidentifiedDeliveryIndicators != rhs._unidentifiedDeliveryIndicators {return false} + if lhs._typingIndicators != rhs._typingIndicators {return false} + if lhs._linkPreviews != rhs._linkPreviews {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_AttachmentPointer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AttachmentPointer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "contentType"), + 3: .same(proto: "key"), + 4: .same(proto: "size"), + 5: .same(proto: "thumbnail"), + 6: .same(proto: "digest"), + 7: .same(proto: "fileName"), + 8: .same(proto: "flags"), + 9: .same(proto: "width"), + 10: .same(proto: "height"), + 11: .same(proto: "caption"), + 101: .same(proto: "url"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularFixed64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._contentType) + case 3: try decoder.decodeSingularBytesField(value: &self._key) + case 4: try decoder.decodeSingularUInt32Field(value: &self._size) + case 5: try decoder.decodeSingularBytesField(value: &self._thumbnail) + case 6: try decoder.decodeSingularBytesField(value: &self._digest) + case 7: try decoder.decodeSingularStringField(value: &self._fileName) + case 8: try decoder.decodeSingularUInt32Field(value: &self._flags) + case 9: try decoder.decodeSingularUInt32Field(value: &self._width) + case 10: try decoder.decodeSingularUInt32Field(value: &self._height) + case 11: try decoder.decodeSingularStringField(value: &self._caption) + case 101: try decoder.decodeSingularStringField(value: &self._url) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularFixed64Field(value: v, fieldNumber: 1) + } + if let v = self._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._key { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } + if let v = self._size { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 4) + } + if let v = self._thumbnail { + try visitor.visitSingularBytesField(value: v, fieldNumber: 5) + } + if let v = self._digest { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._fileName { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + if let v = self._flags { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 8) + } + if let v = self._width { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 9) + } + if let v = self._height { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 10) + } + if let v = self._caption { + try visitor.visitSingularStringField(value: v, fieldNumber: 11) + } + if let v = self._url { + try visitor.visitSingularStringField(value: v, fieldNumber: 101) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_AttachmentPointer, rhs: SessionProtos_AttachmentPointer) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._contentType != rhs._contentType {return false} + if lhs._key != rhs._key {return false} + if lhs._size != rhs._size {return false} + if lhs._thumbnail != rhs._thumbnail {return false} + if lhs._digest != rhs._digest {return false} + if lhs._fileName != rhs._fileName {return false} + if lhs._flags != rhs._flags {return false} + if lhs._width != rhs._width {return false} + if lhs._height != rhs._height {return false} + if lhs._caption != rhs._caption {return false} + if lhs._url != rhs._url {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_AttachmentPointer.Flags: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "VOICE_MESSAGE"), + ] +} + +extension SessionProtos_GroupContext: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GroupContext" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "type"), + 3: .same(proto: "name"), + 4: .same(proto: "members"), + 5: .same(proto: "avatar"), + 6: .same(proto: "admins"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._id) + case 2: try decoder.decodeSingularEnumField(value: &self._type) + case 3: try decoder.decodeSingularStringField(value: &self._name) + case 4: try decoder.decodeRepeatedStringField(value: &self.members) + case 5: try decoder.decodeSingularMessageField(value: &self._avatar) + case 6: try decoder.decodeRepeatedStringField(value: &self.admins) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if !self.members.isEmpty { + try visitor.visitRepeatedStringField(value: self.members, fieldNumber: 4) + } + if let v = self._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if !self.admins.isEmpty { + try visitor.visitRepeatedStringField(value: self.admins, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_GroupContext, rhs: SessionProtos_GroupContext) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._type != rhs._type {return false} + if lhs._name != rhs._name {return false} + if lhs.members != rhs.members {return false} + if lhs._avatar != rhs._avatar {return false} + if lhs.admins != rhs.admins {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_GroupContext.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "UPDATE"), + 2: .same(proto: "DELIVER"), + 3: .same(proto: "QUIT"), + 4: .same(proto: "REQUEST_INFO"), + ] +} + +extension SessionProtos_ContactDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ContactDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "number"), + 2: .same(proto: "name"), + 3: .same(proto: "avatar"), + 4: .same(proto: "color"), + 5: .same(proto: "verified"), + 6: .same(proto: "profileKey"), + 7: .same(proto: "blocked"), + 8: .same(proto: "expireTimer"), + 101: .same(proto: "nickname"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._number) + case 2: try decoder.decodeSingularStringField(value: &self._name) + case 3: try decoder.decodeSingularMessageField(value: &self._avatar) + case 4: try decoder.decodeSingularStringField(value: &self._color) + case 5: try decoder.decodeSingularMessageField(value: &self._verified) + case 6: try decoder.decodeSingularBytesField(value: &self._profileKey) + case 7: try decoder.decodeSingularBoolField(value: &self._blocked) + case 8: try decoder.decodeSingularUInt32Field(value: &self._expireTimer) + case 101: try decoder.decodeSingularStringField(value: &self._nickname) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._number { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = self._color { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if let v = self._verified { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if let v = self._profileKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._blocked { + try visitor.visitSingularBoolField(value: v, fieldNumber: 7) + } + if let v = self._expireTimer { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 8) + } + if let v = self._nickname { + try visitor.visitSingularStringField(value: v, fieldNumber: 101) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_ContactDetails, rhs: SessionProtos_ContactDetails) -> Bool { + if lhs._number != rhs._number {return false} + if lhs._name != rhs._name {return false} + if lhs._avatar != rhs._avatar {return false} + if lhs._color != rhs._color {return false} + if lhs._verified != rhs._verified {return false} + if lhs._profileKey != rhs._profileKey {return false} + if lhs._blocked != rhs._blocked {return false} + if lhs._expireTimer != rhs._expireTimer {return false} + if lhs._nickname != rhs._nickname {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_ContactDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_ContactDetails.protoMessageName + ".Avatar" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "contentType"), + 2: .same(proto: "length"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._contentType) + case 2: try decoder.decodeSingularUInt32Field(value: &self._length) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._length { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_ContactDetails.Avatar, rhs: SessionProtos_ContactDetails.Avatar) -> Bool { + if lhs._contentType != rhs._contentType {return false} + if lhs._length != rhs._length {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GroupDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "name"), + 3: .same(proto: "members"), + 4: .same(proto: "avatar"), + 5: .same(proto: "active"), + 6: .same(proto: "expireTimer"), + 7: .same(proto: "color"), + 8: .same(proto: "blocked"), + 9: .same(proto: "admins"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._name) + case 3: try decoder.decodeRepeatedStringField(value: &self.members) + case 4: try decoder.decodeSingularMessageField(value: &self._avatar) + case 5: try decoder.decodeSingularBoolField(value: &self._active) + case 6: try decoder.decodeSingularUInt32Field(value: &self._expireTimer) + case 7: try decoder.decodeSingularStringField(value: &self._color) + case 8: try decoder.decodeSingularBoolField(value: &self._blocked) + case 9: try decoder.decodeRepeatedStringField(value: &self.admins) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if !self.members.isEmpty { + try visitor.visitRepeatedStringField(value: self.members, fieldNumber: 3) + } + if let v = self._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = self._active { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } + if let v = self._expireTimer { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 6) + } + if let v = self._color { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + if let v = self._blocked { + try visitor.visitSingularBoolField(value: v, fieldNumber: 8) + } + if !self.admins.isEmpty { + try visitor.visitRepeatedStringField(value: self.admins, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_GroupDetails, rhs: SessionProtos_GroupDetails) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._name != rhs._name {return false} + if lhs.members != rhs.members {return false} + if lhs._avatar != rhs._avatar {return false} + if lhs._active != rhs._active {return false} + if lhs._expireTimer != rhs._expireTimer {return false} + if lhs._color != rhs._color {return false} + if lhs._blocked != rhs._blocked {return false} + if lhs.admins != rhs.admins {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_GroupDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_GroupDetails.protoMessageName + ".Avatar" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "contentType"), + 2: .same(proto: "length"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._contentType) + case 2: try decoder.decodeSingularUInt32Field(value: &self._length) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._length { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_GroupDetails.Avatar, rhs: SessionProtos_GroupDetails.Avatar) -> Bool { + if lhs._contentType != rhs._contentType {return false} + if lhs._length != rhs._length {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SessionProtos_PublicChatInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PublicChatInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "serverID"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._serverID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._serverID { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_PublicChatInfo, rhs: SessionProtos_PublicChatInfo) -> Bool { + if lhs._serverID != rhs._serverID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/SessionMessagingKit/Protos/Makefile b/SessionMessagingKit/Protos/Makefile new file mode 100644 index 000000000..7f89be1f1 --- /dev/null +++ b/SessionMessagingKit/Protos/Makefile @@ -0,0 +1,12 @@ + +PROTOC=protoc \ + --proto_path='./' +WRAPPER_SCRIPT=../../Scripts/ProtoWrappers.py \ + --proto-dir='./' --verbose + +all: session_protos + +session_protos: SessionProtos.proto + $(PROTOC) --swift_out=./Generated \SessionProtos.proto + $(WRAPPER_SCRIPT) --dst-dir=./Generated \ + --wrapper-prefix=SNProto --proto-prefix=SessionProtos --proto-file=SessionProtos.proto diff --git a/SessionMessagingKit/Protos/SessionProtos.proto b/SessionMessagingKit/Protos/SessionProtos.proto new file mode 100644 index 000000000..f16efa267 --- /dev/null +++ b/SessionMessagingKit/Protos/SessionProtos.proto @@ -0,0 +1,475 @@ +/** + * Copyright (C) 2014-2016 Open Whisper Systems + * + * Licensed according to the LICENSE file in this repository. + */ + +// iOS - since we use a modern proto-compiler, we must specify +// the legacy proto format. +syntax = "proto2"; + +// iOS - package name determines class prefix +package SessionProtos; + +option java_package = "org.whispersystems.signalservice.internal.push"; +option java_outer_classname = "SignalServiceProtos"; + +message Envelope { + enum Type { + UNKNOWN = 0; + CIPHERTEXT = 1; + KEY_EXCHANGE = 2; + PREKEY_BUNDLE = 3; + RECEIPT = 5; + UNIDENTIFIED_SENDER = 6; + CLOSED_GROUP_CIPHERTEXT = 7; // Loki + FALLBACK_MESSAGE = 101; // Loki: Encrypted using the fallback session cipher. Contains a pre key bundle if it's a session request. + } + + // @required + optional Type type = 1; + optional string source = 2; + optional uint32 sourceDevice = 7; + optional string relay = 3; + // @required + optional uint64 timestamp = 5; + optional bytes legacyMessage = 6; // Contains an encrypted DataMessage + optional bytes content = 8; // Contains an encrypted Content + // We may eventually want to make this required. + optional string serverGuid = 9; + // We may eventually want to make this required. + optional uint64 serverTimestamp = 10; +} + +message TypingMessage { + enum Action { + STARTED = 0; + STOPPED = 1; + } + + // @required + optional uint64 timestamp = 1; + // @required + optional Action action = 2; + optional bytes groupId = 3; +} + +message Content { + optional DataMessage dataMessage = 1; + optional SyncMessage syncMessage = 2; + optional CallMessage callMessage = 3; + optional NullMessage nullMessage = 4; + optional ReceiptMessage receiptMessage = 5; + optional TypingMessage typingMessage = 6; + optional PrekeyBundleMessage prekeyBundleMessage = 101; // Loki + optional LokiDeviceLinkMessage lokiDeviceLinkMessage = 103; // Loki +} + +message PrekeyBundleMessage { // Loki + optional bytes identityKey = 1; + optional uint32 deviceID = 2; + optional uint32 prekeyID = 3; + optional uint32 signedKeyID = 4; + optional bytes prekey = 5; + optional bytes signedKey = 6; + optional bytes signature = 7; +} + +message LokiDeviceLinkMessage { // Loki + optional string masterPublicKey = 1; + optional string slavePublicKey = 2; + optional bytes slaveSignature = 3; + optional bytes masterSignature = 4; +} + +message CallMessage { + message Offer { + // @required + optional uint64 id = 1; + // Signal-iOS renamed the description field to avoid + // conflicts with [NSObject description]. + // @required + optional string sessionDescription = 2; + } + + message Answer { + // @required + optional uint64 id = 1; + // Signal-iOS renamed the description field to avoid + // conflicts with [NSObject description]. + // @required + optional string sessionDescription = 2; + } + + message IceUpdate { + // @required + optional uint64 id = 1; + // @required + optional string sdpMid = 2; + // @required + optional uint32 sdpMLineIndex = 3; + // @required + optional string sdp = 4; + } + + message Busy { + // @required + optional uint64 id = 1; + } + + message Hangup { + // @required + optional uint64 id = 1; + } + + optional Offer offer = 1; + optional Answer answer = 2; + repeated IceUpdate iceUpdate = 3; + optional Hangup hangup = 4; + optional Busy busy = 5; + // Signal-iOS sends profile key with call messages + // for earlier discovery + optional bytes profileKey = 6; +} + +message ClosedGroupCiphertextMessageWrapper { + // @required + optional bytes ciphertext = 1; + // @required + optional bytes ephemeralPublicKey = 2; +} + +message DataMessage { + enum Flags { + END_SESSION = 1; + EXPIRATION_TIMER_UPDATE = 2; + PROFILE_KEY_UPDATE = 4; + UNLINK_DEVICE = 128; + } + + message Quote { + message QuotedAttachment { + enum Flags { + VOICE_MESSAGE = 1; + } + + optional string contentType = 1; + optional string fileName = 2; + optional AttachmentPointer thumbnail = 3; + optional uint32 flags = 4; + } + + // @required + optional uint64 id = 1; + // @required + optional string author = 2; + optional string text = 3; + repeated QuotedAttachment attachments = 4; + } + + message Contact { + message Name { + optional string givenName = 1; + optional string familyName = 2; + optional string prefix = 3; + optional string suffix = 4; + optional string middleName = 5; + optional string displayName = 6; + } + + message Phone { + enum Type { + HOME = 1; + MOBILE = 2; + WORK = 3; + CUSTOM = 4; + } + + optional string value = 1; + optional Type type = 2; + optional string label = 3; + } + + message Email { + enum Type { + HOME = 1; + MOBILE = 2; + WORK = 3; + CUSTOM = 4; + } + + optional string value = 1; + optional Type type = 2; + optional string label = 3; + } + + message PostalAddress { + enum Type { + HOME = 1; + WORK = 2; + CUSTOM = 3; + } + + optional Type type = 1; + optional string label = 2; + optional string street = 3; + optional string pobox = 4; + optional string neighborhood = 5; + optional string city = 6; + optional string region = 7; + optional string postcode = 8; + optional string country = 9; + } + + message Avatar { + optional AttachmentPointer avatar = 1; + optional bool isProfile = 2; + } + + optional Name name = 1; + repeated Phone number = 3; + repeated Email email = 4; + repeated PostalAddress address = 5; + optional Avatar avatar = 6; + optional string organization = 7; + } + + message Preview { + // @required + optional string url = 1; + optional string title = 2; + optional AttachmentPointer image = 3; + } + + message LokiProfile { // Loki + optional string displayName = 1; + optional string profilePicture = 2; + } + + message ClosedGroupUpdate { // Loki + enum Type { + NEW = 0; // groupPublicKey, name, groupPrivateKey, senderKeys, members, admins + INFO = 1; // groupPublicKey, name, senderKeys, members, admins + SENDER_KEY_REQUEST = 2; // groupPublicKey + SENDER_KEY = 3; // groupPublicKey, senderKeys + } + + message SenderKey { + // @required + optional bytes chainKey = 1; + // @required + optional uint32 keyIndex = 2; + // @required + optional bytes publicKey = 3; + } + + optional string name = 1; + // @required + optional bytes groupPublicKey = 2; + optional bytes groupPrivateKey = 3; + repeated SenderKey senderKeys = 4; + repeated bytes members = 5; + repeated bytes admins = 6; + // @required + optional Type type = 7; + } + + optional string body = 1; + repeated AttachmentPointer attachments = 2; + optional GroupContext group = 3; + optional uint32 flags = 4; + optional uint32 expireTimer = 5; + optional bytes profileKey = 6; + optional uint64 timestamp = 7; + optional Quote quote = 8; + repeated Contact contact = 9; + repeated Preview preview = 10; + optional LokiProfile profile = 101; // Loki: The current user's profile + optional ClosedGroupUpdate closedGroupUpdate = 103; // Loki + optional PublicChatInfo publicChatInfo = 999; // Loki: Internal public chat info +} + +message NullMessage { + optional bytes padding = 1; +} + +message ReceiptMessage { + enum Type { + DELIVERY = 0; + READ = 1; + } + + // @required + optional Type type = 1; + repeated uint64 timestamp = 2; +} + +message Verified { + enum State { + DEFAULT = 0; + VERIFIED = 1; + UNVERIFIED = 2; + } + + // @required + optional string destination = 1; + optional bytes identityKey = 2; + optional State state = 3; + optional bytes nullMessage = 4; +} + +message SyncMessage { + message Sent { + message UnidentifiedDeliveryStatus { + optional string destination = 1; + optional bool unidentified = 2; + } + optional string destination = 1; + optional uint64 timestamp = 2; + optional DataMessage message = 3; + optional uint64 expirationStartTimestamp = 4; + repeated UnidentifiedDeliveryStatus unidentifiedStatus = 5; + optional bool isRecipientUpdate = 6 [default = false]; + } + + message Contacts { + optional AttachmentPointer blob = 1; + // Signal-iOS renamed this property. + optional bool isComplete = 2 [default = false]; + optional bytes data = 101; // Loki + } + + message Groups { + optional AttachmentPointer blob = 1; + optional bytes data = 101; // Loki + } + + message OpenGroupDetails { // Loki + // @required + optional string url = 1; + // @required + optional uint64 channelID = 2; + } + + message Blocked { + repeated string numbers = 1; + repeated bytes groupIds = 2; + } + + message Request { + enum Type { + UNKNOWN = 0; + CONTACTS = 1; + GROUPS = 2; + BLOCKED = 3; + CONFIGURATION = 4; + } + + // @required + optional Type type = 1; + } + + message Read { + // @required + optional string sender = 1; + // @required + optional uint64 timestamp = 2; + } + + message Configuration { + optional bool readReceipts = 1; + optional bool unidentifiedDeliveryIndicators = 2; + optional bool typingIndicators = 3; + optional bool linkPreviews = 4; + } + + optional Sent sent = 1; + optional Contacts contacts = 2; + optional Groups groups = 3; + optional Request request = 4; + repeated Read read = 5; + optional Blocked blocked = 6; + optional Verified verified = 7; + optional Configuration configuration = 9; + optional bytes padding = 8; + repeated OpenGroupDetails openGroups = 100; +} + +message AttachmentPointer { + enum Flags { + VOICE_MESSAGE = 1; + } + + // @required + optional fixed64 id = 1; + optional string contentType = 2; + optional bytes key = 3; + optional uint32 size = 4; + optional bytes thumbnail = 5; + optional bytes digest = 6; + optional string fileName = 7; + optional uint32 flags = 8; + optional uint32 width = 9; + optional uint32 height = 10; + optional string caption = 11; + optional string url = 101; // Loki +} + +message GroupContext { + enum Type { + UNKNOWN = 0; + UPDATE = 1; + DELIVER = 2; + QUIT = 3; + REQUEST_INFO = 4; + } + // @required + optional bytes id = 1; + // @required + optional Type type = 2; + optional string name = 3; + repeated string members = 4; + optional AttachmentPointer avatar = 5; + repeated string admins = 6; // Loki +} + +message ContactDetails { + message Avatar { + optional string contentType = 1; + optional uint32 length = 2; + } + + // @required + optional string number = 1; + optional string name = 2; + optional Avatar avatar = 3; + optional string color = 4; + optional Verified verified = 5; + optional bytes profileKey = 6; + optional bool blocked = 7; + optional uint32 expireTimer = 8; + optional string nickname = 101; // Loki +} + +message GroupDetails { + message Avatar { + optional string contentType = 1; + optional uint32 length = 2; + } + + // @required + optional bytes id = 1; + optional string name = 2; + repeated string members = 3; + optional Avatar avatar = 4; + optional bool active = 5 [default = true]; + optional uint32 expireTimer = 6; + optional string color = 7; + optional bool blocked = 8; + repeated string admins = 9; // Loki +} + +// Internal - DO NOT SEND +message PublicChatInfo { + optional uint64 serverID = 1; +} diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index e2980dc0e..c3faa1e76 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -637,6 +637,8 @@ C3C2A75F2553A3C500C340D1 /* VisibleMessage+LinkPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A75E2553A3C500C340D1 /* VisibleMessage+LinkPreview.swift */; }; C3C2A7682553A3D900C340D1 /* VisibleMessage+Contact.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A7672553A3D900C340D1 /* VisibleMessage+Contact.swift */; }; C3C2A7712553A41E00C340D1 /* ControlMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A7702553A41E00C340D1 /* ControlMessage.swift */; }; + C3C2A7842553AAF300C340D1 /* SNProto.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A7822553AAF200C340D1 /* SNProto.swift */; }; + C3C2A7852553AAF300C340D1 /* SessionProtos.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A7832553AAF300C340D1 /* SessionProtos.pb.swift */; }; C3C3CF8924D8EED300E1CCE7 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C3CF8824D8EED300E1CCE7 /* TextView.swift */; }; C3D0972B2510499C00F6E3E4 /* BackgroundPoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D0972A2510499C00F6E3E4 /* BackgroundPoller.swift */; }; C3DAB3242480CB2B00725F25 /* SRCopyableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DAB3232480CB2A00725F25 /* SRCopyableLabel.swift */; }; @@ -1507,6 +1509,8 @@ C3C2A75E2553A3C500C340D1 /* VisibleMessage+LinkPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VisibleMessage+LinkPreview.swift"; sourceTree = ""; }; C3C2A7672553A3D900C340D1 /* VisibleMessage+Contact.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VisibleMessage+Contact.swift"; sourceTree = ""; }; C3C2A7702553A41E00C340D1 /* ControlMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ControlMessage.swift; sourceTree = ""; }; + C3C2A7822553AAF200C340D1 /* SNProto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SNProto.swift; sourceTree = ""; }; + C3C2A7832553AAF300C340D1 /* SessionProtos.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SessionProtos.pb.swift; sourceTree = ""; }; C3C3CF8824D8EED300E1CCE7 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = ""; }; C3D0972A2510499C00F6E3E4 /* BackgroundPoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundPoller.swift; sourceTree = ""; }; C3DAB3232480CB2A00725F25 /* SRCopyableLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SRCopyableLabel.swift; sourceTree = ""; }; @@ -3014,6 +3018,7 @@ C3C2A6F125539DE700C340D1 /* SessionMessagingKit */ = { isa = PBXGroup; children = ( + C3C2A7802553AA6300C340D1 /* Protos */, C3C2A70A25539DF900C340D1 /* Meta */, C3C2A74325539EB700C340D1 /* Message.swift */, C3C2A74C2553A39700C340D1 /* VisibleMessage.swift */, @@ -3034,6 +3039,23 @@ path = Meta; sourceTree = ""; }; + C3C2A7802553AA6300C340D1 /* Protos */ = { + isa = PBXGroup; + children = ( + C3C2A7812553AA9000C340D1 /* Generated */, + ); + path = Protos; + sourceTree = ""; + }; + C3C2A7812553AA9000C340D1 /* Generated */ = { + isa = PBXGroup; + children = ( + C3C2A7832553AAF300C340D1 /* SessionProtos.pb.swift */, + C3C2A7822553AAF200C340D1 /* SNProto.swift */, + ); + path = Generated; + sourceTree = ""; + }; D221A07E169C9E5E00537ABF = { isa = PBXGroup; children = ( @@ -4250,7 +4272,9 @@ files = ( C3C2A74D2553A39700C340D1 /* VisibleMessage.swift in Sources */, C3C2A7562553A3AB00C340D1 /* VisibleMessage+Quote.swift in Sources */, + C3C2A7842553AAF300C340D1 /* SNProto.swift in Sources */, C3C2A7682553A3D900C340D1 /* VisibleMessage+Contact.swift in Sources */, + C3C2A7852553AAF300C340D1 /* SessionProtos.pb.swift in Sources */, C3C2A7712553A41E00C340D1 /* ControlMessage.swift in Sources */, C3C2A75F2553A3C500C340D1 /* VisibleMessage+LinkPreview.swift in Sources */, C3C2A74425539EB700C340D1 /* Message.swift in Sources */,