|
|
@@ -20,41 +20,41 @@ import SwiftProtobuf
|
|
|
|
|
|
public protocol ServiceClient {
|
|
|
var channel: Channel { get }
|
|
|
-
|
|
|
+
|
|
|
/// This metadata will be sent with all requests.
|
|
|
var metadata: Metadata { get }
|
|
|
-
|
|
|
+
|
|
|
/// 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".
|
|
|
- var host : String { get }
|
|
|
-
|
|
|
+ var host: String { get }
|
|
|
+
|
|
|
/// This property allows the service timeout to be overridden.
|
|
|
- var timeout : TimeInterval { get }
|
|
|
+ var timeout: TimeInterval { get }
|
|
|
}
|
|
|
|
|
|
open class ServiceClientBase: ServiceClient {
|
|
|
public let channel: Channel
|
|
|
-
|
|
|
+
|
|
|
public var metadata: Metadata
|
|
|
-
|
|
|
+
|
|
|
public var host: String {
|
|
|
- get { return self.channel.host }
|
|
|
- set { self.channel.host = newValue }
|
|
|
+ get { return channel.host }
|
|
|
+ set { channel.host = newValue }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public var timeout: TimeInterval {
|
|
|
- get { return self.channel.timeout }
|
|
|
- set { self.channel.timeout = newValue }
|
|
|
+ get { return channel.timeout }
|
|
|
+ set { channel.timeout = newValue }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/// Create a client.
|
|
|
public init(address: String, secure: Bool = true) {
|
|
|
gRPC.initialize()
|
|
|
channel = Channel(address: address, secure: secure)
|
|
|
metadata = Metadata()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/// Create a client that makes secure connections with a custom certificate and (optional) hostname.
|
|
|
public init(address: String, certificates: String, host: String?) {
|
|
|
gRPC.initialize()
|
|
|
@@ -68,26 +68,26 @@ open class ServiceClientBase: ServiceClient {
|
|
|
/// Note: completion blocks are NOT called with this default implementation, and asynchronous unary calls are NOT implemented!
|
|
|
open class ServiceClientTestStubBase: ServiceClient {
|
|
|
open private(set) var channel: Channel
|
|
|
-
|
|
|
- open var metadata : Metadata
|
|
|
-
|
|
|
- open var host : String {
|
|
|
+
|
|
|
+ open var metadata: Metadata
|
|
|
+
|
|
|
+ open var host: String {
|
|
|
get { return self.channel.host }
|
|
|
set { self.channel.host = newValue }
|
|
|
}
|
|
|
-
|
|
|
- open var timeout : TimeInterval {
|
|
|
- get { return self.channel.timeout }
|
|
|
- set { self.channel.timeout = newValue }
|
|
|
+
|
|
|
+ open var timeout: TimeInterval {
|
|
|
+ get { return channel.timeout }
|
|
|
+ set { channel.timeout = newValue }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/// Create a client.
|
|
|
public init(address: String, secure: Bool = true) {
|
|
|
gRPC.initialize()
|
|
|
channel = Channel(address: address, secure: secure)
|
|
|
metadata = Metadata()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/// Create a client that makes secure connections with a custom certificate and (optional) hostname.
|
|
|
public init(address: String, certificates: String, host: String?) {
|
|
|
gRPC.initialize()
|