Skip to main content

ConfluenceApi

Struct ConfluenceApi 

Source
pub struct ConfluenceApi { /* private fields */ }
Expand description

Confluence Cloud REST API v2 backend.

Implementations§

Source§

impl ConfluenceApi

Source

pub fn new(client: AtlassianClient) -> Self

Creates a new Confluence API backend.

Source§

impl ConfluenceApi

Source

pub async fn resolve_space_id(&self, space_key: &str) -> Result<String>

Resolves a space key to a space ID via the Confluence API.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn delete_page(&self, id: &str, purge: bool) -> Result<()>

Deletes a Confluence page.

Source

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.

Source

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.

Source

pub async fn get_page_comments( &self, page_id: &str, ) -> Result<Vec<ConfluenceComment>>

Lists footer comments on a Confluence page, handling pagination.

Source

pub async fn get_page_inline_comments( &self, page_id: &str, ) -> Result<Vec<ConfluenceComment>>

Lists inline comments on a Confluence page, handling pagination.

Source

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.

Source

pub async fn add_page_comment( &self, page_id: &str, body_adf: &ValidatedAdfDocument, ) -> Result<()>

Adds a footer comment to a Confluence page.

Source

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.

Source

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-index was supplied.
  • The supplied --match-index is outside 1..=match_count.
Source

pub async fn get_labels(&self, page_id: &str) -> Result<Vec<ConfluenceLabel>>

Fetches all labels on a Confluence page, handling pagination.

Source

pub async fn add_labels(&self, page_id: &str, labels: &[String]) -> Result<()>

Adds one or more labels to a Confluence page.

Source

pub async fn remove_label(&self, page_id: &str, label_name: &str) -> Result<()>

Removes a label from a Confluence page.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn get_content<'a>( &'a self, id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<ContentItem>> + Send + 'a>>

Fetches a content item by its identifier.
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>>

Updates a content item’s body and optionally its title. Read more
Source§

fn verify_auth<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>

Verifies authentication and returns a display name.
Source§

fn backend_name(&self) -> &'static str

Returns the backend type name (“jira” or “confluence”).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,