Card¶
| CLASS | DESCRIPTION |
|---|---|
Card |
Python interface for Planka Cards |
Stopwatch |
Python interface for Planka Stopwatches |
Card
¶
Card(schema: Schema, session: Planka)
Bases: PlankaModel[Card]
Python interface for Planka Cards
-
Plankapy v2
models
-
Action
Actioncard -
Attachment
Attachmentcard -
Board
Board -
Card
Card -
Card Label
CardLabelcard -
Card Membership
CardMembershipcard -
Comment
Commentcard -
Custom Field Group
CustomFieldGroupcard -
Custom Field Value
CustomFieldValuecard -
Label
Labelget_cards -
List
List -
Notification
Notificationcard -
Task
Taskcard -
Task List
TaskListcard
-
Action
| METHOD | DESCRIPTION |
|---|---|
add_attachment |
Add an Attachment to the card |
add_card_fields |
Add fields directly to a Card |
add_label |
Add a Label to the Card |
add_labels |
Add multiple Labels to the Card |
add_location |
Add a point location to a card as a FieldGroup |
add_member |
Add a User to the Card |
add_members |
Add multiple members to a Card |
add_task_list |
Add a TaskList to the Card |
comment |
Leave a comment as this user and mention any user included in the mentions list |
copy |
Create a deepcopy of the model and its associated schema. |
create_card_field_group |
Create a CustomFieldGroup in the Card |
create_task_list |
Create a NEW TaskList to the Card |
delete |
Delete the Card |
diff |
Get a schema diff between two model schemas. |
duplicate |
Duplicate the card in the current List |
get_field_values |
Get a mapping of CustomFields to CustomFieldValues |
move |
Move the card to a new list (default to top of new list) |
read_notifications |
Read all the current User's Notifications for the Card |
remove_label |
Remove the Label from the Card |
remove_labels |
Remove the Label from the Card |
remove_member |
Remove a User member from the Card |
remove_members |
Remove multiple members from a Card |
restore |
Restore the Card from arcive/trash to its previous list |
sync |
Sync the Card with the Planka server |
update |
Update the Card |
| ATTRIBUTE | DESCRIPTION |
|---|---|
__formatter__ |
Formatter func that allows overriding str behavior for models
TYPE:
|
actions |
Get all Actions associated with the Card |
attachments |
Get all Attachments associated with the Card
TYPE:
|
board |
The Board the Card belongs to
TYPE:
|
card_labels |
Get all CardLabel associations for the Card |
card_memberships |
Get all CardMemberships associated with the Card
TYPE:
|
comments |
Get all Comments on the Card |
comments_count |
Total number of comments on the Card
TYPE:
|
cover |
The Attachment used as cover (None if no cover)
TYPE:
|
created_at |
When the Card was created
TYPE:
|
creator |
The User who Created the card
TYPE:
|
custom_field_groups |
Get all CustomFieldGroups associated with the Card
TYPE:
|
custom_field_values |
Get all CustomFieldValues associated with the Card
TYPE:
|
custom_fields |
Get all CustomFields associated with the Card
TYPE:
|
description |
Detailed description of the Card
TYPE:
|
due_date |
Due date for the card
TYPE:
|
due_date_completed |
Whether the due date is completed
TYPE:
|
formal_name |
Get a formal name for the card
TYPE:
|
is_closed |
Whether the Card is closed
TYPE:
|
labels |
Get all Labels associated with the Card |
list |
The List the Card belongs to
TYPE:
|
list_changed_at |
When the Card was last moved between Lists
TYPE:
|
members |
Get all Users Assigned to the card |
name |
Name/title of the Card
TYPE:
|
position |
Position of the Card within the List
TYPE:
|
prev_list |
The previous List the card was in (available when in archive or trash)
TYPE:
|
project |
Get the Project that the card is in
TYPE:
|
stopwatch |
Stopwatch for time tracking
TYPE:
|
subscribed |
If the current user is subscribed to the Card
TYPE:
|
task_lists |
Get all TaskLists associated with the Card |
tasks |
Get all Tasks associated with the card |
type |
Type of the Card
|
updated_at |
When the Card was last updated
TYPE:
|
url |
The URL to the card
TYPE:
|
users |
Get all Users associated with the Card (including Creator) |
Source code in src/plankapy/v2/models/_base.py
30 31 32 33 34 35 36 | |
__formatter__
class-attribute
instance-attribute
¶
__formatter__: ModelFormatter[Self] = DEFAULT_FORMATTER
Formatter func that allows overriding str behavior for models
card_memberships
property
¶
card_memberships: list[CardMembership]
Get all CardMemberships associated with the Card
creator
property
¶
creator: User | None
The User who Created the card
Note
If the creator is no longer on the Board, only Admins and Project Owners can see them. Otherwise, None will be returned
If the User has been deleted, Admins and Project Owners will get a Server error
custom_field_groups
property
¶
custom_field_groups: list[CustomFieldGroup]
Get all CustomFieldGroups associated with the Card
custom_field_values
property
¶
custom_field_values: list[CustomFieldValue]
Get all CustomFieldValues associated with the Card
custom_fields
property
¶
custom_fields: list[CustomField]
Get all CustomFields associated with the Card
formal_name
property
¶
formal_name: str
Get a formal name for the card {Project}->{Board}->{List}->{Card}
prev_list
property
¶
prev_list: List | None
The previous List the card was in (available when in archive or trash)
add_attachment
¶
add_attachment(attachment: str | bytes, *, cover: bool = False, download_url: bool = False, name: str | None = None) -> Attachment
Add an Attachment to the card
| PARAMETER | DESCRIPTION |
|---|---|
|
The URL or raw bytes of the attachment |
|
Set the new attachment as the cover of the card
TYPE:
|
|
If a link is used, download the file from the link and attach it (default:
TYPE:
|
|
The optional name of the attachment (default is
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Attachment
|
Attachment |
| RAISES | DESCRIPTION |
|---|---|
HTTPStatusError
|
If the url cannot be downloaded |
OSError
|
If a local file cannot be opened and read |
Source code in src/plankapy/v2/models/card.py
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 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
add_card_fields
¶
add_card_fields(*fields: str, group: str = 'Fields', position: Position = 'top') -> CustomFieldGroup
Add fields directly to a Card
| PARAMETER | DESCRIPTION |
|---|---|
|
Varargs of the Fieldnames to add to the Card
TYPE:
|
|
An optional FieldGroup name to add the fields to (default:
TYPE:
|
|
The position to add the Card field group at (default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CustomFieldGroup
|
CustomFieldGroup |
Source code in src/plankapy/v2/models/card.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | |
add_label
¶
add_label(label: Label, *, add_to_board: bool = False) -> CardLabel
Add a Label to the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The Label to add to the card
TYPE:
|
|
If the Label is not in the board, add it (default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CardLabel
|
The CardLabel relationship
TYPE:
|
Note
When using add_to_board The label position will default to the top of the label list
Source code in src/plankapy/v2/models/card.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | |
add_labels
¶
Add multiple Labels to the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The Labels to add (must be associated with the card.board) |
|
If a Label is not in the board, add it (default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[CardLabel]
|
list[CardLabel]: The added CardLabel relations |
Note
Any labels that are not on the Card's Board will be skipped
Source code in src/plankapy/v2/models/card.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | |
add_location
¶
Add a point location to a card as a FieldGroup
| PARAMETER | DESCRIPTION |
|---|---|
|
Latitude of the location
TYPE:
|
|
Longitude of the location
TYPE:
|
|
Name of the location (FieldGroup name)
TYPE:
|
|
Position of the FieldGroup within the Card (default:
TYPE:
|
Source code in src/plankapy/v2/models/card.py
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | |
add_member
¶
add_member(user: User, *, add_to_board: bool = False, role: BoardRole = 'viewer', can_comment: bool = False) -> CardMembership
Add a User to the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The User to add to the Card
TYPE:
|
|
Add the User to the Board if they are not already a member
TYPE:
|
|
If User is added to board, set role (default:
TYPE:
|
|
If User is added as a
TYPE:
|
Note
Default options for adding to Board abide by least privilege so role and comment must be set
Source code in src/plankapy/v2/models/card.py
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | |
add_members
¶
add_members(users: Sequence[User], *, add_to_board: bool = False, role: BoardRole = 'viewer', can_comment: bool = False) -> list[CardMembership]
Add multiple members to a Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The Users to add to the Card |
|
Add the User to the Board if they are not already a member
TYPE:
|
|
If User is added to board, set role (default:
TYPE:
|
|
If User is added as a
TYPE:
|
Note
Default options for adding to Board abide by least privilege so role and comment must be set
Source code in src/plankapy/v2/models/card.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
add_task_list
¶
add_task_list(task_list: TaskList, *, name: str | None = None, position: Position | int = 'top', show_on_card: bool | None = None, hide_completed: bool | None = None) -> TaskList
Add a TaskList to the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The TaskList to add
TYPE:
|
|
Name override, None will use input name (default:
TYPE:
|
|
The position of the TaskList in the Card (default:
TYPE:
|
|
bool | None): Show On Card override, None will use input show (default:
TYPE:
|
|
bool | None): Hide Completed override , None will use input hide (default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TaskList
|
The TaskList |
Source code in src/plankapy/v2/models/card.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | |
comment
¶
Leave a comment as this user and mention any user included in the mentions list
| PARAMETER | DESCRIPTION |
|---|---|
|
The text body of the comment (
|
|
A sequence of Users that will be mentioned after the body |
Note
If a user is explicitly mentioned in the comment, they will be removed from the suffix mention. e.g.
>>> card.comment(
... 'Fix this @user1, then send to @user2',
... mentions=[user1, user2, user3]
... )
'''Fix this @user1, then send to @user2
@user3'''
Example
>>> card.comment('Need Fix', mentions=card2.users)
# Comment from current user On Card:
Need Fix
@user1
@user2
Source code in src/plankapy/v2/models/card.py
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 | |
copy
¶
copy() -> Self
Create a deepcopy of the model and its associated schema.
Note
Since the endpoints for both instances of the Model are the same, any calls to update will restore the state and bring both copies into sync. copies like this are meant more for comparing changes when running a sync or update/assignemnt operation.
Example:
>>> card_copy = card.copy()
>>> card.name = 'Updated Name'
>>> card_copy.name
'Original Name'
>>> card.name
'Updated Name'
>>> # This update may have had side effects
>>> print(card_copy.diff(card))
{'name': ('Original Name', 'Updated Name'), 'updatedAt': ('...2:00pm', '...2:45pm'), ...}
Source code in src/plankapy/v2/models/_base.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
create_card_field_group
¶
create_card_field_group(name: str, position: Position = 'top') -> CustomFieldGroup
Create a CustomFieldGroup in the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The name of the group
TYPE:
|
|
The position of the new group
TYPE:
|
Source code in src/plankapy/v2/models/card.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 | |
create_task_list
¶
create_task_list(*, name: str, position: Position | int = 'top', show_on_card: bool = False, hide_completed: bool = False) -> TaskList
Create a NEW TaskList to the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
Name for the TaskList
|
|
The position of the TaskList in the Card (default:
TYPE:
|
|
bool: Show TaskList on the front of the card (default:
TYPE:
|
|
bool: Hide completed tasks (default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TaskList
|
The TaskList |
Source code in src/plankapy/v2/models/card.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | |
delete
¶
delete()
Delete the Card
Source code in src/plankapy/v2/models/card.py
286 287 288 | |
diff
¶
diff(other: PlankaModel[Schema]) -> Diff
Get a schema diff between two model schemas.
Note
Only matching keys are diffed. Any schema keys that are not in the source schema will not be checked in the target schema
Source code in src/plankapy/v2/models/_base.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
duplicate
¶
Duplicate the card in the current List
| PARAMETER | DESCRIPTION |
|---|---|
|
The position to place the new Card in (default:
TYPE:
|
|
An optional name to give the new Card (default
TYPE:
|
Source code in src/plankapy/v2/models/card.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
get_field_values
¶
get_field_values(*, with_groups: bool = False) -> dict[str, Any]
Get a mapping of CustomFields to CustomFieldValues
| PARAMETER | DESCRIPTION |
|---|---|
|
If set to
TYPE:
|
Source code in src/plankapy/v2/models/card.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |
move
¶
Move the card to a new list (default to top of new list)
Source code in src/plankapy/v2/models/card.py
345 346 347 348 349 350 351 352 | |
read_notifications
¶
read_notifications() -> list[Notification]
Read all the current User's Notifications for the Card
Source code in src/plankapy/v2/models/card.py
290 291 292 293 | |
remove_label
¶
Remove the Label from the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The label to remove (must be associated with the Card)
TYPE:
|
Source code in src/plankapy/v2/models/card.py
659 660 661 662 663 664 665 666 667 668 | |
remove_labels
¶
Remove the Label from the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The labels to remove (must be associated with the Card) |
Source code in src/plankapy/v2/models/card.py
670 671 672 673 674 675 676 677 | |
remove_member
¶
Remove a User member from the Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The User to remove
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
User | None
|
The removed User or None if tha User was not a member |
Source code in src/plankapy/v2/models/card.py
574 575 576 577 578 579 580 581 582 583 584 585 586 | |
remove_members
¶
Remove multiple members from a Card
| PARAMETER | DESCRIPTION |
|---|---|
|
The Users to remove from the Card |
| RETURNS | DESCRIPTION |
|---|---|
list[User]
|
list[User]: The Users that were removed from the card |
Note
If a User in the users sequence is not a member of the card,
They will be excluded from this list
Source code in src/plankapy/v2/models/card.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | |
restore
¶
restore(position: Position = 'top') -> Card
Restore the Card from arcive/trash to its previous list
Source code in src/plankapy/v2/models/card.py
371 372 373 374 375 | |
sync
¶
sync()
Sync the Card with the Planka server
Source code in src/plankapy/v2/models/card.py
271 272 273 | |
update
¶
update(**kwargs: Unpack[Request_updateCard])
Update the Card
Note
dueDate can be set using ISO 8601 string or datetime object
Source code in src/plankapy/v2/models/card.py
275 276 277 278 279 280 281 282 283 284 | |
Stopwatch
¶
Stopwatch(card: Card)
Python interface for Planka Stopwatches
| METHOD | DESCRIPTION |
|---|---|
start |
Start the stopwatch and return the current datetime (None if the stopwatch is started) |
stop |
Stop a running stopwatch and return the time it was last started |
update |
Update the stopwatch |
| ATTRIBUTE | DESCRIPTION |
|---|---|
enabled |
If the stopwatch is enabled for the card (visible on front)
|
is_running |
If the stopwatch is currently running
TYPE:
|
last_started |
The time a running stopwatch was started (None if the stopwatch is stopped)
TYPE:
|
Source code in src/plankapy/v2/models/card.py
753 754 755 | |
last_started
property
¶
last_started: datetime | None
The time a running stopwatch was started (None if the stopwatch is stopped)
start
¶
start() -> datetime | None
Start the stopwatch and return the current datetime (None if the stopwatch is started)
Source code in src/plankapy/v2/models/card.py
806 807 808 809 810 | |
stop
¶
stop() -> datetime | None
Stop a running stopwatch and return the time it was last started
Source code in src/plankapy/v2/models/card.py
812 813 814 815 816 | |
update
¶
Update the stopwatch
Source code in src/plankapy/v2/models/card.py
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | |