Planka¶
Root object for interacting with the Planka API
Attributes:
Name | Type | Description |
---|---|---|
auth |
Type[BaseAuth]
|
Authentication method |
url |
str
|
Base url for the Planka instance |
handler |
JSONHandler
|
JSONHandler instance for making requests |
Note
All objects that return a list of objects will return a QueryableList
object. This object is a subclass of list
see the QueryableList
docs for more information
Note
All implemented public properties return API responses with accessed. This means that the values are not cached and will be updated on every access. If you wish to cache values, you are responsible for doing so. By default, property access will always provide the most up to date information.
Example:
>>> len(project.cards)
5
>>> project.create_card('My Card')
>>> len(project.cards)
6
Example
>>> from plankapy import Planka, PasswordAuth
>>> auth = PasswordAuth('username', 'password')
>>> planka = Planka('https://planka.example.com', auth)
>>> planka.me
User(id=...9234, name='username', ...)
Tip
If you want to store a property chain to update later, but dont want to call it by full name, you can use a lambda
Example:
>>> card = lambda: planka.project[0].boards[0].lists[0].cards[0]
>>> comments = lambda: card().comments
>>> len(comments())
2
>>> card().add_comment('My Comment')
>>> len(comments())
3
Tip
All objects inherit the editor
context manager from the Model
class except Planka
.
This means if you want to make changes to something, you can do it directly to attributes
in an editor context instead of calling the model's update
method
Example:
>>> with card.editor():
... card.name = 'My New Card'
... card.description = 'My New Description'
>>> card.name
'My New Card'
Source code in src/plankapy/interfaces.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 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 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 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 424 425 426 427 428 429 430 431 432 433 |
|
auth
property
writable
¶
config
property
¶
Planka Configuration
Returns:
Type | Description |
---|---|
JSONResponse
|
Configuration data |
notifications
property
¶
Queryable List of all notifications for the current user
Returns:
Type | Description |
---|---|
QueryableList[Notification]
|
Queryable List of all notifications |
project_background_images
property
¶
Get Project Background Images
Returns:
Type | Description |
---|---|
QueryableList[BackgroundImage]
|
Queryable List of all project background images |
projects
property
¶
Queryable List of all projects on the Planka instance
Returns:
Type | Description |
---|---|
QueryableList[Project]
|
Queryable List of all projects |
url
property
writable
¶
The current planka url
Returns:
Type | Description |
---|---|
str
|
Planka url |
user_avatars
property
¶
users
property
¶
Queryable List of all users on the Planka instance
Returns:
Type | Description |
---|---|
QueryableList[User]
|
Queryable List of all users |
create_project(*args, **kwargs)
¶
create_project(project: Project) -> Project
create_project(name: str, position: int = None, background: Gradient = None) -> Project
Creates a new project
Note
If no background is provided, a random gradient will be assigned
If no position is provided, the project will be created at position 0
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the project (required) |
required |
position
|
int
|
Position of the project (default: 0) |
required |
background
|
Gradient
|
Background gradient of the project (default: None) |
required |
Alternate
Name | Type | Description | Default |
---|---|---|---|
project
|
Project
|
Project instance to create |
required |
Returns:
Name | Type | Description |
---|---|---|
Project |
Project
|
New project instance |
Example
>>> new_project = planka.create_project('My Project')
>>> new_project.set_background_gradient('blue-xchange') # Set background gradient
>>> new_project.add_project_manager(planka.me) # Add current user as project manager
Source code in src/plankapy/interfaces.py
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
create_user(username, email, password, name=None)
¶
Create a new user
Note
Planka will reject insecure passwords! If creating a user with a specific password fails, try a more secure password
Note
If the username is not lowercase, it will be converted to lowercase
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username
|
str
|
Username of the user (required) |
required |
email
|
str
|
Email address of the user (required) |
required |
password
|
str
|
Password for the user (required) |
required |
name
|
str
|
Full name of the user (default: |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If the username or email already exists |
ValueError
|
If password is insecure or a 400 code is returned |
Source code in src/plankapy/interfaces.py
387 388 389 390 391 392 393 394 395 396 397 398 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 424 425 426 427 428 429 430 431 432 433 |
|