-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add support for continuation tokens #15
Comments
Worth noting that the Azure SDK has done some work in this area, notably:
Need to decide whether we leverage this or just implement something similar to the Azure DevOps Python package. |
A recent enhancement to the autorust enables access to headers on responses by using I'll update the docs and add an example to show how to do this. |
Added an example that demonstrates how to do large queries with continuation tokens by using the new |
@johnbatty I'm curious on your thoughts about also handling pagination for APIs that don't use continuation tokens like the Git Commit Get Changes API, which only uses |
Operations that return many items use continuation tokens to allow the items to be returned in batches.
REST responses that do not contain all items include an HTTP header
x-ms-continuationtoken
that provides a continuation token value. This value must be provided on a subsequent call as acontinuationToken
parameter to query the remaining items (repeated as necessary until the server does not include thex-ms-continuationtoken
header).The Python SDK has a "response" object that includes the continuation token, with the actual response as a
value
field.The Rust SDK already modifies the spec to handle responses that return lists of items, as the server sends them in a wrapper:
We could change this to include the continuation token as per the Python SDK (and perhaps change our wrapper type to be
<...>Response
rather than<...>List
.Deserialization of this struct from the protocol would still work because the
continuation_token
field is declared as anOption
, so would always be set toNone
as the field is in the headers rather than the body. However, we could modify the code generator to fill in this value from the response headers before the value is returned to the application.Useful links:
The text was updated successfully, but these errors were encountered: