Skip to content

Commit d11bbb1

Browse files
committed
Confluence: add collaborative editing methods
1 parent 827de3d commit d11bbb1

File tree

2 files changed

+102
-8
lines changed

2 files changed

+102
-8
lines changed

atlassian/confluence.py

+98-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
from requests import HTTPError
88
from deprecated import deprecated
99
from atlassian import utils
10-
from .errors import (
11-
ApiError,
12-
ApiNotFoundError,
13-
ApiPermissionError,
14-
ApiValueError,
15-
ApiConflictError,
16-
)
10+
from .errors import ApiError, ApiNotFoundError, ApiPermissionError, ApiValueError, ApiConflictError, ApiNotAcceptable
1711
from .rest_client import AtlassianRestAPI
1812

1913
log = logging.getLogger(__name__)
@@ -1572,17 +1566,18 @@ def update_existing_page(
15721566
representation="storage",
15731567
minor_edit=False,
15741568
version_comment=None,
1569+
full_width=False,
15751570
):
15761571
"""Duplicate update_page. Left for the people who used it before. Use update_page instead"""
15771572
return self.update_page(
15781573
page_id=page_id,
15791574
title=title,
15801575
body=body,
1581-
parent_id=None,
15821576
type=type,
15831577
representation=representation,
15841578
minor_edit=minor_edit,
15851579
version_comment=version_comment,
1580+
full_width=full_width,
15861581
)
15871582

15881583
def update_page(
@@ -2943,6 +2938,101 @@ def clean_jira_metadata_cache(self, global_id):
29432938
params = {"globalId": global_id}
29442939
return self.delete(url, params=params)
29452940

2941+
# Collaborative editing
2942+
def collaborative_editing_get_configuration(self):
2943+
"""
2944+
Get collaborative editing configuration
2945+
Related to the on-prem setup Confluence Data Center
2946+
:return:
2947+
"""
2948+
if self.cloud:
2949+
return ApiNotAcceptable
2950+
url = "rest/synchrony-interop/configuration"
2951+
return self.get(url, headers=self.no_check_headers)
2952+
2953+
def collaborative_editing_disable(self):
2954+
"""
2955+
Disable collaborative editing
2956+
Related to the on-prem setup Confluence Data Center
2957+
:return:
2958+
"""
2959+
if self.cloud:
2960+
return ApiNotAcceptable
2961+
url = "rest/synchrony-interop/disable"
2962+
return self.post(url, headers=self.no_check_headers)
2963+
2964+
def collaborative_editing_enable(self):
2965+
"""
2966+
Disable collaborative editing
2967+
Related to the on-prem setup Confluence Data Center
2968+
:return:
2969+
"""
2970+
if self.cloud:
2971+
return ApiNotAcceptable
2972+
url = "rest/synchrony-interop/enable"
2973+
return self.post(url, headers=self.no_check_headers)
2974+
2975+
def collaborative_editing_restart(self):
2976+
"""
2977+
Disable collaborative editing
2978+
Related to the on-prem setup Confluence Data Center
2979+
:return:
2980+
"""
2981+
if self.cloud:
2982+
return ApiNotAcceptable
2983+
url = "rest/synchrony-interop/restart"
2984+
return self.post(url, headers=self.no_check_headers)
2985+
2986+
def collaborative_editing_shared_draft_status(self):
2987+
"""
2988+
Status of collaborative editing
2989+
Related to the on-prem setup Confluence Data Center
2990+
:return: false or true parameter in json
2991+
{
2992+
"sharedDraftsEnabled": false
2993+
}
2994+
"""
2995+
if self.cloud:
2996+
return ApiNotAcceptable
2997+
url = "rest/synchrony-interop/status"
2998+
return self.get(url, headers=self.no_check_headers)
2999+
3000+
def collaborative_editing_synchrony_status(self):
3001+
"""
3002+
Status of collaborative editing
3003+
Related to the on-prem setup Confluence Data Center
3004+
:return: stopped or running parameter in json
3005+
{
3006+
"status": "stopped"
3007+
}
3008+
"""
3009+
if self.cloud:
3010+
return ApiNotAcceptable
3011+
url = "rest/synchrony-interop/synchrony-status"
3012+
return self.get(url, headers=self.no_check_headers)
3013+
3014+
def synchrony_get_configuration(self):
3015+
"""
3016+
Status of collaborative editing
3017+
Related to the on-prem setup Confluence Data Center
3018+
:return:
3019+
"""
3020+
if self.cloud:
3021+
return ApiNotAcceptable
3022+
url = "rest/synchrony/1.0/config/status"
3023+
return self.get(url, headers=self.no_check_headers)
3024+
3025+
def synchrony_remove_draft(self, page_id):
3026+
"""
3027+
Status of collaborative editing
3028+
Related to the on-prem setup Confluence Data Center
3029+
:return:
3030+
"""
3031+
if self.cloud:
3032+
return ApiNotAcceptable
3033+
url = "rest/synchrony/1.0/content/{pageId}/changes/unpublished".format(pageId=page_id)
3034+
return self.delete(url)
3035+
29463036
def get_license_details(self):
29473037
"""
29483038
Returns the license detailed information

atlassian/errors.py

+4
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ class ApiValueError(ApiError):
2121

2222
class ApiConflictError(ApiError):
2323
pass
24+
25+
26+
class ApiNotAcceptable(ApiError):
27+
pass

0 commit comments

Comments
 (0)