Skip to content

Commit 7221fa3

Browse files
monkey-wenjunfangwenjun
andauthored
Add inline task setting checkbox method (#573)
* Add inline task setting checkbox method * Add inline task setting checkbox method Co-authored-by: fangwenjun <[email protected]>
1 parent 15a9fda commit 7221fa3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

atlassian/confluence.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,3 +2179,25 @@ def get_subtree_of_content_ids(self, page_id):
21792179
if child_subtree:
21802180
output.extend([p for p in child_subtree])
21812181
return set(output)
2182+
2183+
def set_inline_tasks_checkbox(self, page_id, task_id, status):
2184+
"""
2185+
Set inline task element value
2186+
status is CHECKED or UNCHECKED
2187+
:return:
2188+
"""
2189+
url = "/rest/inlinetasks/1/task/{page_id}/{task_id}/".format(page_id=page_id, task_id=task_id)
2190+
data = {"status": status, "trigger": "VIEW_PAGE"}
2191+
try:
2192+
response = self.post(url, json=data)
2193+
if response.status_code == 200:
2194+
return True
2195+
else:
2196+
return False
2197+
except HTTPError as e:
2198+
if e.response.status_code != 200:
2199+
raise ApiError(
2200+
"Param cannot be empty",
2201+
reason=e)
2202+
raise
2203+

docs/confluence.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,6 @@ Other actions
222222
# Compare content and check is already updated or not
223223
confluence.is_page_content_is_already_updated(page_id, body)
224224
225+
# Add inline task setting checkbox method
226+
confluence.set_inline_tasks_checkbox(page_id, task_id, status)
227+

0 commit comments

Comments
 (0)