Board¶
Bases: Board_
Interface for interacting with planka Boards and their included sub-objects
Note
All implemented public properties return API responses with accessed. This means that the values are not cached and will be updated on every access. If you wish to cache values, you are responsible for doing so. By default, property access will always provide the most up to date information.
| METHOD | DESCRIPTION |
|---|---|
__eq__ |
Check if two model instances are equal |
__getitem__ |
Get the value of an attribute |
__hash__ |
Generate a hash for the model instance so it can be used in mappings ( |
__iter__ |
Iterate over public, assigned model attribute names |
add_user |
Adds a user to the board |
bind |
Bind routes to the model |
create_label |
Creates a new label in the board |
create_list |
Creates a new list in the board |
delete |
Deletes the board |
editor |
Context manager for editing the model |
json |
Dump the model properties to a JSON string |
pickle |
Pickle the model, preserving as much of its state as possible |
refresh |
Refreshes the board data |
remove_user |
Remove a user from a board |
update |
Updates the board with new values |
| ATTRIBUTE | DESCRIPTION |
|---|---|
attachments |
All attachments in the board
TYPE:
|
boardMemberships |
All board memberships
TYPE:
|
cardLabels |
All card -> label relationships in the board
TYPE:
|
cardMemberships |
All card -> user relationships in the board
TYPE:
|
cards |
All cards in the board
TYPE:
|
created_at |
Get the creation date of the model instance
TYPE:
|
deleted_at |
Get the deletion date of the model instance
TYPE:
|
editors |
All users that can edit the board
TYPE:
|
labels |
All labels in the board
TYPE:
|
link |
Get the link to the model instance
TYPE:
|
lists |
All lists in the board
TYPE:
|
project |
Project the board belongs to
TYPE:
|
routes |
Get the routes for the model instance
TYPE:
|
tasks |
All tasks in the board
TYPE:
|
unique_name |
Generate a unique name for the model instance using the last 5 characters of the id
TYPE:
|
updated_at |
Get the last update date of the model instance
TYPE:
|
users |
All users in the board
TYPE:
|
viewers |
All users that can view the board
TYPE:
|
attachments
property
¶
attachments: QueryableList[Attachment]
All attachments in the board
Note
This property is used by the Card class to determine its attachments
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[Attachment]
|
A list of all card attachments in the board |
boardMemberships
property
¶
boardMemberships: QueryableList[BoardMembership]
All board memberships
Note
This property is primarily here for internal use, '.editor' and '.viewer' properties are derived from the board memberships
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[BoardMembership]
|
Queryable List of all membership types (editor, viewer) |
cardLabels
property
¶
cardLabels: QueryableList[CardLabel]
All card -> label relationships in the board
Note
This property is used by the Card class to determine its labels
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[CardLabel]
|
A list of all card labels in the board |
cardMemberships
property
¶
cardMemberships: QueryableList[CardMembership]
All card -> user relationships in the board
Note
This property is used by the Card class to determine its users
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[CardMembership]
|
A list of all card memberships in the board |
cards
property
¶
cards: QueryableList[Card]
All cards in the board
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[Card]
|
A list of all cards in the board |
created_at
property
¶
created_at: datetime | None
Get the creation date of the model instance
| RETURNS | DESCRIPTION |
|---|---|
datetime | None
|
Optional[datetime]: The creation date of the model instance |
deleted_at
property
¶
deleted_at: datetime | None
Get the deletion date of the model instance
| RETURNS | DESCRIPTION |
|---|---|
datetime | None
|
Optional[datetime]: The deletion date of the model instance |
editors
property
¶
editors: QueryableList[User]
All users that can edit the board
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[User]
|
Queryable List of all editors |
labels
property
¶
labels: QueryableList[Label]
All labels in the board
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[Label]
|
Queryable List of all labels in the board |
link
property
¶
link: str | None
Get the link to the model instance
Note
Only Project, Board, and Card models have links.
All other models return None
| RETURNS | DESCRIPTION |
|---|---|
str
|
The link to the model instance
TYPE:
|
lists
property
¶
lists: QueryableList[List]
All lists in the board
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[List]
|
Queryable List of all lists in the board |
project
property
¶
project: Project
Project the board belongs to
Note
All objects include a reference to their parent object and parent objects include a reference to their children This means that you can traverse the entire API structure from any object
| RETURNS | DESCRIPTION |
|---|---|
Project
|
Project instance
TYPE:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
tasks
property
¶
tasks: QueryableList[Task]
All tasks in the board
Note
This property is used by the Card class to determine its tasks
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[Task]
|
A list of all card tasks in the board |
unique_name
property
¶
unique_name: str
Generate a unique name for the model instance using the last 5 characters of the id and the name attribute
| RETURNS | DESCRIPTION |
|---|---|
str
|
The unique name for the model instance in the format {name}_{id[:-5]}
TYPE:
|
updated_at
property
¶
updated_at: datetime | None
Get the last update date of the model instance
| RETURNS | DESCRIPTION |
|---|---|
datetime | None
|
Optional[datetime]: The last update date of the model instance |
users
property
¶
users: QueryableList[User]
All users in the board
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[User]
|
Queryable List of all users |
viewers
property
¶
viewers: QueryableList[User]
All users that can view the board
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[User]
|
Queryable List of all viewers |
__eq__
¶
Check if two model instances are equal
Note
Compares the hash and class of the model instances
Warning
Does not compare the attributes of the model instances, out of sync models with different attributes can still be equal, it's best to refresh the models before comparing.
| PARAMETER | DESCRIPTION |
|---|---|
|
The other model instance to compare
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the model instances are equal, False otherwise
TYPE:
|
Source code in src/plankapy/v1/models.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
__getitem__
¶
__getitem__(key) -> Any
Get the value of an attribute
Warning
This is an implementation detail that allows for the unpacking operations
in the rest of the codebase, all model attributes are still directly accessible
through __getattribute___
Note
Returns None if the attribute is Unset or starts with an underscore
Example
print(model['name'])
>>> "Model Name"
model.name = Unset
print(model['name'])
>>> None
Source code in src/plankapy/v1/models.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
__hash__
¶
__hash__() -> int
Generate a hash for the model instance so it can be used in mappings (dict, set)
Note
All Models are still mutable, but their ID value is unique
| RETURNS | DESCRIPTION |
|---|---|
int
|
The hash value of the model instance
TYPE:
|
Example
board_map = {
Board(name="Board 1"): board.,
Board(name="Board 2"): "Board 2"
}
>>> 1
Source code in src/plankapy/v1/models.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
__iter__
¶
__iter__()
Iterate over public, assigned model attribute names
Warning
This is used in conjunction with __getitem__ to unpack assigned values.
This allows model state to be passed as keyword arguments to functions
Example:
model = Model(name="Model Name", position=1, other=Unset)
def func(name=None, position=None):
return {"name": name, "position": position}
print(func(**model))
>>> {'name': 'Model Name', 'position': 1}
None values to be assigned during
a PATCH request to delete data
Note
Skips attributes that are Unset or start with an underscore
| RETURNS | DESCRIPTION |
|---|---|
Iterator
|
The iterator of the model attributes |
Example
# Skip Private attributes
print(list(model.__dict__))
>>> ['_privateattribute', 'name', 'position', 'id']
print(list(model))
>>> ['name', 'position', 'id'] # Skips _privateattribute
# Skip Unset attributes
print(model.___dict___)
>>> {'_privateattribute': 'Private', 'name': 'Model Name', 'position': Unset, 'id': 1}
items = dict(model.items())
print(items)
>>> {'name': 'Model Name', 'id': 1} # Skips position because it's Unset
Source code in src/plankapy/v1/models.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
add_user
¶
add_user(user: User, role: BoardRole = 'viewer', canComment: bool = False) -> BoardMembership
Adds a user to the board
| PARAMETER | DESCRIPTION |
|---|---|
|
User instance to add
TYPE:
|
|
Whether the user can comment on the board (default: False)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BoardMembership
|
New board membership
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the role is invalid (must be 'viewer' or 'editor') |
Source code in src/plankapy/v1/interfaces.py
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | |
bind
¶
Bind routes to the model Args: routes (Routes): The routes to bind to the model instance
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Self for chain operations |
Example
model = Model(**kwargs).bind(routes)
Source code in src/plankapy/v1/models.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
create_label
¶
create_label(label: Label) -> Label
create_label(*args, **kwargs) -> Label
Creates a new label in the board
| PARAMETER | DESCRIPTION |
|---|---|
|
Name of the label (required)
TYPE:
|
|
Position of the label (default: 0)
TYPE:
|
|
Color of the label (default: "berry-red")
TYPE:
|
| ALTERNATE | DESCRIPTION |
|---|---|
|
Label instance to create
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Label
|
New label instance
TYPE:
|
Example
>>> new_label = board.create_label('My Label')
>>> label = Label(name='My Label', position=0, color='wet-moss')
>>> new_label2 = board.create_label(label)
Source code in src/plankapy/v1/interfaces.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | |
create_list
¶
create_list(*args, **kwargs) -> List
Creates a new list in the board
| PARAMETER | DESCRIPTION |
|---|---|
|
Name of the list (required)
TYPE:
|
|
Position of the list (default: 0)
TYPE:
|
| ALTERNATE | DESCRIPTION |
|---|---|
|
List instance to create
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
List
|
New list instance
TYPE:
|
Example
>>> new_list = board.create_list('My List')
>>> l = List(name='My List', position=0)
>>> new_list2 = board.create_list(l)
Source code in src/plankapy/v1/interfaces.py
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | |
delete
¶
delete() -> Board
Deletes the board
Danger
This action is irreversible and cannot be undone
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Deleted board instance
TYPE:
|
Source code in src/plankapy/v1/interfaces.py
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | |
editor
¶
Context manager for editing the model
Example
print(model.name)
>>> "Old Name"
with model.editor() as m:
m.name = "New Name"
m.position = 1
print(model.name)
>>> "New Name"
Source code in src/plankapy/v1/models.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
json
¶
json() -> str
Dump the model properties to a JSON string
Note
Only properties defined in the {Model}_ dataclass are dumped.
All relationships and included items (e.g. board.cards) are lost.
If you wish to preserve these relationships, use the .pickle method
| RETURNS | DESCRIPTION |
|---|---|
str
|
(str) : A JSON string with the Model attributes |
Source code in src/plankapy/v1/models.py
132 133 134 135 136 137 138 139 140 141 142 143 | |
pickle
¶
pickle() -> bytes
Pickle the model, preserving as much of its state as possible
Warning
This method currently works, and since the object data is updated by routes
You can use this to store a reference to a specific object. The data will be
maintained until operations that trigger a .refresh() call are made, e.g.
using the .editor() context.
| RETURNS | DESCRIPTION |
|---|---|
bytes
|
(bytes) : Raw bytes generated by |
Source code in src/plankapy/v1/models.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
refresh
¶
refresh() -> None
Refreshes the board data
Source code in src/plankapy/v1/interfaces.py
1145 1146 1147 1148 | |
remove_user
¶
remove_user(user: User) -> User
remove_user(userId: int) -> User
remove_user(*args, **kwargs) -> User
Remove a user from a board
Source code in src/plankapy/v1/interfaces.py
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | |
update
¶
update() -> Board
update(board: Board) -> Board
update(*args, **kwargs) -> Board
Updates the board with new values
| PARAMETER | DESCRIPTION |
|---|---|
|
Name of the board (optional)
TYPE:
|
|
Position of the board (optional)
TYPE:
|
| ALTERNATE | DESCRIPTION |
|---|---|
|
Board instance to update (required)
TYPE:
|
Note
If no arguments are provided, the board will update itself with the current values stored in its attributes
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Updated board instance
TYPE:
|
Source code in src/plankapy/v1/interfaces.py
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | |