Skip to content

Commit 06f872b

Browse files
Rename resposne to output in event stream wrappers
1 parent ebd012a commit 06f872b

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

designs/event-streams.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class DuplexEventStream[
181181

182182
input_stream: EventPublisher[IE]
183183
output_stream: EventReceiver[OE] | None = None
184-
response: O | None = None
184+
output: O | None = None
185185

186186
def __init__(
187187
self,
@@ -208,7 +208,7 @@ class DuplexEventStream[
208208
class InputEventStream[IE: SerializeableShape, O]:
209209

210210
input_stream: EventPublisher[IE]
211-
response: O | None = None
211+
output: O | None = None
212212

213213
def __init__(
214214
self,
@@ -235,11 +235,11 @@ class InputEventStream[IE: SerializeableShape, O]:
235235
class OutputEventStream[OE: DeserializeableShape, O: DeserializeableShape]:
236236

237237
output_stream: EventReceiver[OE]
238-
response: O
238+
output: O
239239

240240
def __init__(self, output_stream: EventReceiver[OE], output: O) -> None:
241241
self.output_stream = output_stream
242-
self.response = output
242+
self.output = output
243243

244244
async def close(self) -> None:
245245
await self.output_stream.close()
@@ -257,7 +257,7 @@ the underlying publisher and/or receiver.
257257

258258
Both `InputEventStream` and `DuplexEventStream` have an `await_output` method
259259
that waits for the initial request to be received, returning that and the output
260-
stream. Their `response` and `output_stream` properties will not be set until
260+
stream. Their `output` and `output_stream` properties will not be set until
261261
then. This is important because clients MUST be able to start sending events to
262262
the service immediately, without waiting for the initial response. This is
263263
critical because there are existing services that require one or more events to
@@ -277,8 +277,8 @@ with await client.input_operation() as stream:
277277
stream.input_stream.send(FooEvent(foo="bar"))
278278
```
279279

280-
The `OutputEventStream`'s initial `response` and `output_stream` will never be
281-
`None`, however. Instead, the `ClientProtocol` MUST set values for these when
280+
The `OutputEventStream`'s `output` and `output_stream` will never be `None`,
281+
however. Instead, the `ClientProtocol` MUST set values for these when
282282
constructing the object. This differs from the other stream types because the
283283
lack of an input stream means that the service has nothing to wait on from the
284284
client before sending responses.

packages/smithy-core/src/smithy_core/aio/eventstream.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def handle_output(stream: EventStream) -> None:
6161
This value will also be None if the operation has no output stream.
6262
"""
6363

64-
response: O | None = None
64+
output: O | None = None
6565
"""The initial response from the service.
6666
6767
This value may be None until ``await_output`` has been called.
@@ -98,8 +98,8 @@ async def await_output(self) -> tuple[O, EventReceiver[OE]]:
9898
:returns: A tuple containing the initial response and output stream. If the
9999
operation has no output stream, the second value will be None.
100100
"""
101-
self.response, self.output_stream = await self._output_future
102-
return self.response, self.output_stream
101+
self.output, self.output_stream = await self._output_future
102+
return self.output, self.output_stream
103103

104104
async def close(self) -> None:
105105
"""Closes the event stream.
@@ -141,7 +141,7 @@ async def main():
141141
input_stream: EventPublisher[IE]
142142
"""An event stream that sends events to the service."""
143143

144-
response: O | None = None
144+
output: O | None = None
145145
"""The initial response from the service.
146146
147147
This value may be None until ``await_output`` has been called.
@@ -170,9 +170,9 @@ async def await_output(self) -> O:
170170
171171
:returns: The service's initial response.
172172
"""
173-
if self.response is None:
174-
self.response = await self._output_future
175-
return self.response
173+
if self.output is None:
174+
self.output = await self._output_future
175+
return self.output
176176

177177
async def close(self) -> None:
178178
"""Closes the event stream."""
@@ -212,7 +212,7 @@ async def main():
212212
This value will also be None if the operation has no output stream.
213213
"""
214214

215-
response: O
215+
output: O
216216
"""The initial response from the service.
217217
218218
This may include context necessary to interpret output events or prepare input
@@ -221,7 +221,7 @@ async def main():
221221

222222
def __init__(self, output_stream: EventReceiver[OE], output: O) -> None:
223223
self.output_stream = output_stream
224-
self.response = output
224+
self.output = output
225225

226226
async def close(self) -> None:
227227
"""Closes the event stream."""

0 commit comments

Comments
 (0)