confluence-sdk~ ConfluenceSdk

An SDK to access the Confluence API

Methods

(async) createAttachment(pageId, path) → {Promise.<void>}

Create an attachment to a Confluence page from a local file

Parameters:
NameTypeDescription
pageIdnumber

The id of the Confluence page

pathstring

The path of the file to be attached

Returns:
Type: 
Promise.<void>

(async) createPage(page) → {Promise.<RemotePage>}

Create a LocalPage in Confluence

Parameters:
NameTypeDescription
pageLocalPage

The local page to create in Confluence

Returns:

The RemotePage created

Type: 
Promise.<RemotePage>

(async) deletePage(id) → {Promise.<void>}

Delete a Confluence page

Parameters:
NameTypeDescription
idnumber

The id of the Confluence page

Returns:
Type: 
Promise.<void>

(async) findPage(title) → {Promise.<(RemotePage|undefined)>}

Find page by title

Parameters:
NameTypeDescription
titlestring

The page title to find

Returns:

The remote page or undefined if not found

Type: 
Promise.<(RemotePage|undefined)>

(async) getChildPages(parentPageId) → {Promise.<Map.<string, RemotePage>>}

Return the children of a Confluence page

Parameters:
NameTypeDescription
parentPageIdnumber

The id of the Confluence page

Returns:

A Map of RemotePages indexed by their path

Type: 
Promise.<Map.<string, RemotePage>>

pageMeta(page) → {Meta}

Parameters:
NameTypeDescription
pageobject

Confluence page data

Returns:

A Meta instance created from the page.metadata

Type: 
Meta

remotePage(page, parentId) → {RemotePage}

Parameters:
NameTypeDescription
pageobject

Confluence page data

parentIdnumber

The id of the parent of page

Returns:

A RemotePage instance created from the page data

Type: 
RemotePage

(async) updatePage(remotePage) → {Promise.<RemotePage>}

Update the content of an existing page.

Parameters:
NameTypeDescription
remotePageRemotePage

The page to be updated

Returns:

The updated RemotePage

Type: 
Promise.<RemotePage>

validateResponse(response, validStatuses) → {object}

Parameters:
NameTypeDescription
responseAxiosResponse

An AxiosResponse object

validStatusesArray.<number>

An array of http statuses to consider successful

Throws:

RequestError if status is not successful

Returns:

The response.data

Type: 
object