Skip to main content

Members

Overview

The Members module provides methods to interact with members in the BuiltAPI platform. This module allows you to list, retrieve, create, update, and remove members.

Methods

list

List members with optional pagination.

Parameters

  • skip (Optional[int]): Number of members to skip. Default is 0.
  • take (Optional[int]): Number of members to take. Default is 100.

Returns

  • MembersList: A list of members.

Example

from builtapi import BuiltAPI

client = BuiltAPI()
members = client.members.list(skip=0, take=50)
print(members)

one_by_id

Retrieve a single member by their ID.

Parameters

  • id (str): The ID of the member to retrieve.

Returns

  • Member: The member with the specified ID.

Example

from builtapi import BuiltAPI

client = BuiltAPI()
member = client.members.one_by_id(id='member_id')
print(member)

current

Retrieve the current member.

Returns

  • Member: The current member.

Example

from builtapi import BuiltAPI

client = BuiltAPI()
current_member = client.members.current()
print(current_member)

create

Create a new member.

Parameters

  • email (str): The email of the new member.
  • role (MemberRoles): The role of the new member.

Returns

  • Member: The newly created member.

Example

from builtapi import BuiltAPI

client = BuiltAPI()
new_member = client.members.create(email='[email protected]', role='USER')
print(new_member)

update

Update an existing member.

Parameters

  • id (str): The ID of the member to update.
  • role (MemberRoles): The new role of the member.

Returns

  • Member: The updated member.

Example

from builtapi import BuiltAPI

client = BuiltAPI()
updated_member = client.members.update(id='member_id', role='ADMIN')
print(updated_member)

remove

Remove a member by their ID.

Parameters

  • id (str): The ID of the member to remove.

Returns

  • Member: The removed member.

Example

from builtapi import BuiltAPI

client = BuiltAPI()
removed_member = client.members.remove(id='member_id')
print(removed_member)

Schemas

MemberRoles

class MemberRoles(str, Enum):
owner = 'OWNER'
admin = 'ADMIN'
user = 'USER'

Member

class Member(BaseModel):
"""
Dataclass describes Member in BuiltAPI
"""
id: str
createdAt: str
updatedAt: str
workspaceId: str
userId: str
role: MemberRoles
user: Optional[UserProfile] = None

MembersList

class MembersList(BaseModel):
"""
Dataclass describes Members as list
"""
take: int
count: int
total: int
items: List[Member]