ClientModel: Add SSE result collection#43821
ClientModel: Add SSE result collection#43821annelo-msft wants to merge 16 commits intoAzure:mainfrom
Conversation
…be replaced in a polling paradigm
|
API change check APIView has identified API level changes in this PR and created following API reviews. |
| /// <param name="response">The <see cref="PipelineResponse"/> received | ||
| /// from the service.</param> | ||
| protected ClientResult(PipelineResponse response) | ||
| protected ClientResult(PipelineResponse? response) |
There was a problem hiding this comment.
We would only include this change if we have good reason to believe we'll want it for pageable/operation types in the future.
| public abstract IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default); | ||
|
|
||
| // TODO: take CancellationToken? | ||
| //public static ClientResultCollection<T> Create<TValue>(PipelineResponse response) where TValue : IJsonModel<T> |
There was a problem hiding this comment.
TODO: could we accomplish this method signature?
|
|
||
| public abstract IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default); | ||
|
|
||
| // TODO: take CancellationToken? |
There was a problem hiding this comment.
TODO: Take cancellation token in factory method?
| /// to the response most recently returned from the service.</remarks> | ||
| /// <param name="response">The <see cref="PipelineResponse"/> to return | ||
| /// from <see cref="GetRawResponse"/>.</param> | ||
| protected void SetRawResponse(PipelineResponse response) |
There was a problem hiding this comment.
TODO: Assert not null per nullability annotation
|
|
||
| namespace System.ClientModel; | ||
|
|
||
| // TODO: Re-enable sync version |
There was a problem hiding this comment.
TODO: sync result collection
|
|
||
| internal sealed class AsyncServerSentEventEnumerator : IAsyncEnumerator<ServerSentEvent>, IDisposable, IAsyncDisposable | ||
| { | ||
| // TODO: make this configurable per coming from TypeSpec |
There was a problem hiding this comment.
TODO: parameterize terminal event
| return new(response, GetServerSentEventDeserializationEnumerator<U>); | ||
| } | ||
|
|
||
| private static IAsyncEnumerator<U> GetServerSentEventDeserializationEnumerator<U>(Stream stream, CancellationToken cancellationToken = default) |
There was a problem hiding this comment.
Curious: Why a func?
|
|
||
| #region Helpers | ||
|
|
||
| private string _mockContent = """ |
There was a problem hiding this comment.
TODO: put it in one place? Currently copied a lot.
Also: more robust set of test cases?
|
Closing in favor of #43840 |
No description provided.