ExAzureCore.Paging (ex_azure_core v0.3.0)

Copy Markdown

Helpers for building lazy streams over paginated Azure responses.

Generated SDK operations that page via a nextLink set their :stream_builder to a closure that delegates here, so the page-walking logic lives (and is tested) in one place.

Summary

Functions

Builds a lazy Stream that walks continuation-token pagination.

Builds a lazy Stream that walks nextLink-style pagination.

Functions

continuation_stream(config, initial_op, opts)

@spec continuation_stream(map(), ExAzureCore.Operation.t(), keyword()) ::
  Enumerable.t()

Builds a lazy Stream that walks continuation-token pagination.

Fetches initial_op, extracts the page's items and a continuation token from each response body, decodes each item, and re-issues the same operation with the token set on a request parameter until the token is absent.

Options

  • :items - response body key holding the page's item list (required)
  • :token_response - response body key holding the continuation token (required)
  • :token_query - query parameter name to carry the token on the next request
  • :token_header - header name to carry the token (use instead of :token_query)
  • :decode - 1-arity function applied to each raw item (default: identity)