Ver Fonte

Update comments in client templates.

Tim Burks há 8 anos atrás
pai
commit
b5aa1d9a20

+ 24 - 20
Examples/Echo/Generated/echo.client.pb.swift

@@ -49,7 +49,7 @@ public enum Echo_EchoClientError : Error {
   case invalidMessageReceived
   case error(c: CallResult)
 }
-// Get (Unary)
+/// Get (Unary)
 public class Echo_EchoGetCall {
   private var call : Call
 
@@ -84,7 +84,7 @@ public class Echo_EchoGetCall {
   }
 }
 
-// Expand (Server Streaming)
+/// Expand (Server Streaming)
 public class Echo_EchoExpandCall {
   private var call : Call
 
@@ -93,7 +93,7 @@ public class Echo_EchoExpandCall {
     self.call = channel.makeCall("/echo.Echo/Expand")
   }
 
-  // Call this once with the message to send.
+  /// Call this once with the message to send.
   fileprivate func run(request: Echo_EchoRequest, metadata: Metadata) throws -> Echo_EchoExpandCall {
     let requestData = try request.serializeProtobuf()
     let sem = DispatchSemaphore(value: 0)
@@ -107,7 +107,7 @@ public class Echo_EchoExpandCall {
     return self
   }
 
-  // Call this to wait for a result. Blocks.
+  /// Call this to wait for a result. Blocks.
   public func receive() throws -> Echo_EchoResponse {
     var returnError : Echo_EchoClientError?
     var response : Echo_EchoResponse!
@@ -133,7 +133,7 @@ public class Echo_EchoExpandCall {
   }
 }
 
-// Collect (Client Streaming)
+/// Collect (Client Streaming)
 public class Echo_EchoCollectCall {
   private var call : Call
 
@@ -142,7 +142,7 @@ public class Echo_EchoCollectCall {
     self.call = channel.makeCall("/echo.Echo/Collect")
   }
 
-  // Call this to start a call.
+  /// Call this to start a call.
   fileprivate func run(metadata:Metadata) throws -> Echo_EchoCollectCall {
     let sem = DispatchSemaphore(value: 0)
     try self.call.start(.clientStreaming,
@@ -154,13 +154,13 @@ public class Echo_EchoCollectCall {
     return self
   }
 
-  // Call this to send each message in the request stream.
+  /// Call this to send each message in the request stream.
   public func send(_ message: Echo_EchoRequest) throws {
     let messageData = try message.serializeProtobuf()
     try call.sendMessage(data:messageData)
   }
 
-  // Call this to close the connection and wait for a response. Blocks.
+  /// Call this to close the connection and wait for a response. Blocks.
   public func closeAndReceive() throws -> Echo_EchoResponse {
     var returnError : Echo_EchoClientError?
     var returnResponse : Echo_EchoResponse!
@@ -187,7 +187,7 @@ public class Echo_EchoCollectCall {
   }
 }
 
-// Update (Bidirectional Streaming)
+/// Update (Bidirectional Streaming)
 public class Echo_EchoUpdateCall {
   private var call : Call
 
@@ -196,6 +196,7 @@ public class Echo_EchoUpdateCall {
     self.call = channel.makeCall("/echo.Echo/Update")
   }
 
+  /// Call this to start a call.
   fileprivate func run(metadata:Metadata) throws -> Echo_EchoUpdateCall {
     let sem = DispatchSemaphore(value: 0)
     try self.call.start(.bidiStreaming,
@@ -207,6 +208,7 @@ public class Echo_EchoUpdateCall {
     return self
   }
 
+  /// Call this to wait for a result. Blocks.
   public func receive() throws -> Echo_EchoResponse {
     var returnError : Echo_EchoClientError?
     var returnMessage : Echo_EchoResponse!
@@ -231,11 +233,13 @@ public class Echo_EchoUpdateCall {
     return returnMessage
   }
 
+  /// Call this to send each message in the request stream.
   public func send(_ message:Echo_EchoRequest) throws {
     let messageData = try message.serializeProtobuf()
     try call.sendMessage(data:messageData)
   }
 
+  /// Call this to close the sending connection.
   public func closeSend() throws {
     let sem = DispatchSemaphore(value: 0)
     try call.close() {
@@ -246,7 +250,7 @@ public class Echo_EchoUpdateCall {
 }
 
 
-// Call methods of this class to make API calls.
+/// Call methods of this class to make API calls.
 public class Echo_EchoService {
   private var channel: Channel
 
@@ -279,25 +283,25 @@ public class Echo_EchoService {
     metadata = Metadata()
   }
 
-  // Synchronous. Unary.
+  /// Synchronous. Unary.
   public func get(_ request: Echo_EchoRequest) throws -> Echo_EchoResponse {
     return try Echo_EchoGetCall(channel).run(request:request, metadata:metadata)
   }
-  // Asynchronous. Server-streaming.
-  // Send the initial message.
-  // Use methods on the returned object to get streamed responses.
+  /// Asynchronous. Server-streaming.
+  /// Send the initial message.
+  /// Use methods on the returned object to get streamed responses.
   public func expand(_ request: Echo_EchoRequest) throws -> Echo_EchoExpandCall {
     return try Echo_EchoExpandCall(channel).run(request:request, metadata:metadata)
   }
-  // Asynchronous. Client-streaming.
-  // Use methods on the returned object to stream messages and
-  // to close the connection and wait for a final response.
+  /// 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() throws -> Echo_EchoCollectCall {
     return try Echo_EchoCollectCall(channel).run(metadata:metadata)
   }
-  // Asynchronous. Bidirectional-streaming.
-  // Use methods on the returned object to stream messages,
-  // to wait for replies, and to close the connection.
+  /// Asynchronous. Bidirectional-streaming.
+  /// Use methods on the returned object to stream messages,
+  /// to wait for replies, and to close the connection.
   public func update() throws -> Echo_EchoUpdateCall {
     return try Echo_EchoUpdateCall(channel).run(metadata:metadata)
   }

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/templates.swift


+ 5 - 1
Plugin/Templates/client-call-bidistreaming.swift

@@ -1,4 +1,4 @@
-// {{ method.name }} (Bidirectional Streaming)
+/// {{ method.name }} (Bidirectional Streaming)
 public class {{ .|call:protoFile,service,method }} {
   private var call : Call
 
@@ -7,6 +7,7 @@ public class {{ .|call:protoFile,service,method }} {
     self.call = channel.makeCall("{{ .|path:protoFile,service,method }}")
   }
 
+  /// Call this to start a call.
   fileprivate func run(metadata:Metadata) throws -> {{ .|call:protoFile,service,method }} {
     let sem = DispatchSemaphore(value: 0)
     try self.call.start(.bidiStreaming,
@@ -18,6 +19,7 @@ public class {{ .|call:protoFile,service,method }} {
     return self
   }
 
+  /// Call this to wait for a result. Blocks.
   public func receive() throws -> {{ method|output }} {
     var returnError : {{ .|clienterror:protoFile,service }}?
     var returnMessage : {{ method|output }}!
@@ -42,11 +44,13 @@ public class {{ .|call:protoFile,service,method }} {
     return returnMessage
   }
 
+  /// Call this to send each message in the request stream.
   public func send(_ message:{{ method|input }}) throws {
     let messageData = try message.serializeProtobuf()
     try call.sendMessage(data:messageData)
   }
 
+  /// Call this to close the sending connection.
   public func closeSend() throws {
     let sem = DispatchSemaphore(value: 0)
     try call.close() {

+ 4 - 4
Plugin/Templates/client-call-clientstreaming.swift

@@ -1,4 +1,4 @@
-// {{ method.name }} (Client Streaming)
+/// {{ method.name }} (Client Streaming)
 public class {{ .|call:protoFile,service,method }} {
   private var call : Call
 
@@ -7,7 +7,7 @@ public class {{ .|call:protoFile,service,method }} {
     self.call = channel.makeCall("{{ .|path:protoFile,service,method }}")
   }
 
-  // Call this to start a call.
+  /// Call this to start a call.
   fileprivate func run(metadata:Metadata) throws -> {{ .|call:protoFile,service,method }} {
     let sem = DispatchSemaphore(value: 0)
     try self.call.start(.clientStreaming,
@@ -19,13 +19,13 @@ public class {{ .|call:protoFile,service,method }} {
     return self
   }
 
-  // Call this to send each message in the request stream.
+  /// Call this to send each message in the request stream.
   public func send(_ message: {{ method|input }}) throws {
     let messageData = try message.serializeProtobuf()
     try call.sendMessage(data:messageData)
   }
 
-  // Call this to close the connection and wait for a response. Blocks.
+  /// Call this to close the connection and wait for a response. Blocks.
   public func closeAndReceive() throws -> {{ method|output }} {
     var returnError : {{ .|clienterror:protoFile,service }}?
     var returnResponse : {{ method|output }}!

+ 3 - 3
Plugin/Templates/client-call-serverstreaming.swift

@@ -1,4 +1,4 @@
-// {{ method.name }} (Server Streaming)
+/// {{ method.name }} (Server Streaming)
 public class {{ .|call:protoFile,service,method }} {
   private var call : Call
 
@@ -7,7 +7,7 @@ public class {{ .|call:protoFile,service,method }} {
     self.call = channel.makeCall("{{ .|path:protoFile,service,method }}")
   }
 
-  // Call this once with the message to send.
+  /// Call this once with the message to send.
   fileprivate func run(request: {{ method|input }}, metadata: Metadata) throws -> {{ .|call:protoFile,service,method }} {
     let requestData = try request.serializeProtobuf()
     let sem = DispatchSemaphore(value: 0)
@@ -21,7 +21,7 @@ public class {{ .|call:protoFile,service,method }} {
     return self
   }
 
-  // Call this to wait for a result. Blocks.
+  /// Call this to wait for a result. Blocks.
   public func receive() throws -> {{ method|output }} {
     var returnError : {{ .|clienterror:protoFile,service }}?
     var response : {{ method|output }}!

+ 1 - 1
Plugin/Templates/client-call-unary.swift

@@ -1,4 +1,4 @@
-// {{ method.name }} (Unary)
+/// {{ method.name }} (Unary)
 public class {{ .|call:protoFile,service,method }} {
   private var call : Call
 

+ 11 - 11
Plugin/Templates/client.pb.swift

@@ -65,7 +65,7 @@ public enum {{ .|clienterror:protoFile,service }} : Error {
 //-{% endif %}
 //-{% endfor %}
 
-// Call methods of this class to make API calls.
+/// Call methods of this class to make API calls.
 public class {{ .|serviceclass:protoFile,service }} {
   private var channel: Channel
 
@@ -100,31 +100,31 @@ public class {{ .|serviceclass:protoFile,service }} {
 
   //-{% for method in service.method %}
   //-{% if not method.clientStreaming and not method.serverStreaming %}
-  // Synchronous. Unary.
+  /// Synchronous. Unary.
   public func {{ method.name|lowercase }}(_ request: {{ method|input }}) throws -> {{ method|output }} {
     return try {{ .|call:protoFile,service,method }}(channel).run(request:request, metadata:metadata)
   }
   //-{% endif %}
   //-{% if not method.clientStreaming and method.serverStreaming %}
-  // Asynchronous. Server-streaming.
-  // Send the initial message.
-  // Use methods on the returned object to get streamed responses.
+  /// Asynchronous. Server-streaming.
+  /// Send the initial message.
+  /// Use methods on the returned object to get streamed responses.
   public func {{ method.name|lowercase }}(_ request: {{ method|input }}) throws -> {{ .|call:protoFile,service,method }} {
     return try {{ .|call:protoFile,service,method }}(channel).run(request:request, metadata:metadata)
   }
   //-{% endif %}
   //-{% if method.clientStreaming and not method.serverStreaming %}
-  // Asynchronous. Client-streaming.
-  // Use methods on the returned object to stream messages and
-  // to close the connection and wait for a final response.
+  /// 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 {{ method.name|lowercase }}() throws -> {{ .|call:protoFile,service,method }} {
     return try {{ .|call:protoFile,service,method }}(channel).run(metadata:metadata)
   }
   //-{% endif %}
   //-{% if method.clientStreaming and method.serverStreaming %}
-  // Asynchronous. Bidirectional-streaming.
-  // Use methods on the returned object to stream messages,
-  // to wait for replies, and to close the connection.
+  /// Asynchronous. Bidirectional-streaming.
+  /// Use methods on the returned object to stream messages,
+  /// to wait for replies, and to close the connection.
   public func {{ method.name|lowercase }}() throws -> {{ .|call:protoFile,service,method }} {
     return try {{ .|call:protoFile,service,method }}(channel).run(metadata:metadata)
   }

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff