Skip to main content

resolve_version

Function resolve_version 

Source
pub fn resolve_version(
    raw: &str,
    versions: &[PageVersion],
    relative_to: u32,
) -> Result<u32>
Expand description

Resolves a user-supplied version reference against a list of PageVersion records returned by ConfluenceApi::list_page_versions.

Accepts:

  • "latest" — the newest known version (versions[0].number).
  • "previous" — the version immediately before relative_to.
  • "v-N" (e.g. "v-2") — the version relative_to - N.
  • Numeric ("5") — that exact version; must be present in versions.
  • ISO 8601 date — the most recent version whose created_at <= the given date. Detected when the input contains - or T.

relative_to anchors "previous" and "v-N". Pass the resolved to version when resolving from, so previous always means “one before to” regardless of what to itself is.

versions must be ordered newest-first (the natural shape returned by list_page_versions).