Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions lib/confluence.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,62 @@ Confluence.prototype.getContentById = function(id, callback){
.end(function(err, res){
processCallback(callback, err, res);
});
/**
* Get stored content child(ren) by content id
*
* @param {string} id
* @param {string} child_type ('page' ...)
* @param {Function} callback
*/
Confluence.prototype.getContentChildByContentId = function(id, child_type, callback) {
if (typeof child_type === "function") {
callback = child_type;
child_type = undefined;
}

request
.get(
this.config.baseUrl +
this.config.apiPath +
"/content/" +
id +
"/child" +
(typeof child_type === "string" ? "/" + child_type : "") +
"?expand=body.storage,version"
)
.auth(this.config.username, this.config.password)
.end(function(err, res) {
processCallback(callback, err, res);
});
};

/**
* Get stored content descendant(s) by content id
*
* @param {string} id
* @param {string} child_type ('page' ...)
* @param {Function} callback
*/
Confluence.prototype.getContentDescendantByContentId = function(id, child_type, callback) {
if (typeof child_type === "function") {
callback = child_type;
child_type = undefined;
}

request
.get(
this.config.baseUrl +
this.config.apiPath +
"/content/" +
id +
"/descendant" +
(typeof child_type === "string" ? "/" + child_type : "") +
"?expand=body.storage,version"
)
.auth(this.config.username, this.config.password)
.end(function(err, res) {
processCallback(callback, err, res);
});
};

/**
Expand Down