add space to markdown comments

This commit is contained in:
hwelch-fle 2023-05-01 15:50:41 -04:00
parent 4eceb43d44
commit 9be8e6cae1

View file

@ -2,7 +2,7 @@ import requests
import json import json
API_URL = "http://localhost:3000" API_URL = "http://localhost:3000"
API_USER = "demo-demo.demo" API_USER = "demo- demo.demo"
API_PASS = "demo" API_PASS = "demo"
OFFSET = 65535 OFFSET = 65535
@ -26,7 +26,7 @@ class Planka:
def deauthenticate(self) -> bool: def deauthenticate(self) -> bool:
"""Deletes the auth token from the Planka API """Deletes the auth token from the Planka API
-return: True if successful, False if not - return: True if successful, False if not
""" """
try: try:
self.request("DELETE", "/api/access-tokens/me") self.request("DELETE", "/api/access-tokens/me")
@ -37,7 +37,7 @@ class Planka:
def validate(self) -> bool: def validate(self) -> bool:
"""Validates the Planka API connection """Validates the Planka API connection
-return: True if successful, False if not - return: True if successful, False if not
""" """
try: try:
self.request("GET", "/*") self.request("GET", "/*")
@ -47,7 +47,7 @@ class Planka:
def authenticate(self) -> bool: def authenticate(self) -> bool:
"""Gets an auth token from the Planka API """Gets an auth token from the Planka API
-return: True if successful, False if not - return: True if successful, False if not
""" """
try: try:
request = requests.post(f"{self.url}/api/access-tokens", data={'emailOrUsername': self.username, 'password': self.password}) request = requests.post(f"{self.url}/api/access-tokens", data={'emailOrUsername': self.username, 'password': self.password})
@ -60,10 +60,10 @@ class Planka:
def request(self, method:str, endpoint:str, data:dict=None) -> dict: def request(self, method:str, endpoint:str, data:dict=None) -> dict:
"""Makes a request to the Planka API """Makes a request to the Planka API
-method: HTTP method - method: HTTP method
-endpoint: API endpoint - endpoint: API endpoint
-data: Data to send with request (default: None) - data: Data to send with request (default: None)
-return: JSON response from Planka API - return: JSON response from Planka API
""" """
if not self.auth: if not self.auth:
self.authenticate() self.authenticate()
@ -88,8 +88,8 @@ class Planka:
def get_template(self, template:str) -> dict: def get_template(self, template:str) -> dict:
"""Returns a template from the templates.json file """Returns a template from the templates.json file
-template: Name of template to return - template: Name of template to return
-return: Template dictionary - return: Template dictionary
""" """
try: try:
return self.templates[template] return self.templates[template]
@ -99,7 +99,7 @@ class Planka:
class Controller(): class Controller():
def __init__(self, instance:Planka) -> None: def __init__(self, instance:Planka) -> None:
"""Controller class for Planka API """Controller class for Planka API
-instance: Planka API instance - instance: Planka API instance
""" """
self.instance = instance self.instance = instance
self.template:dict = None self.template:dict = None
@ -108,19 +108,19 @@ class Controller():
def __str__(self) -> str: def __str__(self) -> str:
"""Returns a string representation of the controller object """Returns a string representation of the controller object
-return: String representation of controller object - return: String representation of controller object
""" """
return f"{type(self).__name__}:\n{json.dumps(self.data, sort_keys=True, indent=4)}" return f"{type(self).__name__}:\n{json.dumps(self.data, sort_keys=True, indent=4)}"
def __repr__(self) -> str: def __repr__(self) -> str:
"""Returns a string representation of the controller object """Returns a string representation of the controller object
-return: String representation of controller object - return: String representation of controller object
""" """
return f"<{type(self).__name__}({self.__class__.__bases__[0].__name__})>{self.__str__()}" return f"<{type(self).__name__}({self.__class__.__bases__[0].__name__})>{self.__str__()}"
def build(self, **kwargs) -> dict: def build(self, **kwargs) -> dict:
"""Builds the controller data """Builds the controller data
-return: Controller data dictionary - return: Controller data dictionary
""" """
if not kwargs: if not kwargs:
return kwargs return kwargs
@ -131,8 +131,8 @@ class Controller():
def create(self, route:str, data:dict=None) -> dict: def create(self, route:str, data:dict=None) -> dict:
"""Creates a new controller object (POST) """Creates a new controller object (POST)
-route: Route for controller object POST request - route: Route for controller object POST request
-return: POST response dictionary - return: POST response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -143,16 +143,16 @@ class Controller():
def get(self, route:str) -> dict: def get(self, route:str) -> dict:
"""Gets a controller object (GET) """Gets a controller object (GET)
-route: Route for controller object GET request - route: Route for controller object GET request
-return: GET response dictionary - return: GET response dictionary
""" """
return self.instance.request("GET", route) return self.instance.request("GET", route)
def update(self, route:str, data:dict=None) -> dict: def update(self, route:str, data:dict=None) -> dict:
"""Updates a controller object (PATCH) """Updates a controller object (PATCH)
-route: Route for controller object PATCH request - route: Route for controller object PATCH request
-oid: ID of controller object - oid: ID of controller object
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -163,15 +163,15 @@ class Controller():
def delete(self, route:str) -> dict: def delete(self, route:str) -> dict:
"""Deletes a controller object (DELETE) """Deletes a controller object (DELETE)
-route: Route for controller object DELETE request - route: Route for controller object DELETE request
-oid: ID of controller object - oid: ID of controller object
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
return self.instance.request("DELETE", route) return self.instance.request("DELETE", route)
def last_response(self) -> dict: def last_response(self) -> dict:
"""Returns the last response from the controller object """Returns the last response from the controller object
-return: Last response dictionary - return: Last response dictionary
""" """
return self.response return self.response
@ -183,9 +183,9 @@ class Project(Controller):
def get(self, name:str=None, oid:str=None) -> dict: def get(self, name:str=None, oid:str=None) -> dict:
"""Gets a project by name """Gets a project by name
-oid: ID of project to get (optional) - oid: ID of project to get (optional)
-name: Name of project if None returns all projects - name: Name of project if None returns all projects
-return: GET response dictionary - return: GET response dictionary
""" """
if oid: if oid:
return super().get(f"/api/projects/{oid}") return super().get(f"/api/projects/{oid}")
@ -200,13 +200,13 @@ class Project(Controller):
def get_project_names(self) -> list: def get_project_names(self) -> list:
"""Gets a list of project names """Gets a list of project names
-return: List of project names - return: List of project names
""" """
return [prj["name"] for prj in self.get()['items']] return [prj["name"] for prj in self.get()['items']]
def create(self) -> dict: def create(self) -> dict:
"""Creates a new project """Creates a new project
-return: POST response dictionary - return: POST response dictionary
""" """
if not self.data: if not self.data:
raise InvalidToken(f"Please Build a {type(self).__name__} before creating") raise InvalidToken(f"Please Build a {type(self).__name__} before creating")
@ -216,16 +216,16 @@ class Project(Controller):
def update(self, name:str) -> dict: def update(self, name:str) -> dict:
"""Updates a project """Updates a project
-name: Name of project to update - name: Name of project to update
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
prj_id = prj_id = self.get(name)['item']['id'] prj_id = prj_id = self.get(name)['item']['id']
return super().update(f"/api/projects/{prj_id}") return super().update(f"/api/projects/{prj_id}")
def delete(self, name:str) -> dict: def delete(self, name:str) -> dict:
"""Deletes a project """Deletes a project
-name: Name of project to delete - name: Name of project to delete
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
prj_id = self.get(name)['item']['id'] prj_id = self.get(name)['item']['id']
return super().delete(f"/api/projects/{prj_id}") return super().delete(f"/api/projects/{prj_id}")
@ -238,10 +238,10 @@ class Board(Controller):
def get(self, project_name:str=None, board_name:str=None, oid:str=None) -> dict: def get(self, project_name:str=None, board_name:str=None, oid:str=None) -> dict:
"""Gets a board by name """Gets a board by name
-oid: ID of board to get (optonal) - oid: ID of board to get (optonal)
-name: Name of board if None returns all boards - name: Name of board if None returns all boards
-project_name: Name of project to get boards from - project_name: Name of project to get boards from
-return: GET response dictionary - return: GET response dictionary
""" """
if oid: if oid:
return super().get(f"/api/boards/{oid}") return super().get(f"/api/boards/{oid}")
@ -260,8 +260,8 @@ class Board(Controller):
def create(self, project_name:str) -> dict: def create(self, project_name:str) -> dict:
"""Creates a new board """Creates a new board
-prj_name: Name of project to create board in - prj_name: Name of project to create board in
-return: POST response dictionary - return: POST response dictionary
""" """
if not self.data: if not self.data:
raise InvalidToken(f"Please Build a {type(self).__name__} before creating") raise InvalidToken(f"Please Build a {type(self).__name__} before creating")
@ -271,10 +271,10 @@ class Board(Controller):
def update(self, project_name:str=None, board_name:str=None, data:dict=None, oid:str=None) -> dict: def update(self, project_name:str=None, board_name:str=None, data:dict=None, oid:str=None) -> dict:
"""Updates a board """Updates a board
-oid: ID of board to update (optional) - oid: ID of board to update (optional)
-project_name: Name of project to update board in - project_name: Name of project to update board in
-board_name: Name of board to update - board_name: Name of board to update
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -289,10 +289,10 @@ class Board(Controller):
def delete(self, project_name:str=None, board_name:str=None, oid:str=None): def delete(self, project_name:str=None, board_name:str=None, oid:str=None):
"""Deletes a board """Deletes a board
-oid: ID of board to delete (optional) - oid: ID of board to delete (optional)
-project_name: Name of project to delete board in - project_name: Name of project to delete board in
-board_name: Name of board to delete - board_name: Name of board to delete
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
if oid: if oid:
return super().delete(f"/api/boards/{oid}") return super().delete(f"/api/boards/{oid}")
@ -312,10 +312,10 @@ class List(Controller):
def get(self, project_name:str=None, board_name:str=None, list_name:str=None): def get(self, project_name:str=None, board_name:str=None, list_name:str=None):
"""Gets a list by name """Gets a list by name
NOTE: No GET route for list by ID NOTE: No GET route for list by ID
-project_name: Name of project to get list from - project_name: Name of project to get list from
-board_name: Name of board to get list from - board_name: Name of board to get list from
-list_name: Name of list to get - list_name: Name of list to get
-return: GET response dictionary - return: GET response dictionary
""" """
if not (project_name and board_name): if not (project_name and board_name):
raise InvalidToken("Please provide project and board names") raise InvalidToken("Please provide project and board names")
@ -331,9 +331,9 @@ class List(Controller):
def create(self, project_name:str=None, board_name:str=None, data:dict=None): def create(self, project_name:str=None, board_name:str=None, data:dict=None):
"""Creates a new list """Creates a new list
-project_name: Name of project to create list in - project_name: Name of project to create list in
-board_name: Name of board to create list in - board_name: Name of board to create list in
-return: POST response dictionary - return: POST response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -347,11 +347,11 @@ class List(Controller):
def update(self, project_name:str=None, board_name:str=None, list_name:str=None, data:dict=None, oid:str=None): def update(self, project_name:str=None, board_name:str=None, list_name:str=None, data:dict=None, oid:str=None):
"""Updates a list """Updates a list
-oid: ID of list to update (optional) - oid: ID of list to update (optional)
-project_name: Name of project to update list in - project_name: Name of project to update list in
-board_name: Name of board to update list in - board_name: Name of board to update list in
-list_name: Name of list to update - list_name: Name of list to update
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -366,11 +366,11 @@ class List(Controller):
def delete(self, project_name:str=None, board_name:str=None, list_name:str=None, oid:str=None): def delete(self, project_name:str=None, board_name:str=None, list_name:str=None, oid:str=None):
"""Deletes a list """Deletes a list
-oid: ID of list to delete (optional) - oid: ID of list to delete (optional)
-project_name: Name of project to delete list in - project_name: Name of project to delete list in
-board_name: Name of board to delete list in - board_name: Name of board to delete list in
-list_name: Name of list to delete - list_name: Name of list to delete
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
if oid: if oid:
return super().delete(f"/api/lists/{oid}") return super().delete(f"/api/lists/{oid}")
@ -387,12 +387,12 @@ class Card(Controller):
def get(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, oid:str=None): def get(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, oid:str=None):
"""Gets a card by name """Gets a card by name
-oid: ID of card to get (optional) - oid: ID of card to get (optional)
-project_name: Name of project to get card from - project_name: Name of project to get card from
-board_name: Name of board to get card from - board_name: Name of board to get card from
-list_name: Name of list to get card from - list_name: Name of list to get card from
-card_name: Name of card to get - card_name: Name of card to get
-return: GET response dictionary - return: GET response dictionary
""" """
if oid != None: if oid != None:
return super().get(f"/api/cards/{oid}") return super().get(f"/api/cards/{oid}")
@ -412,10 +412,10 @@ class Card(Controller):
def create(self, project_name:str=None, board_name:str=None, list_name:str=None, data:dict=None): def create(self, project_name:str=None, board_name:str=None, list_name:str=None, data:dict=None):
"""Creates a new card """Creates a new card
-project_name: Name of project to create card in - project_name: Name of project to create card in
-board_name: Name of board to create card in - board_name: Name of board to create card in
-list_name: Name of list to create card in - list_name: Name of list to create card in
-return: POST response dictionary - return: POST response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -430,12 +430,12 @@ class Card(Controller):
def delete(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, oid:str=None): def delete(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, oid:str=None):
"""Deletes a card """Deletes a card
-oid: ID of card to delete (optional) - oid: ID of card to delete (optional)
-project_name: Name of project to delete card in - project_name: Name of project to delete card in
-board_name: Name of board to delete card in - board_name: Name of board to delete card in
-list_name: Name of list to delete card in - list_name: Name of list to delete card in
-card_name: Name of card to delete - card_name: Name of card to delete
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
if oid != None: if oid != None:
return super().delete(f"/api/cards/{oid}") return super().delete(f"/api/cards/{oid}")
@ -446,12 +446,12 @@ class Card(Controller):
def update(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, data:dict=None, oid:str=None): def update(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, data:dict=None, oid:str=None):
"""Updates a card """Updates a card
-oid: ID of card to update (optional) - oid: ID of card to update (optional)
-project_name: Name of project to update card in - project_name: Name of project to update card in
-board_name: Name of board to update card in - board_name: Name of board to update card in
-list_name: Name of list to update card in - list_name: Name of list to update card in
-card_name: Name of card to update - card_name: Name of card to update
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -466,12 +466,12 @@ class Card(Controller):
def get_labels(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, oid:str=None): def get_labels(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, oid:str=None):
"""Gets labels for a card """Gets labels for a card
-oid: ID of card to get labels from (optional) - oid: ID of card to get labels from (optional)
-project_name: Name of project to get card from - project_name: Name of project to get card from
-board_name: Name of board to get card from - board_name: Name of board to get card from
-list_name: Name of list to get card from - list_name: Name of list to get card from
-card_name: Name of card to get - card_name: Name of card to get
-return: GET response dictionary - return: GET response dictionary
""" """
if oid: if oid:
return self.get(oid=oid)['included']['cardLabels'] return self.get(oid=oid)['included']['cardLabels']
@ -492,10 +492,10 @@ class Label(Controller):
def get(self, project_name:str=None, board_name:str=None, label_name:str=None) -> dict: def get(self, project_name:str=None, board_name:str=None, label_name:str=None) -> dict:
"""Gets a label by name """Gets a label by name
-project_name: Name of project to get label from - project_name: Name of project to get label from
-board_name: Name of board to get label from - board_name: Name of board to get label from
-label_name: Name of label to get - label_name: Name of label to get
-return: GET response dictionary - return: GET response dictionary
""" """
if not (project_name and board_name): if not (project_name and board_name):
raise InvalidToken("Please provide project and board names") raise InvalidToken("Please provide project and board names")
@ -511,9 +511,9 @@ class Label(Controller):
def create(self, project_name:str=None, board_name:str=None, data:dict=None): def create(self, project_name:str=None, board_name:str=None, data:dict=None):
"""Creates a new label """Creates a new label
-project_name: Name of project to create label in - project_name: Name of project to create label in
-board_name: Name of board to create label in - board_name: Name of board to create label in
-return: POST response dictionary - return: POST response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -527,11 +527,11 @@ class Label(Controller):
def delete(self, project_name:str=None, board_name:str=None, label_name:str=None, oid:str=None): def delete(self, project_name:str=None, board_name:str=None, label_name:str=None, oid:str=None):
"""Deletes a label """Deletes a label
-oid: ID of label to delete (optional) - oid: ID of label to delete (optional)
-project_name: Name of project to delete label from - project_name: Name of project to delete label from
-board_name: Name of board to delete label from - board_name: Name of board to delete label from
-label_name: Name of label to delete - label_name: Name of label to delete
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
if oid: if oid:
return super().delete(f"/api/labels/{oid}") return super().delete(f"/api/labels/{oid}")
@ -542,12 +542,12 @@ class Label(Controller):
def add(self, project_name:str=None, board_name:str=None, list_name:str=None ,card_name:str=None, label_name:str=None, card_id:str=None, label_id:str=None): def add(self, project_name:str=None, board_name:str=None, list_name:str=None ,card_name:str=None, label_name:str=None, card_id:str=None, label_id:str=None):
"""Adds a label to a card """Adds a label to a card
-project_name: Name of project to add label to card in - project_name: Name of project to add label to card in
-board_name: Name of board to add label to card in - board_name: Name of board to add label to card in
-label_name: Name of label to add to card - label_name: Name of label to add to card
-card_name: Name of card to add label to - card_name: Name of card to add label to
-list_name: Name of list to add label to card in - list_name: Name of list to add label to card in
-return: POST response dictionary - return: POST response dictionary
""" """
if label_id and card_id: if label_id and card_id:
return super().create(f"/api/cards/{card_id}/labels", data={"labelId":label_id}) return super().create(f"/api/cards/{card_id}/labels", data={"labelId":label_id})
@ -565,12 +565,12 @@ class Label(Controller):
def remove(self, project_name:str=None, board_name:str=None, list_name:str=None ,card_name:str=None, label_name:str=None, card_id:str=None, label_id:str=None): def remove(self, project_name:str=None, board_name:str=None, list_name:str=None ,card_name:str=None, label_name:str=None, card_id:str=None, label_id:str=None):
"""Removes a label from a card """Removes a label from a card
-project_name: Name of project to remove label from card in - project_name: Name of project to remove label from card in
-board_name: Name of board to remove label from card in - board_name: Name of board to remove label from card in
-label_name: Name of label to remove from card - label_name: Name of label to remove from card
-card_name: Name of card to remove label from - card_name: Name of card to remove label from
-list_name: Name of list to remove label from card in - list_name: Name of list to remove label from card in
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
if label_id and card_id: if label_id and card_id:
return super().delete(f"/api/cards/{card_id}/labels/{label_id}") return super().delete(f"/api/cards/{card_id}/labels/{label_id}")
@ -595,12 +595,12 @@ class Task(Controller):
def get(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, task_name:str=None) -> dict: def get(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, task_name:str=None) -> dict:
"""Gets a task by name """Gets a task by name
NOTE: No GET route for tasks by OID NOTE: No GET route for tasks by OID
-project_name: Name of project to get task from - project_name: Name of project to get task from
-board_name: Name of board to get task from - board_name: Name of board to get task from
-list_name: Name of list to get task from - list_name: Name of list to get task from
-card_name: Name of card to get task from - card_name: Name of card to get task from
-task_name: Name of task to get - task_name: Name of task to get
-return: GET response dictionary - return: GET response dictionary
""" """
if not (project_name and board_name and list_name and card_name): if not (project_name and board_name and list_name and card_name):
raise InvalidToken("Please provide project, board, list, and card names") raise InvalidToken("Please provide project, board, list, and card names")
@ -619,12 +619,12 @@ class Task(Controller):
def create(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, data:dict=None, card_id:str=None): def create(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, data:dict=None, card_id:str=None):
"""Creates a new task """Creates a new task
-card_id: ID of card to create task in (optional) - card_id: ID of card to create task in (optional)
-project_name: Name of project to create task in - project_name: Name of project to create task in
-board_name: Name of board to create task in - board_name: Name of board to create task in
-list_name: Name of list to create task in - list_name: Name of list to create task in
-card_name: Name of card to create task in - card_name: Name of card to create task in
-return: POST response dictionary - return: POST response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -643,13 +643,13 @@ class Task(Controller):
def update(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, task_name:str=None, data:dict=None, oid:str=None): def update(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, task_name:str=None, data:dict=None, oid:str=None):
"""Updates a task """Updates a task
-oid: Object ID of task to update (optional) - oid: Object ID of task to update (optional)
-project_name: Name of project to update task in - project_name: Name of project to update task in
-board_name: Name of board to update task in - board_name: Name of board to update task in
-list_name: Name of list to update task in - list_name: Name of list to update task in
-card_name: Name of card to update task in - card_name: Name of card to update task in
-task_name: Name of task to update - task_name: Name of task to update
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -664,13 +664,13 @@ class Task(Controller):
def delete(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, task_name:str=None, oid:str=None): def delete(self, project_name:str=None, board_name:str=None, list_name:str=None, card_name:str=None, task_name:str=None, oid:str=None):
"""Deletes a task """Deletes a task
-oid: ID of task to delete (Use this if you already have the ID) - oid: ID of task to delete (Use this if you already have the ID)
-project_name: Name of project to delete task from - project_name: Name of project to delete task from
-board_name: Name of board to delete task from - board_name: Name of board to delete task from
-list_name: Name of list to delete task from - list_name: Name of list to delete task from
-card_name: Name of card to delete task from - card_name: Name of card to delete task from
-task_name: Name of task to delete - task_name: Name of task to delete
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
if oid: if oid:
return super().delete(f"/api/tasks/{id}") return super().delete(f"/api/tasks/{id}")
@ -700,14 +700,14 @@ class Background(Controller):
def gradients(self) -> dict: def gradients(self) -> dict:
"""Gets all gradients """Gets all gradients
-return: GET response dictionary - return: GET response dictionary
""" """
return self.options return self.options
def apply(self, prj_name:str): def apply(self, prj_name:str):
"""Applies a gradient to a project """Applies a gradient to a project
-project: Name of project to apply gradient to - project: Name of project to apply gradient to
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
project = Project(self.instance) project = Project(self.instance)
prj_id = project.get(prj_name)["item"]["id"] prj_id = project.get(prj_name)["item"]["id"]
@ -719,8 +719,8 @@ class Background(Controller):
def clear(self, prj_name:str): def clear(self, prj_name:str):
"""Clears a gradient from a project """Clears a gradient from a project
-project: Name of project to clear gradient from - project: Name of project to clear gradient from
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
project = Project(self.instance) project = Project(self.instance)
prj_id = project.get(prj_name)["item"]["id"] prj_id = project.get(prj_name)["item"]["id"]
@ -735,13 +735,13 @@ class Comment(Controller):
class User(Controller): class User(Controller):
def __init__(self, instance:Planka, **kwargs) -> None: def __init__(self, instance:Planka, **kwargs) -> None:
"""Creates a user """Creates a user
-username: Username of user to create - username: Username of user to create
-name: Display name of user to create - name: Display name of user to create
-password: Password of user to create - password: Password of user to create
-email: Email of user to create - email: Email of user to create
-subscribe: Subscibe user to own cards (default: False) - subscribe: Subscibe user to own cards (default: False)
-organization: Organization of user to create (default: None) - organization: Organization of user to create (default: None)
-admin: Admin state of user to create (default: False) - admin: Admin state of user to create (default: False)
""" """
self.instance = instance self.instance = instance
self.template = instance.get_template("user") self.template = instance.get_template("user")
@ -749,8 +749,8 @@ class User(Controller):
def get(self, username:str=None): def get(self, username:str=None):
"""Gets a user """Gets a user
-username: Username of user to get (all if not provided) - username: Username of user to get (all if not provided)
-return: GET response dictionary - return: GET response dictionary
""" """
if not username: if not username:
return super().get("/api/users")["items"] return super().get("/api/users")["items"]
@ -762,8 +762,8 @@ class User(Controller):
def create(self, data:dict=None): def create(self, data:dict=None):
"""Creates a user """Creates a user
-data: Data dictionary to create user with (optional) - data: Data dictionary to create user with (optional)
-return: POST response dictionary - return: POST response dictionary
""" """
if not data: if not data:
data = self.data data = self.data
@ -775,9 +775,9 @@ class User(Controller):
def delete(self, username:str, oid:str=None): def delete(self, username:str, oid:str=None):
"""Deletes a user """Deletes a user
-username: Username of user to delete - username: Username of user to delete
-oid: ID of user to delete (Use this if you already have the ID) - oid: ID of user to delete (Use this if you already have the ID)
-return: DELETE response dictionary - return: DELETE response dictionary
""" """
if oid: if oid:
return super().delete(f"/api/users/{oid}") return super().delete(f"/api/users/{oid}")
@ -787,10 +787,10 @@ class User(Controller):
def update(self, username:str, oid:str=None, data:dict=None): def update(self, username:str, oid:str=None, data:dict=None):
"""Updates a user """Updates a user
-username: Username of user to update - username: Username of user to update
-oid: ID of user to update (Use this if you already have the ID) - oid: ID of user to update (Use this if you already have the ID)
-data: Data dictionary to update user with (optional) - data: Data dictionary to update user with (optional)
-return: PATCH response dictionary - return: PATCH response dictionary
""" """
user = self.get(username) user = self.get(username)
if not data: if not data: