Skip to content

Helpers

add_editors_to_board(board, users)

Add users to a board with editing permissions

Parameters:

Name Type Description Default
board Board

Board to add users to

required
users list[User]

Users to add

required

Returns:

Name Type Description
Board list[BoardMembership]

Board with users added

Source code in src/plankapy/helpers.py
110
111
112
113
114
115
116
117
118
119
120
def add_editors_to_board(board: Board, users: list[User]) -> list[BoardMembership]:
    """Add users to a board with editing permissions

    Args:
        board (Board): Board to add users to
        users (list[User]): Users to add

    Returns:
        Board: Board with users added
    """
    return [board.add_user(users, canComment=True) for user in users]

add_labels_to_card(card, labels)

Add labels to a card

Parameters:

Name Type Description Default
card Card

Card to add labels to

required
labels list[Label]

Labels to add

required

Returns:

Type Description
list[CardLabel]

list[CardLabel]: CardLabel relationships created

Source code in src/plankapy/helpers.py
146
147
148
149
150
151
152
153
154
155
156
def add_labels_to_card(card: Card, labels: list[Label]) -> list[CardLabel]:
    """Add labels to a card

    Args:
        card (Card): Card to add labels to
        labels (list[Label]): Labels to add

    Returns:
        list[CardLabel]: CardLabel relationships created
    """
    return [card.add_label(label) for label in labels]

add_members_to_card(card, members)

Add members to a card

Parameters:

Name Type Description Default
card Card

Card to add members to

required
members list[User]

Members to add

required

Returns:

Type Description
list[CardMembership]

list[CardMembership]: CardMemberships created

Source code in src/plankapy/helpers.py
158
159
160
161
162
163
164
165
166
167
168
def add_members_to_card(card: Card, members: list[User]) -> list[CardMembership]:
    """Add members to a card

    Args:
        card (Card): Card to add members to
        members (list[User]): Members to add

    Returns:
        list[CardMembership]: CardMemberships created
    """
    return [card.add_member(member) for member in members]

add_viewers_to_board(board, users)

Add users to a board with viewing permissions

Parameters:

Name Type Description Default
board Board

Board to add users to

required
users list[User]

Users to add

required

Returns:

Type Description
list[BoardMembership]

list[BoardMembership]: BoardMemberships created

Source code in src/plankapy/helpers.py
122
123
124
125
126
127
128
129
130
131
132
def add_viewers_to_board(board: Board, users: list[User]) -> list[BoardMembership]:
    """Add users to a board with viewing permissions

    Args:
        board (Board): Board to add users to
        users (list[User]): Users to add

    Returns:
        list[BoardMembership]: BoardMemberships created
    """
    return [board.add_user(user, canComment=False) for user in users]

by_action_type(action_list, type)

Get actions by type

Parameters:

Name Type Description Default
action_list list[Action]

List of actions to search

required
type ActionType

Type of the action

required

Returns:

Type Description
list[Action]

list[Action]: Actions with the given type

Source code in src/plankapy/helpers.py
 96
 97
 98
 99
100
101
102
103
104
105
106
def by_action_type(action_list: list[Action], type: ActionType) -> list[Action]:
    """Get actions by type

    Args:
        action_list (list[Action]): List of actions to search
        type (ActionType): Type of the action

    Returns:
        list[Action]: Actions with the given type
    """
    return [action for action in action_list if action.type == type]

by_board_name(board_list, name)

Get boards by name

Parameters:

Name Type Description Default
board_list list[Board]

List of boards to search

required
name str

Name of the board

required

Returns:

Type Description
list[Board]

list[Board]: Boards with the given name

Source code in src/plankapy/helpers.py
48
49
50
51
52
53
54
55
56
57
58
def by_board_name(board_list: list[Board], name: str) -> list[Board]:
    """Get boards by name

    Args:
        board_list (list[Board]): List of boards to search
        name (str): Name of the board

    Returns:
        list[Board]: Boards with the given name
    """
    return [board for board in board_list if board.name == name]

by_card_name(card_list, name)

Get cards by name

