Skip to content

Add support for continuation tokens #15

@johnbatty

Description

@johnbatty

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions