Skip to content

Card

Bases: 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 (dict, set)

__iter__

Iterate over public, assigned model attribute names

add_attachment

Adds an attachment to the card

add_comment

Adds a comment to the card

add_label

Adds a label to the card

add_member

Adds a user to the card

add_stopwatch

Adds a stopwatch to the card if there is not one already

add_task

Adds a task to the card

bind

Bind routes to the model

delete

Deletes the card

duplicate

Duplicates the card

editor

Context manager for editing the model

json

Dump the model properties to a JSON string

move

Moves the card to a new list

pickle

Pickle the model, preserving as much of its state as possible

refresh

Refreshes the card data

remove_attachment

Removes an attachment from the card

remove_comment

Pass a comment from self.comments to remove it

remove_label

Removes a label from the card

remove_member

Removes a user from the card

remove_stopwatch

Removes the stopwatch from the card

set_due_date

Sets the due date of the card

update

Updates the card with new values

ATTRIBUTE DESCRIPTION
attachments

All attachments on the card

TYPE: QueryableList[Attachment]

board

Board the card belongs to

TYPE: Board

comments

All comments on the card

TYPE: QueryableList[Action]

created_at

Get the creation date of the model instance

TYPE: datetime | None

creator

User that created the card

TYPE: User

deleted_at

Get the deletion date of the model instance

TYPE: datetime | None

due_date

Due date of the card in datetime format

TYPE: datetime | None

labels

All labels on the card

TYPE: QueryableList[Label]

link

Get the link to the model instance

TYPE: str | None

list

List the card belongs to

TYPE: List

members

All users assigned to the card

TYPE: QueryableList[User]

routes

Get the routes for the model instance

TYPE: Routes

tasks

All tasks on the card

TYPE: QueryableList[Task]

unique_name

Generate a unique name for the model instance using the last 5 characters of the id

TYPE: str

updated_at

Get the last update date of the model instance

TYPE: datetime | None

attachments property

attachments: QueryableList[Attachment]

All attachments on the card

RETURNS DESCRIPTION
QueryableList[Attachment]

Queryable List of all attachments on the card

board property

board: Board

Board the card belongs to

RETURNS DESCRIPTION
Board

Board instance

TYPE: Board

comments property

comments: QueryableList[Action]

All comments on the card

RETURNS DESCRIPTION
QueryableList[Action]

Queryable List of all comments on the card

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

creator property

creator: User

User that created the card

RETURNS DESCRIPTION
User

Creator of the card

TYPE: User

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

due_date property

due_date: datetime | None

Due date of the card in datetime format

Note

The dueDate attribute is stored as an ISO 8601 string, this property will return the due date as a python datetime object

RETURNS DESCRIPTION
datetime | None

Due date of the card

labels property

labels: QueryableList[Label]

All labels on the card

RETURNS DESCRIPTION
QueryableList[Label]

Queryable List of all labels on the card

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: str | None

list property

list: List

List the card belongs to

RETURNS DESCRIPTION
List

List instance

TYPE: List

members property

members: QueryableList[User]

All users assigned to the card

RETURNS DESCRIPTION
QueryableList[User]

Queryable List of all users assigned to the card

routes property writable

routes: Routes

Get the routes for the model instance

RETURNS DESCRIPTION
Routes

The routes bound to the model instance

TYPE: Routes

tasks property

tasks: QueryableList[Task]

All tasks on the card

RETURNS DESCRIPTION
QueryableList[Task]

Queryable List of all tasks on the card

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: str

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__

__eq__(other: Model) -> bool

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

other

The other model instance to compare

TYPE: Model

RETURNS DESCRIPTION
bool

True if the model instances are equal, False otherwise

TYPE: bool

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
def __eq__(self, other: Model) -> bool:
    """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.

    Args:
        other (Model): The other model instance to compare

    Returns:
        bool: True if the model instances are equal, False otherwise
    """
    return isinstance(other, self.__class__) and hash(self) == hash(other)

