Transactional
Note
This Class is not meant to be instantiated directly, but rather accessed through the transactional
Property on an
instance of Client. For more details, see the Guide.
list_modules
list_modules() -> list[Module]
get_model_status
get_model_status() -> ModelStatus
Gets the current status of the Model.
Returns:
Type | Description |
---|---|
ModelStatus
|
The current status of the Mode. |
list_line_items
list_line_items(only_module_id: int | None = None) -> list[LineItem]
Lists all the Line Items in the Model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
only_module_id
|
int | None
|
If provided, only Line Items from this Module will be returned. |
None
|
Returns:
Type | Description |
---|---|
list[LineItem]
|
The List of Line Items. |
list_lists
list_lists() -> list[List]
get_list_metadata
get_list_metadata(list_id: int) -> ListMetadata
Gets the metadata for a List.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_id
|
int
|
The ID of the List. |
required |
Returns:
Type | Description |
---|---|
ListMetadata
|
The Metadata for the List. |
get_list_items
get_list_items(list_id: int) -> list[ListItem]
Gets all the items in a List.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_id
|
int
|
The ID of the List. |
required |
Returns:
Type | Description |
---|---|
list[ListItem]
|
The List of Items. |
insert_list_items
insert_list_items(
list_id: int, items: list[dict[str, str | int | dict]]
) -> InsertionResult
Insert new items to the given list. The items must be a list of dictionaries with at least
the keys code
and name
. You can optionally pass further keys for parents, extra
properties etc. If you pass a long list, it will be split into chunks of 100,000 items, the
maximum allowed by the API.
Warning: If one or some of the requests timeout during large batch operations, the operation may actually complete on the server. Retries for these chunks will then report these items as "ignored" rather than "added", leading to misleading results. The results in Anaplan will be correct, but this function may report otherwise. Be generous with your timeouts and retries if you are using this function for large batch operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_id
|
int
|
The ID of the List. |
required |
items
|
list[dict[str, str | int | dict]]
|
The items to insert into the List. |
required |
Returns:
Type | Description |
---|---|
InsertionResult
|
The result of the insertion, indicating how many items were added, ignored or failed. |
delete_list_items
delete_list_items(list_id: int, items: list[dict[str, str | int]]) -> int
Deletes items from a List. If you pass a long list, it will be split into chunks of 100,000 items, the maximum allowed by the API.
Warning: If one or some of the requests timeout during large batch operations, the operation may actually complete on the server. Retries for these chunks will then report none of these items as deleted, since on the retry none are removed, leading to misleading results. The results in Anaplan will be correct, but this function may report otherwise. Be generous with your timeouts and retries if you are using this function for large batch operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_id
|
int
|
The ID of the List. |
required |
items
|
list[dict[str, str | int]]
|
The items to delete from the List. Must be a dict with either |
required |
reset_list_index
reset_list_index(list_id: int) -> None
Resets the index of a List. The List must be empty to do so.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_id
|
int
|
The ID of the List. |
required |
update_module_data
update_module_data(
module_id: int, data: list[dict[str, Any]]
) -> int | dict[str, Any]
Write the passed items to the specified module. If successful, the number of cells changed is returned, if only partially successful or unsuccessful, the response with the according details is returned instead.
You can update a maximum of 100,000 cells or 15 MB of data (whichever is lower) in a single request. You must chunk your data accordingly. This is not done by this SDK, since it is discouraged. For larger imports, you should use the Bulk API instead.
For more details see: https://anaplan.docs.apiary.io/#UpdateModuleCellData.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module_id
|
int
|
The ID of the Module. |
required |
data
|
list[dict[str, Any]]
|
The data to write to the Module. |
required |
Returns:
Type | Description |
---|---|
int | dict[str, Any]
|
The number of cells changed or the response with the according error details. |