Parameters:

Name Type Description Default
card_list list[Card]

List of cards to search

required
name str

Name of the card

required

Returns:

Type Description
list[Card]

list[Card]: Cards with the given

Source code in src/plankapy/helpers.py
72
73
74
75
76
77
78
79
80
81
82
def by_card_name(card_list: list[Card], name: str) -> list[Card]:
    """Get cards by name

    Args:
        card_list (list[Card]): List of cards to search
        name (str): Name of the card

    Returns:
        list[Card]: Cards with the given 
    """
    return [card for card in card_list if card.name == name]

by_label_name(label_list, name)

Get labels by name

Parameters:

Name Type Description Default
label_list list[Label]

List of labels to search

required
name str

Name of the label

required

Returns:

Type Description
list[Label]

list[Label]: Labels with the given name

Source code in src/plankapy/helpers.py
84
85
86
87
88
89
90
91
92
93
94
def by_label_name(label_list: list[Label], name: str) -> list[Label]:
    """Get labels by name

    Args:
        label_list (list[Label]): List of labels to search
        name (str): Name of the label

    Returns:
        list[Label]: Labels with the given name
    """
    return [label for label in label_list if label.name == name]

by_list_name(list_list, name)

Get lists by name

Parameters:

Name Type Description Default
list_list list[List]

List of lists to search

required
name str

Name of the list

required

Returns:

Type Description
list[List]

list[List]: Lists with the given name

Source code in src/plankapy/helpers.py
60
61
62
63
64
65
66
67
68
69
70
def by_list_name(list_list: list[List], name: str) -> list[List]:
    """Get lists by name

    Args:
        list_list (list[List]): List of lists to search
        name (str): Name of the list

    Returns:
        list[List]: Lists with the given name
    """
    return [list_ for list_ in list_list if list_.name == name]

by_project_name(project_list, name)

Get projects by name

Parameters:

Name Type Description Default
project_list list[Project]

List of projects to search

required
name str

Name of the project

required

Returns:

Type Description
list[Project]

list[Project]: Projects with the given name

Source code in src/plankapy/helpers.py
36
37
38
39
40
41
42
43
44
45
46
def by_project_name(project_list: list[Project], name: str) -> list[Project]:
    """Get projects by name

    Args:
        project_list (list[Project]): List of projects to search
        name (str): Name of the project

    Returns:
        list[Project]: Projects with the given name
    """
    return [project for project in project_list if project.name == name]

by_username(user_list, name)

Get users by username

Parameters:

Name Type Description Default
user_list list[User]

List of users to search

required
name str

Username of the user

required

Returns:

Type Description
list[User]

list[User]: Users with the given username

Source code in src/plankapy/helpers.py
24
25
26
27
28
29
30
31
32
33
34
def by_username(user_list: list[User], name: str) -> list[User]:
    """Get users by username

    Args:
        user_list (list[User]): List of users to search
        name (str): Username of the user

    Returns:
        list[User]: Users with the given username
    """
    return [user for user in user_list if user.username == name]

create_board_labels(board, labels)

Create labels on a board

Parameters:

Name Type Description Default
board Board

Board to create labels on

required
labels list[Label]

Labels to create

required

Returns:

Type Description
list[Label]

list[Label]: The labels that were created

Source code in src/plankapy/helpers.py
134
135
136
137
138
139
140
141
142
143
144
def create_board_labels(board: Board, labels: list[Label]) -> list[Label]:
    """Create labels on a board

    Args:
        board (Board): Board to create labels on
        labels (list[Label]): Labels to create

    Returns:
        list[Label]: The labels that were created
    """
    return [board.create_label(label) for label in labels]

delete_actions(actions)

Delete a list of actions

Parameters:

Name Type Description Default
actions list[Action]

Actions to delete

required

Returns:

Type Description
list[Action]

list[Action]: Actions that were deleted

Source code in src/plankapy/helpers.py
239
240
241
242
243
244
245
246
247
248
def delete_actions(actions: list[Action]) -> list[Action]:
    """Delete a list of actions

    Args:
        actions (list[Action]): Actions to delete

    Returns:
        list[Action]: Actions that were deleted
    """
    return [action.delete() for action in actions]

delete_boards(boards)

Delete a list of boards

Parameters:

Name Type Description Default
boards list[Board]

Boards to delete

required

Returns:

Type Description
list[Board]

list[Board]: Boards that were deleted

Source code in src/plankapy/helpers.py
184
185
186
187
188
189
190
191
192
193
def delete_boards(boards: list[Board]) -> list[Board]:
    """Delete a list of boards

    Args:
        boards (list[Board]): Boards to delete

    Returns:
        list[Board]: Boards that were deleted
    """
    return [board.delete() for board in boards]

delete_cards(cards)

Delete a list of cards

Parameters:

Name Type Description Default
cards list[Card]

Cards to delete

required

Returns:

Type Description
list[Card]

list[Card]: Cards that were deleted

Source code in src/plankapy/helpers.py
206
207
208
209
210
211
212
213
214
215
def delete_cards(cards: list[Card]) -> list[Card]:
    """Delete a list of cards

    Args:
        cards (list[Card]): Cards to delete

    Returns:
        list[Card]: Cards that were deleted
    """
    return [card.delete() for card in cards]

delete_labels(labels)

Delete a list of labels

Parameters:

Name Type Description Default
labels list[Label]

Labels to delete

required

Returns:

Type Description
list[Label]

list[Label]: Labels that were deleted

Source code in src/plankapy/helpers.py
217
218
219
220
221
222
223
224
225
226
def delete_labels(labels: list[Label]) -> list[Label]:
    """Delete a list of labels

    Args:
        labels (list[Label]): Labels to delete

    Returns:
        list[Label]: Labels that were deleted
    """
    return [label.delete() for label in labels]

delete_lists(lists)

Delete a list of lists

Parameters:

Name Type Description Default
lists list[List]

Lists to delete

required

Returns:

Type Description
list[List]

list[List]: Lists that were deleted

Source code in src/plankapy/helpers.py
195
196
197
198
199
200
201
202
203
204
def delete_lists(lists: list[List]) -> list[List]:
    """Delete a list of lists

    Args:
        lists (list[List]): Lists to delete

    Returns:
        list[List]: Lists that were deleted
    """
    return [list_.delete() for list_ in lists]

delete_projects(projects)

Delete a list of projects

Parameters:

Name Type Description Default
projects list[Project]

Projects to delete

required

Returns:

Type Description
list[Project]

list[Project]: Projects that were deleted

Source code in src/plankapy/helpers.py
173
174
175
176
177
178
179
180
181
182
def delete_projects(projects: list[Project]) -> list[Project]:
    """Delete a list of projects

    Args:
        projects (list[Project]): Projects to delete

    Returns:
        list[Project]: Projects that were deleted
    """
    return [project.delete() for project in projects]

delete_users(users)

Delete a list of users

Parameters:

Name Type Description Default
users list[User]

Users to delete

required

Returns:

Type Description
list[User]

list[User]: Users that were deleted

Source code in src/plankapy/helpers.py
228
229
230
231
232
233
234
235
236
237
def delete_users(users: list[User]) -> list[User]:
    """Delete a list of users

    Args:
        users (list[User]): Users to delete

    Returns:
        list[User]: Users that were deleted
    """
    return [user.delete() for user in users]

get_boards_by_name(project, name)

Get all boards in a project by name

Parameters:

Name Type Description Default
project Project

Project to search

required
name str

Name of the board

required

Returns:

Type Description
list[Board]

list[Board]: Boards in the project with the given name

Source code in src/plankapy/helpers.py
277
278
279
280
281
282
283
284
285
286
287
def get_boards_by_name(project: Project, name: str) -> list[Board]:
    """Get all boards in a project by name

    Args:
        project (Project): Project to search
        name (str): Name of the board

    Returns:
        list[Board]: Boards in the project with the given name
    """
    return by_board_name(project.boards, name)

get_cards_by_name(org_unit, name)

Get a card by name from a list or board

