Teams
List, get, iterate, count, and look up teams within a project using filters, includes, and ordering.
project.teams is a TeamCollection. It supports all methods in the shared collection
contract: list, get, get_or_none, iter, count, one, and first.
Basic list
from optixlog import SDKClient
from optixlog.management import Management
client = SDKClient(base_url="https://optixlog.leidos.com", api_key="sk-opt-...")
mgmt = Management(client)
project = mgmt.project("proj_grating_7f3a")
page = project.teams.list()
for team in page.items:
print(team.id, team.name)Filters
Filter by name (substring match) and/or category. Both filters are AND — a team must
match all supplied filters.
# Teams in the "engineering" category whose name contains "Photonics"
page = project.teams.list(
name="Photonics",
category="engineering",
limit=50,
order_by="name",
order="asc",
)Include member count
Pass include=["counts"] to populate team.member_count. Without it, member_count is
None.
page = project.teams.list(include=["counts"])
for team in page.items:
print(f"{team.name}: {team.member_count} members")Get by id
# Raises NotFoundError if the team does not exist
team = project.teams.get("team-abc123", include=["counts"])
# Returns None instead of raising
team = project.teams.get_or_none("team-abc123")Iterate all teams
iter walks pages automatically. Use it when you don't need cursor control.
for team in project.teams.iter(category="engineering", include=["counts"]):
print(team.name, team.member_count)Count
total = project.teams.count(category="engineering")
print(f"Engineering teams: {total}")Note that count only accepts category as a filter — name is not supported.
Unique lookups
# Exactly one match — raises NotFoundError or MultipleResultsError
team = project.teams.one(name="Photonics Engineering", category="engineering")
# First match or None
team = project.teams.first(category="engineering")Ordering
Order results by name, created_at, updated_at, or category. Default is name ascending.
page = project.teams.list(order_by="created_at", order="desc")Team fields
Prop
Type
Accessing memberships from a team
Once you have a Team object, its memberships attribute is a pre-bound
TeamMembershipCollection scoped to that team. See
Team Memberships.
team = project.teams.get("team-abc123")
for m in team.memberships.iter(include=["user"]):
print(m.user_ref.id, m.role)