Models¶
| CLASS | DESCRIPTION |
|---|---|
Action_ |
Action Model |
Archive_ |
Archive Model |
Attachment_ |
Attachment Model |
BoardMembership_ |
Board Membership Model |
Board_ |
Board Model |
CardLabel_ |
Card Label Model |
CardMembership_ |
Card Membership Model |
CardSubscription_ |
Card Subscription Model |
Card_ |
Card Model |
IdentityProviderUser_ |
Identity Provider User Model |
Label_ |
Label Model |
List_ |
List Model |
Model |
Implements common magic methods for all Models |
Notification_ |
Notification Model |
ProjectManager_ |
Project Manager Model |
Project_ |
Project Model |
QueryableList |
A list of Queryable objects |
Stopwatch |
Stopwatch Model |
Task_ |
Task Model |
User_ |
User Model |
Action_
dataclass
¶
Action_(id: int | None = Unset, type: ActionType | None = Required, data: dict | None = Required, cardId: int | None = Required, userId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Action Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the action
TYPE:
|
type |
The type of the action
TYPE:
|
data |
The data of the action
TYPE:
|
cardId |
The ID of the card the action is associated with
TYPE:
|
userId |
The ID of the user who created the action
TYPE:
|
createdAt |
The creation date of the action
TYPE:
|
updatedAt |
The last update date of the action
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Archive_
dataclass
¶
Archive_(fromModel: str | None = Required, originalRecordId: int | None = Required, originalRecord: dict | None = Required)
Bases: Model
Archive Model
Warning
This model is currently unavailable in the Planka API
| ATTRIBUTE | DESCRIPTION |
|---|---|
fromModel |
The model the archive is from
TYPE:
|
originalRecordId |
The ID of the original record
TYPE:
|
originalRecord |
The original record
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Attachment_
dataclass
¶
Attachment_(id: int | None = Unset, name: str | None = Required, dirname: Literal['public', 'private/attachments'] | None = Required, filename: str | None = Required, image: dict | None = Unset, url: str | None = Unset, coverUrl: str | None = Unset, cardId: int | None = Required, creatorUserId: int | None = Unset, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Attachment Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the attachment
TYPE:
|
name |
The name of the attachment
TYPE:
|
url |
The URL of the attachment
TYPE:
|
cardId |
The ID of the card the attachment is associated with
TYPE:
|
dirname |
The directory name of the attachment
TYPE:
|
filename |
The filename of the attachment
TYPE:
|
image |
The image of the attachment in the format
TYPE:
|
url |
The URL of the attachment
TYPE:
|
coverUrl |
The cover URL of the attachment
TYPE:
|
cardId |
The ID of the card the attachment is associated with
TYPE:
|
creatorUserId |
The ID of the user who created the attachment
TYPE:
|
createdAt |
The creation date of the attachment
TYPE:
|
updatedAt |
The last update date of the attachment
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
BoardMembership_
dataclass
¶
BoardMembership_(id: int | None = Unset, role: BoardRole | None = Required, canComment: bool | None = Unset, boardId: int | None = Required, userId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Board Membership Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the board membership
TYPE:
|
role |
The role of the board membership
TYPE:
|
canComment |
The comment permission of the board membership
TYPE:
|
boardId |
The ID of the board the membership is associated with
TYPE:
|
userId |
The ID of the user the membership is associated with
TYPE:
|
createdAt |
The creation date of the board membership
TYPE:
|
updatedAt |
The last update date of the board membership
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Board_
dataclass
¶
Board_(id: int | None = Unset, name: str | None = Required, position: int | None = Required, projectId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Board Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the board
TYPE:
|
name |
The name of the board
TYPE:
|
description |
The description of the board
TYPE:
|
isClosed |
The closed status of the board
TYPE:
|
isStarred |
The starred status of the board
TYPE:
|
createdAt |
The creation date of the board
TYPE:
|
updatedAt |
The last update date of the board
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
CardLabel_
dataclass
¶
CardLabel_(id: int | None = Unset, cardId: int | None = Required, labelId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Card Label Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the card label
TYPE:
|
cardId |
The ID of the card the label is associated with
TYPE:
|
labelId |
The ID of the label the card is associated with
TYPE:
|
createdAt |
The creation date of the card label
TYPE:
|
updatedAt |
The last update date of the card label
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
CardMembership_
dataclass
¶
CardMembership_(id: int | None = Unset, cardId: int | None = Required, userId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Card Membership Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the card membership
TYPE:
|
cardId |
The ID of the card the membership is associated with
TYPE:
|
userId |
The ID of the user the membership is associated with
TYPE:
|
createdAt |
The creation date of the card membership
TYPE:
|
updatedAt |
The last update date of the card membership
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
CardSubscription_
dataclass
¶
CardSubscription_(id: int | None = Unset, cardId: int | None = Required, userId: int | None = Required, isPermanent: bool | None = Unset, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Card Subscription Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the card subscription
TYPE:
|
cardId |
The ID of the card the subscription is associated with
TYPE:
|
userId |
The ID of the user the subscription is associated with
TYPE:
|
createdAt |
The creation date of the card subscription
TYPE:
|
updatedAt |
The last update date of the card subscription
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Card_
dataclass
¶
Card_(id: int | None = Unset, name: str | None = Required, position: int | None = Required, description: str | None = Unset, dueDate: str | None = Unset, isDueDateCompleted: bool | None = Unset, stopwatch: Stopwatch | None = Unset, boardId: int | None = Required, listId: int | None = Required, creatorUserId: int | None = Unset, coverAttachmentId: int | None = Unset, isSubscribed: bool | None = Unset, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Card Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the card
TYPE:
|
name |
The name of the card
TYPE:
|
position |
The position of the card
TYPE:
|
description |
The description of the card
TYPE:
|
dueDate |
The due date of the card
TYPE:
|
isDueDateCompleted |
The due date completion status of the card
TYPE:
|
stopwatch |
The stopwatch associated with the card
TYPE:
|
boardId |
The ID of the board the card is associated with
TYPE:
|
listId |
The ID of the list the card is associated with
TYPE:
|
creatorUserId |
The ID of the user who created the card
TYPE:
|
coverAttachmentId |
The ID of the cover attachment of the card
TYPE:
|
isSubscribed |
The current user's subscription status with the card
TYPE:
|
createdAt |
The creation date of the card
TYPE:
|
updatedAt |
The last update date of the card
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
IdentityProviderUser_
dataclass
¶
IdentityProviderUser_(id: int | None = Unset, issuer: str | None = Unset, sub: str | None = Unset, userId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Identity Provider User Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the identity provider user
TYPE:
|
issuer |
The issuer of the identity provider user
TYPE:
|
sub |
The sub of the identity provider user
TYPE:
|
userId |
The ID of the user the identity provider user is associated with
TYPE:
|
createdAt |
The creation date of the identity provider user
TYPE:
|
updatedAt |
The last update date of the identity provider user
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Label_
dataclass
¶
Label_(id: int | None = Unset, name: str | None = Required, position: int | None = Required, color: str | None = Required, boardId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Label Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the label
TYPE:
|
name |
The name of the label
TYPE:
|
position |
The position of the label
TYPE:
|
color |
The color of the label
TYPE:
|
boardId |
The ID of the board the label is associated with
TYPE:
|
createdAt |
The creation date of the label
TYPE:
|
updatedAt |
The last update date of the label
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
List_
dataclass
¶
List_(id: int | None = Unset, name: str | None = Required, position: int | None = Required, boardId: int | None = Required, color: str | None = Unset, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
List Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the list
TYPE:
|
name |
The name of the list
TYPE:
|
position |
The position of the list
TYPE:
|
boardId |
The ID of the board the list is associated with
TYPE:
|
color |
The color of the list
TYPE:
|
createdAt |
The creation date of the list
TYPE:
|
updatedAt |
The last update date of the list
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Model
¶
Bases: Mapping
Implements common magic methods for all Models
- Plankapy v1 Models
-
Archive
__eq__ -
Plankapy v1
-
Models
-
Action___eq__ -
Archive___eq__ -
Attachment___eq__ -
BoardMembership___eq__ -
Board___eq__ -
CardLabel___eq__ -
CardMembership___eq__ -
CardSubscription___eq__ -
Card___eq__ -
IdentityProviderUser___eq__ -
Label___eq__ -
List___eq__ -
Model__eq__ -
Notification___eq__ -
ProjectManager___eq__ -
Project___eq__ -
Stopwatch__eq__ -
Task___eq__ -
User___eq__
-
- User Interfaces
- Card Interfaces
- Board Interfaces
- Project Interfaces
-
Models
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
| ATTRIBUTE | DESCRIPTION |
|---|---|
created_at |
Get the creation date of the model instance
TYPE:
|
deleted_at |
Get the deletion date of the model instance
TYPE:
|
link |
Get the link to the model instance
TYPE:
|
routes |
Get the routes for the model instance
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:
|
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Notification_
dataclass
¶
Notification_(id: int | None = Unset, isRead: bool = Required, userId: int | None = Required, actionId: int | None = Required, cardId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Notification Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the notification
TYPE:
|
isRead |
The read status of the notification
TYPE:
|
userId |
The ID of the user the notification is associated with
TYPE:
|
actionId |
The ID of the action the notification is associated with
TYPE:
|
cardId |
The ID of the card the notification is associated with
TYPE:
|
createdAt |
The creation date of the notification
TYPE:
|
updatedAt |
The last update date of the notification
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
ProjectManager_
dataclass
¶
ProjectManager_(id: int | None = Unset, projectId: int | None = Required, userId: int | None = Required, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Project Manager Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the project manager
TYPE:
|
projectId |
The ID of the project the manager is associated with
TYPE:
|
userId |
The ID of the user the manager is associated with
TYPE:
|
createdAt |
The creation date of the project manager
TYPE:
|
updatedAt |
The last update date of the project manager
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Project_
dataclass
¶
Project_(id: int | None = Unset, name: str | None = Required, background: dict | None = Unset, backgroundImage: BackgroundImage | None = Unset, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Project Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the project
TYPE:
|
name |
The name of the project
TYPE:
|
background |
The background of the project
TYPE:
|
backgroundImage |
The background image of the project
TYPE:
|
createdAt |
The creation date of the project
TYPE:
|
updatedAt |
The last update date of the project
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
QueryableList
¶
A list of Queryable objects
This class is a subclass of the built-in list class that allows for querying the list of objects.
-
Plankapy v1
- Board Interfaces
- Card Interfaces Card
-
Models
QueryableList - Planka
- Project Interfaces Project
- QueryableList
- User Interfaces User
| METHOD | DESCRIPTION |
|---|---|
filter_where |
Filter the list of objects by keyword arguments |
order_by |
Order the list by a key |
pop_where |
Get the first object that matches the filter |
select_where |
Select objects from the list that match a function |
take |
Take the first n objects from the list |
filter_where
¶
filter_where(**kwargs) -> QueryableList[M] | None
Filter the list of objects by keyword arguments
| PARAMETER | DESCRIPTION |
|---|---|
|
See Model for the available attributes
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[M] | None
|
QueryableList[M]: The objects that match the filter or None if no objects match |
Example:
>>> users = QueryableList(project.users)
>>> users
[User(id=1, name='Bob'), User(id=2, name='Alice'), User(id=3, name='Bob')]
>>> users.filter_where(name='Bob')
[User(id=1, name='Bob'), User(id=3, name='Bob')]
Source code in src/plankapy/v1/models.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
order_by
¶
order_by(key: str, desc: bool = False) -> QueryableList[M]
Order the list by a key
| PARAMETER | DESCRIPTION |
|---|---|
|
The key to order by
TYPE:
|
|
True to order in descending order, False otherwise
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[M]
|
QueryableList[M]: The list of objects ordered by the key |
Example:
>>> users = QueryableList(project.users)
>>> users
[User(name='Bob'), User(name='Alice')]
>>> users = users.order_by('name')
>>> users
[User(name='Alice'), User(name='Bob')]
>>> users = users.order_by('name', desc=True)
>>> users
[User(name='Bob'), User(name='Alice')]
Source code in src/plankapy/v1/models.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | |
pop_where
¶
pop_where(**kwargs) -> M | None
Get the first object that matches the filter
| PARAMETER | DESCRIPTION |
|---|---|
|
Keyword arguments to filter the list by
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
M
|
The first object that matches the filter
TYPE:
|
Example:
>>> users = QueryableList(project.users)
>>> users
[User(id=1, name='Bob'), User(id=2, name='Alice'), User(id=3, name='Bob')]
>>> users.pop_where(name='Bob')
User(id=1, name='Bob')
>>> user = users.pop_where(name='Frank')
>>> user
None
Source code in src/plankapy/v1/models.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | |
select_where
¶
select_where(predicate: Callable[[M], bool]) -> QueryableList[M]
Select objects from the list that match a function
| PARAMETER | DESCRIPTION |
|---|---|
|
A function that takes an object and returns a boolean |
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[M]
|
QueryableList[M]: The objects that match the function |
Example:
>>> users = QueryableList(project.users)
>>> users
[User(id=1, name='Bob'), User(id=2, name='Alice'), User(id=3, name='Frank')]
>>> users = users.select_where(lambda x: x.name in ('Bob', 'Alice'))
>>> users
[User(id=1, name='Bob'), User(id=2, name='Alice')]
Source code in src/plankapy/v1/models.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
take
¶
take(n: int) -> QueryableList[M]
Take the first n objects from the list
| PARAMETER | DESCRIPTION |
|---|---|
|
The number of objects to take
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[M]
|
QueryableList[M]: The first n objects in the list, if n is greater than the length of the list, the list is padded with |
Example:
>>> users = QueryableList(project.users)
>>> users.take(2)
[User(name='Alice'), User(name='Bob')]
>>> users.take(3)
[User(name='Alice'), User(name='Bob'), None]
Source code in src/plankapy/v1/models.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
Stopwatch
dataclass
¶
Bases: Model
Stopwatch Model
Note
The stopwatch model is not a regular interface and instead is dynamically generated on
Access through the Card .stopwatch attribute. There is an override that intercepts
__getitem__ to return a Stopwatch.
All Stopwatch methods directly update the .stopwatch attribute of the linked Card
instance.
| ATTRIBUTE | DESCRIPTION |
|---|---|
startedAt |
The start date of the stopwatch
TYPE:
|
total |
The total time of the stopwatch (in seconds)
TYPE:
|
_card |
The card the stopwatch is associated with (Managed by the
TYPE:
|
- Plankapy v1 Card Interfaces Card
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
set |
Set an amount of time for the stopwatch |
start |
Starts the stopwatch |
start_time |
Returns the datetime the stopwatch was started |
stop |
Stops the stopwatch |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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 | |
set
¶
Set an amount of time for the stopwatch
| PARAMETER | DESCRIPTION |
|---|---|
|
Hours to set
TYPE:
|
|
Minutes to set
TYPE:
|
|
Seconds to set
TYPE:
|
Source code in src/plankapy/v1/models.py
674 675 676 677 678 679 680 681 682 683 684 | |
start
¶
start() -> None
Starts the stopwatch
Source code in src/plankapy/v1/models.py
652 653 654 655 656 657 658 659 | |
start_time
¶
start_time() -> datetime
Returns the datetime the stopwatch was started
Source code in src/plankapy/v1/models.py
647 648 649 650 | |
stop
¶
stop() -> None
Stops the stopwatch
Source code in src/plankapy/v1/models.py
661 662 663 664 665 666 667 668 669 670 671 672 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
Task_
dataclass
¶
Task_(id: int | None = Unset, name: str | None = Required, position: int | None = Required, isCompleted: bool = Unset, cardId: int | None = Unset, createdAt: str | None = Unset, updatedAt: str | None = Unset)
Bases: Model
Task Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the task
TYPE:
|
name |
The name of the task
TYPE:
|
position |
The position of the task
TYPE:
|
isCompleted |
The completion status of the task
TYPE:
|
cardId |
The ID of the card the task is associated with
TYPE:
|
createdAt |
The creation date of the task
TYPE:
|
updatedAt |
The last update date of the task
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |
User_
dataclass
¶
User_(id: int | None = Unset, name: str | None = Required, username: str | None = Unset, email: str | None = Required, language: str | None = Unset, organization: str | None = Unset, phone: str | None = Unset, avatarUrl: str | None = Unset, isSso: bool | None = Unset, isAdmin: bool = Unset, isDeletionLocked: bool = Unset, isLocked: bool = Unset, isRoleLocked: bool = Unset, isUsernameLocked: bool = Unset, subscribeToOwnCards: bool = Unset, createdAt: str | None = Unset, updatedAt: str | None = Unset, deletedAt: str | None = Unset)
Bases: Model
User Model
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The ID of the user
TYPE:
|
name |
The name of the user
TYPE:
|
username |
The username of the user
TYPE:
|
email |
The email of the user
TYPE:
|
language |
The language of the user
TYPE:
|
organization |
The organization of the user
TYPE:
|
phone |
The phone of the user
TYPE:
|
avatarUrl |
The avatar URL of the user
TYPE:
|
isSso |
The SSO status of the user
TYPE:
|
isAdmin |
The admin status of the user
TYPE:
|
isDeletionLocked |
The deletion lock status of the user
TYPE:
|
isLocked |
The lock status of the user
TYPE:
|
isRoleLocked |
The role lock status of the user
TYPE:
|
isUsernameLocked |
The username lock status of the user
TYPE:
|
subscribeToOwnCards |
The subscription status of the user
TYPE:
|
createdAt |
The creation date of the user
TYPE:
|
updatedAt |
The last update date of the user
TYPE:
|
deletedAt |
The deletion date of the user
TYPE:
|
| 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 |
bind |
Bind routes to the model |
delete |
Delete the model instance |
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 |
"Refresh the model instance |
update |
Update the model instance |
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 |
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:
|
routes
property
writable
¶
routes: Routes
Get the routes for the model instance
| RETURNS | DESCRIPTION |
|---|---|
Routes
|
The routes bound to the model instance
TYPE:
|
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 |
__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 | |
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 | |
delete
¶
delete()
Delete the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
313 314 315 316 317 318 | |
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()
"Refresh the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
306 307 308 309 310 311 | |
update
¶
update()
Update the model instance Note: Method is implemented in the child classes, but is not required
Source code in src/plankapy/v1/models.py
299 300 301 302 303 304 | |