-
Notifications
You must be signed in to change notification settings - Fork 23
Description
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 a continuationToken
parameter to query the remaining items (repeated as necessary until the server does not include the x-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:
{
count: Option<i32>,
value: Vec<type>
} <type>List
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
.
{
count: Option<i32>,
value: Vec<type>
continuation_token: Option<String>
} <type>Response
Deserialization of this struct from the protocol would still work because the continuation_token
field is declared as an Option
, so would always be set to None
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:
- https://jessehouwing.net/azure-devops-accessing-apis-with-large-volumes-of-data/#:~:text=x-%20ms-continuation-token%20is%20returned%20by%20Azure%20DevOps%20in,the%20%26continuationToken%3D%24%20%7Bx-ms-continuation-token%7D%20query%20parameter%20to%20the%20call.
- Return Continuation Token in response azure-devops-python-api#152