@@ -86,16 +86,28 @@ extension GRPCCore.ServiceDescriptor {
86
86
@available ( macOS 15 . 0 , iOS 18 . 0 , watchOS 11 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , * )
87
87
internal protocol Echo_EchoStreamingServiceProtocol : GRPCCore . RegistrableRPCService {
88
88
/// Immediately returns an echo of a request.
89
- func get( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
89
+ func get(
90
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
91
+ context: GRPCCore . ServerContext
92
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
90
93
91
94
/// Splits a request into words and returns each word in a stream of messages.
92
- func expand( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
95
+ func expand(
96
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
97
+ context: GRPCCore . ServerContext
98
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
93
99
94
100
/// Collects a stream of messages and returns them concatenated when the caller closes.
95
- func collect( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
101
+ func collect(
102
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
103
+ context: GRPCCore . ServerContext
104
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
96
105
97
106
/// Streams back messages as they are received in an input stream.
98
- func update( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
107
+ func update(
108
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
109
+ context: GRPCCore . ServerContext
110
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
99
111
}
100
112
101
113
/// Conformance to `GRPCCore.RegistrableRPCService`.
@@ -107,32 +119,44 @@ extension Echo_Echo.StreamingServiceProtocol {
107
119
forMethod: Echo_Echo . Method. Get. descriptor,
108
120
deserializer: GRPCProtobuf . ProtobufDeserializer < Echo_EchoRequest > ( ) ,
109
121
serializer: GRPCProtobuf . ProtobufSerializer < Echo_EchoResponse > ( ) ,
110
- handler: { request in
111
- try await self . get ( request: request)
122
+ handler: { request, context in
123
+ try await self . get (
124
+ request: request,
125
+ context: context
126
+ )
112
127
}
113
128
)
114
129
router. registerHandler (
115
130
forMethod: Echo_Echo . Method. Expand. descriptor,
116
131
deserializer: GRPCProtobuf . ProtobufDeserializer < Echo_EchoRequest > ( ) ,
117
132
serializer: GRPCProtobuf . ProtobufSerializer < Echo_EchoResponse > ( ) ,
118
- handler: { request in
119
- try await self . expand ( request: request)
133
+ handler: { request, context in
134
+ try await self . expand (
135
+ request: request,
136
+ context: context
137
+ )
120
138
}
121
139
)
122
140
router. registerHandler (
123
141
forMethod: Echo_Echo . Method. Collect. descriptor,
124
142
deserializer: GRPCProtobuf . ProtobufDeserializer < Echo_EchoRequest > ( ) ,
125
143
serializer: GRPCProtobuf . ProtobufSerializer < Echo_EchoResponse > ( ) ,
126
- handler: { request in
127
- try await self . collect ( request: request)
144
+ handler: { request, context in
145
+ try await self . collect (
146
+ request: request,
147
+ context: context
148
+ )
128
149
}
129
150
)
130
151
router. registerHandler (
131
152
forMethod: Echo_Echo . Method. Update. descriptor,
132
153
deserializer: GRPCProtobuf . ProtobufDeserializer < Echo_EchoRequest > ( ) ,
133
154
serializer: GRPCProtobuf . ProtobufSerializer < Echo_EchoResponse > ( ) ,
134
- handler: { request in
135
- try await self . update ( request: request)
155
+ handler: { request, context in
156
+ try await self . update (
157
+ request: request,
158
+ context: context
159
+ )
136
160
}
137
161
)
138
162
}
@@ -141,33 +165,63 @@ extension Echo_Echo.StreamingServiceProtocol {
141
165
@available ( macOS 15 . 0 , iOS 18 . 0 , watchOS 11 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , * )
142
166
internal protocol Echo_EchoServiceProtocol : Echo_Echo . StreamingServiceProtocol {
143
167
/// Immediately returns an echo of a request.
144
- func get( request: GRPCCore . ServerRequest . Single < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Single < Echo_EchoResponse >
168
+ func get(
169
+ request: GRPCCore . ServerRequest . Single < Echo_EchoRequest > ,
170
+ context: GRPCCore . ServerContext
171
+ ) async throws -> GRPCCore . ServerResponse . Single < Echo_EchoResponse >
145
172
146
173
/// Splits a request into words and returns each word in a stream of messages.
147
- func expand( request: GRPCCore . ServerRequest . Single < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
174
+ func expand(
175
+ request: GRPCCore . ServerRequest . Single < Echo_EchoRequest > ,
176
+ context: GRPCCore . ServerContext
177
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
148
178
149
179
/// Collects a stream of messages and returns them concatenated when the caller closes.
150
- func collect( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Single < Echo_EchoResponse >
180
+ func collect(
181
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
182
+ context: GRPCCore . ServerContext
183
+ ) async throws -> GRPCCore . ServerResponse . Single < Echo_EchoResponse >
151
184
152
185
/// Streams back messages as they are received in an input stream.
153
- func update( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
186
+ func update(
187
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
188
+ context: GRPCCore . ServerContext
189
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse >
154
190
}
155
191
156
192
/// Partial conformance to `Echo_EchoStreamingServiceProtocol`.
157
193
@available ( macOS 15 . 0 , iOS 18 . 0 , watchOS 11 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , * )
158
194
extension Echo_Echo . ServiceProtocol {
159
- internal func get( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse > {
160
- let response = try await self . get ( request: GRPCCore . ServerRequest. Single ( stream: request) )
195
+ internal func get(
196
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
197
+ context: GRPCCore . ServerContext
198
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse > {
199
+ let response = try await self . get (
200
+ request: GRPCCore . ServerRequest. Single ( stream: request) ,
201
+ context: context
202
+ )
161
203
return GRPCCore . ServerResponse. Stream ( single: response)
162
204
}
163
205
164
- internal func expand( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse > {
165
- let response = try await self . expand ( request: GRPCCore . ServerRequest. Single ( stream: request) )
206
+ internal func expand(
207
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
208
+ context: GRPCCore . ServerContext
209
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse > {
210
+ let response = try await self . expand (
211
+ request: GRPCCore . ServerRequest. Single ( stream: request) ,
212
+ context: context
213
+ )
166
214
return response
167
215
}
168
216
169
- internal func collect( request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse > {
170
- let response = try await self . collect ( request: request)
217
+ internal func collect(
218
+ request: GRPCCore . ServerRequest . Stream < Echo_EchoRequest > ,
219
+ context: GRPCCore . ServerContext
220
+ ) async throws -> GRPCCore . ServerResponse . Stream < Echo_EchoResponse > {
221
+ let response = try await self . collect (
222
+ request: request,
223
+ context: context
224
+ )
171
225
return GRPCCore . ServerResponse. Stream ( single: response)
172
226
}
173
227
}
0 commit comments