Links
albert.collections.links
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
client_credentials: ClientCredentials | None = None,
retries: int | None = None,
)
Bases: Session
A session that has a base URL, which is prefixed to all request URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL to prefix to all requests. (e.g., "https://sandbox.albertinvent.com") |
required |
retries
|
int
|
The number of retries for failed requests. Defaults to 3. |
None
|
client_credentials
|
ClientCredentials | None
|
The client credentials for programmatic authentication. Optional if token is provided. |
None
|
token
|
str | None
|
The JWT token for authentication. Optional if client credentials are provided. |
None
|
Methods:
Name | Description |
---|---|
request |
|
Source code in src/albert/session.py
request
Source code in src/albert/session.py
BaseCollection
BaseCollection(*, session: AlbertSession)
BaseCollection is the base class for all collection classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert API Session instance. |
required |
Source code in src/albert/collections/base.py
Link
Bases: BaseResource
A link in Albert.
Attributes:
Name | Type | Description |
---|---|---|
parent |
EntityLink
|
The parent entity of the link. |
child |
EntityLink
|
The child entity of the link. |
category |
LinkCategory
|
The category of the link. Allowed values are |
id |
str | None
|
The Albert ID of the link. Set when the link is retrieved from Albert. |
counter |
int | None
|
The counter of the link. Optional. |
LinkCategory
LinksCollection
LinksCollection(*, session: AlbertSession)
Bases: BaseCollection
LinksCollection is a collection class for managing Link entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Creates a new link entity. |
delete |
Deletes a link entity by its ID. |
get_by_id |
Retrieves a link entity by its ID. |
list |
Generates a list of link entities with optional filters. |
Source code in src/albert/collections/links.py
create
Creates a new link entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
links
|
list[Link]
|
List of Link entities to create. |
required |
Returns:
Type | Description |
---|---|
Link
|
The created link entity. |
Source code in src/albert/collections/links.py
delete
delete(*, id: str) -> None
Deletes a link entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the link entity to delete. |
required |
get_by_id
list
list(
*,
limit: int = 100,
type: str | None = None,
category: LinkCategory | None = None,
id: str | None = None,
) -> Iterator[Link]
Generates a list of link entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of link entities to return. |
100
|
type
|
str
|
The type of the link entities to return. Allowed values are |
None
|
category
|
LinkCategory
|
The category of the link entities to return. Allowed values are |
None
|
id
|
str
|
The ID of the link entity to return. (Use with |
None
|
Returns:
Type | Description |
---|---|
Iterator[Link]
|
An iterator of Links. |