jetraw.links module¶
Link management for Jetraw invitation links.
This module provides functionality to create and manage invitation links that allow external users to create accounts and join Jetraw organizations.
- class jetraw.links.Link(link, client)¶
Bases:
object
Represents a Jetraw invitation link.
Invitation links allow external users to create accounts and join the Jetraw organization. Links can be created, listed, and revoked.
Example
>>> # Create a new invitation link >>> link = create_link("Invite new team members") >>> print(link.url) # Share this URL with external users >>> >>> # Revoke the link >>> link.revoke()
- property created_at: datetime¶
Get the timestamp when the link was created.
- property created_by: str¶
Get the user ID who created the link.
- property id: str¶
Get the unique identifier of the link.
- revoke()¶
Revoke the invitation link.
Once revoked, the link can no longer be used to create accounts.
- Raises:
RuntimeError – If the link revocation fails
Example
>>> link = create_link("Team invitation") >>> link.revoke() # Link is now inactive
- property revoked_at: datetime¶
Get the timestamp when the link was revoked (None if active).
- property revoked_by: str¶
Get the user ID who revoked the link (None if active).
- property summary: str¶
Get the summary/description of the link.
- property url: str¶
Get the invitation URL.
This is the URL that external users can use to create accounts and join the Jetraw organization.
- jetraw.links.create_link(summary, *, client=None)¶
Create a new invitation link.
- Parameters:
summary (
str
) – Description/summary of the invitation linkclient (
Client
) – Jetraw client instance (uses default if None)
- Returns:
The created invitation link
- Return type:
- Raises:
RuntimeError – If the link creation fails
Example
>>> # Create an invitation link >>> link = create_link("Invite new team members") >>> print(f"Share this URL: {link.url}")
- jetraw.links.list_links(*, client=None)¶
List all invitation links for the organization.
- Parameters:
client (
Client
) – Jetraw client instance (uses default if None)- Returns:
List of all invitation links (active and revoked)
- Return type:
list[Link]
- Raises:
RuntimeError – If listing links fails
Example
>>> # List all invitation links >>> links = list_links() >>> for link in links: ... status = "Active" if link.revoked_at is None else "Revoked" ... print(f"{link.summary}: {status}")