Code generate Swift wrappers for protocol buffers.

This commit is contained in:
Matthew Chen 2018-08-01 11:29:46 -04:00
parent b164ce9403
commit 377634a1f7
3 changed files with 23 additions and 24 deletions

View file

@ -11,10 +11,8 @@ syntax = "proto2";
// iOS - package name determines class prefix
package IOSProtos;
message BackupSnapshot
{
message BackupEntity
{
message BackupSnapshot {
message BackupEntity {
enum Type {
UNKNOWN = 0;
MIGRATION = 1;

View file

@ -14,8 +14,7 @@ package WebSocketProtos;
option java_package = "org.whispersystems.signalservice.internal.websocket";
option java_outer_classname = "WebSocketProtos";
message WebSocketRequestMessage
{
message WebSocketRequestMessage {
optional string verb = 1;
optional string path = 2;
optional bytes body = 3;
@ -23,8 +22,7 @@ message WebSocketRequestMessage
optional uint64 requestId = 4;
}
message WebSocketResponseMessage
{
message WebSocketResponseMessage {
optional uint64 requestId = 1;
optional uint32 status = 2;
optional string message = 3;
@ -32,8 +30,7 @@ message WebSocketResponseMessage
optional bytes body = 4;
}
message WebSocketMessage
{
message WebSocketMessage {
enum Type {
UNKNOWN = 0;
REQUEST = 1;

View file

@ -1,6 +1,10 @@
// DO NOT EDIT.
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: Provisioning.proto
//
// For information on using the generated types, please see the documenation:
// https://github.com/apple/swift-protobuf/
//*
// Copyright (C) 2014-2016 Open Whisper Systems
@ -18,7 +22,7 @@ import SwiftProtobuf
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that your are building against the same version of the API
// that was used to generate this file.
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
typealias Version = _2
}
@ -51,8 +55,8 @@ struct ProvisioningProtos_ProvisionEnvelope {
init() {}
fileprivate var _publicKey: Data?
fileprivate var _body: Data?
fileprivate var _publicKey: Data? = nil
fileprivate var _body: Data? = nil
}
struct ProvisioningProtos_ProvisionMessage {
@ -127,24 +131,24 @@ struct ProvisioningProtos_ProvisionMessage {
init() {}
fileprivate var _identityKeyPublic: Data?
fileprivate var _identityKeyPrivate: Data?
fileprivate var _number: String?
fileprivate var _provisioningCode: String?
fileprivate var _userAgent: String?
fileprivate var _profileKey: Data?
fileprivate var _readReceipts: Bool?
fileprivate var _identityKeyPublic: Data? = nil
fileprivate var _identityKeyPrivate: Data? = nil
fileprivate var _number: String? = nil
fileprivate var _provisioningCode: String? = nil
fileprivate var _userAgent: String? = nil
fileprivate var _profileKey: Data? = nil
fileprivate var _readReceipts: Bool? = nil
}
// MARK: - Code below here is support for the SwiftProtobuf runtime.
private let _protobuf_package = "ProvisioningProtos"
fileprivate let _protobuf_package = "ProvisioningProtos"
extension ProvisioningProtos_ProvisionEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".ProvisionEnvelope"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "publicKey"),
2: .same(proto: "body")
2: .same(proto: "body"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -184,7 +188,7 @@ extension ProvisioningProtos_ProvisionMessage: SwiftProtobuf.Message, SwiftProto
4: .same(proto: "provisioningCode"),
5: .same(proto: "userAgent"),
6: .same(proto: "profileKey"),
7: .same(proto: "readReceipts")
7: .same(proto: "readReceipts"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {