Skip to content

Commit

Permalink
added whiteboard methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gkowalc committed Apr 21, 2024
1 parent 5596fd5 commit 19aaf29
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,47 @@ def audit(
params["searchString"] = search_string
return self.get(url, params=params)

"""
##############################################################################################
# Confluence whiteboards (cloud only!) #
##############################################################################################
"""

def create_whiteboard(self, spaceId, title=None, parentId=None):
# Use spaceId, not space key.
url = '/api/v2/whiteboards'
data = {"spaceId": spaceId}
if title is not None:
data["title"] = title
if parentId is not None:
data["parentId"] = parentId
return self.post(url, data=data)

def get_whiteboard(self, whiteboard_id):
try:
url = f'/api/v2/whiteboards/{whiteboard_id}'
return self.get(url)
except HTTPError as e:
# Default 404 error handling is ambiguous
if e.response.status_code == 404:
raise ApiValueError("Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e)

raise


def delete_whiteboard(self, whiteboard_id):
# Deleting a whiteboard moves the whiteboard to the trash, where it can be restored later
try:
url = f'/api/v2/whiteboards/{whiteboard_id}'
return self.delete(url)
except HTTPError as e:
# # Default 404 error handling is ambiguous
if e.response.status_code == 404:
raise ApiValueError(
"Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e)

raise

"""
##############################################################################################
# Team Calendars REST API implements (https://jira.atlassian.com/browse/CONFSERVER-51003) #
Expand Down

0 comments on commit 19aaf29

Please sign in to comment.