__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
def __getitem__(self, 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:
        ```python
        print(model['name'])
        >>> "Model Name"

        model.name = Unset
        print(model['name'])
        >>> None
        ```
    """
    val = self.__dict__[key]
    return val if val is not Unset else None

__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: int

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
def __hash__(self) -> 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:
        int: The hash value of the model instance

    Example:
        ```python
        board_map = {
            Board(name="Board 1"): board.,
            Board(name="Board 2"): "Board 2"
        }
        >>> 1
        ```
    """
    if hasattr(self, 'id'):
        return int(self.id)

    # Default hash if no id (string of name and attributes)
    return hash(f"{self.__class__.__name__}{self.__dict__}")

__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}
Notice how only the assigned values are returned after unpacking and any Unset or private attributes are skipped, This allows 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
def __iter__(self):
    """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:
            ```python
            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}
            ```
        Notice how only the assigned values are returned after unpacking and any Unset or 
        private attributes are skipped, This allows `None` values to be assigned during
        a `PATCH` request to delete data 

    Note:
        Skips attributes that are `Unset` or start with an underscore

    Returns:
        Iterator: The iterator of the model attributes

    Example:
        ```python

        # 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
        ```
    """
    return iter(
        k for k, v in self.__dict__.items() 
        if v is not Unset 
        and not k.startswith("_")
    )

add_attachment

add_attachment(file_path: Path) -> Attachment

Adds an attachment to the card

PARAMETER DESCRIPTION

attachment

Attachment instance to add (can be a file path or url)

TYPE: Path | <url>

RETURNS DESCRIPTION
Attachment

New attachment instance

TYPE: Attachment

Source code in src/plankapy/v1/interfaces.py
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
def add_attachment(self, file_path: Path) -> Attachment:
    """Adds an attachment to the card

    Args:
        attachment (Path | <url>): Attachment instance to add (can be a file path or url)

    Returns:
        Attachment: New attachment instance
    """
    route = self.routes.post_attachment(cardId=self.id)
    return Attachment(**route(_file=file_path)['item']).bind(self.routes)

add_comment

add_comment(comment: str) -> Action

Adds a comment to the card

Note

Comments can only be added by the authenticated user, all comments made through plankapy will be attributed to the user in planka.me

PARAMETER DESCRIPTION

comment

Comment to add

TYPE: str

RETURNS DESCRIPTION
Action

New comment action instance

TYPE: Action

Source code in src/plankapy/v1/interfaces.py
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
def add_comment(self, comment: str) -> Action:
    """Adds a comment to the card

    Note:
        Comments can only be added by the authenticated user, all comments made
        through plankapy will be attributed to the user in `planka.me`

    Args:
        comment (str): Comment to add

    Returns:
        Action: New comment action instance
    """
    route = self.routes.post_comment_action(cardId=self.id)        
    return Action(**route(text=comment, cardId=self.id)['item']).bind(self.routes)

add_label

add_label(label: Label) -> CardLabel

Adds a label to the card

PARAMETER DESCRIPTION

label

Label instance to add

TYPE: Label

RETURNS DESCRIPTION
CardLabel

New card label instance

TYPE: CardLabel

Source code in src/plankapy/v1/interfaces.py
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
def add_label(self, label: Label) -> CardLabel:
    """Adds a label to the card

    Args:
        label (Label): Label instance to add

    Returns:
        CardLabel: New card label instance
    """
    route = self.routes.post_card_label(cardId=self.id)
    return CardLabel(**route(labelId=label.id, cardId=self.id)['item']).bind(self.routes)

add_member

add_member(user: User) -> CardMembership

Adds a user to the card

PARAMETER DESCRIPTION

user

User instance to add

TYPE: User

RETURNS DESCRIPTION
CardMembership

New card membership instance

TYPE: CardMembership

Source code in src/plankapy/v1/interfaces.py
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
def add_member(self, user: User) -> CardMembership:
    """Adds a user to the card

    Args:
        user (User): User instance to add

    Returns:
        CardMembership: New card membership instance
    """
    route = self.routes.post_card_membership(cardId=self.id)
    return CardMembership(**route(userId=user.id, cardId=self.id)['item']).bind(self.routes)

add_stopwatch

add_stopwatch() -> Stopwatch

Adds a stopwatch to the card if there is not one already

Warning

The stopwatch stored in the Card instance dictionary is actually a dictionary that is used to update the stopwatch on Planka. When you access the stopwatch attribute with card.stopwatch, a Stopwatch instance is generated. This is an implementation detail to keep the stopwatch interface separate from the Card interface.

Example:

>>> card.add_stopwatch()
>>> card.stopwatch
Stopwatch(startedAt=None, total=0)

>>> card.__dict__['stopwatch']
{'startedAt': None, 'total': 0}

>>> card.stopwatch.start()
>>> card.stopwatch
Stopwatch(startedAt=datetime.datetime(2024, 9, 30, 0, 0, 0), total=0)

>>> card.__dict__['stopwatch']
{'startedAt': '2024-9-30T00:00:00Z', 'total': 0}

