Client

Get the current organization

organization = client.get_organization()

Methods

Get IAM integrations

# get the default IAM integration
default_iam_integration = organization.get_default_iam_integration()

# get all of the IAM integrations (returns a list of IAMIntegration objects)
iam_integrations = organization.get_iam_integrations()

for integration in iam_integrations:
  print(integration)

Create a project tag

organization.create_resource_tag(
  {
    "text": "new-tag-name",
    "color": "ffffff"
  }
)

Get the project tags

# get the project tags (returns a list of ResourceTag objects)
tags = organization.get_resource_tags()

for tag in tags:
  print(tag)

Invite users

Depending on the level of access required, you can:
  • Invite users to a workspace without assigning them to any projects.
  • Invite users to a workspace and assign them to specific projects.
# get and view the available roles
roles = client.get_roles()
print("Roles: ", roles)

# create an invitation for an organization-wide role (in this case, a labeler)
organization.invite_user(
    email="<email_address>",
    role=roles["LABELER"]
)

Get pending invites

project_id = "<project_id>"

# For the entire organization
org_invites = organization.get_invites()

# For a specific project
project_invites = organization.get_project_invites(project_id)

Cancel invite

email = "<email_address>""
project_id = "<project_id>"

# Option 1: organization invite
invite = next(
    invite for invite in org.get_invites() if invite.email == email
)

# Option 2: project invite
invite = next(
    invite for invite in org.get_project_invites(project_id) if invite.email == email
)

invite.cancel()

View the invite limit

# already accounts for users currently in the organization, thus:
# 	used = users + invites_sent
# 	remaining = limit - used
organization.invite_limit()

Remove a user

# the argument must be a User object
organization.remove_user(user)

Attributes

Get the basics

# name (str)
organization.name

# created_at (datetime)
organization.created_at

# updated_at (datetime)
organization.updated_at

Get the users

# get the users (relationship to User objects)
users = organization.users()

# inspect one user
next(users)

# inspect all users
for user in users:
  print(user)

# for ease of use, you can convert the paginated collection to a list
list(users)

Get the projects

# get the projects (relationship to Project objects)
projects = organization.projects()

# inspect one project
next(projects)

# inspect all projects
for project in projects:
  print(project)

# for ease of use, you can convert the paginated collection to a list
list(projects)

Get the webhooks

# get the webhooks (relationship to Webhook objects)
webhooks = organization.webhooks()

# inspect one webhook
next(webhooks)

# inspect all webhooks
for webhook in webhooks:
  print(webhook)

# for ease of use, you can convert the paginated collection to a list
list(webhooks)

Get tasks


# All tasks
tasks = organization.tasks()

# Tasks in progress
org_tasks_in_progress = organization.tasks(where=Task.status_as_enum == TaskStatus.In_Progress)

# Failed tasks
org_task_failed = organization.tasks(where=Task.status_as_enum == TaskStatus.Failed)