Skip to content

Commit ac7afbc

Browse files
committed
Update hello-world
1 parent 49b9488 commit ac7afbc

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Examples/hello-world/Sources/Subcommands/Greet.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct Greet: AsyncParsableCommand {
3333
let client = GRPCClient(
3434
transport: try .http2NIOPosix(
3535
target: .ipv4(host: "127.0.0.1", port: self.port),
36-
config: .defaults(transportSecurity: .plaintext)
36+
transportSecurity: .plaintext
3737
)
3838
)
3939

@@ -45,7 +45,7 @@ struct Greet: AsyncParsableCommand {
4545
client.beginGracefulShutdown()
4646
}
4747

48-
let greeter = Helloworld_Greeter_Client(wrapping: client)
48+
let greeter = Helloworld_Greeter.Client(wrapping: client)
4949
let reply = try await greeter.sayHello(.with { $0.name = self.name })
5050
print(reply.message)
5151
}

Examples/hello-world/Sources/Subcommands/Serve.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct Serve: AsyncParsableCommand {
2929
let server = GRPCServer(
3030
transport: .http2NIOPosix(
3131
address: .ipv4(host: "127.0.0.1", port: self.port),
32-
config: .defaults(transportSecurity: .plaintext)
32+
transportSecurity: .plaintext
3333
),
3434
services: [Greeter()]
3535
)
@@ -43,14 +43,14 @@ struct Serve: AsyncParsableCommand {
4343
}
4444
}
4545

46-
struct Greeter: Helloworld_Greeter_ServiceProtocol {
46+
struct Greeter: Helloworld_Greeter.SimpleServiceProtocol {
4747
func sayHello(
48-
request: ServerRequest<Helloworld_HelloRequest>,
48+
request: Helloworld_HelloRequest,
4949
context: ServerContext
50-
) async throws -> ServerResponse<Helloworld_HelloReply> {
50+
) async throws -> Helloworld_HelloReply {
5151
var reply = Helloworld_HelloReply()
52-
let recipient = request.message.name.isEmpty ? "stranger" : request.message.name
52+
let recipient = request.name.isEmpty ? "stranger" : request.name
5353
reply.message = "Hello, \(recipient)"
54-
return ServerResponse(message: reply)
54+
return reply
5555
}
5656
}

0 commit comments

Comments
 (0)