RETURNS DESCRIPTION
Stopwatch

A stopwatch instance used to track time on the card

TYPE: Stopwatch

Source code in src/plankapy/v1/interfaces.py
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
def add_stopwatch(self) -> Stopwatch:
    """Adds a stopwatch to the card if there is not one already

    Warning:
        The stopwatch stored in the Card instance dictionary is actually a dictionary
        that is used to update the stopwatch on Planka. When you access the stopwatch
        attribute with `card.stopwatch`, a `Stopwatch` instance is generated. This is
        an implementation detail to keep the stopwatch interface separate from the Card
        interface.

        Example:
            ```python
            >>> card.add_stopwatch()
            >>> card.stopwatch
            Stopwatch(startedAt=None, total=0)

            >>> card.__dict__['stopwatch']
            {'startedAt': None, 'total': 0}

            >>> card.stopwatch.start()
            >>> card.stopwatch
            Stopwatch(startedAt=datetime.datetime(2024, 9, 30, 0, 0, 0), total=0)

            >>> card.__dict__['stopwatch']
            {'startedAt': '2024-9-30T00:00:00Z', 'total': 0}
            ```

    Returns:
        Stopwatch: A stopwatch instance used to track time on the card
    """
    self.refresh()

    if not self.stopwatch:
        with self.editor():
            self.stopwatch = {**Stopwatch(startedAt=None, total=0).stop()}
    return self.stopwatch

add_task

add_task(task: Task) -> Task
add_task(name: str, position: int = 0, isCompleted: bool = False, isDeleted: bool = False) -> Task
add_task(*args, **kwargs) -> Task

Adds a task to the card

PARAMETER DESCRIPTION

name

Name of the task (required)

TYPE: str

position

Position of the task (default: 0)

TYPE: int

isCompleted

Whether the task is completed (default: False)

TYPE: bool

isDeleted

Whether the task is deleted (default: False)

TYPE: bool

ALTERNATE DESCRIPTION

task

Task instance to create

TYPE: Task

RETURNS DESCRIPTION
Task

New task instance

TYPE: Task

Source code in src/plankapy/v1/interfaces.py
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
def add_task(self, *args, **kwargs) -> Task:
    """Adds a task to the card

    Args:
        name (str): Name of the task (required)
        position (int): Position of the task (default: 0)
        isCompleted (bool): Whether the task is completed (default: False)
        isDeleted (bool): Whether the task is deleted (default: False)

    Args: Alternate
        task (Task): Task instance to create

    Returns:
        Task: New task instance
    """
    overload = parse_overload(
        args, kwargs, 
        model='task', 
        options=('name', 'position', 'isCompleted', 'isDeleted'), 
        required=('name',)) # Only name requires user provided value

    route = self.routes.post_task(cardId=self.id)

    # Required arguments with defaults must be manually assigned
    overload['position'] = overload.get('position', 0)
    overload['isCompleted'] = overload.get('isCompleted', False)
    overload['isDeleted'] = overload.get('isDeleted', False)

    return Task(**route(**overload)['item']).bind(self.routes)

bind

bind(routes: Routes) -> Self

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
def bind(self, routes: Routes) -> Self:
    """Bind routes to the model
    Args:
        routes (Routes): The routes to bind to the model instance

    Returns:
        Self for chain operations

    Example:
        ```python
        model = Model(**kwargs).bind(routes)
        ```
    """
    self.routes = routes
    return self

delete

delete() -> Card

Deletes the card

Danger

This action is irreversible and cannot be undone

RETURNS DESCRIPTION
Card

The deleted card instance

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
def delete(self) -> Card:
    """Deletes the card

    Danger:
        This action is irreversible and cannot be undone

    Returns:
        Card: The deleted card instance
    """
    self.refresh()
    route = self.routes.delete_card(id=self.id)
    route()
    return self

duplicate

duplicate() -> Card

Duplicates the card

Note

Duplicating a card will always insert it one slot below the original card

RETURNS DESCRIPTION
Card

The duplicated card instance

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
def duplicate(self) -> Card:
    """Duplicates the card

    Note:
        Duplicating a card will always insert it one slot below the original card

    Returns:
        Card: The duplicated card instance
    """
    route = self.routes.post_duplicate_card(id=self.id)
    return Card(**route(**self)['item']).bind(self.routes)

editor

editor() -> Generator[Self, None, None]

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
@contextmanager
def editor(self) -> Generator[Self, None, None]:
    """Context manager for editing the model

    Example:
        ```python
        print(model.name)
        >>> "Old Name"
        with model.editor() as m:
            m.name = "New Name"
            m.position = 1

        print(model.name)
        >>> "New Name"
        ```

    """
    try:
        self.refresh()
        _self = self.__dict__.copy() # Backup the model state
        yield self
    except Exception as e:
        self.__dict__ = _self # Restore the model state
        raise e
    finally:
        self.update()

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
def json(self) -> 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:
        (str) : A JSON string with the Model attributes
    """
    return json.dumps({k: self[k] for k in self})

move

move(list: List) -> Card

Moves the card to a new list

PARAMETER DESCRIPTION

list

List instance to move the card to

TYPE: List

RETURNS DESCRIPTION
Card

The moved card instance

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
def move(self, list: List) -> Card:
    """Moves the card to a new list

    Args:
        list (List): List instance to move the card to

    Returns:
        Card: The moved card instance
    """
    self.listId = list.id
    self.boardId = list.boardId
    self.update()
    return self

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 pickle.dump

Source code in src/plankapy/v1/models.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
def pickle(self) -> 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:
        (bytes) : Raw bytes generated by `pickle.dump`
    """
    out = io.BufferedWriter(raw=io.BytesIO())
    pickle.dump(self, out)
    return out.raw.read()

refresh

refresh()

Refreshes the card data

Note

This method is used to update the card instance with the latest data from the server

Source code in src/plankapy/v1/interfaces.py
2240
2241
2242
2243
2244
2245
2246
2247
def refresh(self):
    """Refreshes the card data

    Note:
        This method is used to update the card instance with the latest data from the server
    """
    route = self.routes.get_card(id=self.id)
    self.__init__(**route()['item'])

remove_attachment

remove_attachment(attachment: Attachment) -> Attachment | None

Removes an attachment from the card

PARAMETER DESCRIPTION

attachment

Attachment instance to remove

TYPE: Attachment

Note

This method will remove the attachment from the card, but the attachment itself will not be deleted

RETURNS DESCRIPTION
Card

The card instance with the attachment removed

TYPE: Attachment | None

Source code in src/plankapy/v1/interfaces.py
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
def remove_attachment(self, attachment: Attachment) -> Attachment | None:
    """Removes an attachment from the card

    Args:
        attachment (Attachment): Attachment instance to remove

    Note:
        This method will remove the attachment from the card, but the attachment itself will not be deleted

    Returns:
        Card: The card instance with the attachment removed
    """
    for card_attachment in self.attachments:
        if card_attachment.id == attachment.id:
            return card_attachment.delete()
    return None

remove_comment

remove_comment(comment_action: Action) -> Card

Pass a comment from self.comments to remove it

PARAMETER DESCRIPTION

comment_action

Comment instance to remove

TYPE: Action

Note

This method will remove the comment from the card, but the comment itself will not be deleted

RETURNS DESCRIPTION
Card

The card instance with the comment removed

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
def remove_comment(self, comment_action: Action) -> Card:
    """Pass a comment from self.comments to remove it

    Args:
        comment_action (Action): Comment instance to remove

    Note:
        This method will remove the comment from the card, but the comment itself will not be deleted

    Returns:
        Card: The card instance with the comment removed
    """
    for comment in self.comments:
        if comment.id == comment_action.id:
            comment.delete()
    return self

remove_label

remove_label(label: Label) -> Card

Removes a label from the card

PARAMETER DESCRIPTION

label

Label instance to remove

TYPE: Label

Note

This method will remove the label from the card, but the label itself will not be deleted

RETURNS DESCRIPTION
Card

The card instance with the label removed

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
def remove_label(self, label: Label) -> Card:
    """Removes a label from the card

    Args:
        label (Label): Label instance to remove

    Note:
        This method will remove the label from the card, but the label itself will not be deleted

    Returns:
        Card: The card instance with the label removed   
    """
    for card_label in self.board.cardLabels:
        if card_label.cardId == self.id and card_label.labelId == label.id:
            card_label.delete()
    return self

remove_member

remove_member(user: User) -> Card

Removes a user from the card

PARAMETER DESCRIPTION

user

User instance to remove

TYPE: User

Note

This method will remove the user from the card, but the user itself will not be deleted

RETURNS DESCRIPTION
Card

