pub struct ConfluenceApi { /* private fields */ }Expand description
Confluence Cloud REST API v2 backend.
Implementations§
Source§impl ConfluenceApi
impl ConfluenceApi
Sourcepub fn new(client: AtlassianClient) -> Self
pub fn new(client: AtlassianClient) -> Self
Creates a new Confluence API backend.
Source§impl ConfluenceApi
impl ConfluenceApi
Sourcepub async fn resolve_space_id(&self, space_key: &str) -> Result<String>
pub async fn resolve_space_id(&self, space_key: &str) -> Result<String>
Resolves a space key to a space ID via the Confluence API.
Sourcepub async fn list_spaces(
&self,
keys: &[&str],
type_: Option<&str>,
status: Option<&str>,
cursor: Option<&str>,
limit: u32,
) -> Result<ConfluenceSpacePage>
pub async fn list_spaces( &self, keys: &[&str], type_: Option<&str>, status: Option<&str>, cursor: Option<&str>, limit: u32, ) -> Result<ConfluenceSpacePage>
Lists Confluence spaces (one page at a time).
Optional filters: keys (matches any of the given space keys; joined as
a single comma-separated query parameter), type (one of "global",
"personal", "collaboration", "knowledge_base"), status (one of
"current", "archived"). Pagination is not auto-drained: pass
ConfluenceSpacePage::next_cursor back as cursor to fetch the next
page.
Sourcepub async fn list_space_pages(
&self,
space_id: &str,
status: Option<&str>,
sort: Option<&str>,
cursor: Option<&str>,
limit: u32,
) -> Result<PageSummaryPage>
pub async fn list_space_pages( &self, space_id: &str, status: Option<&str>, sort: Option<&str>, cursor: Option<&str>, limit: u32, ) -> Result<PageSummaryPage>
Enumerates pages within a Confluence space (one response at a time).
Optional filters are passed through to the Confluence v2 API verbatim:
status (e.g. current, archived, draft, trashed) and sort
(e.g. id, -id, title, -title, created-date, -created-date,
modified-date, -modified-date). Pagination is not auto-drained:
pass PageSummaryPage::next_cursor back as cursor to fetch the
next page.
Sourcepub async fn create_page(
&self,
space_key: &str,
title: &str,
body_adf: &ValidatedAdfDocument,
parent_id: Option<&str>,
) -> Result<String>
pub async fn create_page( &self, space_key: &str, title: &str, body_adf: &ValidatedAdfDocument, parent_id: Option<&str>, ) -> Result<String>
Creates a new Confluence page.
Sourcepub async fn move_page(
&self,
page_id: &str,
target_id: &str,
position: MovePosition,
) -> Result<MovedPage>
pub async fn move_page( &self, page_id: &str, target_id: &str, position: MovePosition, ) -> Result<MovedPage>
Moves or reparents a Confluence page within its current space.
Same-space only — cross-space moves are not supported by the v2 API.
Uses the v1 move endpoint (PUT /wiki/rest/api/content/{id}/move/{position}/{target}),
then re-fetches the page with ?include-ancestors=true to populate
the returned MovedPage.
Sourcepub async fn delete_page(&self, id: &str, purge: bool) -> Result<()>
pub async fn delete_page(&self, id: &str, purge: bool) -> Result<()>
Deletes a Confluence page.
Sourcepub async fn get_children(&self, page_id: &str) -> Result<Vec<ChildPage>>
pub async fn get_children(&self, page_id: &str) -> Result<Vec<ChildPage>>
Fetches all child pages of a given page, handling pagination.
Uses the v1 content API (/wiki/rest/api/content/{id}/child/page)
which is more widely supported than the v2 children endpoint.
Sourcepub async fn get_space_root_pages(
&self,
space_id: &str,
) -> Result<Vec<ChildPage>>
pub async fn get_space_root_pages( &self, space_id: &str, ) -> Result<Vec<ChildPage>>
Fetches top-level pages in a space (pages with no parent), handling pagination.
Uses the v2 API endpoint /wiki/api/v2/spaces/{space-id}/pages?depth=root.
Sourcepub async fn get_page_comments(
&self,
page_id: &str,
) -> Result<Vec<ConfluenceComment>>
pub async fn get_page_comments( &self, page_id: &str, ) -> Result<Vec<ConfluenceComment>>
Lists footer comments on a Confluence page, handling pagination.
Sourcepub async fn get_page_inline_comments(
&self,
page_id: &str,
) -> Result<Vec<ConfluenceComment>>
pub async fn get_page_inline_comments( &self, page_id: &str, ) -> Result<Vec<ConfluenceComment>>
Lists inline comments on a Confluence page, handling pagination.
Sourcepub async fn get_comment_replies(
&self,
comment_id: &str,
kind: CommentKind,
) -> Result<Vec<ConfluenceComment>>
pub async fn get_comment_replies( &self, comment_id: &str, kind: CommentKind, ) -> Result<Vec<ConfluenceComment>>
Lists the replies (child comments) of a comment.
kind selects which Confluence v2 endpoint to hit: footer replies and
inline replies live on separate URLs. The returned comments are stamped
with the same kind as the parent — Confluence treats reply chains as
homogenous.
Sourcepub async fn add_page_comment(
&self,
page_id: &str,
body_adf: &ValidatedAdfDocument,
) -> Result<()>
pub async fn add_page_comment( &self, page_id: &str, body_adf: &ValidatedAdfDocument, ) -> Result<()>
Adds a footer comment to a Confluence page.
Sourcepub async fn add_inline_page_comment(
&self,
page_id: &str,
body_adf: &ValidatedAdfDocument,
anchor: &InlineAnchor,
) -> Result<()>
pub async fn add_inline_page_comment( &self, page_id: &str, body_adf: &ValidatedAdfDocument, anchor: &InlineAnchor, ) -> Result<()>
Adds an inline comment anchored to a text selection on a Confluence page.
anchor is typically produced by Self::resolve_anchor, which counts
occurrences on the live page and validates that a 1-based match_index
the user supplied is in range.
Sourcepub async fn resolve_anchor(
&self,
page_id: &str,
anchor_text: &str,
match_index_1based: Option<usize>,
) -> Result<InlineAnchor>
pub async fn resolve_anchor( &self, page_id: &str, anchor_text: &str, match_index_1based: Option<usize>, ) -> Result<InlineAnchor>
Resolves an inline-comment anchor by counting anchor_text occurrences
in the live page body.
match_index_1based is what the user typed (1-based) and is None if
they omitted the flag. The returned InlineAnchor is ready to hand to
Self::add_inline_page_comment.
§Errors
- The anchor text does not appear on the page.
- The text appears more than once and no
--match-indexwas supplied. - The supplied
--match-indexis outside1..=match_count.
Sourcepub async fn get_labels(&self, page_id: &str) -> Result<Vec<ConfluenceLabel>>
pub async fn get_labels(&self, page_id: &str) -> Result<Vec<ConfluenceLabel>>
Fetches all labels on a Confluence page, handling pagination.
Sourcepub async fn add_labels(&self, page_id: &str, labels: &[String]) -> Result<()>
pub async fn add_labels(&self, page_id: &str, labels: &[String]) -> Result<()>
Adds one or more labels to a Confluence page.
Sourcepub async fn remove_label(&self, page_id: &str, label_name: &str) -> Result<()>
pub async fn remove_label(&self, page_id: &str, label_name: &str) -> Result<()>
Removes a label from a Confluence page.
Sourcepub async fn get_page_metadata(&self, page_id: &str) -> Result<PageMetadata>
pub async fn get_page_metadata(&self, page_id: &str) -> Result<PageMetadata>
Fetches lightweight metadata (id, title, current version) for a page.
Cheaper than AtlassianApi::get_content because it skips the body
and the space-key lookup.
Sourcepub async fn list_page_versions(
&self,
page_id: &str,
since: Option<&SinceFilter>,
limit: u32,
) -> Result<(Vec<PageVersion>, bool)>
pub async fn list_page_versions( &self, page_id: &str, since: Option<&SinceFilter>, limit: u32, ) -> Result<(Vec<PageVersion>, bool)>
Lists version history for a Confluence page, auto-paginated.
Returns up to limit versions matching the optional since filter.
limit = 0 means unlimited. The Confluence v2 API returns versions
newest-first, so encountering a version older than since ends
pagination early.
The boolean in the return tuple is truncated: true when limit
was hit before the API was exhausted (more newer-than-since
versions exist upstream).
Sourcepub async fn upload_attachment(
&self,
page_id: &str,
file_path: &Path,
filename: Option<&str>,
comment: Option<&str>,
minor_edit: bool,
) -> Result<ConfluenceAttachment>
pub async fn upload_attachment( &self, page_id: &str, file_path: &Path, filename: Option<&str>, comment: Option<&str>, minor_edit: bool, ) -> Result<ConfluenceAttachment>
Uploads an attachment to a Confluence page from a local file path.
Streams the file body — the file is never fully buffered in memory.
Sends X-Atlassian-Token: no-check (Atlassian convention for
state-changing multipart endpoints).
Does not retry on 429: see AtlassianClient::post_multipart.
Sourcepub async fn list_attachments(
&self,
page_id: &str,
cursor: Option<&str>,
limit: u32,
) -> Result<ConfluenceAttachmentPage>
pub async fn list_attachments( &self, page_id: &str, cursor: Option<&str>, limit: u32, ) -> Result<ConfluenceAttachmentPage>
Lists attachments on a Confluence page (one page at a time).
Unlike other v2 list helpers in this module, this does not
auto-drain pagination: pass ConfluenceAttachmentPage::next_cursor
back as cursor to fetch the next page.
Sourcepub async fn delete_attachment(
&self,
attachment_id: &str,
purge: bool,
) -> Result<()>
pub async fn delete_attachment( &self, attachment_id: &str, purge: bool, ) -> Result<()>
Deletes an attachment by ID.
When purge is true, permanently purges (requires space admin);
otherwise the attachment is moved to trash.
Sourcepub async fn get_page_at_version(
&self,
id: &str,
version: u32,
) -> Result<ContentItem>
pub async fn get_page_at_version( &self, id: &str, version: u32, ) -> Result<ContentItem>
Fetches a Confluence page pinned to a specific version number.
Like AtlassianApi::get_content but returns the historical
snapshot at version rather than the current head. Used by the
version-comparison tooling to fetch each side of the diff
independently — Confluence stores versions as immutable snapshots.
Trait Implementations§
Source§impl AtlassianApi for ConfluenceApi
impl AtlassianApi for ConfluenceApi
Source§fn get_content<'a>(
&'a self,
id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<ContentItem>> + Send + 'a>>
fn get_content<'a>( &'a self, id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<ContentItem>> + Send + 'a>>
Source§fn update_content<'a>(
&'a self,
id: &'a str,
body_adf: &'a ValidatedAdfDocument,
title: Option<&'a str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
fn update_content<'a>( &'a self, id: &'a str, body_adf: &'a ValidatedAdfDocument, title: Option<&'a str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
Source§fn verify_auth<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
fn verify_auth<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
Source§fn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Auto Trait Implementations§
impl Freeze for ConfluenceApi
impl !RefUnwindSafe for ConfluenceApi
impl Send for ConfluenceApi
impl Sync for ConfluenceApi
impl Unpin for ConfluenceApi
impl UnsafeUnpin for ConfluenceApi
impl !UnwindSafe for ConfluenceApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more