Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.domain.orgs.org_invite

Module Contents

OrgInvite

class roboto.domain.orgs.org_invite.OrgInvite(record, roboto_client=None)#View Source

An invitation to join an organization from one user to another.

Organization invitations allow existing members to invite new users to join their organization. Invitations are created by calling Org.invite_user() and can be accepted or declined by the invited user.

Invitations cannot be created directly through the constructor - they must be created through the organization’s invite_user method.

OrgInvite.accept()

accept()#View Source

Accept this invitation and join the organization.

The invited user becomes a member of the organization with default user role permissions.

Raises

The caller is not the invited user.

The invitation has already been accepted or declined.

Return type

None

Usage

Accept an invitation:

from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
invite.accept()  # Join the organization

OrgInvite.create()

classmethod create(invited_user_id, org_id, roboto_client=None)#View Source

Create a new organization invitation.

Creates an invitation for the specified user to join the organization. This method is typically called internally by Org.invite_user().

Parameters

invited_user_id str

Unique identifier for the user to invite.

org_id str

Unique identifier for the organization.

roboto_client Optional[roboto.http.RobotoClient]

Optional Roboto client instance. If not provided, uses the default client.

Returns

A new OrgInvite instance representing the created invitation.

Raises

The user or organization does not exist.

The user is already a member or has a pending invite.

The caller lacks permission to invite users.

Usage

Create an invitation (typically done via Org.invite_user):

from roboto import OrgInvite
invite = OrgInvite.create("alice@example.com", "org_12345")

OrgInvite.decline()

decline()#View Source

Decline this invitation and do not join the organization.

The invitation is marked as declined and cannot be accepted later.

Raises

The caller is not the invited user.

The invitation has already been accepted or declined.

Return type

None

Usage

Decline an invitation:

from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
invite.decline()  # Do not join the organization

OrgInvite.for_org()

classmethod for_org(org_id, roboto_client=None)#View Source

Retrieve all pending invitations for an organization.

Parameters

org_id str

Unique identifier for the organization.

roboto_client Optional[roboto.http.RobotoClient]

Optional Roboto client instance. If not provided, uses the default client.

Returns

collections.abc.Collection[OrgInvite]

Collection of OrgInvite instances for pending invitations.

Raises

The organization does not exist.

The caller lacks permission to view invitations.

Usage

List all invitations for an organization:

from roboto import OrgInvite
invites = OrgInvite.for_org("org_12345")
for invite in invites:
    print(f"Pending invite for: {invite.invited_user_id}")

OrgInvite.from_id()

classmethod from_id(invite_id, roboto_client=None)#View Source

Load an existing invitation by its unique ID.

Parameters

invite_id str

Unique identifier for the invitation to retrieve.

roboto_client Optional[roboto.http.RobotoClient]

Optional Roboto client instance. If not provided, uses the default client.

Returns

OrgInvite instance for the specified invitation ID.

Raises

No invitation exists with the specified ID.

The caller is not authorized to access this invitation.

Usage

Load an invitation by ID:

from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
print(f"Invited user: {invite.invited_user_id}")

Properties

OrgInvite.invite_id

invite_id str #

Unique identifier for this invitation.

Returns

str

The invitation’s unique ID.

OrgInvite.invited_by_user_id

invited_by_user_id str #

User ID of the person who created this invitation.

Returns

str

The unique identifier of the user who sent the invitation.

OrgInvite.invited_user_id

invited_user_id str #

User ID of the person who was invited.

Returns

str

The unique identifier of the invited user.

OrgInvite.org_id

org_id str #

Organization ID for the organization this invitation is for.

Returns

str

The unique identifier of the organization.

OrgInvite.to_dict()

to_dict()#View Source

Convert this invitation to a dictionary representation.

Returns a JSON-serializable dictionary containing all invitation data.

Returns

dict[str, Any]

Dictionary representation of the invitation.

Usage

Export invitation data:

from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
invite_data = invite.to_dict()
print(f"Invited user: {invite_data.get('user_id')}")

Was this page helpful?