Skip to content

Commit bfd9cdf

Browse files
committed
Add page_exists, blog_post_exists, and title lookup methods to Confluence Cloud (closes #581)
The Server implementation had these methods but the Cloud module was missing them. Adds get_page_by_title, get_blog_post_by_title, page_exists, and blog_post_exists to match Server API parity.
1 parent 63e744f commit bfd9cdf

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

atlassian/confluence/cloud/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,24 @@ def get_content_ancestors(self, content_id, **kwargs):
6060
"""Get ancestor content."""
6161
return self.get(f"content/{content_id}/ancestors", **kwargs)
6262

63+
def get_page_by_title(self, space_key, title, **kwargs):
64+
"""Get page by title and space key."""
65+
return self.get("content", params={"spaceKey": space_key, "title": title, "type": "page", **kwargs})
66+
67+
def get_blog_post_by_title(self, space_key, title, **kwargs):
68+
"""Get blog post by title and space key."""
69+
return self.get("content", params={"spaceKey": space_key, "title": title, "type": "blogpost", **kwargs})
70+
71+
def page_exists(self, space_key, title, **kwargs):
72+
"""Check if page exists."""
73+
result = self.get_page_by_title(space_key, title, **kwargs)
74+
return len(result.get("results", [])) > 0
75+
76+
def blog_post_exists(self, space_key, title, **kwargs):
77+
"""Check if blog post exists."""
78+
result = self.get_blog_post_by_title(space_key, title, **kwargs)
79+
return len(result.get("results", [])) > 0
80+
6381
# Space Management
6482
def get_spaces(self, **kwargs):
6583
"""Get all spaces."""

0 commit comments

Comments
 (0)