From 0153e1cefd7bc1b8280d7b4e25d7b081bbd66b27 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 7 May 2021 14:46:53 +1000 Subject: [PATCH] Update protos --- .../Protos/Generated/SNProto.swift | 112 ++++++++++++++++++ .../Protos/Generated/SessionProtos.pb.swift | 74 ++++++++++++ .../Protos/SessionProtos.proto | 7 ++ 3 files changed, 193 insertions(+) diff --git a/SessionMessagingKit/Protos/Generated/SNProto.swift b/SessionMessagingKit/Protos/Generated/SNProto.swift index d5ea4e38e..da1d9dc85 100644 --- a/SessionMessagingKit/Protos/Generated/SNProto.swift +++ b/SessionMessagingKit/Protos/Generated/SNProto.swift @@ -1294,6 +1294,118 @@ extension SNProtoDataMessageLokiProfile.SNProtoDataMessageLokiProfileBuilder { #endif +// MARK: - SNProtoDataMessageOpenGroupInvitation + +@objc public class SNProtoDataMessageOpenGroupInvitation: NSObject { + + // MARK: - SNProtoDataMessageOpenGroupInvitationBuilder + + @objc public class func builder(url: String, name: String) -> SNProtoDataMessageOpenGroupInvitationBuilder { + return SNProtoDataMessageOpenGroupInvitationBuilder(url: url, name: name) + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SNProtoDataMessageOpenGroupInvitationBuilder { + let builder = SNProtoDataMessageOpenGroupInvitationBuilder(url: url, name: name) + return builder + } + + @objc public class SNProtoDataMessageOpenGroupInvitationBuilder: NSObject { + + private var proto = SessionProtos_DataMessage.OpenGroupInvitation() + + @objc fileprivate override init() {} + + @objc fileprivate init(url: String, name: String) { + super.init() + + setUrl(url) + setName(name) + } + + @objc public func setUrl(_ valueParam: String) { + proto.url = valueParam + } + + @objc public func setName(_ valueParam: String) { + proto.name = valueParam + } + + @objc public func build() throws -> SNProtoDataMessageOpenGroupInvitation { + return try SNProtoDataMessageOpenGroupInvitation.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SNProtoDataMessageOpenGroupInvitation.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SessionProtos_DataMessage.OpenGroupInvitation + + @objc public let url: String + + @objc public let name: String + + private init(proto: SessionProtos_DataMessage.OpenGroupInvitation, + url: String, + name: String) { + self.proto = proto + self.url = url + self.name = name + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageOpenGroupInvitation { + let proto = try SessionProtos_DataMessage.OpenGroupInvitation(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.OpenGroupInvitation) throws -> SNProtoDataMessageOpenGroupInvitation { + guard proto.hasURL else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: url") + } + let url = proto.url + + guard proto.hasName else { + throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: name") + } + let name = proto.name + + // MARK: - Begin Validation Logic for SNProtoDataMessageOpenGroupInvitation - + + // MARK: - End Validation Logic for SNProtoDataMessageOpenGroupInvitation - + + let result = SNProtoDataMessageOpenGroupInvitation(proto: proto, + url: url, + name: name) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SNProtoDataMessageOpenGroupInvitation { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SNProtoDataMessageOpenGroupInvitation.SNProtoDataMessageOpenGroupInvitationBuilder { + @objc public func buildIgnoringErrors() -> SNProtoDataMessageOpenGroupInvitation? { + return try! self.build() + } +} + +#endif + // MARK: - SNProtoDataMessageClosedGroupControlMessageKeyPairWrapper @objc public class SNProtoDataMessageClosedGroupControlMessageKeyPairWrapper: NSObject { diff --git a/SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift b/SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift index 46674b662..4f5b5cfe0 100644 --- a/SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift +++ b/SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift @@ -670,6 +670,39 @@ struct SessionProtos_DataMessage { fileprivate var _profilePicture: String? = nil } + struct OpenGroupInvitation { + // 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 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 unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _url: String? = nil + fileprivate var _name: String? = nil + } + struct ClosedGroupControlMessage { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -2058,6 +2091,47 @@ extension SessionProtos_DataMessage.LokiProfile: SwiftProtobuf.Message, SwiftPro } } +extension SessionProtos_DataMessage.OpenGroupInvitation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".OpenGroupInvitation" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "url"), + 3: .same(proto: "name"), + ] + + public var isInitialized: Bool { + if self._url == nil {return false} + if self._name == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._url) + case 3: try decoder.decodeSingularStringField(value: &self._name) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._url { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SessionProtos_DataMessage.OpenGroupInvitation, rhs: SessionProtos_DataMessage.OpenGroupInvitation) -> Bool { + if lhs._url != rhs._url {return false} + if lhs._name != rhs._name {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension SessionProtos_DataMessage.ClosedGroupControlMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".ClosedGroupControlMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ diff --git a/SessionMessagingKit/Protos/SessionProtos.proto b/SessionMessagingKit/Protos/SessionProtos.proto index b0b3b45d3..2e22da754 100644 --- a/SessionMessagingKit/Protos/SessionProtos.proto +++ b/SessionMessagingKit/Protos/SessionProtos.proto @@ -101,6 +101,13 @@ message DataMessage { optional string profilePicture = 2; } + message OpenGroupInvitation { + // @required + required string url = 1; + // @required + required string name = 3; + } + message ClosedGroupControlMessage { enum Type {