Parameters:

Name Type Description Default
org_unit List | Board

List or Board to search

required
name str

Name of the card

required

Returns:

Type Description
list[Card]

list[Card]: Cards in the list or board with the given name

Source code in src/plankapy/helpers.py
301
302
303
304
305
306
307
308
309
310
311
def get_cards_by_name(org_unit: List | Board, name: str) -> list[Card]:
    """Get a card by name from a list or board

    Args:
        org_unit (List | Board): List or Board to search
        name (str): Name of the card

    Returns:
        list[Card]: Cards in the list or board with the given name
    """
    return by_card_name(org_unit.cards, name)

get_labels_by_name(org_unit, name)

Get a label by name from a board or card

Parameters:

Name Type Description Default
org_unit Board | Card

Board or Card to search

required
name str

Name of the label

required

Returns:

Type Description
list[Label]

list[Label]: Labels in the board or card with the given name

Source code in src/plankapy/helpers.py
313
314
315
316
317
318
319
320
321
322
323
def get_labels_by_name(org_unit: Board | Card, name: str) -> list[Label]:
    """Get a label by name from a board or card

    Args:
        org_unit (Board | Card): Board or Card to search
        name (str): Name of the label

    Returns:
        list[Label]: Labels in the board or card with the given name
    """
    return by_label_name(org_unit.labels, name)

get_lists_by_name(board, name)

Get all lists in a board by name

Parameters:

Name Type Description Default
board Board

Board to search

required
name str

Name of the list

required

Returns:

Type Description
list[List]

list[List]: Lists in the board with the given name

Source code in src/plankapy/helpers.py
289
290
291
292
293
294
295
296
297
298
299
def get_lists_by_name(board: Board, name: str) -> list[List]:
    """Get all lists in a board by name

    Args:
        board (Board): Board to search
        name (str): Name of the list

    Returns:
        list[List]: Lists in the board with the given name
    """
    return by_list_name(board.lists, name)

get_projects_by_name(planka, name)

Get all projects with the given name

Parameters:

Name Type Description Default
planka Planka

Planka instance

required
name str

Name of the project

required

Returns:

Type Description
list[Project]

list[Project]: List of projects with the given name

Source code in src/plankapy/helpers.py
265
266
267
268
269
270
271
272
273
274
275
def get_projects_by_name(planka: Planka, name: str) -> list[Project]:
    """Get all projects with the given name

    Args:
        planka (Planka): Planka instance
        name (str): Name of the project

    Returns:
        list[Project]: List of projects with the given name
    """
    return by_project_name(planka.projects, name)

get_users_by_username(org_unit, username)

Get a user by username from a Planka Instance, Project, or Board

Parameters:

Name Type Description Default
org_unit Planka | Project | Board

Planka instance, Project, or Board to search

required
username str

Username of the user

required

Returns:

Type Description
list[User]

list[User]: Users in the org_unit with the given username

Source code in src/plankapy/helpers.py
325
326
327
328
329
330
331
332
333
334
335
def get_users_by_username(org_unit: Planka | Project | Board, username: str) -> list[User]:
    """Get a user by username from a Planka Instance, Project, or Board

    Args:
        org_unit (Planka | Project | Board): Planka instance, Project, or Board to search
        username (str): Username of the user

    Returns:
        list[User]: Users in the org_unit with the given username
    """
    return by_username(org_unit.users, username)

remove_labels_from_card(card, labels)

Remove labels from a card

Parameters:

Name Type Description Default
card Card

Card to remove labels from

required
labels list[Label]

Labels to remove

required

Returns:

Type Description
list[Label]

list[Label]: Labels that were removed

Source code in src/plankapy/helpers.py
252
253
254
255
256
257
258
259
260
261
262
def remove_labels_from_card(card: Card, labels: list[Label]) -> list[Label]:
    """Remove labels from a card

    Args:
        card (Card): Card to remove labels from
        labels (list[Label]): Labels to remove

    Returns:
        list[Label]: Labels that were removed
    """
    return [card.remove_label(label) for label in labels]