Planka¶
Root object for interacting with the Planka API
| ATTRIBUTE | DESCRIPTION |
|---|---|
auth |
Authentication method
TYPE:
|
url |
Base url for the Planka instance
TYPE:
|
handler |
JSONHandler instance for making requests
TYPE:
|
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'
| METHOD | DESCRIPTION |
|---|---|
create_project |
Creates a new project |
create_user |
Create a new user |
Source code in src/plankapy/v1/interfaces.py
188 189 190 191 | |
auth
property
writable
¶
auth: Type[BaseAuth]
Current authentication instance
| RETURNS | DESCRIPTION |
|---|---|
Type[BaseAuth]
|
Authentication method |
config
property
¶
config: JSONResponse
Planka Configuration
| RETURNS | DESCRIPTION |
|---|---|
JSONResponse
|
Configuration data |
notifications
property
¶
notifications: QueryableList[Notification]
Queryable List of all notifications for the current user
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[Notification]
|
Queryable List of all notifications |
project_background_images
property
¶
project_background_images: QueryableList[BackgroundImage]
Get Project Background Images
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[BackgroundImage]
|
Queryable List of all project background images |
projects
property
¶
projects: QueryableList[Project]
Queryable List of all projects on the Planka instance
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[Project]
|
Queryable List of all projects |
user_avatars
property
¶
users
property
¶
users: QueryableList[User]
Queryable List of all users on the Planka instance
| RETURNS | DESCRIPTION |
|---|---|
QueryableList[User]
|
Queryable List of all users |
create_project
¶
create_project(project: Project) -> Project
create_project(name: str, position: int = None, background: Gradient = None) -> Project
create_project(*args, **kwargs) -> 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
| PARAMETER | DESCRIPTION |
|---|---|
|
Name of the project (required)
TYPE:
|
|
Position of the project (default: 0)
TYPE:
|
|
Background gradient of the project (default: None)
TYPE:
|
| ALTERNATE | DESCRIPTION |
|---|---|
|
Project instance to create
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Project
|
New project instance
TYPE:
|
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/v1/interfaces.py
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 | |
create_user
¶
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
| PARAMETER | DESCRIPTION |
|---|---|
|
Username of the user (required)
TYPE:
|
|
Email address of the user (required)
TYPE:
|
|
Password for the user (required)
TYPE:
|
|
Full name of the user (default:
TYPE:
|
| RAISES | 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/v1/interfaces.py
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 434 | |