Skip to content

Add get_by_name to Users, Groups, and Schedules endpoints (unique-by-name types) #1837

Description

@jacalata

Sites already has get_by_name(site_name) -> SiteItem. Three other endpoints have server-enforced unique names and would benefit from the same shape:

  • Users — usernames unique per site.
  • Groups — group names unique per site.
  • Schedules — server throws ScheduleNameExistsException on duplicate name.

Proposal:

# UsersEndpoint
def get_by_name(self, username: str) -> UserItem | None:
    matches = list(self.filter(name=username))
    return matches[0] if matches else None

This formalizes a naming pattern across the API surface:

  • get_by_* returns a single item (or None/raises when not found). Use when the lookup key is unique on the server.
  • filter(...) returns a lazy QuerySet[T] for chaining or when multiplicity is possible.

Callers with unique-name types get a natural T | None shape. Callers with multi-name endpoints (workbooks/datasources/views/flows/projects) continue to use .filter(name=name).

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions