Skip to content

CardLabel

Bases: CardLabel_

Source code in src/plankapy/interfaces.py
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
class CardLabel(CardLabel_):

    @property
    def card(self) -> Card:
        """Card the label is attached to

        Returns:
            Card: Card instance
        """
        card_route = self.routes.get_card(id=self.cardId)
        return Card(**card_route()['item']).bind(self.routes)

    @property
    def board(self) -> Board:
        """Board the card belongs to

        Returns:
            Board: Board instance
        """
        board_route = self.routes.get_board(id=self.card.boardId)
        return Board(**board_route()['item']).bind(self.routes)

    @property
    def label(self) -> Label:
        """Label attached to the card

        Returns:
            Label: Label instance
        """
        for label in self.board.labels:
            if label.id == self.labelId:
                return label

    def delete(self) -> tuple[Card, Label]:
        """Deletes the card label relationship

        Danger:
            This action is irreversible and cannot be undone

        Returns:
            tuple[Card, Label]: The card and label that were removed from each other
        """
        self.refresh()
        route = self.routes.delete_card_label(cardId=self.card.id, labelId=self.labelId)
        route()
        return (self.card, self.label)

board property

Board the card belongs to

Returns:

Name Type Description
Board Board

Board instance

card property

Card the label is attached to

Returns:

Name Type Description
Card Card

Card instance

label property

Label attached to the card

Returns:

Name Type Description
Label Label

Label instance

delete()

Deletes the card label relationship

Danger

This action is irreversible and cannot be undone

Returns:

Type Description
tuple[Card, Label]

tuple[Card, Label]: The card and label that were removed from each other

Source code in src/plankapy/interfaces.py
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
def delete(self) -> tuple[Card, Label]:
    """Deletes the card label relationship

    Danger:
        This action is irreversible and cannot be undone

    Returns:
        tuple[Card, Label]: The card and label that were removed from each other
    """
    self.refresh()
    route = self.routes.delete_card_label(cardId=self.card.id, labelId=self.labelId)
    route()
    return (self.card, self.label)