The card instance with the user removed

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
def remove_member(self, user: User) -> Card:
    """Removes a user from the card

    Args:
        user (User): User instance to remove

    Note:
        This method will remove the user from the card, but the user itself will not be deleted

    Returns:
        Card: The card instance with the user removed
    """
    for card_membership in self.board.cardMemberships:
        if card_membership.cardId == self.id and card_membership.userId == user.id:
            card_membership.delete()
    return self

remove_stopwatch

remove_stopwatch() -> Stopwatch

Removes the stopwatch from the card

RETURNS DESCRIPTION
Stopwatch

The stopwatch instance that was removed

TYPE: Stopwatch

Source code in src/plankapy/v1/interfaces.py
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
def remove_stopwatch(self) -> Stopwatch:
    """Removes the stopwatch from the card

    Returns:
        Stopwatch: The stopwatch instance that was removed
    """
    self.refresh()
    with self.editor():
        _stopwatch = self.stopwatch
        self.stopwatch = None
    return _stopwatch

set_due_date

set_due_date(due_date: datetime | None) -> Card

Sets the due date of the card

PARAMETER DESCRIPTION

dueDate

Due date of the card (None to remove)

TYPE: datetime

RETURNS DESCRIPTION
Card

The card instance with the due date set

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
def set_due_date(self, due_date: datetime  | None) -> Card:
    """Sets the due date of the card

    Args:
        dueDate (datetime): Due date of the card (None to remove)

    Returns:
        Card: The card instance with the due date set
    """
    with self.editor():
        self.dueDate = due_date.isoformat() if due_date else None
    return self

update

update() -> Card
update(card: Card) -> Card
update(name: str, position: int = 0, description: str = None, dueDate: datetime = None, isDueDateCompleted: bool = None, stopwatch: Stopwatch = None, boardId: int = None, listId: int = None, creatorUserId: int = None, coverAttachmentId: int = None, isSubscribed: bool = None) -> Card
update(*args, **kwargs) -> Card

Updates the card with new values

Tip

It's recommended to use a card.editor() context manager to update the card

Example: ```python

with card.editor(): ... card.name='New Name'

card Card(name='New Name', ...) ``

PARAMETER DESCRIPTION

name

Name of the card (optional)

TYPE: str

position

Position of the card (optional)

TYPE: int

description

Description of the card (optional)

TYPE: str

dueDate

Due date of the card (optional)

TYPE: datetime

isDueDateCompleted

Whether the due date is completed (optional)

TYPE: bool

stopwatch

Stopwatch of the card (optional)

TYPE: Stopwatch

boardId

Board id of the card (optional)

TYPE: int

listId

List id of the card (optional)

TYPE: int

creatorUserId

Creator user id of the card (optional)

TYPE: int

coverAttachmentId

Cover attachment id of the card (optional)

TYPE: int

isSubscribed

Whether the card is subscribed (optional)

TYPE: bool

ALTERNATE DESCRIPTION

card

Card instance to update (required)

TYPE: Card

Note

If no arguments are provided, the card will update itself with the current values stored in its attributes

RETURNS DESCRIPTION
Card

Updated card instance

TYPE: Card

Source code in src/plankapy/v1/interfaces.py
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
def update(self, *args, **kwargs) -> Card:
    """Updates the card with new values

    Tip:
        It's recommended to use a `card.editor()` context manager to update the card

        Example:
        ```python
        >>> with card.editor():
        ...    card.name='New Name'

        >>> card
        Card(name='New Name', ...)
        ``

    Args:
        name (str): Name of the card (optional)
        position (int): Position of the card (optional)
        description (str): Description of the card (optional)
        dueDate (datetime): Due date of the card (optional)
        isDueDateCompleted (bool): Whether the due date is completed (optional)
        stopwatch (Stopwatch): Stopwatch of the card (optional)
        boardId (int): Board id of the card (optional)
        listId (int): List id of the card (optional)
        creatorUserId (int): Creator user id of the card (optional)
        coverAttachmentId (int): Cover attachment id of the card (optional)
        isSubscribed (bool): Whether the card is subscribed (optional)

    Args: Alternate
        card (Card): Card instance to update (required)

    Note:
        If no arguments are provided, the card will update itself with the current values stored in its attributes

    Returns:
        Card: Updated card instance
    """
    overload = parse_overload(
        args, kwargs, 
        model='card', 
        options=('name', 'position', 'description', 'dueDate', 
                'isDueDateCompleted', 'stopwatch', 
                'creatorUserId', 'coverAttachmentId', 
                'isSubscribed'), 
        noarg=self)

    route = self.routes.patch_card(id=self.id)
    self.__init__(**route(**overload)['item'])
    return self