Skip to content

Commit 19aaf29

Browse files
author
gkowalc
committed
added whiteboard methods
1 parent 5596fd5 commit 19aaf29

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

atlassian/confluence.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,6 +2877,47 @@ def audit(
28772877
params["searchString"] = search_string
28782878
return self.get(url, params=params)
28792879

2880+
"""
2881+
##############################################################################################
2882+
# Confluence whiteboards (cloud only!) #
2883+
##############################################################################################
2884+
"""
2885+
2886+
def create_whiteboard(self, spaceId, title=None, parentId=None):
2887+
# Use spaceId, not space key.
2888+
url = '/api/v2/whiteboards'
2889+
data = {"spaceId": spaceId}
2890+
if title is not None:
2891+
data["title"] = title
2892+
if parentId is not None:
2893+
data["parentId"] = parentId
2894+
return self.post(url, data=data)
2895+
2896+
def get_whiteboard(self, whiteboard_id):
2897+
try:
2898+
url = f'/api/v2/whiteboards/{whiteboard_id}'
2899+
return self.get(url)
2900+
except HTTPError as e:
2901+
# Default 404 error handling is ambiguous
2902+
if e.response.status_code == 404:
2903+
raise ApiValueError("Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e)
2904+
2905+
raise
2906+
2907+
2908+
def delete_whiteboard(self, whiteboard_id):
2909+
# Deleting a whiteboard moves the whiteboard to the trash, where it can be restored later
2910+
try:
2911+
url = f'/api/v2/whiteboards/{whiteboard_id}'
2912+
return self.delete(url)
2913+
except HTTPError as e:
2914+
# # Default 404 error handling is ambiguous
2915+
if e.response.status_code == 404:
2916+
raise ApiValueError(
2917+
"Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e)
2918+
2919+
raise
2920+
28802921
"""
28812922
##############################################################################################
28822923
# Team Calendars REST API implements (https://jira.atlassian.com/browse/CONFSERVER-51003) #

0 commit comments

Comments
 (0)