Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Confluence] added new endpoints for confluence whiteboards + docs + example #1377

Merged
merged 35 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2e8e1b0
fixing minor issue in scrap_regex_from_issue method
Feb 3, 2024
715463b
new Confluence method scrap_regex_from_page+ docs + examples
Feb 4, 2024
4db577a
Merge branch 'atlassian-api:master' into master
gkowalc Feb 4, 2024
e13b5ba
Merge branch 'atlassian-api:master' into master
gkowalc Feb 8, 2024
9fd7ae4
added method get_attachments_ids_from_page to jira.py
Feb 8, 2024
f695346
added method download_attachments_from_issue
Feb 8, 2024
6f3c1f6
refactoring download_all_attachments_from_page method
Feb 8, 2024
7fd73d8
finished download_attachments_from_issue
Feb 9, 2024
ef752ab
added two new methods: download_attachments.from_issue and get_attac…
Feb 9, 2024
999de01
Merge branch 'atlassian-api:master' into master
gkowalc Feb 9, 2024
2edee0c
Merge branch 'atlassian-api:master' into master
gkowalc Feb 10, 2024
fe7c1f1
Merge branch 'master' of github.com:gkowalc/atlassian-python-api
Feb 15, 2024
bf7dcb4
Merge branch 'master' of github.com:gkowalc/atlassian-python-api
Feb 27, 2024
7d6b0a0
Merge branch 'master' of github.com:gkowalc/atlassian-python-api
Mar 13, 2024
a56b1be
added fix to the infinitive loop
Mar 13, 2024
0802a35
Merge branch 'master' of github.com:gkowalc/atlassian-python-api
Mar 19, 2024
c23e7cd
adding reursion depth condition
Mar 19, 2024
e8e8959
fixed reursion depth condition
Mar 19, 2024
8c2824b
added update4d jira.py with new method + docs +example
Mar 19, 2024
9b1c9c4
added update4d jira.py with new method + docs +exampl
Mar 19, 2024
08d4acb
fix flake8 issue
Mar 19, 2024
20cae0b
Merge branch 'atlassian-api:master' into master
gkowalc Mar 20, 2024
26cf691
hotfix get_issue_tree_recursive
Mar 20, 2024
4cc2a03
Merge branch 'master' of github.com:gkowalc/atlassian-python-api
Mar 22, 2024
10ee67e
added expand to get_issue method, added new method
Mar 22, 2024
273401b
get_issue_status_changelog method
Mar 22, 2024
b70f618
included param expand in get_issue method decription
Mar 22, 2024
6bcd2c0
Merge branch 'atlassian-api:master' into master
gkowalc Mar 29, 2024
6a83b0b
WIP PR changes - https://github.com/atlassian-api/atlassian-python-ap…
Mar 29, 2024
0a6367c
Merge branch 'atlassian-api:master' into master
gkowalc Apr 12, 2024
5596fd5
improving index.rst docs https://github.com/atlassian-api/atlassian-p…
Apr 12, 2024
7b359a2
Merge branch 'atlassian-api:master' into master
gkowalc Apr 21, 2024
19aaf29
added whiteboard methods
Apr 21, 2024
8233f84
Merge branch 'master' of github.com:gkowalc/atlassian-python-api
Apr 21, 2024
fd3c1b6
added confluence whiteboard endpoints
Apr 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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):
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):
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
15 changes: 15 additions & 0 deletions docs/confluence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ Page actions
# Get regex matches from Confluence page
confluence.scrap_regex_from_page(page_id, regex)

Confluence Whiteboards
----------------------

.. code-block:: python

# Create new whiteboard - cloud only
confluence.create_whiteboard(spaceId, title=None, parentId=None)

# Delete existing whiteboard - cloud only
confluence.delete_whiteboard(whiteboard_id)

# Get whiteboard by id - cloud only!
confluence.get_whiteboard(whiteboard_id)


Template actions
----------------

Expand Down
20 changes: 20 additions & 0 deletions examples/confluence/confluence_whiteboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from atlassian import Confluence

confluence = Confluence(
url="<instance_url>",
username="<atlassian_username>",
password="api_key",
)
"""
This is example on how to use confluence whiteboard endponds
Currently only available on confluence cloud
"""
# create whiteboard. First parameter is a spaceID (not spacekey!),
# second param is a name of whiteboard (optional), third one is a parent pageid (optional)
confluence.create_whiteboard("42342", "My whiteboard", "545463")

# To delete of get whiteboard, use whiteboard id
# https://<instance_name>/wiki/spaces/<space_key>/whiteboard/<whiteboard_id>
# Deleting a whiteboard moves the whiteboard to the trash, where it can be restored later
confluence.delete_whiteboard("42342")
confluence.get_whiteboard("42342")
Loading