Skip to content

Commit 7cb37b3

Browse files
committed
Update parameter labels for GRPCClient
Motivation: The updated generated code added parameter labels to the handler passed to each method of the GRPCClient. This was done purposefully to improve readability. We haven't as yet actually updated the client to use the new labels. Modifications: - Update param labels in GRPCClient Result: New generated code compiles
1 parent 0fc4956 commit 7cb37b3

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Sources/GRPCCore/GRPCClient.swift

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ public final class GRPCClient: Sendable {
256256
serializer: some MessageSerializer<Request>,
257257
deserializer: some MessageDeserializer<Response>,
258258
options: CallOptions,
259-
handler: @Sendable @escaping (ClientResponse<Response>) async throws -> ReturnValue
259+
onResponse handleResponse: @Sendable @escaping (
260+
_ response: ClientResponse<Response>
261+
) async throws -> ReturnValue
260262
) async throws -> ReturnValue {
261263
try await self.bidirectionalStreaming(
262264
request: StreamingClientRequest(single: request),
@@ -266,7 +268,7 @@ public final class GRPCClient: Sendable {
266268
options: options
267269
) { stream in
268270
let singleResponse = await ClientResponse(stream: stream)
269-
return try await handler(singleResponse)
271+
return try await handleResponse(singleResponse)
270272
}
271273
}
272274

@@ -287,7 +289,9 @@ public final class GRPCClient: Sendable {
287289
serializer: some MessageSerializer<Request>,
288290
deserializer: some MessageDeserializer<Response>,
289291
options: CallOptions,
290-
handler: @Sendable @escaping (ClientResponse<Response>) async throws -> ReturnValue
292+
onResponse handleResponse: @Sendable @escaping (
293+
_ response: ClientResponse<Response>
294+
) async throws -> ReturnValue
291295
) async throws -> ReturnValue {
292296
try await self.bidirectionalStreaming(
293297
request: request,
@@ -297,7 +301,7 @@ public final class GRPCClient: Sendable {
297301
options: options
298302
) { stream in
299303
let singleResponse = await ClientResponse(stream: stream)
300-
return try await handler(singleResponse)
304+
return try await handleResponse(singleResponse)
301305
}
302306
}
303307

@@ -318,15 +322,17 @@ public final class GRPCClient: Sendable {
318322
serializer: some MessageSerializer<Request>,
319323
deserializer: some MessageDeserializer<Response>,
320324
options: CallOptions,
321-
handler: @Sendable @escaping (StreamingClientResponse<Response>) async throws -> ReturnValue
325+
onResponse handleResponse: @Sendable @escaping (
326+
_ response: StreamingClientResponse<Response>
327+
) async throws -> ReturnValue
322328
) async throws -> ReturnValue {
323329
try await self.bidirectionalStreaming(
324330
request: StreamingClientRequest(single: request),
325331
descriptor: descriptor,
326332
serializer: serializer,
327333
deserializer: deserializer,
328334
options: options,
329-
handler: handler
335+
onResponse: handleResponse
330336
)
331337
}
332338

@@ -350,7 +356,9 @@ public final class GRPCClient: Sendable {
350356
serializer: some MessageSerializer<Request>,
351357
deserializer: some MessageDeserializer<Response>,
352358
options: CallOptions,
353-
handler: @Sendable @escaping (StreamingClientResponse<Response>) async throws -> ReturnValue
359+
onResponse handleResponse: @Sendable @escaping (
360+
_ response: StreamingClientResponse<Response>
361+
) async throws -> ReturnValue
354362
) async throws -> ReturnValue {
355363
let applicableInterceptors = try self.stateMachine.withLock {
356364
try $0.checkExecutableAndGetApplicableInterceptors(for: descriptor)
@@ -367,7 +375,7 @@ public final class GRPCClient: Sendable {
367375
deserializer: deserializer,
368376
transport: self.transport,
369377
interceptors: applicableInterceptors,
370-
handler: handler
378+
handler: handleResponse
371379
)
372380
}
373381
}

0 commit comments

Comments
 (0)