Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Examples/Datastore/PackageManager/RUNME
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ protoc \
googleapis/google/type/latlng.proto \
-Igoogleapis \
--swift_out=googleapis \
--swift_opt=Visibility=Public \
--plugin=$HOME/local/bin/protoc-gen-swift \
--swiftgrpc_out=Sources

# move swift files to this directory
Expand Down
50 changes: 25 additions & 25 deletions Examples/Echo/Generated/echo.client.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ import Dispatch
import gRPC

/// Type for errors thrown from generated client code.
public enum Echo_EchoClientError : Error {
internal enum Echo_EchoClientError : Error {
case endOfStream
case invalidMessageReceived
case error(c: CallResult)
}

/// Get (Unary)
public class Echo_EchoGetCall {
internal class Echo_EchoGetCall {
private var call : Call

/// Create a call.
Expand Down Expand Up @@ -101,7 +101,7 @@ public class Echo_EchoGetCall {
}

/// Expand (Server Streaming)
public class Echo_EchoExpandCall {
internal class Echo_EchoExpandCall {
private var call : Call

/// Create a call.
Expand All @@ -123,7 +123,7 @@ public class Echo_EchoExpandCall {
}

/// Call this to wait for a result. Blocking.
public func receive() throws -> Echo_EchoResponse {
internal func receive() throws -> Echo_EchoResponse {
var returnError : Echo_EchoClientError?
var returnResponse : Echo_EchoResponse!
let sem = DispatchSemaphore(value: 0)
Expand All @@ -142,7 +142,7 @@ public class Echo_EchoExpandCall {
}

/// Call this to wait for a result. Nonblocking.
public func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
internal func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
do {
try call.receiveMessage() {(responseData) in
if let responseData = responseData {
Expand All @@ -160,7 +160,7 @@ public class Echo_EchoExpandCall {
}

/// Collect (Client Streaming)
public class Echo_EchoCollectCall {
internal class Echo_EchoCollectCall {
private var call : Call

/// Create a call.
Expand All @@ -176,13 +176,13 @@ public class Echo_EchoCollectCall {
}

/// Call this to send each message in the request stream. Nonblocking.
public func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
internal func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
let messageData = try message.serializedData()
try call.sendMessage(data:messageData, errorHandler:errorHandler)
}

/// Call this to close the connection and wait for a response. Blocking.
public func closeAndReceive() throws -> Echo_EchoResponse {
internal func closeAndReceive() throws -> Echo_EchoResponse {
var returnError : Echo_EchoClientError?
var returnResponse : Echo_EchoResponse!
let sem = DispatchSemaphore(value: 0)
Expand All @@ -203,7 +203,7 @@ public class Echo_EchoCollectCall {
}

/// Call this to close the connection and wait for a response. Nonblocking.
public func closeAndReceive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->())
internal func closeAndReceive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->())
throws {
do {
try call.receiveMessage() {(responseData) in
Expand All @@ -222,7 +222,7 @@ public class Echo_EchoCollectCall {
}

/// Update (Bidirectional Streaming)
public class Echo_EchoUpdateCall {
internal class Echo_EchoUpdateCall {
private var call : Call

/// Create a call.
Expand All @@ -238,7 +238,7 @@ public class Echo_EchoUpdateCall {
}

/// Call this to wait for a result. Blocking.
public func receive() throws -> Echo_EchoResponse {
internal func receive() throws -> Echo_EchoResponse {
var returnError : Echo_EchoClientError?
var returnMessage : Echo_EchoResponse!
let sem = DispatchSemaphore(value: 0)
Expand All @@ -257,7 +257,7 @@ public class Echo_EchoUpdateCall {
}

/// Call this to wait for a result. Nonblocking.
public func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
internal func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
do {
try call.receiveMessage() {(data) in
if let data = data {
Expand All @@ -274,13 +274,13 @@ public class Echo_EchoUpdateCall {
}

/// Call this to send each message in the request stream.
public func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
internal func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
let messageData = try message.serializedData()
try call.sendMessage(data:messageData, errorHandler:errorHandler)
}

/// Call this to close the sending connection. Blocking.
public func closeSend() throws {
internal func closeSend() throws {
let sem = DispatchSemaphore(value: 0)
try closeSend() {
sem.signal()
Expand All @@ -289,24 +289,24 @@ public class Echo_EchoUpdateCall {
}

/// Call this to close the sending connection. Nonblocking.
public func closeSend(completion:@escaping ()->()) throws {
internal func closeSend(completion:@escaping ()->()) throws {
try call.close() {
completion()
}
}
}

/// Call methods of this class to make API calls.
public class Echo_EchoService {
internal class Echo_EchoService {
private var channel: Channel

/// This metadata will be sent with all requests.
public var metadata : Metadata
internal var metadata : Metadata

/// This property allows the service host name to be overridden.
/// For example, it can be used to make calls to "localhost:8080"
/// appear to be to "example.com".
public var host : String {
internal var host : String {
get {
return self.channel.host
}
Expand All @@ -316,27 +316,27 @@ public class Echo_EchoService {
}

/// Create a client that makes insecure connections.
public init(address: String) {
internal init(address: String) {
gRPC.initialize()
channel = Channel(address:address)
metadata = Metadata()
}

/// Create a client that makes secure connections.
public init(address: String, certificates: String?, host: String?) {
internal init(address: String, certificates: String?, host: String?) {
gRPC.initialize()
channel = Channel(address:address, certificates:certificates, host:host)
metadata = Metadata()
}

/// Synchronous. Unary.
public func get(_ request: Echo_EchoRequest)
internal func get(_ request: Echo_EchoRequest)
throws
-> Echo_EchoResponse {
return try Echo_EchoGetCall(channel).run(request:request, metadata:metadata)
}
/// Asynchronous. Unary.
public func get(_ request: Echo_EchoRequest,
internal func get(_ request: Echo_EchoRequest,
completion: @escaping (Echo_EchoResponse?, CallResult)->())
throws
-> Echo_EchoGetCall {
Expand All @@ -347,23 +347,23 @@ public class Echo_EchoService {
/// Asynchronous. Server-streaming.
/// Send the initial message.
/// Use methods on the returned object to get streamed responses.
public func expand(_ request: Echo_EchoRequest, completion: @escaping (CallResult)->())
internal func expand(_ request: Echo_EchoRequest, completion: @escaping (CallResult)->())
throws
-> Echo_EchoExpandCall {
return try Echo_EchoExpandCall(channel).start(request:request, metadata:metadata, completion:completion)
}
/// Asynchronous. Client-streaming.
/// Use methods on the returned object to stream messages and
/// to close the connection and wait for a final response.
public func collect(completion: @escaping (CallResult)->())
internal func collect(completion: @escaping (CallResult)->())
throws
-> Echo_EchoCollectCall {
return try Echo_EchoCollectCall(channel).start(metadata:metadata, completion:completion)
}
/// Asynchronous. Bidirectional-streaming.
/// Use methods on the returned object to stream messages,
/// to wait for replies, and to close the connection.
public func update(completion: @escaping (CallResult)->())
internal func update(completion: @escaping (CallResult)->())
throws
-> Echo_EchoUpdateCall {
return try Echo_EchoUpdateCall(channel).start(metadata:metadata, completion:completion)
Expand Down
36 changes: 18 additions & 18 deletions Examples/Echo/Generated/echo.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
typealias Version = _1
}

public struct Echo_EchoRequest: SwiftProtobuf.Message {
public static let protoMessageName: String = _protobuf_package + ".EchoRequest"
struct Echo_EchoRequest: SwiftProtobuf.Message {
static let protoMessageName: String = _protobuf_package + ".EchoRequest"

/// The text of a message to be echoed.
public var text: String = String()
var text: String = String()

public var unknownFields = SwiftProtobuf.UnknownStorage()
var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
init() {}

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularStringField(value: &self.text)
Expand All @@ -52,25 +52,25 @@ public struct Echo_EchoRequest: SwiftProtobuf.Message {
}
}

public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.text.isEmpty {
try visitor.visitSingularStringField(value: self.text, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
}

public struct Echo_EchoResponse: SwiftProtobuf.Message {
public static let protoMessageName: String = _protobuf_package + ".EchoResponse"
struct Echo_EchoResponse: SwiftProtobuf.Message {
static let protoMessageName: String = _protobuf_package + ".EchoResponse"

/// The text of an echo response.
public var text: String = String()
var text: String = String()

public var unknownFields = SwiftProtobuf.UnknownStorage()
var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
init() {}

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularStringField(value: &self.text)
Expand All @@ -79,7 +79,7 @@ public struct Echo_EchoResponse: SwiftProtobuf.Message {
}
}

public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.text.isEmpty {
try visitor.visitSingularStringField(value: self.text, fieldNumber: 1)
}
Expand All @@ -92,23 +92,23 @@ public struct Echo_EchoResponse: SwiftProtobuf.Message {
fileprivate let _protobuf_package = "echo"

extension Echo_EchoRequest: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "text"),
]

public func _protobuf_generated_isEqualTo(other: Echo_EchoRequest) -> Bool {
func _protobuf_generated_isEqualTo(other: Echo_EchoRequest) -> Bool {
if self.text != other.text {return false}
if unknownFields != other.unknownFields {return false}
return true
}
}

extension Echo_EchoResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "text"),
]

public func _protobuf_generated_isEqualTo(other: Echo_EchoResponse) -> Bool {
func _protobuf_generated_isEqualTo(other: Echo_EchoResponse) -> Bool {
if self.text != other.text {return false}
if unknownFields != other.unknownFields {return false}
return true
Expand Down
Loading