-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
ClientModel: Updates to paging types to support sub-client enumerator pattern #44825
Open
annelo-msft
wants to merge
43
commits into
Azure:main
Choose a base branch
from
annelo-msft:scm-pageenumerator-pattern
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…deserialize before using
API change check APIView has identified API level changes in this PR and created following API reviews. |
annelo-msft
requested review from
bterlson,
jsquire,
tg-msft,
christothes,
KrzysztofCwalina,
johanste,
JoshLove-msft,
m-nash,
trrwilson and
joseharriaga
July 3, 2024 23:41
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
In response to feedback on the
System.ClientModel
collection and paging types from Azure SDK architects, we are making changes to these APIs to address the following considerations:This PR addresses the above considerations in the following ways:
PageCollection<T>
(orAsyncPageCollection<T>
) from service methods that request a collection of values from paginated endpoints. These types have two methods:GetAllValues
andGetCurrentPage
(and corresponding async methods) that can be called by users to implement the primary scenarios.IEnumerable<ClientResult>
orIAsyncEnumerable<ClientResult>
. EachClientResult
in these collections represents a page of values returned by a single service response.PageCollection<T>
andAsyncPageCollection<T>
inherit fromIEnumerable<ClientResult>
andIAsyncEnumerable<ClientResult>
, respectively.PageCollection<T>
andAsyncPageCollection<T>
to return from service methods.PageResult<T>
has twoContinuationToken
properties that can be used by generated subclients to obtain either the same page or the next page in the collection. These tokens can be passed to service methods to obtain a page collection subclient that starts from the page the token represents.ContinuationToken
is an opaque wrapper around some bytes instead of astring
as it was before.What's in this PR
This PR contains the following:
CollectionResult<T>
.AsyncCollectionResult<T>
, andPageResult<T>
to align with the convention that theResult
suffix indicates the type inherits fromClientResult
-- users can callGetRawResponse
on these types to obtain the raw response backing the return type.PageCollection<T>
,AsyncPageCollection<T>
andContinuationToken
types as described above.PageCollection<T>
,AsyncPageCollection<T>
andContinuationToken
corresponding to a paginated service operation. These types are intended to be emitted by the generator into individual client libraries.PagingClient
andPagingProtocolClient
implementations illustrating the patterns intended to be used by SCM-based clients for clients that have both convenience methods and protocol methods, and clients that have only protocol methods, respectively.PagingClient
andPagingProtocolClient
.