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] Expand parameter addition for get_draft_page_by_id #1388

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 11 additions & 18 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,27 +506,20 @@ def get_page_comments(

return response

def get_draft_page_by_id(self, page_id, status="draft"):
def get_draft_page_by_id(self, page_id, status="draft", expand=None):
"""
Provide content by id with status = draft
:param page_id:
:param status:
Gets content by id with status = draft
:param page_id: Content ID
:param status: (str) list of content statuses to filter results on. Default value: [draft]
:param expand: OPTIONAL: Default value: history,space,version
We can also specify some extensions such as extensions.inlineProperties
(for getting inline comment-specific properties) or extensions. Resolution
for the resolution status of each comment in the results
:return:
"""
url = "rest/api/content/{page_id}?status={status}".format(page_id=page_id, status=status)

try:
response = self.get(url)
except HTTPError as e:
if e.response.status_code == 404:
raise ApiPermissionError(
"The calling user does not have permission to view the content",
reason=e,
)

raise

return response
# Version not passed since draft versions don't match the page and
# operate differently between different collaborative modes
return self.get_page_by_id(page_id=page_id, expand=expand, status=status)

def get_all_pages_by_label(self, label, start=0, limit=50):
"""
Expand Down
2 changes: 1 addition & 1 deletion atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ def issue_field_value_append(self, issue_id_or_key, field, value, notify_users=T
else:
new_value = [value]

fields = {'{}'.format(field): new_value}
fields = {"{}".format(field): new_value}

return self.put(
"{base_url}/{key}".format(base_url=base_url, key=issue_id_or_key),
Expand Down