-
Notifications
You must be signed in to change notification settings - Fork 5.1k
ClientModel: investigation for StreamingClientResult<T> #42873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.ClientModel.Primitives; | ||
| using System.Collections.Generic; | ||
| using System.Threading; | ||
|
|
||
| namespace System.ClientModel; | ||
|
|
||
| #pragma warning disable CS1591 // public XML comments | ||
| public abstract class StreamingClientResult<T> : ClientResult, IAsyncEnumerable<T> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only thing this does is abstractly implement the We still have an open question of whether this should implement IDisposable to make it easy to dispose the response content stream by putting this result in a using block, but I'm interested to first investigate how hard it is to use the IAsyncDisposable interface implementation in the IAsyncEnumerator returned from GetAsyncEnumerator. |
||
| { | ||
| protected internal StreamingClientResult(PipelineResponse response) : base(response) | ||
| { | ||
| } | ||
|
|
||
| public abstract IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default); | ||
| } | ||
| #pragma warning restore CS1591 // public XML comments | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was considering this, but I don't think we can provide it without a non-abstract implementation in ClientModel. It would be the responsibility of the client's concrete subtype to provide such a factory method.