Pagination
Page[T] generic container, cursor-based iteration, and the Order alias.
The OptixLog SDK uses cursor-based pagination throughout the Management API. Every .list() call returns a Page[T]; every .iter() call walks all pages automatically.
from optixlog import Page, OrderPage[T]
A generic frozen dataclass containing one page of results.
Signature
@dataclass(frozen=True)
class Page(Generic[T]):
items: list[T]
next_cursor: str | None
total: int | None = NoneFields
Prop
Type
Order alias
Order = Literal["asc", "desc"]Every .list() and .iter() call accepts an order parameter of type Order. Pass "asc" for oldest-first / alphabetically ascending; pass "desc" for newest-first / descending. Default varies by collection (see each collection's reference page).
Manual cursor iteration
Use .list() when you want control over which pages you fetch:
from optixlog import SDKClient
from optixlog.management import Management
client = SDKClient(base_url="https://optixlog.leidos.com", api_key="sk-opt-...")
teams_col = Management(client).project("proj_grating_7f3a").teams
cursor = None
while True:
page = teams_col.list(limit=20, cursor=cursor)
for team in page.items:
print(team.id, team.name)
if page.next_cursor is None:
break
cursor = page.next_cursorAutomatic iteration with .iter()
Every collection exposes an .iter() method that walks all pages automatically. It yields individual items — you do not need to manage cursors:
from optixlog import SDKClient
from optixlog.management import Management
client = SDKClient(base_url="https://optixlog.leidos.com", api_key="sk-opt-...")
nodes_col = Management(client).project("proj_grating_7f3a").workflow_nodes
for node in nodes_col.iter(label="SimulationNode", order="desc"):
print(node.id, node.display_name).iter() makes as many network requests as needed to exhaust the result set. For large collections, consider using .list() with a cursor instead to process pages incrementally.
Counting without fetching items
Use .count() to get the total number of matching records without fetching any items:
total = Management(client).project("proj_grating_7f3a").teams.count()
print(f"Total teams: {total}")
simulation_count = Management(client).project("proj_grating_7f3a").workflow_nodes.count(
label="SimulationNode"
)
print(f"Simulation nodes: {simulation_count}")