Struct confluence::Session [] [src]

pub struct Session {
    // some fields omitted
}
[]

Client's session.

Methods

impl Session

fn login(url: &str, user: &str, pass: &str) -> Result<Session>[]

Create new confluence session.

Example

let session = confluence::Session::login(
    "https://confluence",
    "user",
    "pass"
).unwrap();

fn logout(&self) -> Result<bool>[]

Explicitly log out out of confluence.

This is done automatically at the end of Session's lifetime.

fn get_space(&self, space_key: &str) -> Result<Space>[]

Returns a single Space.

If the spaceKey does not exist: earlier versions of Confluence will throw an Exception. Later versions (3.0+) will return a null object.

In this client the difference will be in error type.

Example

println!("Space: {:#?}",
    session.get_space(
        "SomeSpaceKey"
    )
);

fn get_page_by_title(&self, space_key: &str, page_title: &str) -> Result<Page>[]

Returns a single Page by space and title.

Example

println!("Page: {:#?}",
    session.get_page_by_title(
        "SomeSpaceKey", "Page Title"
    )
);

fn get_page_by_id(&self, page_id: i64) -> Result<Page>[]

Returns a single Page by id.

Example

println!("Page: {:#?}",
    session.get_page_by_id(
        123456
    )
);

fn store_page(&self, page: UpdatePage) -> Result<Page>[]

Adds or updates a page.

For adding

The Page given as an argument should have:

  • (optional) parent_id
  • space
  • title
  • content

fields at a minimum.

Use helper UpdatePage::with_create_fields to create such page.

Example

use confluence::UpdatePage;

session.store_page(
    UpdatePage::with_create_fields(
        None,
        "SpaceKey",
        "Page Title",
        "<b>Works</b>"
    )
);

For updating

The Page given should have:

  • (optional) parent_id
  • id
  • space
  • title
  • content
  • version

fields at a minimum.

Use method into on Page to convert it to UpdatePage.

Example

use confluence::UpdatePage;

let mut page = session.get_page_by_title(
    "SomeSpaceKey", "Page Title"
).unwrap();

page.title = "New Page Title".into();

session.store_page(page.into());

fn update_page(&self, page: UpdatePage, options: PageUpdateOptions) -> Result<Page>[]

Updates the page.

Same as store_page, but with additional update options parameter.

fn get_children(&self, page_id: i64) -> Result<Vec<PageSummary>>[]

Returns all the direct children of this page.

Example

println!("Page Summaries: {:#?}",
    session.get_children(
        123456
    )
);

fn call(&self, method: Method) -> Result<Response>[]

Call a custom method on this session.

Usage

The elements in Method struct here will be converted directly into SOAP envelope's Body.

The returned Response.body will contain the parsed Body element.

Discussion

So far only few methods have convenience wrappers here, so if you need to call something else, it's not so convenient, but possible.

If you need an example, look at how these convenience methods are implemented.

Pull requests are welcome!

Trait Implementations

impl Drop for Session

fn drop(&mut self)